forked from TurboWarp/extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
77 lines (76 loc) · 1.9 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
// eslint-disable-next-line no-undef
module.exports = {
env: {
es2021: true
},
extends: 'eslint:recommended',
overrides: [
],
parserOptions: {
ecmaVersion: 'latest'
},
globals: {
Scratch: 'readonly'
},
rules: {
// Here is where we enforce rules to have somewhat consistent code style without being overbearing
'semi': [
'warn',
'always'
],
'brace-style': 'warn',
'key-spacing': 'warn',
'keyword-spacing': 'warn',
'new-parens': 'warn',
'no-trailing-spaces': [
'warn',
{
ignoreComments: true
}
],
'space-infix-ops': 'warn',
'no-tabs': 'warn',
'no-unused-vars': 'off',
// Allow while (true) { }
'no-constant-condition': [
'error',
{
checkLoops: false
}
],
// Allow empty catch {} blocks
'no-empty': [
'error',
{
allowEmptyCatch: true
}
],
// Returning a value from a constructor() implies a mistake
'no-constructor-return': 'error',
// new Promise(async () => {}) implies a mistake
'no-async-promise-executor': 'warn',
// x === x implies a mistake
'no-self-compare': 'error',
// Using ${...} in a non-template-string implies a mistake
'no-template-curly-in-string': 'error',
// Loops that only iterate once imply a mistake
'no-unreachable-loop': 'error',
// Detect some untrusted code execution
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
'no-script-url': 'error',
// Combinations of || and && are unreadable and may not do what you expect
'no-mixed-operators': [
'error',
{
groups: [
['&&', '||']
]
}
],
// Disallow async functions that don't need to be. This is important as a Promise and non-Promise return value
// significantly impacts the behavior of projects.
'require-await': 'error'
}
};