1 | module.exports = {
|
2 | extends: ['@3fs', '@3fs/eslint-config/configs/jsx-a11y'],
|
3 | plugins: ['react', 'react-hooks'],
|
4 | parserOptions: { ecmaFeatures: { jsx: true } },
|
5 | settings: {
|
6 | 'import/resolver': {
|
7 | node: {
|
8 | extensions: [
|
9 | '.js',
|
10 | '.jsx',
|
11 | '.json'
|
12 | ]
|
13 | }
|
14 | },
|
15 | 'react': {
|
16 | pragma: 'React',
|
17 | version: 'detect'
|
18 | }
|
19 | },
|
20 | |
21 |
|
22 |
|
23 |
|
24 | rules: {
|
25 |
|
26 | 'jsx-quotes': ['error', 'prefer-double'],
|
27 |
|
28 |
|
29 | 'react-hooks/rules-of-hooks': 'error',
|
30 | 'react-hooks/exhaustive-deps': 'warn',
|
31 |
|
32 |
|
33 | 'react/boolean-prop-naming': 'off',
|
34 | 'react/button-has-type': 'error',
|
35 | 'react/destructuring-assignment': 'error',
|
36 | 'react/display-name': ['off', { ignoreTranspilerName: false }],
|
37 | 'react/forbid-dom-props': 'off',
|
38 | 'react/forbid-prop-types': [
|
39 | 'error',
|
40 | {
|
41 | forbid: [
|
42 | 'any',
|
43 | 'array',
|
44 | 'object'
|
45 | ]
|
46 | }
|
47 | ],
|
48 | 'react/function-component-definition': 'error',
|
49 | 'react/jsx-boolean-value': ['error', 'never'],
|
50 | 'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
|
51 | 'react/jsx-closing-tag-location': 'off',
|
52 | 'react/jsx-curly-spacing': [
|
53 | 'error',
|
54 | 'never',
|
55 | { allowMultiline: true }
|
56 | ],
|
57 | 'react/jsx-handler-names': [
|
58 | 'off',
|
59 | {
|
60 | eventHandlerPrefix: 'handle',
|
61 | eventHandlerPropPrefix: 'on'
|
62 | }
|
63 | ],
|
64 | 'react/jsx-indent-props': ['error', 2],
|
65 | 'react/jsx-key': 'off',
|
66 | 'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
|
67 | 'react/jsx-no-bind': [
|
68 | 'error',
|
69 | {
|
70 | ignoreRefs: true,
|
71 | allowArrowFunctions: true,
|
72 | allowBind: false
|
73 | }
|
74 | ],
|
75 | 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
|
76 | 'react/jsx-no-literals': 'off',
|
77 | 'react/jsx-no-script-url': 'error',
|
78 | 'react/jsx-no-undef': 'error',
|
79 | 'react/jsx-newline': 'off',
|
80 | 'react/jsx-pascal-case': [
|
81 | 'error',
|
82 | {
|
83 | allowAllCaps: true,
|
84 | ignore: []
|
85 | }
|
86 | ],
|
87 | 'react/sort-prop-types': [
|
88 | 'off',
|
89 | {
|
90 | ignoreCase: true,
|
91 | callbacksLast: false,
|
92 | requiredFirst: false
|
93 | }
|
94 | ],
|
95 | 'react/jsx-sort-prop-types': 'off',
|
96 | 'react/jsx-sort-props': [
|
97 | 'off',
|
98 | {
|
99 | ignoreCase: true,
|
100 | callbacksLast: false,
|
101 | shorthandFirst: false,
|
102 | shorthandLast: false,
|
103 | noSortAlphabetically: false,
|
104 | reservedFirst: true
|
105 | }
|
106 | ],
|
107 | 'react/jsx-uses-react': ['error'],
|
108 | 'react/jsx-uses-vars': 'error',
|
109 | 'react/no-adjacent-inline-elements': 'off',
|
110 | 'react/no-danger': 'warn',
|
111 | 'react/no-deprecated': ['error'],
|
112 | 'react/no-did-mount-set-state': 'error',
|
113 | 'react/no-did-update-set-state': 'error',
|
114 | 'react/no-will-update-set-state': 'error',
|
115 | 'react/no-direct-mutation-state': 'off',
|
116 | 'react/no-is-mounted': 'error',
|
117 | 'react/no-multi-comp': ['error', { ignoreStateless: true }],
|
118 | 'react/no-set-state': 'off',
|
119 | 'react/no-string-refs': 'error',
|
120 | 'react/no-unknown-property': 'error',
|
121 | 'react/jsx-no-useless-fragment': 'error',
|
122 | 'react/prefer-es6-class': ['error', 'always'],
|
123 | 'react/prefer-read-only-props': 'off',
|
124 | 'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
|
125 | 'react/prop-types': [
|
126 | 'error',
|
127 | {
|
128 | ignore: [],
|
129 | customValidators: [],
|
130 | skipUndeclared: false
|
131 | }
|
132 | ],
|
133 | 'react/react-in-jsx-scope': 'error',
|
134 | 'react/require-render-return': 'error',
|
135 | 'react/self-closing-comp': 'error',
|
136 | 'react/sort-comp': [
|
137 | 'error',
|
138 | {
|
139 | order: [
|
140 | 'static-methods',
|
141 | 'lifecycle',
|
142 | '/^on.+$/',
|
143 | '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
|
144 | 'everything-else',
|
145 | '/^render.+$/',
|
146 | 'render'
|
147 | ]
|
148 | }
|
149 | ],
|
150 | 'react/state-in-constructor': 'off',
|
151 | 'react/static-property-placement': 'off',
|
152 | 'react/jsx-wrap-multilines': [
|
153 | 'error',
|
154 | {
|
155 | declaration: true,
|
156 | assignment: true,
|
157 | return: true,
|
158 | arrow: true
|
159 | }
|
160 | ],
|
161 | 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
|
162 | 'react/jsx-fragments': ['error', 'element'],
|
163 | 'react/jsx-equals-spacing': ['error', 'never'],
|
164 | 'react/jsx-indent': ['error', 2],
|
165 | 'react/jsx-no-target-blank': 'error',
|
166 | 'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx'] }],
|
167 | 'react/jsx-no-comment-textnodes': 'error',
|
168 | 'react/jsx-no-constructed-context-values': 'error',
|
169 | 'react/no-render-return-value': 'error',
|
170 | 'react/require-optimization': ['off', { allowDecorators: [] }],
|
171 | 'react/no-find-dom-node': 'error',
|
172 | 'react/forbid-component-props': ['off', { forbid: [] }],
|
173 | 'react/forbid-elements': ['off', { forbid: [] }],
|
174 | 'react/no-danger-with-children': 'error',
|
175 | 'react/no-unused-prop-types': [
|
176 | 'error',
|
177 | {
|
178 | customValidators: [],
|
179 | skipShapeProps: true
|
180 | }
|
181 | ],
|
182 | 'react/style-prop-object': 'error',
|
183 | 'react/no-unescaped-entities': 'error',
|
184 | 'react/no-children-prop': 'error',
|
185 | 'react/jsx-curly-newline': ['error', { multiline: 'consistent', singleline: 'consistent' }],
|
186 | 'react/jsx-tag-spacing': [
|
187 | 'error',
|
188 | {
|
189 | closingSlash: 'never',
|
190 | beforeSelfClosing: 'allow',
|
191 | afterOpening: 'never'
|
192 | }
|
193 | ],
|
194 | 'react/jsx-child-element-spacing': 'error',
|
195 | 'react/jsx-curly-brace-presence': ['error', { props: 'always', children: 'never' }],
|
196 | 'react/jsx-max-depth': ['error', { max: 5 }],
|
197 | 'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
|
198 | 'react/jsx-props-no-multi-spaces': 'error',
|
199 | 'react/jsx-props-no-spreading': 'off',
|
200 | 'react/jsx-sort-default-props': 'off',
|
201 | 'react/no-access-state-in-setstate': 'error',
|
202 | 'react/no-this-in-sfc': 'error',
|
203 | 'react/no-typos': 'error',
|
204 | 'react/no-unsafe': ['error', { checkAliases: true }],
|
205 | 'react/no-unused-state': 'error',
|
206 | 'react/no-array-index-key': 'error',
|
207 | 'react/require-default-props': 'error',
|
208 | 'react/forbid-foreign-prop-types': 'off',
|
209 | 'react/void-dom-elements-no-children': 'error',
|
210 | 'react/default-props-match-prop-types': ['off', { allowRequiredDefaults: false }],
|
211 | 'react/no-redundant-should-component-update': 'off'
|
212 | }
|
213 | };
|