-
Notifications
You must be signed in to change notification settings - Fork 220
/
.eslintrc.js
160 lines (160 loc) · 4.64 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
module.exports = {
extends: ['eslint-config-airbnb', 'plugin:prettier/recommended'],
plugins: ['react', 'import', 'security', 'prettier'],
parser: 'babel-eslint',
env: {
browser: true,
node: true,
es6: true,
jest: true,
},
rules: {
'prettier/prettier': 'error',
'prefer-destructuring': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/no-noninteractive-element-interactions': 'off',
'jsx-a11y/no-autofocus': 'off',
'jsx-a11y/no-noninteractive-tabindex': 'off',
'jsx-a11y/anchor-has-content': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'react/destructuring-assignment': 'off',
'react/jsx-no-bind': 'error',
'react/no-multi-comp': 'off',
'no-restricted-syntax': [
'error',
'DebuggerStatement',
'ForInStatement',
'WithStatement',
],
'comma-dangle': ['error', 'always-multiline'], // https://github.com/airbnb/javascript/commit/788208295469e19b806c06e01095dc8ba1b6cdc9
'no-underscore-dangle': 'off',
'react/require-default-props': 'off',
'react/jsx-curly-spacing': 'off',
'arrow-body-style': 'off',
'no-mixed-operators': [
'error',
{
groups: [
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
allowSamePrecedence: true,
},
],
'react/jsx-filename-extension': [
'error',
{ extensions: ['.js', '.jsx', '.tsx'] },
],
'react/no-string-refs': 'off',
'no-param-reassign': 'off',
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
'import/no-unresolved': [
2,
{ ignore: ['react', 'react-dom', 'react-intl-tel-input'] },
],
'import/extensions': 'off',
'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', // repos with a single test file
'test-*.js', // repos with multiple top-level test files
'**/*.test.js', // tests where the extension denotes that it is a test
'**/webpack.config.js', // webpack config
'**/webpack.config.*.js', // webpack config
'config/jest/**',
'src/testUtils/**',
'*.js',
],
optionalDependencies: false,
},
],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
},
globals: {
__DEVELOPMENT__: true,
__CLIENT__: true,
__SERVER__: true,
__DISABLE_SSR__: true,
__DEVTOOLS__: true,
},
overrides: [
// typescript common config
{
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
files: ['**/*.d.ts', '**/*.test.ts', '**/*.test.tsx'],
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'eslint-plugin-import',
'eslint-plugin-react',
],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
},
groups: [['external', 'builtin'], 'parent', 'sibling'],
'newlines-between': 'always',
},
],
'react/jsx-first-prop-new-line': [1, 'multiline'],
'react/jsx-max-props-per-line': [
1,
{
maximum: 1,
},
],
'react/sort-comp': [
2,
{
order: [
'static-methods',
'instance-variables',
'instance-methods',
'lifecycle',
'everything-else',
'render',
],
},
],
'spaced-comment': [
'error',
'always',
{
line: {
markers: ['#region', '#endregion', 'region', 'endregion'],
},
},
],
},
settings: {
'import/resolver': 'eslint-import-resolver-typescript',
},
},
// typescript test-only config
{
files: ['**/*.test.ts', '**/*.test.tsx'],
rules: {
'no-use-before-define': 'off',
'no-console': 'off', // we want to be able to output results for tsc purposes
},
},
],
}