7
7
const { Linter } = require ( "eslint" )
8
8
9
9
const isESLint7 = Linter . version . startsWith ( "7" )
10
+ const isESLint8 = Linter . version . startsWith ( "8" )
10
11
11
12
/** @type {import('eslint').Linter.Config } */
12
13
module . exports = {
@@ -32,7 +33,7 @@ module.exports = {
32
33
"consistent-return" : "error" ,
33
34
curly : "error" ,
34
35
"default-case" : "error" ,
35
- ...( isESLint7 ? { "default-case-last" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
36
+ ...( isESLint7 || isESLint8 ? { "default-case-last" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
36
37
"default-param-last" : "error" ,
37
38
"dot-notation" : "error" ,
38
39
eqeqeq : [ "error" , "always" , { null : "ignore" } ] ,
@@ -43,6 +44,7 @@ module.exports = {
43
44
"init-declarations" : "error" ,
44
45
"linebreak-style" : [ "error" , "unix" ] ,
45
46
"lines-between-class-members" : "error" ,
47
+ ...( isESLint8 ? { "logical-assignment-operators" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
46
48
"max-statements-per-line" : [ "error" , { max : 1 } ] ,
47
49
"multiline-comment-style" : [ "error" , "separate-lines" ] ,
48
50
"new-cap" : "error" ,
@@ -53,6 +55,7 @@ module.exports = {
53
55
"no-case-declarations" : "error" ,
54
56
"no-compare-neg-zero" : "error" ,
55
57
"no-cond-assign" : "error" ,
58
+ ...( isESLint8 ? { "no-constant-binary-expression" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
56
59
"no-constant-condition" : "error" ,
57
60
"no-constructor-return" : "error" ,
58
61
"no-control-regex" : "error" ,
@@ -68,6 +71,7 @@ module.exports = {
68
71
"no-empty-character-class" : "error" ,
69
72
"no-empty-function" : "error" ,
70
73
"no-empty-pattern" : "error" ,
74
+ ...( isESLint8 ? { "no-empty-static-block" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
71
75
"no-eval" : "error" ,
72
76
"no-ex-assign" : "error" ,
73
77
"no-extend-native" : "error" ,
@@ -98,7 +102,7 @@ module.exports = {
98
102
"no-lone-blocks" : "error" ,
99
103
"no-lonely-if" : "error" ,
100
104
"no-loop-func" : "error" ,
101
- ...( isESLint7 ? { "no-loss-of-precision" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
105
+ ...( isESLint7 || isESLint8 ? { "no-loss-of-precision" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
102
106
"no-misleading-character-class" : "error" ,
103
107
"no-mixed-operators" : [
104
108
"error" ,
@@ -110,17 +114,22 @@ module.exports = {
110
114
} ,
111
115
] ,
112
116
"no-new" : "error" ,
117
+ ...( isESLint8 ? { "no-new-native-nonconstructor" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
113
118
"no-new-object" : "error" ,
114
119
"no-new-require" : "error" ,
115
120
"no-new-wrappers" : "error" ,
116
- ...( isESLint7 ? { "no-nonoctal-decimal-escape" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
121
+ ...( isESLint7 || isESLint8
122
+ ? { "no-nonoctal-decimal-escape" : "off" }
123
+ : { } ) , // TODO: enable once we drop ESLint v6 support
117
124
"no-obj-calls" : "error" ,
118
125
"no-octal" : "error" ,
119
126
"no-octal-escape" : "error" ,
120
127
"no-param-reassign" : [ "error" , { props : false } ] ,
121
128
"no-process-env" : "error" ,
122
129
"no-process-exit" : "error" ,
123
- ...( isESLint7 ? { "no-promise-executor-return" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
130
+ ...( isESLint7 || isESLint8
131
+ ? { "no-promise-executor-return" : "off" }
132
+ : { } ) , // TODO: enable once we drop ESLint v6 support
124
133
"no-prototype-builtins" : "error" ,
125
134
"no-redeclare" : [ "error" , { builtinGlobals : true } ] ,
126
135
"no-regex-spaces" : "error" ,
@@ -151,12 +160,15 @@ module.exports = {
151
160
"no-unmodified-loop-condition" : "error" ,
152
161
"no-unneeded-ternary" : "error" ,
153
162
"no-unreachable" : "error" ,
154
- ...( isESLint7 ? { "no-unreachable-loop" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
163
+ ...( isESLint7 || isESLint8 ? { "no-unreachable-loop" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
155
164
"no-unsafe-finally" : "error" ,
156
165
"no-unsafe-negation" : [ "error" , { enforceForOrderingRelations : true } ] ,
157
- ...( isESLint7 ? { "no-unsafe-optional-chaining" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
166
+ ...( isESLint7 || isESLint8
167
+ ? { "no-unsafe-optional-chaining" : "off" }
168
+ : { } ) , // TODO: enable once we drop ESLint v6 support
158
169
"no-unused-expressions" : "error" ,
159
170
"no-unused-labels" : "error" ,
171
+ ...( isESLint8 ? { "no-unused-private-class-members" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
160
172
"no-unused-vars" : [
161
173
"error" ,
162
174
{
@@ -168,7 +180,9 @@ module.exports = {
168
180
} ,
169
181
] ,
170
182
"no-use-before-define" : [ "error" , "nofunc" ] ,
171
- ...( isESLint7 ? { "no-useless-backreference" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
183
+ ...( isESLint7 || isESLint8
184
+ ? { "no-useless-backreference" : "off" }
185
+ : { } ) , // TODO: enable once we drop ESLint v6 support
172
186
"no-useless-call" : "error" ,
173
187
"no-useless-catch" : "error" ,
174
188
"no-useless-concat" : "error" ,
@@ -190,6 +204,7 @@ module.exports = {
190
204
{ blankLine : "always" , next : "*" , prev : "function" } ,
191
205
] ,
192
206
"prefer-exponentiation-operator" : "error" ,
207
+ ...( isESLint8 ? { "prefer-object-has-own" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
193
208
"prefer-promise-reject-errors" : "error" ,
194
209
"prefer-regex-literals" : "error" ,
195
210
quotes : [ "error" , "double" , { avoidEscape : true } ] ,
0 commit comments