-
Notifications
You must be signed in to change notification settings - Fork 5
/
eslintrc.js
118 lines (111 loc) · 3.06 KB
/
eslintrc.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
module.exports = {
extends: [
// Resolve to absolute paths so it can be found relative to wherever eslint is running
require.resolve('eslint-config-airbnb'),
require.resolve('eslint-config-prettier')
],
// Resolve to absolute path so it can be found relative to wherever eslint is running
parser: require.resolve('@babel/eslint-parser'),
parserOptions: {
requireConfigFile: false
},
plugins: [
'import',
'jsx-a11y',
'react',
'jest'
],
settings: {
'react': {
'version': 'detect'
}
},
env: {
jest: true,
browser: true
},
rules: {
// eslint
'arrow-body-style': 'off',
'class-methods-use-this': 'off',
'comma-dangle': [
'error',
'never'
],
'global-require': 'off',
'no-alert': 'error',
'no-console': 'error',
'no-underscore-dangle': 'off',
'padded-blocks': 'error',
'semi': [
'error',
'never'
],
'quotes': [
'error',
'single'
],
'prefer-object-spread': 'warn',
// import plugin
'import/default': 'error',
'import/named': 'error',
'import/no-extraneous-dependencies': ['error', {
devDependencies: [
'test/**', // tape, common npm pattern
'tests/**', // also common npm pattern
'spec/**', // mocha, rspec-like pattern
'**/__tests__/**', // jest pattern
'**/__mocks__/**', // jest pattern
'test.{js,jsx}', // repos with a single test file
'test-*.{js,jsx}', // repos with multiple top-level test files
'**/*{.,_}{test,spec}.{js,jsx}', // tests where the extension or filename suffix denotes that it is a test
'**/jest.config.js', // jest config
'**/jest.setup.js', // jest setup
'**/jestenv.js', // jestenv
'**/postcss.config.js', // postcss
'**/webpack.config.js', // webpack config
'**/webpack.config.*.js', // webpack config
'**/webpack.*.config.js' // TELUS webpack config
],
optionalDependencies: false
}],
// react plugin
'react/display-name': 'error',
'react/forbid-prop-types': [
1,
{
'forbid': [
'any'
]
}
],
'react/jsx-boolean-value': 'off',
'react/jsx-key': 'error',
'react/jsx-max-props-per-line': 'off',
'react/jsx-uses-react': [
'warn'
],
'react/no-danger': 'off',
'react/no-did-mount-set-state': 'warn',
'react/no-did-update-set-state': 'warn',
'react/no-direct-mutation-state': 'warn',
'react/no-multi-comp': 'warn',
'react/no-unknown-property': 'warn',
'react/sort-comp': 'warn',
'react/jsx-props-no-spreading': 'warn',
'react/jsx-fragments': 'warn',
'react/require-default-props': ['error',{ forbidDefaultForRequired: false, ignoreFunctionalComponents: true }],
// jsx-a11y plugin
'jsx-a11y/no-static-element-interaction': 'off',
'jsx-a11y/href-no-hash': 'off',
'jsx-a11y/anchor-is-valid': [
'warn',
{
'aspects': [
'invalidHref'
]
}
],
'react/jsx-curly-brace-presence': 'warn'
}
}