chore(backend): add ESLint and Prettier configuration

This commit is contained in:
SaidSoighiri94
2026-06-16 10:01:19 +02:00
parent 2ac1a3281b
commit d67cf8d65e
6 changed files with 1132 additions and 4 deletions
+3
View File
@@ -0,0 +1,3 @@
dist
node_modules
prisma/migrations
+7
View File
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"semi": true,
"printWidth": 100,
"tabWidth": 2,
"trailingComma": "all"
}
+26
View File
@@ -0,0 +1,26 @@
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
import globals from 'globals';
export default tseslint.config(
{
ignores: ['dist/**', 'node_modules/**', 'prisma/migrations/**'],
},
js.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
languageOptions: {
globals: { ...globals.node },
},
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'prefer-const': 'error',
'no-console': 'off',
},
},
);
+1076 -1
View File
File diff suppressed because it is too large Load Diff
+12 -2
View File
@@ -11,21 +11,31 @@
"prisma:migrate": "prisma migrate dev",
"prisma:studio": "prisma studio",
"seed": "ts-node prisma/seed.ts",
"fixtures": "ts-node prisma/fixtures.ts"
"fixtures": "ts-node prisma/fixtures.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write \"src/**/*.ts\" \"prisma/**/*.ts\"",
"format:check": "prettier --check \"src/**/*.ts\" \"prisma/**/*.ts\""
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"devDependencies": {
"@eslint/js": "^10.0.1",
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/jsonwebtoken": "^9.0.10",
"@types/node": "^25.9.1",
"eslint": "^10.5.0",
"eslint-config-prettier": "^10.1.8",
"globals": "^17.6.0",
"nodemon": "^3.1.14",
"prettier": "^3.8.4",
"prisma": "^7.8.0",
"ts-node": "^10.9.2",
"typescript": "^6.0.3"
"typescript": "^6.0.3",
"typescript-eslint": "^8.61.1"
},
"dependencies": {
"@prisma/adapter-mssql": "^7.8.0",
+8 -1
View File
@@ -106,6 +106,13 @@ En terminal interactif (VS Code), `migrate dev` fonctionne normalement (taper `y
- Express 5 propage nativement les erreurs des handlers async : pas de wrapper `asyncHandler` nécessaire.
- Vérifié au runtime : `/health` 200, route inconnue 404 en JSON, requêtes journalisées.
### Étape 12 — Block 1 : ESLint + Prettier
- ESLint 10 (flat config `eslint.config.mjs`) + typescript-eslint 8 ; Prettier 3 (`.prettierrc.json`).
- Règles du `CLAUDE.md` encodées : `no-explicit-any`, `no-non-null-assertion`, `explicit-module-boundary-types`, `no-unused-vars` (ignore le préfixe `_`), `prefer-const`. `eslint-config-prettier` désactive les règles en conflit avec Prettier.
- Prettier : quotes simples, point-virgule, 100 colonnes, 2 espaces, trailing commas.
- Scripts : `lint`, `lint:fix`, `format`, `format:check`.
- État : lint vert sur tout le code existant ; formatage appliqué (3 fichiers) ; build OK.
---
## Dette technique en attente
@@ -120,4 +127,4 @@ En terminal interactif (VS Code), `migrate dev` fonctionne normalement (taper `y
---
*Dernière mise à jour : 2026-06-15 — Middlewares backend (gestion d'erreurs, logs) en place.*
*Dernière mise à jour : 2026-06-15 — ESLint + Prettier configurés, Block 1 quasi terminé (reste Swagger).*