-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase.js
85 lines (81 loc) · 2.76 KB
/
base.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
75
76
77
78
79
80
81
82
83
84
85
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import globals from 'globals';
import { restrictedGlobals } from './noRestrictedGlobals.js';
export default [
// Add the jsx extension to linted files.
{ files: ['**/*.jsx'] },
{
languageOptions: {
globals: {
...globals.browser,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
settings: {
react: {
version: 'detect',
},
linkComponents: [{ name: 'Link', linkAttribute: 'to' }],
},
rules: {
'no-restricted-globals': ['error', ...restrictedGlobals],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'react-refresh/only-export-components': 'error',
// https://github.com/jsx-eslint/eslint-plugin-react
// Last rules review: v7.32.2
'react/button-has-type': [
'error',
{
button: true,
submit: true,
reset: false,
},
],
'react/no-array-index-key': 'warn',
'react/no-children-prop': 'error',
'react/no-danger': 'warn',
'react/no-danger-with-children': 'error',
'react/no-deprecated': 'error',
'react/no-find-dom-node': 'error',
'react/no-is-mounted': 'error',
'react/no-render-return-value': 'error',
'react/no-string-refs': 'error',
'react/no-this-in-sfc': 'error',
'react/no-typos': 'error',
'react/no-unescaped-entities': 'error',
'react/no-unknown-property': 'error',
'react/no-unsafe': 'error',
// Allow as props to support Blueprint's `xxxRenderer` pattern.
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
'react/no-unused-prop-types': 'error',
'react/self-closing-comp': 'error',
'react/style-prop-object': 'error',
'react/void-dom-elements-no-children': 'error',
'react/jsx-boolean-value': 'error',
'react/jsx-key': 'error',
'react/jsx-no-comment-textnodes': 'error',
'react/jsx-no-constructed-context-values': 'error',
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
// TODO: enable when https://github.com/jsx-eslint/eslint-plugin-react/issues/3292 is fixed.
'react/jsx-no-leaked-render': 'off',
'react/jsx-no-target-blank': 'error',
'react/jsx-no-undef': 'error',
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
'react/jsx-pascal-case': ['error', { allowAllCaps: true }],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
},
},
];