-
Notifications
You must be signed in to change notification settings - Fork 330
/
Copy pathreact.js
77 lines (74 loc) · 2.17 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
75
76
77
const disabledRules = {
'jsx-a11y/no-onchange': 'off',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
// TODO: All rules below should be set to their defaults
// when we're able to make the appropriate changes.
'jsx-a11y/alt-text': 'warn',
'jsx-a11y/html-has-lang': 'warn',
'jsx-a11y/no-autofocus': 'warn',
'react/button-has-type': 'warn',
'react/display-name': 'off',
'react/jsx-curly-brace-presence': 'off',
'react/jsx-no-leaked-render': 'off',
'react/jsx-no-useless-fragment': 'warn',
'react/jsx-sort-props': 'off',
'react-hooks/rules-of-hooks': 'warn',
};
const extensions = [
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:import/react',
];
module.exports = {
extends: extensions,
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@emotion/*'],
message:
'Please do not import emotion directly. Import helpers from ./design-system or ./primitives instead.',
},
],
},
],
'react/button-has-type': 'warn',
'react/function-component-definition': 'off',
'react/hook-use-state': 'warn',
'react/jsx-boolean-value': 'warn',
'react/jsx-curly-brace-presence': 'warn',
'react/jsx-fragments': 'warn',
'react/jsx-no-leaked-render': 'warn',
'react/jsx-no-target-blank': [
'error',
{
allowReferrer: true,
},
],
'react/jsx-no-useless-fragment': ['warn', { allowExpressions: true }],
'react/jsx-pascal-case': 'warn',
'react/jsx-sort-props': 'warn',
'react/no-array-index-key': 'warn',
'react/no-unstable-nested-components': 'warn',
'react/no-unknown-property': ['error', { ignore: ['css'] }], // Emotion
'react/self-closing-comp': 'warn',
...disabledRules,
},
// TODO: Enable when we're able to make the appropriate changes.
// overrides: [
// {
// files: TEST_FILES,
// extends: [...extensions, 'plugin:jest/recommended', 'plugin:testing-library/react'],
// plugins: ['testing-library'],
// },
// ],
settings: {
react: {
version: 'detect',
},
},
};