-
-
Notifications
You must be signed in to change notification settings - Fork 98
/
.eslintrc.js
97 lines (96 loc) · 2.36 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
module.exports = {
env: {
browser: true,
es2021: true
},
extends: 'eslint:recommended',
parserOptions: {
ecmaVersion: 13,
sourceType: 'module'
},
rules: {
// byte saving rules
'no-duplicate-imports': 2,
'object-shorthand': 2,
'prefer-arrow-callback': 2,
'no-else-return': 2,
'one-var': [
'error',
{
uninitialized: 'always'
}
],
'prefer-exponentiation-operator': 2,
'no-restricted-syntax': [
'error',
{
selector: 'BinaryExpression[operator="==="]',
message: "Prefer '==' over '===' to save bytes"
},
{
selector: 'BinaryExpression[operator="!=="]',
message: "Prefer '!=' over '!==' to save bytes"
},
{
selector:
'MemberExpression[object.name=Math][property.name=floor]',
message: "Prefer '| 0' over 'Math.floor' to save bytes"
},
{
selector: 'VariableDeclaration[kind=const]',
message: "Prefer 'let' over 'const' to save bytes"
},
{
selector: 'MemberExpression[property.name=forEach]',
message: "Prefer '.map()' over '.forEach()' to save bytes"
}
],
// code style rules
'spaced-comment': [
'error',
'always',
{
exceptions: ['@__PURE__']
}
],
'array-bracket-spacing': 2,
'object-curly-spacing': ['error', 'always'],
'no-trailing-spaces': 2,
'multiline-comment-style': ['error', 'separate-lines'],
'max-len': [
'error',
{
comments: 70,
// ignore JSDoc block comments, @ifdef comments, template
// literals with placeholders (ignoreStrings option doesn't
// seem to work with it), and mocha describe and it functions
// with template literals with placeholders
ignorePattern:
'^\\s*(\\*|\\/\\/ @ifdef|\\/\\* @ifdef|`|describe\\(`)|it\\(`',
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreRegExpLiterals: true
}
]
},
overrides: [
{
files: ['test/**/*.js'],
env: {
browser: true,
es2021: true,
mocha: true
},
globals: {
expect: true,
sinon: true
},
plugins: ['mocha-no-only'],
rules: {
'no-restricted-syntax': 0,
'mocha-no-only/mocha-no-only': 2
}
}
]
};