4
4
*/
5
5
"use strict"
6
6
7
+ const { ESLint, version : ESLintVersion } = require ( "eslint" )
8
+
9
+ const version = ESLint . version || ESLintVersion
10
+ const isESLint7 = version . startsWith ( "7" )
11
+
12
+ /** @type {import('eslint').Linter.Config } */
7
13
module . exports = {
8
14
root : true ,
9
15
plugins : [ "@eslint-community/mysticatea" ] ,
@@ -27,7 +33,7 @@ module.exports = {
27
33
"consistent-return" : "error" ,
28
34
curly : "error" ,
29
35
"default-case" : "error" ,
30
- "default-case-last" : "error" ,
36
+ ... ( isESLint7 ? { "default-case-last" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
31
37
"default-param-last" : "error" ,
32
38
"dot-notation" : "error" ,
33
39
eqeqeq : [ "error" , "always" , { null : "ignore" } ] ,
@@ -93,7 +99,7 @@ module.exports = {
93
99
"no-lone-blocks" : "error" ,
94
100
"no-lonely-if" : "error" ,
95
101
"no-loop-func" : "error" ,
96
- "no-loss-of-precision" : "error" ,
102
+ ... ( isESLint7 ? { "no-loss-of-precision" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
97
103
"no-misleading-character-class" : "error" ,
98
104
"no-mixed-operators" : [
99
105
"error" ,
@@ -108,14 +114,14 @@ module.exports = {
108
114
"no-new-object" : "error" ,
109
115
"no-new-require" : "error" ,
110
116
"no-new-wrappers" : "error" ,
111
- "no-nonoctal-decimal-escape" : "error" ,
117
+ ... ( isESLint7 ? { "no-nonoctal-decimal-escape" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
112
118
"no-obj-calls" : "error" ,
113
119
"no-octal" : "error" ,
114
120
"no-octal-escape" : "error" ,
115
121
"no-param-reassign" : [ "error" , { props : false } ] ,
116
122
"no-process-env" : "error" ,
117
123
"no-process-exit" : "error" ,
118
- "no-promise-executor-return" : "error" ,
124
+ ... ( isESLint7 ? { "no-promise-executor-return" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
119
125
"no-prototype-builtins" : "error" ,
120
126
"no-redeclare" : [ "error" , { builtinGlobals : true } ] ,
121
127
"no-regex-spaces" : "error" ,
@@ -146,10 +152,10 @@ module.exports = {
146
152
"no-unmodified-loop-condition" : "error" ,
147
153
"no-unneeded-ternary" : "error" ,
148
154
"no-unreachable" : "error" ,
149
- "no-unreachable-loop" : "error" ,
155
+ ... ( isESLint7 ? { "no-unreachable-loop" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
150
156
"no-unsafe-finally" : "error" ,
151
157
"no-unsafe-negation" : [ "error" , { enforceForOrderingRelations : true } ] ,
152
- "no-unsafe-optional-chaining" : "error" ,
158
+ ... ( isESLint7 ? { "no-unsafe-optional-chaining" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
153
159
"no-unused-expressions" : "error" ,
154
160
"no-unused-labels" : "error" ,
155
161
"no-unused-vars" : [
@@ -163,7 +169,7 @@ module.exports = {
163
169
} ,
164
170
] ,
165
171
"no-use-before-define" : [ "error" , "nofunc" ] ,
166
- "no-useless-backreference" : "error" ,
172
+ ... ( isESLint7 ? { "no-useless-backreference" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
167
173
"no-useless-call" : "error" ,
168
174
"no-useless-catch" : "error" ,
169
175
"no-useless-concat" : "error" ,
0 commit comments