-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy patheslint.config.mjs
94 lines (92 loc) · 2.76 KB
/
eslint.config.mjs
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
// Run `npx @eslint/config-inspector` to inspect the config.
import globals from 'globals';
import js from '@eslint/js';
import importPlugin from 'eslint-plugin-import';
import jsdoc from 'eslint-plugin-jsdoc';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import reactReduxPlugin from 'eslint-plugin-react-redux';
import pluginCypress from 'eslint-plugin-cypress/flat';
import eslintConfigPrettier from 'eslint-config-prettier';
import babelParser from '@babel/eslint-parser';
export default [
{
ignores: ['\*_/**fixtures**/_.js', 'serviceWorker.js']
},
js.configs.recommended,
importPlugin.flatConfigs.recommended,
jsdoc.configs['flat/recommended'],
jsxA11y.flatConfigs.recommended,
reactPlugin.configs.flat.recommended,
pluginCypress.configs.recommended,
eslintConfigPrettier,
{
plugins: {
'react-hooks': reactHooksPlugin,
'react-redux': reactReduxPlugin
}
},
{
languageOptions: {
ecmaVersion: 2023,
parser: babelParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
...globals.node,
...globals.jest,
},
},
settings: {
'import/resolver': {
node: {
paths: ['src'],
extensions: ['.js', '.jsx', '.ts', '.d.ts', '.tsx']
},
},
react: {
version: 'detect',
},
},
rules: {
'id-length': ['error', { min: 2 }],
'jsdoc/require-hyphen-before-param-description': ['warn', 'always'],
'jsdoc/tag-lines': ['error', 'any', { startLines: 1 }],
'no-console': ['warn'],
'no-use-before-define': ['error','nofunc'],
'no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
},
],
'no-var': ['error'],
'prefer-const': ['error'],
radix: ['error'],
'react/jsx-no-leaked-render': [
'error',
{ validStrategies: ['coerce', 'ternary'] },
],
'react/no-multi-comp': ['error', { ignoreStateless: true }],
'react/no-unstable-nested-components': ['error'],
'react/self-closing-comp': ['error'],
'react/boolean-prop-naming': ['error', { validateNested: true }],
'react/default-props-match-prop-types': [
'error',
{ allowRequiredDefaults: true },
],
'react/jsx-curly-brace-presence': ['error'],
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
...reactHooksPlugin.configs.recommended.rules,
...reactReduxPlugin.configs.recommended.rules
},
},
];