77const { Linter } = require ( "eslint" )
88
99const isESLint7 = Linter . version . startsWith ( "7" )
10+ const isESLint8 = Linter . version . startsWith ( "8" )
1011
1112/** @type {import('eslint').Linter.Config } */
1213module . exports = {
@@ -32,7 +33,7 @@ module.exports = {
3233 "consistent-return" : "error" ,
3334 curly : "error" ,
3435 "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
3637 "default-param-last" : "error" ,
3738 "dot-notation" : "error" ,
3839 eqeqeq : [ "error" , "always" , { null : "ignore" } ] ,
@@ -43,6 +44,7 @@ module.exports = {
4344 "init-declarations" : "error" ,
4445 "linebreak-style" : [ "error" , "unix" ] ,
4546 "lines-between-class-members" : "error" ,
47+ ...( isESLint8 ? { "logical-assignment-operators" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
4648 "max-statements-per-line" : [ "error" , { max : 1 } ] ,
4749 "multiline-comment-style" : [ "error" , "separate-lines" ] ,
4850 "new-cap" : "error" ,
@@ -53,6 +55,7 @@ module.exports = {
5355 "no-case-declarations" : "error" ,
5456 "no-compare-neg-zero" : "error" ,
5557 "no-cond-assign" : "error" ,
58+ ...( isESLint8 ? { "no-constant-binary-expression" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
5659 "no-constant-condition" : "error" ,
5760 "no-constructor-return" : "error" ,
5861 "no-control-regex" : "error" ,
@@ -68,6 +71,7 @@ module.exports = {
6871 "no-empty-character-class" : "error" ,
6972 "no-empty-function" : "error" ,
7073 "no-empty-pattern" : "error" ,
74+ ...( isESLint8 ? { "no-empty-static-block" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
7175 "no-eval" : "error" ,
7276 "no-ex-assign" : "error" ,
7377 "no-extend-native" : "error" ,
@@ -98,7 +102,7 @@ module.exports = {
98102 "no-lone-blocks" : "error" ,
99103 "no-lonely-if" : "error" ,
100104 "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
102106 "no-misleading-character-class" : "error" ,
103107 "no-mixed-operators" : [
104108 "error" ,
@@ -110,17 +114,22 @@ module.exports = {
110114 } ,
111115 ] ,
112116 "no-new" : "error" ,
117+ ...( isESLint8 ? { "no-new-native-nonconstructor" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
113118 "no-new-object" : "error" ,
114119 "no-new-require" : "error" ,
115120 "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
117124 "no-obj-calls" : "error" ,
118125 "no-octal" : "error" ,
119126 "no-octal-escape" : "error" ,
120127 "no-param-reassign" : [ "error" , { props : false } ] ,
121128 "no-process-env" : "error" ,
122129 "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
124133 "no-prototype-builtins" : "error" ,
125134 "no-redeclare" : [ "error" , { builtinGlobals : true } ] ,
126135 "no-regex-spaces" : "error" ,
@@ -151,12 +160,15 @@ module.exports = {
151160 "no-unmodified-loop-condition" : "error" ,
152161 "no-unneeded-ternary" : "error" ,
153162 "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
155164 "no-unsafe-finally" : "error" ,
156165 "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
158169 "no-unused-expressions" : "error" ,
159170 "no-unused-labels" : "error" ,
171+ ...( isESLint8 ? { "no-unused-private-class-members" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
160172 "no-unused-vars" : [
161173 "error" ,
162174 {
@@ -168,7 +180,9 @@ module.exports = {
168180 } ,
169181 ] ,
170182 "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
172186 "no-useless-call" : "error" ,
173187 "no-useless-catch" : "error" ,
174188 "no-useless-concat" : "error" ,
@@ -190,6 +204,7 @@ module.exports = {
190204 { blankLine : "always" , next : "*" , prev : "function" } ,
191205 ] ,
192206 "prefer-exponentiation-operator" : "error" ,
207+ ...( isESLint8 ? { "prefer-object-has-own" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
193208 "prefer-promise-reject-errors" : "error" ,
194209 "prefer-regex-literals" : "error" ,
195210 quotes : [ "error" , "double" , { avoidEscape : true } ] ,
0 commit comments