1- /**
2- * @author Toru Nagashima
3- * See LICENSE file in root directory for full license.
4- */
51"use strict"
62
73const { Linter } = require ( "eslint" )
84const semver = require ( "semver" )
95
106const isESLint7OrHigher = semver . gte ( Linter . version , "7.0.0" )
117const isESLint8OrHigher = semver . gte ( Linter . version , "8.0.0" )
8+ const isESLint850OrHigher = semver . gte ( Linter . version , "8.50.0" )
9+ const isESLint853OrHigher = semver . gte ( Linter . version , "8.53.0" )
1210
1311/** @type {import('eslint').Linter.Config } */
1412module . exports = {
@@ -43,10 +41,7 @@ module.exports = {
4341 "getter-return" : "error" ,
4442 "grouped-accessor-pairs" : "error" ,
4543 "init-declarations" : "error" ,
46- "linebreak-style" : [ "error" , "unix" ] ,
47- "lines-between-class-members" : "error" ,
4844 ...( isESLint8OrHigher ? { "logical-assignment-operators" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
49- "max-statements-per-line" : [ "error" , { max : 1 } ] ,
5045 "multiline-comment-style" : [ "error" , "separate-lines" ] ,
5146 "new-cap" : "error" ,
5247 "no-alert" : "error" ,
@@ -107,21 +102,14 @@ module.exports = {
107102 "no-loop-func" : "error" ,
108103 ...( isESLint7OrHigher ? { "no-loss-of-precision" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
109104 "no-misleading-character-class" : "error" ,
110- "no-mixed-operators" : [
111- "error" ,
112- {
113- groups : [
114- [ "&" , "|" , "^" , "~" , "<<" , ">>" , ">>>" ] ,
115- [ "&&" , "||" ] ,
116- ] ,
117- } ,
118- ] ,
119105 "no-new" : "error" ,
120106 ...( isESLint8OrHigher ? { "no-new-native-nonconstructor" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
121- "no-new-object" : "error" ,
122107 "no-new-require" : "error" ,
123108 "no-new-wrappers" : "error" ,
124109 ...( isESLint7OrHigher ? { "no-nonoctal-decimal-escape" : "off" } : { } ) , // TODO: enable once we drop ESLint v6 support
110+ ...( isESLint850OrHigher
111+ ? { "no-object-constructor" : "error" }
112+ : { "no-new-object" : "error" } ) , // TODO: remove once we drop ESLint v8.50 support
125113 "no-obj-calls" : "error" ,
126114 "no-octal" : "error" ,
127115 "no-octal-escape" : "error" ,
@@ -152,7 +140,6 @@ module.exports = {
152140 "no-shadow" : [ "error" , { builtinGlobals : true } ] ,
153141 "no-shadow-restricted-names" : "error" ,
154142 "no-sparse-arrays" : "error" ,
155- "no-tabs" : "error" ,
156143 "no-throw-literal" : "error" ,
157144 "no-undef" : [ "error" , { typeof : true } ] ,
158145 "no-unexpected-multiline" : "error" ,
@@ -194,48 +181,13 @@ module.exports = {
194181 uninitialized : "always" ,
195182 } ,
196183 ] ,
197- "padding-line-between-statements" : [
198- "error" ,
199- { blankLine : "always" , next : "*" , prev : "directive" } ,
200- { blankLine : "always" , next : "function" , prev : "*" } ,
201- { blankLine : "always" , next : "*" , prev : "function" } ,
202- ] ,
203184 "prefer-exponentiation-operator" : "error" ,
204185 ...( isESLint8OrHigher ? { "prefer-object-has-own" : "off" } : { } ) , // TODO: enable once we drop ESLint v7 support
205186 "prefer-promise-reject-errors" : "error" ,
206187 "prefer-regex-literals" : "error" ,
207- quotes : [ "error" , "double" , { avoidEscape : true } ] ,
208188 radix : "error" ,
209189 "require-atomic-updates" : "error" ,
210190 "require-await" : "error" ,
211- "spaced-comment" : [
212- "error" ,
213- "always" ,
214- {
215- block : {
216- balanced : true ,
217- markers : [
218- "eslint" ,
219- "eslint-env" ,
220- "eslint-disable" ,
221- "eslint-enable" ,
222- "exported" ,
223- "globals" ,
224- "istanbul" ,
225- ] ,
226- } ,
227- line : {
228- exceptions : [ "-" , "=" ] ,
229- markers : [
230- "eslint-disable-line" ,
231- "eslint-disable-next-line" ,
232- "istanbul" ,
233- "TODO:" ,
234- "FIXME:" ,
235- ] ,
236- } ,
237- } ,
238- ] ,
239191 strict : [ "error" , "global" ] ,
240192 "use-isnan" : [
241193 "error" ,
@@ -250,64 +202,77 @@ module.exports = {
250202 "max-params" : [ "warn" , { max : 8 } ] ,
251203 "no-console" : [ "warn" , { allow : [ "assert" , "error" ] } ] ,
252204
253- // Disabled rules as favor of Prettier.
254- "array-bracket-newline" : "off" ,
255- "array-bracket-spacing" : "off" ,
256- "array-element-newline" : "off" ,
257- "arrow-parens" : "off" ,
258- "arrow-spacing" : "off" ,
259- "block-spacing" : "off" ,
260- "brace-style" : "off" ,
261- "comma-dangle" : "off" ,
262- "comma-spacing" : "off" ,
263- "comma-style" : "off" ,
264- "computed-property-spacing" : "off" ,
265- "dot-location" : "off" ,
266- "eol-last" : "off" ,
267- "func-call-spacing" : "off" ,
268- "function-call-argument-newline" : "off" ,
269- "function-paren-newline" : "off" ,
270- "generator-star-spacing" : "off" ,
271- "implicit-arrow-linebreak" : "off" ,
272- indent : "off" ,
273- "jsx-quotes" : "off" ,
274- "key-spacing" : "off" ,
275- "keyword-spacing" : "off" ,
276- "multiline-ternary" : "off" ,
277- "new-parens" : "off" ,
278- "newline-per-chained-call" : "off" ,
279- "no-extra-parens" : "off" ,
280- "no-extra-semi" : "off" ,
281- "no-floating-decimal" : "off" ,
282- "no-mixed-spaces-and-tabs" : "off" ,
283- "no-multi-spaces" : "off" ,
284- "no-multiple-empty-lines" : "off" ,
285- "no-trailing-spaces" : "off" ,
286- "no-whitespace-before-property" : "off" ,
287- "nonblock-statement-body-position" : "off" ,
288- "object-curly-newline" : "off" ,
289- "object-curly-spacing" : "off" ,
290- "object-property-newline" : "off" ,
291- "one-var-declaration-per-line" : "off" ,
292- "operator-linebreak" : "off" ,
293- "padded-blocks" : "off" ,
294- "quote-props" : "off" ,
295- "rest-spread-spacing" : "off" ,
296- semi : "off" ,
297- "semi-spacing" : "off" ,
298- "semi-style" : "off" ,
299- "space-before-blocks" : "off" ,
300- "space-before-function-paren" : "off" ,
301- "space-in-parens" : "off" ,
302- "space-infix-ops" : "off" ,
303- "space-unary-ops" : "off" ,
304- "switch-colon-spacing" : "off" ,
305- "template-curly-spacing" : "off" ,
306- "template-tag-spacing" : "off" ,
307- "unicode-bom" : "off" ,
308- "wrap-iife" : "off" ,
309- "wrap-regex" : "off" ,
310- "yield-star-spacing" : "off" ,
205+ ...( isESLint853OrHigher
206+ ? { }
207+ : {
208+ "array-bracket-newline" : "off" ,
209+ "array-bracket-spacing" : "off" ,
210+ "array-element-newline" : "off" ,
211+ "arrow-parens" : "off" ,
212+ "arrow-spacing" : "off" ,
213+ "block-spacing" : "off" ,
214+ "brace-style" : "off" ,
215+ "comma-dangle" : "off" ,
216+ "comma-spacing" : "off" ,
217+ "comma-style" : "off" ,
218+ "computed-property-spacing" : "off" ,
219+ "dot-location" : "off" ,
220+ "eol-last" : "off" ,
221+ "func-call-spacing" : "off" ,
222+ "function-call-argument-newline" : "off" ,
223+ "function-paren-newline" : "off" ,
224+ "generator-star-spacing" : "off" ,
225+ "implicit-arrow-linebreak" : "off" ,
226+ indent : "off" ,
227+ "jsx-quotes" : "off" ,
228+ "key-spacing" : "off" ,
229+ "keyword-spacing" : "off" ,
230+ "linebreak-style" : "off" ,
231+ "lines-around-comment" : "off" ,
232+ "lines-between-class-members" : "off" ,
233+ "max-len" : "off" ,
234+ "max-statements-per-line" : "off" ,
235+ "multiline-ternary" : "off" ,
236+ "new-parens" : "off" ,
237+ "newline-per-chained-call" : "off" ,
238+ "no-confusing-arrow" : "off" ,
239+ "no-extra-parens" : "off" ,
240+ "no-extra-semi" : "off" ,
241+ "no-floating-decimal" : "off" ,
242+ "no-mixed-operators" : "off" ,
243+ "no-mixed-spaces-and-tabs" : "off" ,
244+ "no-multi-spaces" : "off" ,
245+ "no-multiple-empty-lines" : "off" ,
246+ "no-tabs" : "off" ,
247+ "no-trailing-spaces" : "off" ,
248+ "no-whitespace-before-property" : "off" ,
249+ "nonblock-statement-body-position" : "off" ,
250+ "object-curly-newline" : "off" ,
251+ "object-curly-spacing" : "off" ,
252+ "object-property-newline" : "off" ,
253+ "one-var-declaration-per-line" : "off" ,
254+ "operator-linebreak" : "off" ,
255+ "padded-blocks" : "off" ,
256+ "padding-line-between-statements" : "off" ,
257+ "quote-props" : "off" ,
258+ quotes : "off" ,
259+ "rest-spread-spacing" : "off" ,
260+ semi : "off" ,
261+ "semi-spacing" : "off" ,
262+ "semi-style" : "off" ,
263+ "space-before-blocks" : "off" ,
264+ "space-before-function-paren" : "off" ,
265+ "space-in-parens" : "off" ,
266+ "space-infix-ops" : "off" ,
267+ "space-unary-ops" : "off" ,
268+ "spaced-comment" : "off" ,
269+ "switch-colon-spacing" : "off" ,
270+ "template-curly-spacing" : "off" ,
271+ "template-tag-spacing" : "off" ,
272+ "wrap-iife" : "off" ,
273+ "wrap-regex" : "off" ,
274+ "yield-star-spacing" : "off" ,
275+ } ) , // TODO: remove once we drop ESLint v8.53 support
311276
312277 // Disabled rules
313278 "arrow-body-style" : "off" ,
@@ -327,18 +292,15 @@ module.exports = {
327292 "id-length" : "off" ,
328293 "id-match" : "off" ,
329294 "line-comment-position" : "off" ,
330- "lines-around-comment" : "off" ,
331295 "max-classes-per-file" : "off" ,
332296 "max-depth" : "off" ,
333- "max-len" : "off" ,
334297 "max-lines" : "off" ,
335298 "max-lines-per-function" : "off" ,
336299 "max-statements" : "off" ,
337300 "no-await-in-loop" : "off" ,
338301 "no-bitwise" : "off" ,
339302 "no-buffer-constructor" : "off" ,
340303 "no-class-assign" : "off" ,
341- "no-confusing-arrow" : "off" ,
342304 "no-const-assign" : "off" ,
343305 "no-continue" : "off" ,
344306 "no-dupe-class-members" : "off" ,
@@ -391,6 +353,7 @@ module.exports = {
391353 "sort-keys" : "off" ,
392354 "sort-vars" : "off" ,
393355 "symbol-description" : "off" ,
356+ "unicode-bom" : "off" ,
394357 "vars-on-top" : "off" ,
395358
396359 //
0 commit comments