forked from arnog/mathlive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
357 lines (338 loc) · 10.7 KB
/
.eslintrc.json
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
{
"env": {
"browser": true,
// "commonjs": true,
// "es6": true,
"es2020": true,
"jest": true,
"node": true, // For jest, config files, etc...
"amd": true,
"mocha": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
// Configure the parser with the tsconfig file in the root project
// (or rather an extended version that add peripheral files such as rollup.config.js
// so that eslint doesn't complain that they are not in the project)
"project": "./tsconfig.eslint.json",
// "ecmaFeatures": { "jsx": false }, // default
"ecmaVersion": 2020,
// "sourceType": "module" // Allow the use of import
"extraFileExtensions": [".less"]
},
"extends": [
// Uses the recommended rules for Typescript
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
// Disable rules that conflict with prettier
// See https://prettier.io/docs/en/integrating-with-linters.html
"plugin:prettier/recommended"
// "plugin:no-unsanitized/DOM"
],
// Note:
// "off" or 0 - turn the rule off
// "warn" or 1 - turn the rule on as a warning (doesn’t affect exit code)
// "error" or 2 - turn the rule on as an error (exit code is 1 when triggered)
// See http://eslint.org/docs/rules/
"rules": {
// "no-unsanitized/method": [
// "warn",
// {
// // "disableDefault": true,
// "escape": {
// "methods": [
// "createHTML",
// "mathfield.config.createHTML",
// "MathfieldPrivate.config.createHTML"
// ]
// }
// }
// ],
"no-restricted-globals": [
"error",
"postMessage",
"blur",
"focus",
"close",
"frames",
"self",
"parent",
"opener",
"top",
"length",
"closed",
"location",
"origin",
"name",
"locationbar",
"menubar",
"personalbar",
"scrollbars",
"statusbar",
"toolbar",
"status",
"frameElement",
// "navigator",
"customElements",
"external",
"screen",
"innerWidth",
"innerHeight",
"scrollX",
"pageXOffset",
"scrollY",
"pageYOffset",
"screenX",
"screenY",
"outerWidth",
"outerHeight",
"devicePixelRatio",
"clientInformation",
"screenLeft",
"screenTop",
"defaultStatus",
"defaultstatus",
"styleMedia",
"onanimationend",
"onanimationiteration",
"onanimationstart",
"onsearch",
"ontransitionend",
"onwebkitanimationend",
"onwebkitanimationiteration",
"onwebkitanimationstart",
"onwebkittransitionend",
"isSecureContext",
"onabort",
"onblur",
"oncancel",
"oncanplay",
"oncanplaythrough",
"onchange",
"onclick",
"onclose",
"oncontextmenu",
"oncuechange",
"ondblclick",
"ondrag",
"ondragend",
"ondragenter",
"ondragleave",
"ondragover",
"ondragstart",
"ondrop",
"ondurationchange",
"onemptied",
"onended",
"onerror",
"onfocus",
"oninput",
"oninvalid",
"onkeydown",
"onkeypress",
"onkeyup",
"onload",
"onloadeddata",
"onloadedmetadata",
"onloadstart",
"onmousedown",
"onmouseenter",
"onmouseleave",
"onmousemove",
"onmouseout",
"onmouseover",
"onmouseup",
"onmousewheel",
"onpause",
"onplay",
"onplaying",
"onprogress",
"onratechange",
"onreset",
"onresize",
"onscroll",
"onseeked",
"onseeking",
"onselect",
"onstalled",
"onsubmit",
"onsuspend",
"ontimeupdate",
"ontoggle",
"onvolumechange",
"onwaiting",
"onwheel",
"onauxclick",
"ongotpointercapture",
"onlostpointercapture",
"onpointerdown",
"onpointermove",
"onpointerup",
"onpointercancel",
"onpointerover",
"onpointerout",
"onpointerenter",
"onpointerleave",
"onafterprint",
"onbeforeprint",
"onbeforeunload",
"onhashchange",
"onlanguagechange",
"onmessage",
"onmessageerror",
"onoffline",
"ononline",
"onpagehide",
"onpageshow",
"onpopstate",
"onrejectionhandled",
"onstorage",
"onunhandledrejection",
"onunload",
"performance",
"stop",
"open",
"print",
"captureEvents",
"releaseEvents",
"getComputedStyle",
"matchMedia",
"moveTo",
"moveBy",
"resizeTo",
"resizeBy",
"getSelection",
"find",
"createImageBitmap",
"scroll",
"scrollTo",
"scrollBy",
"onappinstalled",
"onbeforeinstallprompt",
"crypto",
"ondevicemotion",
"ondeviceorientation",
"ondeviceorientationabsolute",
"indexedDB",
"webkitStorageInfo",
"chrome",
"visualViewport",
"speechSynthesis",
"webkitRequestFileSystem",
"webkitResolveLocalFileSystemURL",
"openDatabase"
],
// Turn off rules that are Typescript specific
// (they are turned on later in the "overrides" section)
"@typescript-eslint/explicit-module-boundary-types": "off",
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],
// note you must disable the base rule as it can report incorrect errors
"indent": "off",
"no-const-assign": "warn",
"no-this-before-super": "warn",
// "no-undef": "warn",
"no-unreachable": "warn",
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
// "varsIgnorePattern": "^_",
// "vars": "all",
// "args": "after-used",
// "ignoreRestSiblings": false
}
],
"constructor-super": "warn",
"block-scoped-var": "error",
"array-bracket-spacing": ["error", "never"],
"block-spacing": ["error", "always"],
"brace-style": ["warn", "1tbs", { "allowSingleLine": true }],
"prefer-const": "warn",
"valid-typeof": "error",
"consistent-return": "error",
"curly": ["warn", "multi-line"],
"eqeqeq": ["error", "smart"],
"guard-for-in": "warn",
// "max-len": "warn",
"new-cap": "warn",
"no-bitwise": "off",
"no-console": "off",
"no-dupe-class-members": "off", // Support TypeScritp polymorphism
"no-else-return": "warn",
"no-eval": "error",
"no-fallthrough": "error",
"no-invalid-this": "warn",
"no-lone-blocks": "warn",
"no-return-assign": ["warn", "always"],
"no-redeclare": "off",
"no-self-compare": "error",
"no-sequences": "warn",
"no-unneeded-ternary": "warn",
"no-unused-expressions": "warn",
"no-useless-call": "warn",
"no-var": "error",
"no-with": "error",
// "vars-on-top": "warn",
"no-delete-var": "warn",
"no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
"require-jsdoc": "off",
"space-infix-ops": ["error", { "int32Hint": false }],
"no-trailing-spaces": [1, { "skipBlankLines": true }]
},
"overrides": [
{
// Typescript-specific rules
"files": ["*.ts"],
"rules": {
// "@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": "typeParameter",
"format": ["PascalCase"]
}
],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-use-before-define": [
"error",
{
"functions": false,
"classes": false,
"variables": false,
"typedefs": false
}
],
"@typescript-eslint/no-this-alias": [
"error",
{
"allowedNames": ["self", "that"] // Allow `const self = this`; `[]` by default
}
],
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "warn",
"@typescript-eslint/no-unnecessary-type-arguments": "warn",
// "@typescript-eslint/typedef": [
// "warn",
// {
// "parameter": true,
// "arrowParameter": false,
// "variableDeclaration": false
// }
// ],
"@typescript-eslint/array-type": [
"warn",
{ "default": "array" }
],
"@typescript-eslint/no-explicit-any": "off"
}
}
]
}