Dernière fournée de corrections Sonar

Mise en place de MegaLinter ; web-lint pour la partie code quality sur la CI, Trivy pour la partie CVE
This commit is contained in:
2026-07-07 00:11:52 +02:00
parent 587e0fe097
commit 9f0359d8c0
210 changed files with 5345 additions and 2291 deletions

View File

@@ -64,6 +64,15 @@
"buildTarget": "web:build",
"proxyConfig": "proxy.conf.json"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
@@ -93,5 +102,10 @@
"@schematics/angular:resolver": {
"typeSeparator": "."
}
},
"cli": {
"schematicCollections": [
"angular-eslint"
]
}
}

63
web/eslint.config.js Normal file
View File

@@ -0,0 +1,63 @@
// @ts-check
const eslint = require("@eslint/js");
const { defineConfig } = require("eslint/config");
const tseslint = require("typescript-eslint");
const angular = require("angular-eslint");
// Règles qualité "à la Sonar" (bugs, code smells, complexité) portées dans
// ESLint — remplace l'analyse SonarQube côté TypeScript.
const sonarjs = require("eslint-plugin-sonarjs");
module.exports = defineConfig([
{
files: ["**/*.ts"],
extends: [
eslint.configs.recommended,
tseslint.configs.recommended,
tseslint.configs.stylistic,
angular.configs.tsRecommended,
sonarjs.configs.recommended,
],
processor: angular.processInlineTemplates,
rules: {
"@angular-eslint/directive-selector": [
"error",
{
type: "attribute",
prefix: "app",
style: "camelCase",
},
],
"@angular-eslint/component-selector": [
"error",
{
type: "element",
prefix: "app",
style: "kebab-case",
},
],
// Modernisation constructeur → inject() : 567 occurrences dans l'existant.
// Pas un bug — chantier one-shot à mener via la migration officielle
// `ng generate @angular/core:inject`, puis repasser la règle en "error".
"@angular-eslint/prefer-inject": "off",
// Math.random() est légitime ici : tables aléatoires / jets de dés = le
// domaine métier. Aucun usage cryptographique côté front.
"sonarjs/pseudo-random": "off",
},
},
{
files: ["**/*.html"],
extends: [
angular.configs.templateRecommended,
angular.configs.templateAccessibility,
],
rules: {
// Accessibilité : ~127 findings sur l'existant. En "warn" (visibles,
// non bloquants) le temps de résorber le backlog — repasser en "error"
// règle par règle au fil des corrections.
"@angular-eslint/template/label-has-associated-control": "warn",
"@angular-eslint/template/click-events-have-key-events": "warn",
"@angular-eslint/template/interactive-supports-focus": "warn",
"@angular-eslint/template/no-autofocus": "warn",
},
}
]);

1821
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,8 @@
"e2e": "playwright test",
"e2e:ui": "playwright test --ui",
"e2e:headed": "playwright test --headed",
"e2e:report": "playwright show-report"
"e2e:report": "playwright show-report",
"lint": "ng lint"
},
"private": true,
"dependencies": {
@@ -43,9 +44,14 @@
"@angular/compiler-cli": "^21.2.16",
"@emnapi/core": "^1.11.0",
"@emnapi/runtime": "^1.11.0",
"@eslint/js": "^10.0.1",
"@playwright/test": "^1.59.1",
"@vitest/coverage-v8": "^4.1.9",
"angular-eslint": "21.4.0",
"eslint": "^10.3.0",
"eslint-plugin-sonarjs": "^4.1.0",
"typescript": "~5.9.3",
"typescript-eslint": "8.59.2",
"vitest": "^4.1.9"
}
}