From 7d4fdb30117d46472b37f58f724493768454342f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Mon, 20 Jul 2026 17:52:37 +0200 Subject: [PATCH] chore: update ESLint, Stylelint and PHPCS configurations --- .eslintrc.json | 61 -------------------- .stylelintrc.json | 6 +- eslint.config.js | 73 ++++++++++++++++++++++++ phpcs.xml | 142 ++++++++++++++-------------------------------- 4 files changed, 117 insertions(+), 165 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.js diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 4acf8d1..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true - }, - "extends": [ - "eslint:recommended", - "plugin:vue/vue3-strongly-recommended", - "@vue/eslint-config-typescript" - ], - "overrides": [ - { - "files": ["*.ts", "*.vue"], - "rules": { - "no-undef": "off" - } - }, - { - "files": ["*.vue"], - "rules": { - "indent": "off" - } - } - ], - "parser": "vue-eslint-parser", - "parserOptions": { - "parser": "@typescript-eslint/parser", - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": ["vue", "@typescript-eslint"], - "ignorePatterns": [ - "**/*.php", - "**/*.svg", - "**/vendor/*.js", - "**/vendor/**/*.js", - "**/vendor/**/*.scss" - ], - "rules": { - "indent": ["error", 4, { "SwitchCase": 1 }], - "linebreak-style": ["error", "unix"], - "quotes": ["error", "double"], - "semi": ["error", "always"], - "vue/script-indent": ["error", 2, { "baseIndent": 0, "switchCase": 1 }], - "vue/one-component-per-file": "off" - }, - "settings": { - "import/resolver": { - "node": { - "extensions": [".js", ".vue", ".ts", ".d.ts"] - }, - "alias": { - "extensions": [".vue", ".js", ".ts", ".scss", ".d.ts"], - "map": [ - ["~", "./resources/assets"], - ["@", "./node_modules"] - ] - } - } - } -} diff --git a/.stylelintrc.json b/.stylelintrc.json index 94702b9..c2853c4 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -23,14 +23,12 @@ ], "customSyntax": "postcss-scss", "rules": { - "declaration-property-value-no-unknown": true, + "declaration-property-value-no-unknown": null, "selector-max-id": null, "color-no-invalid-hex": true, "order/properties-alphabetical-order": null, "max-nesting-depth": 5, "selector-max-compound-selectors": 5, - "declaration-colon-newline-after": null, - "value-list-comma-newline-after": null, "scss/double-slash-comment-empty-line-before": [ "always", { @@ -42,4 +40,4 @@ } ] } -} \ No newline at end of file +} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..4b1c7aa --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,73 @@ +import vueTsEslintConfig from "@vue/eslint-config-typescript"; +import pluginImportX from "eslint-plugin-import-x"; +import pluginVue from "eslint-plugin-vue"; + +export default [ + // 1. Fichiers et dossiers à ignorer globalement + { + ignores: [ + "**/*.php", + "**/*.svg", + "**/vendor/**", + "node_modules/**", + "public/**" + ] + }, + + // 2. Configurations de base recommandées + ...pluginVue.configs["flat/strongly-recommended"], + ...vueTsEslintConfig(), + + // 3. Plugin d'imports (import-x) + pluginImportX.flatConfigs.recommended, + pluginImportX.flatConfigs.typescript, + + // 4. Options de langage, Paramètres et Règles globales + { + languageOptions: { + ecmaVersion: "latest", + sourceType: "module", + }, + settings: { + // 👉 LA CORRECTION EST ICI + "import-x/resolver": { + // Apprend à ESLint à lire ces extensions + node: { + extensions: [".js", ".ts", ".vue", ".scss", ".d.ts"] + }, + // Demande à ESLint de se fier à 100% à votre tsconfig.json pour les alias ! + typescript: { + alwaysTryTypes: true, + project: "./tsconfig.json", + } + } + }, + rules: { + "indent": ["error", 4, { "SwitchCase": 1 }], + "linebreak-style": ["error", "unix"], + "quotes": ["error", "double"], + "semi": ["error", "always"], + + "vue/one-component-per-file": "off", + "import/order": "off", + }, + }, + + // 5. Overrides pour les fichiers Vue (.vue) + { + files: ["**/*.vue"], + rules: { + "indent": "off", + "vue/script-indent": ["error", 2, { "baseIndent": 0, "switchCase": 1 }], + "no-undef": "off" + } + }, + + // 6. Overrides pour les fichiers TypeScript (.ts) + { + files: ["**/*.ts"], + rules: { + "no-undef": "off" + } + } +]; diff --git a/phpcs.xml b/phpcs.xml index dea0338..a5cae59 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,123 +1,65 @@ - - Created with the PHP Coding Standard Generator. http://edorian.github.com/php-coding-standard-generator/ + + Standard optimisé : Analyse statique complémentaire à Pint. + + app/ config/ + database/ routes/ - app/Lib/vendor/* - - + tests/ + + */vendor/* + */storage/* + _ide_helper.php + */tests/* + + - - - - - - - - - - - - - - - - - - + + + + + + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + */database/migrations/*