73 lines
1.8 KiB
JavaScript
73 lines
1.8 KiB
JavaScript
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"
|
|
}
|
|
}
|
|
];
|