-
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy patheslint.config.js
More file actions
98 lines (91 loc) · 2.75 KB
/
eslint.config.js
File metadata and controls
98 lines (91 loc) · 2.75 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
const { FlatCompat } = require('@eslint/eslintrc');
const compat = new FlatCompat({ baseDirectory: __dirname });
const shareables = [
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:import/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
'plugin:testing-library/react',
];
const baseExtends = compat.extends(...shareables).map(presetConfig => ({
files: ['**/*.{js,jsx}'], // apply on both .js & .jsx
...presetConfig,
}));
module.exports = [
{
ignores: [
// =======================================================================
// ⚠️ DO NOT ADD NEW ENTRIES ⚠️
// Only the files and folders listed below are allowed to be ignored.
// This .gitignore is locked down to maintain consistency across the team.
// To propose changes, please open a discussion or PR with justification.
// =======================================================================
'node_modules/**',
'public/**',
'build/**',
],
},
...baseExtends,
{
files: ['**/*.{js,jsx}'],
languageOptions: {
// eslint-disable-next-line global-require
parser: require('@babel/eslint-parser'),
parserOptions: {
requireConfigFile: false,
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: { jsx: true },
babelOptions: {
plugins: [
'@babel/plugin-transform-optional-chaining',
'@babel/plugin-transform-nullish-coalescing-operator',
],
},
},
globals: {
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
IntersectionObserver: 'readonly',
WebSocket: 'readonly',
sessionStorage: 'readonly',
},
},
settings: {
react: { version: 'detect' },
'import/resolver': {
node: { paths: ['src'], extensions: ['.js', '.jsx'] },
},
},
rules: {
'react/react-in-jsx-scope': 'off',
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'no-underscore-dangle': 'off',
'react/prop-types': 'off',
'react-hooks/exhaustive-deps': 'off',
'no-alert': 'warn',
'no-console': 'warn',
'import/extensions': 'off',
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
},
},
{
files: ['**/__tests__/*.{js,jsx}', '**/*.test.{js,jsx}'],
languageOptions: {
globals: {
describe: 'readonly',
it: 'readonly',
test: 'readonly',
expect: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
vi: 'readonly',
},
},
},
];