forked from Nick-Mazuk/eslint-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact.js
74 lines (74 loc) · 2.21 KB
/
react.js
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
module.exports = {
env: {
browser: true,
commonjs: true,
es2020: true,
},
plugins: ['@typescript-eslint', 'jsx-a11y', 'react', 'react-hooks', 'testing-library'],
extends: [
require.resolve('./lib/base'),
'plugin:react/recommended',
'plugin:jsx-a11y/recommended',
'plugin:testing-library/react',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'class-methods-use-this': 'off',
'import/no-default-export': 'off',
'jsx-a11y/label-has-for': 'off',
'jsx-a11y/no-redundant-roles': 'warn',
'max-lines-per-function': 'off',
'no-inline-comments': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/react-in-jsx-scope': 'off',
'react/no-unescaped-entities': 'off',
'react/no-danger': 'error',
'react/no-access-state-in-setstate': 'error',
'react/no-array-index-key': 'warn',
'react/no-did-mount-set-state': ['error', 'disallow-in-func'],
'react/no-did-update-set-state': ['error', 'disallow-in-func'],
'react/no-multi-comp': ['error', { ignoreStateless: true }],
'react/no-redundant-should-component-update': 'error',
'react/no-this-in-sfc': 'error',
'react/no-typos': 'error',
'react/no-unknown-property': 'error',
'react/no-unsafe': 'error',
'react/no-unused-state': 'error',
'react/no-will-update-set-state': 'error',
'react/prefer-es6-class': 'error',
'react/prefer-stateless-function': 'error',
'react/self-closing-comp': 'error',
'react/sort-comp': 'warn',
'react/state-in-constructor': ['error', 'never'],
'react/void-dom-elements-no-children': 'error',
'react/jsx-boolean-value': 'error',
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
'react/jsx-fragments': ['error', 'syntax'],
'react/jsx-handler-names': 'error',
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
'react/jsx-no-comment-textnodes': 'error',
'react/jsx-no-script-url': 'error',
'react/jsx-no-target-blank': 'error',
'react/jsx-no-useless-fragment': 'error',
'react/jsx-pascal-case': 'error',
},
overrides: [
{
files: ['*.test.tsx'],
rules: {
'no-undefined': 'off',
},
},
],
}