-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheslint.config.js
More file actions
143 lines (135 loc) · 3.51 KB
/
eslint.config.js
File metadata and controls
143 lines (135 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import eslint from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import perfectionist from "eslint-plugin-perfectionist";
import pluginVue from "eslint-plugin-vue";
import globals from "globals";
export default [
// Définir les fichiers à ignorer
{
ignores: ["node_modules/**", "dist/**", "public/**"],
},
// Configuration de base ESLint
eslint.configs.recommended,
// Configuration recommandée pour Vue 3
...pluginVue.configs["flat/recommended"],
// Configuration @stylistic (customize preset)
stylistic.configs.customize({
arrowParens: true,
braceStyle: "1tbs",
commaDangle: "always-multiline",
indent: 2,
jsx: false,
quoteProps: "as-needed",
quotes: "double",
semi: true,
}),
// Configuration globale
{
languageOptions: {
globals: {
...globals.browser,
...globals.es2021,
...globals.node,
Spotify: "readonly",
},
},
linterOptions: {
reportUnusedDisableDirectives: true,
},
},
// Configuration pour les fichiers TypeScript
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
},
plugins: {
"@typescript-eslint": tseslint,
},
rules: {
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": "warn",
"no-unused-vars": "off",
},
},
// Configuration pour les fichiers Vue (TypeScript)
{
files: ["**/*.vue"],
languageOptions: {
parserOptions: {
ecmaVersion: "latest",
parser: tsParser,
sourceType: "module",
},
},
plugins: {
"@typescript-eslint": tseslint,
},
rules: {
"@typescript-eslint/no-unused-vars": "warn",
"vue/html-indent": "off",
"vue/html-self-closing": "off",
"vue/max-attributes-per-line": "off",
"vue/multi-word-component-names": "off",
"vue/singleline-html-element-content-newline": "off",
},
},
// Stylistic overrides (additional rules beyond the preset)
{
rules: {
"@stylistic/indent-binary-ops": ["error", 2],
"@stylistic/linebreak-style": ["error", "unix"],
"@stylistic/max-len": [
"error",
{
code: 120,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreUrls: true,
},
],
"@stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
"@stylistic/object-curly-newline": ["error", { consistent: true }],
"@stylistic/operator-linebreak": ["error", "before"],
"@stylistic/space-before-function-paren": [
"error",
{
anonymous: "always",
asyncArrow: "always",
named: "never",
},
],
},
},
// Configurer Perfectionist
{
plugins: {
perfectionist,
},
rules: {
...perfectionist.configs["recommended-alphabetical"].rules,
},
},
// Règles globales
{
rules: {
"no-console": [
"warn",
{
allow: ["warn", "error"],
},
],
"no-debugger": "warn",
},
},
];