-
Notifications
You must be signed in to change notification settings - Fork 15
/
.eslintrc.js
258 lines (253 loc) · 5.39 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
const restrictedGlobals = [
"addEventListener",
"blur",
"close",
"closed",
"confirm",
"defaultStatus",
"defaultstatus",
"event",
"external",
"find",
"focus",
"frameElement",
"frames",
"history",
"innerHeight",
"innerWidth",
"length",
"location",
"locationbar",
"menubar",
"moveBy",
"moveTo",
"name",
"onblur",
"onerror",
"onfocus",
"onload",
"onresize",
"onunload",
"open",
"opener",
"opera",
"outerHeight",
"outerWidth",
"pageXOffset",
"pageYOffset",
"parent",
"print",
"removeEventListener",
"resizeBy",
"resizeTo",
"screen",
"screenLeft",
"screenTop",
"screenX",
"screenY",
"scroll",
"scrollbars",
"scrollBy",
"scrollTo",
"scrollX",
"scrollY",
"self",
"status",
"statusbar",
"stop",
"toolbar",
"top",
];
module.exports = {
extends: ["eslint:recommended"],
root: true,
// parser: "babel-eslint",
plugins: ["import"],
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
},
overrides: [
{
files: ["**/*.ts?(x)"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
// typescript-eslint specific options
warnOnUnsupportedTypeScriptVersion: true,
},
plugins: ["@typescript-eslint"],
// If adding a typescript-eslint version of an existing ESLint rule,
// make sure to disable the ESLint rule here.
rules: {
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)
"no-dupe-class-members": 0,
// 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
"no-undef": 0,
// Add TypeScript specific rules (and turn off ESLint equivalents)
"@typescript-eslint/consistent-type-assertions": 1,
"no-array-constructor": 0,
"@typescript-eslint/no-array-constructor": 1,
"no-use-before-define": 0,
"@typescript-eslint/no-use-before-define": [
1,
{
functions: false,
classes: false,
variables: false,
typedefs: false,
},
],
"no-unused-expressions": 0,
"@typescript-eslint/no-unused-expressions": [
2,
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": [
1,
{
args: "none",
ignoreRestSiblings: true,
},
],
"no-useless-constructor": 0,
"@typescript-eslint/no-useless-constructor": 1,
},
},
],
// NOTE: When adding rules here, you need to make sure they are compatible with
// `typescript-eslint`, as some rules such as `no-array-constructor` aren't compatible.
rules: {
// http://eslint.org/docs/rules/
"array-callback-return": 1,
"default-case": 0,
"dot-location": [1, "property"],
eqeqeq: [1, "smart"],
"new-parens": 1,
"no-array-constructor": 0,
"no-caller": 1,
"no-cond-assign": [1, "except-parens"],
"no-const-assign": 1,
"no-control-regex": 1,
"no-delete-var": 1,
"no-dupe-args": 1,
"no-dupe-class-members": 1,
"no-dupe-keys": 1,
"no-duplicate-case": 1,
"no-empty-character-class": 1,
"no-empty-pattern": 1,
"no-eval": 1,
"no-ex-assign": 1,
"no-extend-native": 1,
"no-extra-bind": 1,
"no-extra-label": 1,
"no-fallthrough": 1,
"no-func-assign": 1,
"no-implied-eval": 1,
"no-invalid-regexp": 1,
"no-iterator": 1,
"no-label-var": 1,
"no-labels": [1, { allowLoop: true, allowSwitch: false }],
"no-lone-blocks": 1,
"no-loop-func": 1,
"no-mixed-operators": [
1,
{
groups: [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"],
],
allowSamePrecedence: false,
},
],
"no-multi-str": 1,
"no-native-reassign": 1,
"no-negated-in-lhs": 1,
"no-new-func": 1,
"no-new-object": 1,
"no-new-symbol": 1,
"no-new-wrappers": 1,
"no-obj-calls": 1,
"no-octal": 1,
"no-octal-escape": 1,
"no-regex-spaces": 1,
"no-restricted-syntax": [1, "WithStatement"],
"no-script-url": 1,
"no-self-assign": 1,
"no-self-compare": 1,
"no-sequences": 1,
"no-shadow-restricted-names": 1,
"no-sparse-arrays": 1,
"no-template-curly-in-string": 1,
"no-this-before-super": 1,
"no-throw-literal": 1,
"no-undef": 2,
"no-restricted-globals": [2].concat(restrictedGlobals),
"no-unreachable": 1,
"no-unused-expressions": [
2,
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
"no-unused-labels": 1,
"no-unused-vars": [
1,
{
args: "none",
ignoreRestSiblings: true,
},
],
"no-use-before-define": [
1,
{
functions: false,
classes: false,
variables: false,
},
],
"no-useless-computed-key": 1,
"no-useless-concat": 1,
"no-useless-constructor": 1,
"no-useless-escape": 1,
"no-useless-rename": [
1,
{
ignoreDestructuring: false,
ignoreImport: false,
ignoreExport: false,
},
],
"no-with": 1,
"no-whitespace-before-property": 1,
"require-yield": 1,
"rest-spread-spacing": [1, "never"],
strict: [1, "never"],
"unicode-bom": [1, "never"],
"use-isnan": 1,
"valid-typeof": 1,
"getter-return": 1,
// // https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
"import/first": 2,
"import/no-amd": 2,
"import/no-anonymous-default-export": 1,
"import/no-webpack-loader-syntax": 2,
},
};