-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.js
82 lines (76 loc) · 2.2 KB
/
eslint.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
module.exports = {
extends: ['airbnb', './eslint-base', 'plugin:react-hooks/recommended'],
env: {
es6: true,
browser: true
},
rules: {
// Support react-router Link
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['to'],
aspects: ['noHref', 'invalidHref', 'preferButton']
}
],
'jsx-a11y/label-has-for': 'off',
// we do not enforce .jsx
'react/jsx-filename-extension': 'off',
// allow props spreading for html and BaseComponent(HOCs)
'react/jsx-props-no-spreading': [
'warn',
{
html: 'ignore',
custom: 'enforce',
exceptions: ['BaseComponent']
}
],
// Consistent arrow functions for functional components
'react/function-component-definition': [
'warn',
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function'
}
],
'react/react-in-jsx-scope': 'off',
// Supported rules, but not enforced
'react/forbid-prop-types': 'warn',
'react/require-default-props': 'warn',
'react/prop-types': 'warn',
'react/jsx-fragments': 'warn',
'react/default-props-match-prop-types': 'warn',
'react/jsx-no-constructed-context-values': 'warn',
'react/no-unstable-nested-components': 'warn',
'react/no-unused-class-component-methods': 'warn',
// Supported formatting rules, but not enforced
'react/destructuring-assignment': 'warn',
'react/jsx-closing-tag-location': 'warn',
'react/jsx-curly-newline': 'warn',
'react/jsx-one-expression-per-line': 'warn',
'react/jsx-wrap-multilines': 'warn',
'react/jsx-no-useless-fragment': 'warn',
'react/sort-comp': 'warn'
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
// Disable prop-types on .ts files
'react/prop-types': 'off',
'react/forbid-prop-types': 'off',
'react/require-default-props': 'off',
'react/default-props-match-prop-types': 'off'
}
}
],
settings: {
'import/extensions': ['.js', '.jsx', '.ts', '.tsx', '.d.ts'],
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts']
}
}
}
};