-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslint.config.js
More file actions
248 lines (231 loc) · 8.52 KB
/
eslint.config.js
File metadata and controls
248 lines (231 loc) · 8.52 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/**
* Copyright (c) 2025, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Base ESLint config initially generated by `eslint-config-airbnb-extended` (v2.3.2)
* using the React + Prettier + TypeScript template, then manually adapted for GridStudy.
* Source template:
* https://eslint-airbnb-extended.nishargshah.dev/cli/guide
* https://github.com/NishargShah/eslint-config-airbnb-extended/blob/v2.3.2/packages/create-airbnb-x-config/templates/react/prettier/ts/default/eslint.config.mjs
*/
import { configs, plugins } from 'eslint-config-airbnb-extended';
import { rules as prettierConfigRules } from 'eslint-config-prettier';
import prettierPlugin from 'eslint-plugin-prettier';
import reactRefreshPlugin from 'eslint-plugin-react-refresh';
import js from '@eslint/js';
const jsConfig = [
// ESLint Recommended Rules
{
name: 'js/config',
...js.configs.recommended,
},
// Stylistic Plugin
plugins.stylistic,
// Import X Plugin
plugins.importX,
// Airbnb Base Recommended Config
...configs.base.recommended,
];
const reactConfig = [
// React Plugin
plugins.react,
// React Hooks Plugin
plugins.reactHooks,
// React JSX A11y Plugin
plugins.reactA11y,
// Airbnb React Recommended Config
...configs.react.recommended,
];
const typescriptConfig = [
// TypeScript ESLint Plugin
plugins.typescriptEslint,
// Airbnb Base TypeScript Config
...configs.base.typescript,
// Airbnb React TypeScript Config
...configs.react.typescript,
];
const prettierConfig = [
// Prettier Plugin
{
name: 'prettier/plugin/config',
plugins: {
prettier: prettierPlugin,
},
},
// Prettier Config (disable conflicting rules)
{
name: 'prettier/config',
rules: {
...prettierConfigRules,
'prettier/prettier': 'warn',
},
},
];
const projectConfig = [
{
name: 'project/ignores',
ignores: ['dist', 'build', 'coverage'],
},
{
name: 'project/settings',
settings: {
react: {
version: 'detect',
},
// TypeScript import resolver settings
'import-x/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import-x/resolver': {
typescript: {
alwaysTryTypes: true,
project: './tsconfig.json',
},
},
},
},
// React Refresh Plugin
{
name: 'project/react-refresh',
files: ['**/*.{jsx,tsx}'],
plugins: {
'react-refresh': reactRefreshPlugin,
},
rules: {
'react-refresh/only-export-components': ['error', { allowConstantExport: true }],
},
},
// React JSX Runtime (prevents "React must be in scope" errors)
{
name: 'project/react-jsx-runtime',
files: ['**/*.{jsx,tsx}'],
rules: {
'react/react-in-jsx-scope': 'off',
'react/jsx-uses-react': 'off',
},
},
// Custom rules
{
name: 'project/rules',
rules: {
// Code style
curly: 'error',
'no-console': 'off',
'no-plusplus': 'off',
// React rules
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
// Import rules
'import-x/prefer-default-export': 'off',
'import-x/extensions': 'off',
'import-x/no-unresolved': 'off',
'import-x/no-useless-path-segments': 'off',
'import-x/no-cycle': [
'error',
{
maxDepth: Infinity,
ignoreExternal: true,
},
],
'import-x/no-self-import': 'error',
'import-x/no-extraneous-dependencies': [
'off', // Disabled to allow devDependencies in all files, TO FIX later (use type-only imports for typescript types)
{
devDependencies: true,
optionalDependencies: false,
},
],
// MUI deep imports - disabled
'no-restricted-imports': 'off',
// ============================================
// Rules disabled to match old .eslintrc.json behavior
// ============================================
// Stylistic rules
'@stylistic/lines-between-class-members': 'off',
'@stylistic/spaced-comment': 'off',
'arrow-body-style': 'off',
'dot-notation': 'off',
'func-names': 'off', // Disabled - was causing ~20 warnings
'object-shorthand': 'off',
'operator-assignment': 'off',
'prefer-arrow-callback': 'off',
'prefer-const': 'off',
'prefer-destructuring': 'off',
'prefer-exponentiation-operator': 'off',
'prefer-template': 'off',
radix: 'off',
yoda: 'off',
// Code quality rules
camelcase: 'off',
'class-methods-use-this': 'off',
'consistent-return': 'off',
'default-case': 'off',
'no-await-in-loop': 'off',
'no-case-declarations': 'off',
'no-cond-assign': 'off',
'no-continue': 'off',
'no-else-return': 'off',
'no-extra-boolean-cast': 'off',
'no-lonely-if': 'off',
'no-nested-ternary': 'off',
'no-param-reassign': 'off',
'no-prototype-builtins': 'off',
'no-restricted-exports': 'off',
'no-restricted-globals': 'off',
'no-restricted-properties': 'off',
'no-restricted-syntax': 'off',
'no-return-assign': 'off',
'no-shadow': 'off',
'no-undef-init': 'off',
'no-unneeded-ternary': 'off',
'no-unsafe-optional-chaining': 'off',
'no-unused-expressions': 'off',
'no-use-before-define': 'off',
'no-useless-return': 'off',
// Import rules
'import-x/newline-after-import': 'off',
'import-x/no-duplicates': 'off',
'import-x/no-named-as-default': 'off',
'import-x/order': 'off',
// React rules
'react/destructuring-assignment': 'off',
'react/forbid-prop-types': 'off',
'react/function-component-definition': 'off',
'react/jsx-boolean-value': 'off',
'react/jsx-curly-brace-presence': 'off',
'react/jsx-no-bind': 'off',
'react/jsx-no-constructed-context-values': 'off',
'react/jsx-no-duplicate-props': 'off',
'react/jsx-no-useless-fragment': 'off',
'react/no-array-index-key': 'off',
'react/no-children-prop': 'off',
'react/no-unstable-nested-components': 'off',
'react/no-unused-prop-types': 'off',
'react/prop-types': 'off',
'react/self-closing-comp': 'off',
// TypeScript rules
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/default-param-last': 'off',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-unnecessary-template-expression': 'off',
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-wrapper-object-types': 'off',
'@typescript-eslint/prefer-destructuring': 'off',
'@typescript-eslint/prefer-function-type': 'off',
'@typescript-eslint/return-await': 'off',
},
},
];
export default [...jsConfig, ...reactConfig, ...typescriptConfig, ...prettierConfig, ...projectConfig];