UNPKG

38.4 kBJavaScriptView Raw
1/* eslint sort-keys: ["error", "asc"] */
2/* eslint-disable sort-keys */
3
4const options = require("./options.js");
5const globPatterns = require("./glob-patterns.js");
6const tests = require("./tests.js");
7
8module.exports = {
9 parser: "@babel/eslint-parser",
10 env: {
11 es6: true,
12 },
13 parserOptions: {
14 sourceType: "module",
15 ecmaVersion: 2021,
16 // We don't require a Babel config file in our base rules since it would complain
17 // for every regular JS file that the babel config is missing, even when Babel isn't used.
18 // If experimental syntax is used, you can still set this to true.
19 requireConfigFile: false,
20 },
21 plugins: [
22 "@babel",
23 "import",
24 "optimize-regex",
25 "promise",
26 "no-unsafe-regex",
27 ],
28 extends: [
29 "eslint:recommended",
30 "plugin:import/errors",
31 "plugin:import/warnings",
32 "plugin:promise/recommended",
33 ],
34 reportUnusedDisableDirectives: true,
35 rules: {
36 /* eslint-enable sort-keys */
37 "@babel/new-cap": "warn",
38 "@babel/no-invalid-this": "warn",
39 "@babel/no-unused-expressions": [
40 "warn",
41 options["no-unused-expressions"],
42 ],
43 "@babel/object-curly-spacing": ["warn", "always"],
44 "@babel/semi": "warn",
45 "accessor-pairs": [
46 "off",
47 {
48 getWithoutSet: true,
49 },
50 ], // http://eslint.org/docs/rules/accessor-pairs
51 "array-bracket-newline": [
52 "warn",
53 {
54 multiline: true,
55 },
56 ], // http://eslint.org/docs/rules/array-bracket-newline
57 "array-bracket-spacing": ["warn", "never"], // http://eslint.org/docs/rules/array-bracket-spacing
58 "array-callback-return": ["error"], // http://eslint.org/docs/rules/array-callback-return
59 "array-element-newline": "off", // http://eslint.org/docs/rules/array-element-newline
60 "arrow-body-style": "off", // http://eslint.org/docs/rules/arrow-body-style
61 "arrow-parens": "off", // http://eslint.org/docs/rules/arrow-parens
62 "arrow-spacing": [
63 "warn",
64 {
65 after: true,
66 before: true,
67 },
68 ], // http://eslint.org/docs/rules/arrow-spacing
69 // https://github.com/babel/eslint-plugin-babel
70 "block-scoped-var": "error", // http://eslint.org/docs/rules/block-scoped-var
71 "block-spacing": "warn", // http://eslint.org/docs/rules/block-spacing
72 "brace-style": [
73 "warn",
74 "1tbs",
75 {
76 allowSingleLine: false,
77 },
78 ], // http://eslint.org/docs/rules/brace-style
79 camelcase: ["warn", options.camelcase], // http://eslint.org/docs/rules/camelcase
80 "capitalized-comments": ["off"], // http://eslint.org/docs/rules/capitalized-comments
81 "class-methods-use-this": ["off"], // http://eslint.org/docs/rules/class-methods-use-this
82 "comma-dangle": [
83 "warn",
84 {
85 arrays: "always-multiline",
86 exports: "always-multiline",
87 functions: "ignore",
88 imports: "always-multiline",
89 objects: "always-multiline",
90 },
91 ], // http://eslint.org/docs/rules/comma-dangle
92 "comma-spacing": ["warn", options["comma-spacing"]], // http://eslint.org/docs/rules/comma-spacing
93 "comma-style": ["warn", "last"], // http://eslint.org/docs/rules/comma-style
94 complexity: [
95 "off",
96 {
97 max: 12,
98 },
99 ], // http://eslint.org/docs/rules/complexity
100 "computed-property-spacing": ["warn", "never"], // http://eslint.org/docs/rules/computed-property-spacing
101 "consistent-return": "warn", // http://eslint.org/docs/rules/consistent-return
102 "consistent-this": ["off", "self"], // http://eslint.org/docs/rules/consistent-this
103 "constructor-super": "error", // http://eslint.org/docs/rules/constructor-super
104 curly: ["warn", "all"], // http://eslint.org/docs/rules/curly
105 "default-case": "off", // http://eslint.org/docs/rules/default-case
106 "default-case-last": "off", // https://eslint.org/docs/rules/default-case-last
107 "default-param-last": "off", // https://eslint.org/docs/rules/default-param-last
108 "dot-location": ["warn", "property"], // http://eslint.org/docs/rules/dot-location
109 // We don't support ES3 envs anymore, so allowKeywords: true is ok
110 "dot-notation": ["warn", { allowKeywords: true }], // http://eslint.org/docs/rules/dot-notation
111 "eol-last": ["warn", "always"], // http://eslint.org/docs/rules/eol-last
112 eqeqeq: ["warn", "always", { null: "ignore" }], // http://eslint.org/docs/rules/eqeqeq
113 "func-call-spacing": ["warn", "never"], // http://eslint.org/docs/rules/func-call-spacing
114 "func-name-matching": ["off"], // http://eslint.org/docs/rules/func-name-matching
115 "func-names": "off", // http://eslint.org/docs/rules/func-names
116 "func-style": ["warn", "declaration"], // http://eslint.org/docs/rules/func-style
117 "function-call-argument-newline": "off", // https://eslint.org/docs/rules/function-call-argument-newline
118 // We can't use that rule since it conflicts with Prettier's
119 // formating when the line is too long
120 "function-paren-newline": ["off", "multiline"], // https://eslint.org/docs/rules/function-paren-newline
121 "generator-star-spacing": [
122 "warn",
123 {
124 after: true,
125 before: false,
126 },
127 ], // http://eslint.org/docs/rules/generator-star-spacing
128 "grouped-accessor-pairs": ["warn", "setBeforeGet"], // https://eslint.org/docs/rules/grouped-accessor-pairs
129 "guard-for-in": "off", // http://eslint.org/docs/rules/guard-for-in
130 "id-denylist": "off", // https://eslint.org/docs/rules/id-denylist
131 "id-length": "off", // http://eslint.org/docs/rules/id-length
132 "id-match": "off", // http://eslint.org/docs/rules/id-match
133 // We can't use that rule since it conflicts with Prettier's
134 // formating when the line is too long
135 "implicit-arrow-linebreak": ["off", "beside"], // https://eslint.org/docs/rules/implicit-arrow-linebreak
136 "import/dynamic-import-chunkname": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/dynamic-import-chunkname.md
137 "import/exports-last": "off", // https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/exports-last.md
138 "import/extensions": ["warn", "ignorePackages"], // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/extensions.md
139 "import/first": "warn", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md
140 "import/group-exports": "off", // https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/group-exports.md
141 "import/max-dependencies": ["off", { max: 35 }], // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
142 // Is already covered by eslint rule padding-line-between-statements
143 "import/newline-after-import": ["off", { count: 1 }], // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
144 "import/no-absolute-path": "warn", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
145 "import/no-amd": "warn", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-amd.md
146 // The auto-import feature of VS Code (and probably other editors) cannot work when things are
147 // exported anonymously because the editor does not know what the user wants to import.
148 // By just allowing default exports with names, refactoring and auto-importing becomes easier.
149 "import/no-anonymous-default-export": "warn", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-anonymous-default-export.md
150 "import/no-commonjs": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
151 // Currently disabled because of performance reasons :(
152 "import/no-cycle": "off", // https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-cycle.md
153 "import/no-default-export": "off", // https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-default-export.md
154 // Would be nice to turn this rule on but it's rather expensive
155 // and it did not report a lot in the past :(
156 "import/no-deprecated": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
157 "import/no-duplicates": "warn", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
158 "import/no-dynamic-require": "warn", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
159 "import/no-extraneous-dependencies": [
160 "off",
161 {
162 devDependencies: globPatterns.tests.concat(
163 globPatterns.tooling
164 ),
165 optionalDependencies: true,
166 peerDependencies: false,
167 },
168 ], // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
169 "import/no-import-module-exports": "error", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-import-module-exports.md
170 "import/no-internal-modules": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
171 "import/no-mutable-exports": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
172 "import/no-named-default": "warn", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
173 "import/no-named-export": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-export.md
174 "import/no-namespace": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
175 "import/no-nodejs-modules": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
176 "import/no-relative-packages": "error", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-relative-packages.md
177 "import/no-relative-parent-imports": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-relative-parent-imports.md
178 "import/no-restricted-paths": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
179 "import/no-self-import": "error", // https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-self-import.md
180 // While unassigned imports are often a bad choice, the false positive rate was just too high
181 "import/no-unassigned-import": [
182 "off",
183 {
184 allow: globPatterns.withSideEffects,
185 },
186 ], // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
187 "import/no-unresolved": ["error", { commonjs: true }], // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
188 "import/no-unused-modules": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unused-modules.md
189 "import/no-useless-path-segments": "warn", // currently undocumented :(, see https://github.com/import-js/eslint-plugin-import/issues/1032
190 "import/no-webpack-loader-syntax": "warn", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
191 "import/order": [
192 "warn",
193 {
194 // Since we want to keep changes as small as possible we can't order "parent", "sibling" and "index".
195 // Otherwise moving a file from one folder to another might impact a lot of files because
196 // now all the import statements need to be updated.
197 groups: ["builtin", "external", ["parent", "sibling", "index"]],
198 },
199 ], // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/order.md
200 "import/prefer-default-export": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
201 // This rule was just too impractical since code bases often mix commonjs modules and ecmascript modules
202 "import/unambiguous": "off", // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
203 indent: ["warn", 4, options["indent"]], // http://eslint.org/docs/rules/indent
204 "init-declarations": "off", // http://eslint.org/docs/rules/init-declarations
205
206 "jsx-quotes": ["warn", "prefer-double"], // http://eslint.org/docs/rules/jsx-quotes
207 "key-spacing": [
208 "warn",
209 {
210 afterColon: true,
211 beforeColon: false,
212 },
213 ], // http://eslint.org/docs/rules/key-spacing
214 "keyword-spacing": ["warn"], // http://eslint.org/docs/rules/keyword-spacing
215 "line-comment-position": "off", // http://eslint.org/docs/rules/line-comment-position
216 "linebreak-style": ["off", "unix"], // http://eslint.org/docs/rules/linebreak-style
217 "lines-around-comment": "off", // http://eslint.org/docs/rules/lines-around-comment
218 "lines-between-class-members": [
219 "warn",
220 "always",
221 options["lines-between-class-members"],
222 ], // https://eslint.org/docs/rules/lines-between-class-members
223 "max-classes-per-file": "off", // https://eslint.org/docs/rules/max-classes-per-file
224 "max-depth": ["warn", 5], // http://eslint.org/docs/rules/max-depth
225 "max-len": [
226 "warn",
227 {
228 code: 120,
229 ignoreComments: true,
230 ignoreRegExpLiterals: true,
231 ignoreStrings: true,
232 ignoreTemplateLiterals: true,
233 ignoreTrailingComments: true,
234 ignoreUrls: true,
235 tabWidth: 4,
236 },
237 ], // http://eslint.org/docs/rules/max-len
238 "max-lines": ["off", options["max-lines"]],
239 "max-lines-per-function": "off", // https://eslint.org/docs/rules/max-lines-per-function
240 "max-nested-callbacks": ["warn", 3], // http://eslint.org/docs/rules/max-nested-callbacks
241 "max-params": ["warn", { max: 4 }], // http://eslint.org/docs/rules/max-params
242 "max-statements": "off", // http://eslint.org/docs/rules/max-statements
243 "max-statements-per-line": ["warn", { max: 1 }], // http://eslint.org/docs/rules/max-statements-per-line
244 "multiline-comment-style": "off", // https://eslint.org/docs/rules/multiline-comment-style
245 "multiline-ternary": ["warn", "always-multiline"], // http://eslint.org/docs/rules/multiline-ternary
246 // Handled by babel/new-cap
247 "new-cap": "off", // http://eslint.org/docs/rules/new-cap
248 "new-parens": "warn", // http://eslint.org/docs/rules/new-parens
249 "newline-per-chained-call": "warn", // http://eslint.org/docs/rules/newline-per-chained-call
250 "no-alert": "warn", // http://eslint.org/docs/rules/no-alert
251 "no-array-constructor": "warn", // http://eslint.org/docs/rules/no-array-constructor
252 "no-await-in-loop": "warn", // http://eslint.org/docs/rules/no-await-in-loop
253 "no-bitwise": "warn", // http://eslint.org/docs/rules/no-bitwise
254 "no-caller": "warn", // http://eslint.org/docs/rules/no-caller
255 "no-case-declarations": "warn", // http://eslint.org/docs/rules/no-case-declarations
256 "no-class-assign": "warn", // http://eslint.org/docs/rules/no-class-assign
257 "no-confusing-arrow": ["off", { allowParens: true }], // http://eslint.org/docs/rules/no-confusing-arrow
258 "no-console": "off", // http://eslint.org/docs/rules/no-console
259 "no-constant-condition": [
260 "error", // "error" because this is part of "eslint:recommended"
261 {
262 // while (true) loops are pretty common
263 checkLoops: false,
264 },
265 ], // http://eslint.org/docs/rules/no-constant-condition
266 "no-constructor-return": "warn", // https://eslint.org/docs/rules/no-constructor-return
267 "no-continue": "off", // http://eslint.org/docs/rules/no-continue
268 "no-delete-var": "warn", // http://eslint.org/docs/rules/no-delete-var
269 "no-div-regex": "off", // http://eslint.org/docs/rules/no-div-regex
270 "no-dupe-class-members": "warn", // http://eslint.org/docs/rules/no-dupe-class-members
271 "no-dupe-else-if": "warn", // https://eslint.org/docs/rules/no-dupe-else-if
272 // handled by import/no-duplicates
273 "no-duplicate-imports": "off", // http://eslint.org/docs/rules/no-duplicate-imports
274 "no-else-return": "warn", // http://eslint.org/docs/rules/no-else-return
275 "no-empty": "warn", // http://eslint.org/docs/rules/no-empty
276 "no-empty-function": "off", // http://eslint.org/docs/rules/no-empty-function
277 "no-empty-pattern": "warn", // http://eslint.org/docs/rules/no-empty-pattern
278 "no-eq-null": "off", // http://eslint.org/docs/rules/no-eq-null
279 "no-eval": "warn", // http://eslint.org/docs/rules/no-eval
280 "no-extend-native": "warn", // http://eslint.org/docs/rules/no-extend-native
281 "no-extra-bind": "warn", // http://eslint.org/docs/rules/no-extra-bind
282 "no-extra-label": "warn", // http://eslint.org/docs/rules/no-extra-label
283 "no-extra-parens": "off", // http://eslint.org/docs/rules/no-extra-parens
284 "no-fallthrough": "warn", // http://eslint.org/docs/rules/no-fallthrough
285 "no-floating-decimal": "warn", // http://eslint.org/docs/rules/no-floating-decimal
286 "no-global-assign": "warn", // http://eslint.org/docs/rules/no-global-assign
287 "no-implicit-coercion": "warn", // http://eslint.org/docs/rules/no-implicit-coercion
288 "no-implicit-globals": "warn", // http://eslint.org/docs/rules/no-implicit-globals
289 "no-implied-eval": "warn", // http://eslint.org/docs/rules/no-implied-eval
290 "no-import-assign": "warn", // https://eslint.org/docs/rules/no-import-assign
291 "no-inline-comments": "off", // http://eslint.org/docs/rules/no-inline-comments
292 // Handled by babel/no-invalid-this
293 "no-invalid-this": "off", // http://eslint.org/docs/rules/no-invalid-this
294 "no-iterator": "warn", // http://eslint.org/docs/rules/no-iterator
295 "no-label-var": "warn", // http://eslint.org/docs/rules/no-label-var
296 "no-labels": "warn", // http://eslint.org/docs/rules/no-labels
297 "no-lone-blocks": "warn", // http://eslint.org/docs/rules/no-lone-blocks
298 "no-lonely-if": "warn", // http://eslint.org/docs/rules/no-lonely-if
299 "no-loop-func": "warn", // http://eslint.org/docs/rules/no-loop-func
300 "no-loss-of-precision": "warn", // https://eslint.org/docs/rules/no-loss-of-precision
301 "no-magic-numbers": [
302 "off",
303 {
304 // These settings are currently unused, but we may re-use them once we decide to have that rule again.
305 ignore: [
306 // digits are ok
307 0,
308 1,
309 2,
310 3,
311 4,
312 5,
313 6,
314 7,
315 8,
316 9,
317 // multiplications of 10
318 -1,
319 -10,
320 -100,
321 -1000,
322 10,
323 100,
324 1000,
325 // bytes
326 16,
327 32,
328 64,
329 128,
330 256,
331 512,
332 1024,
333 // time
334 60,
335 24,
336 365,
337 // ports
338 80,
339 443,
340 1337,
341 3000,
342 8080,
343 ],
344 ignoreArrayIndexes: true, // using array indexes is not a good style, but we don't want to be too strict about that
345 },
346 ], // http://eslint.org/docs/rules/no-magic-numbers
347 "no-mixed-operators": "warn", // http://eslint.org/docs/rules/no-mixed-operators
348 "no-mixed-spaces-and-tabs": ["warn", false], // http://eslint.org/docs/rules/no-mixed-spaces-and-tabs
349 "no-multi-assign": "off", // http://eslint.org/docs/rules/no-multi-assign
350 "no-multi-spaces": "warn", // http://eslint.org/docs/rules/no-multi-spaces
351 "no-multi-str": "warn", // http://eslint.org/docs/rules/no-multi-str
352 "no-multiple-empty-lines": ["warn", { max: 1 }], // http://eslint.org/docs/rules/no-multiple-empty-lines
353 "no-negated-condition": "warn", // http://eslint.org/docs/rules/no-negated-condition
354 "no-nested-ternary": "off", // http://eslint.org/docs/rules/no-nested-ternary
355 "no-new": "warn", // http://eslint.org/docs/rules/no-new
356 "no-new-func": "warn", // http://eslint.org/docs/rules/no-new-func
357 "no-new-object": "warn", // http://eslint.org/docs/rules/no-new-object
358 "no-new-symbol": "warn", // http://eslint.org/docs/rules/no-new-symbol
359 "no-new-wrappers": "warn", // http://eslint.org/docs/rules/no-new-wrappers
360 "no-nonoctal-decimal-escape": "warn", // http://eslint.org/docs/rules/no-nonoctal-decimal-escape
361 "no-octal": "warn", // http://eslint.org/docs/rules/no-octal
362 "no-octal-escape": "warn", // http://eslint.org/docs/rules/no-octal-escape
363 "no-param-reassign": "off", // http://eslint.org/docs/rules/no-param-reassign
364 "no-plusplus": "off", // http://eslint.org/docs/rules/no-plusplus
365 // The rule reported
366 // await new Promise((resolve) => setTimeout(resolve, 0))
367 // which is pretty common.
368 // Maybe there's an exception for one-liners now?
369 "no-promise-executor-return": "off", // http://eslint.org/docs/rules/no-promise-executor-return
370 "no-proto": "warn", // http://eslint.org/docs/rules/no-proto
371 "no-redeclare": "warn", // http://eslint.org/docs/rules/no-redeclare
372 "no-restricted-exports": [
373 "warn",
374 {
375 restrictedNamedExports: [
376 // If "then" is a function, the module will not be loadedable by an async import()
377 // because it looks like a promise. The JS engine will call the .then() function in that case
378 // Since this is super confusing, let's warn the user about it
379 "then",
380 ],
381 },
382 ], // http://eslint.org/docs/rules/no-restricted-exports
383 "no-restricted-globals": ["warn", "event"], // http://eslint.org/docs/rules/no-restricted-globals
384 "no-restricted-imports": "off", // http://eslint.org/docs/rules/no-restricted-imports
385 "no-restricted-properties": "off", // http://eslint.org/docs/rules/no-restricted-properties
386 "no-restricted-syntax": ["warn", "WithStatement"], // http://eslint.org/docs/rules/no-restricted-syntax
387 "no-return-assign": ["warn", "except-parens"], // http://eslint.org/docs/rules/no-return-assign
388 // We actually want a rule that enforces to *always use return await*.
389 // Reasoning: Putting try/catch around a return without await is a footgun.
390 // try {
391 // return somethingAsync();
392 // } catch (error) { <-- will never be caught
393 // }
394 // Further discussions:
395 // - https://github.com/eslint/eslint/issues/12246
396 // - https://github.com/standard/eslint-config-standard-with-typescript/pull/206
397 // - https://github.com/typescript-eslint/typescript-eslint/issues/1378
398 "no-return-await": "off", // http://eslint.org/docs/rules/no-return-await
399 "no-script-url": "warn", // http://eslint.org/docs/rules/no-script-url
400 "no-self-assign": "warn", // http://eslint.org/docs/rules/no-self-assign
401 "no-self-compare": "warn", // http://eslint.org/docs/rules/no-self-compare
402 "no-sequences": "warn", // http://eslint.org/docs/rules/no-sequences
403 "no-setter-return": "warn", // https://eslint.org/docs/rules/no-setter-return
404 "no-shadow": "off", // http://eslint.org/docs/rules/no-shadow
405 "no-shadow-restricted-names": "warn", // http://eslint.org/docs/rules/no-shadow-restricted-names
406 "no-tabs": "warn", // http://eslint.org/docs/rules/no-tabs
407 "no-template-curly-in-string": "warn", // http://eslint.org/docs/rules/no-template-curly-in-string
408 "no-ternary": "off", // eslint.org/docs/rules/no-ternary
409 "no-this-before-super": "warn", // http://eslint.org/docs/rules/no-this-before-super
410 "no-throw-literal": "warn", // http://eslint.org/docs/rules/no-throw-literal
411 "no-trailing-spaces": "warn", // http://eslint.org/docs/rules/no-trailing-spaces
412 "no-undef": [
413 "warn",
414 {
415 typeof: false,
416 },
417 ], // http://eslint.org/docs/rules/no-undef
418 "no-undef-init": "warn", // http://eslint.org/docs/rules/no-undef-init
419 // Since we disallow shadowing of undefined, it is safe to turn this rule off
420 "no-undefined": "off", // http://eslint.org/docs/rules/no-undefined
421 "no-underscore-dangle": "off", // http://eslint.org/docs/rules/no-underscore-dangle
422 "no-unexpected-multiline": "warn", // http://eslint.org/docs/rules/no-unexpected-multiline
423 "no-unmodified-loop-condition": "warn", // http://eslint.org/docs/rules/no-unmodified-loop-condition
424 "no-unneeded-ternary": "warn", // http://eslint.org/docs/rules/no-unneeded-ternary
425 "no-unreachable-loop": "warn", // http://eslint.org/docs/rules/no-unreachable-loop
426 "no-unsafe-optional-chaining": "warn", // http://eslint.org/docs/rules/no-unsafe-optional-chaining
427 "no-unsafe-regex/no-unsafe-regex": "warn", // https://github.com/kgryte/eslint-plugin-no-unsafe-regex
428 // Handled by babel/no-unused-expressions
429 "no-unused-expressions": ["off", options["no-unused-expressions"]], // http://eslint.org/docs/rules/no-unused-expressions
430 "no-unused-labels": "warn", // http://eslint.org/docs/rules/no-unused-labels
431 "no-unused-vars": ["warn", options["no-unused-vars"]], // http://eslint.org/docs/rules/no-unused-vars
432 "no-use-before-define": "off", // http://eslint.org/docs/rules/no-use-before-define
433 "no-useless-backreference": "warn", // http://eslint.org/docs/rules/no-useless-backreference
434 "no-useless-call": "warn", // http://eslint.org/docs/rules/no-useless-call
435 "no-useless-computed-key": "warn", // http://eslint.org/docs/rules/no-useless-computed-key
436 "no-useless-concat": "warn", // http://eslint.org/docs/rules/no-useless-concat
437 "no-useless-constructor": "warn", // http://eslint.org/docs/rules/no-useless-constructor
438 "no-useless-escape": "warn", // http://eslint.org/docs/rules/no-useless-escape
439 "no-useless-rename": "warn", // http://eslint.org/docs/rules/no-useless-rename
440 "no-useless-return": "warn", // http://eslint.org/docs/rules/no-useless-return
441 "no-var": "warn", // http://eslint.org/docs/rules/no-var
442 "no-void": "off", // http://eslint.org/docs/rules/no-void
443 "no-warning-comments": [
444 "off",
445 {
446 location: "anywhere",
447 terms: ["todo", "fixme", "quickfix"],
448 },
449 ], // http://eslint.org/docs/rules/no-warning-comments
450 "no-whitespace-before-property": "warn", // http://eslint.org/docs/rules/no-whitespace-before-property
451 "no-with": "warn", // http://eslint.org/docs/rules/no-with
452 // Non-block statements are disallowed anyway
453 "nonblock-statement-body-position": "off", // https://eslint.org/docs/rules/nonblock-statement-body-position
454 "object-curly-newline": [
455 "warn",
456 {
457 consistent: true,
458 multiline: true,
459 },
460 ], // http://eslint.org/docs/rules/object-curly-newline
461 // Handled by babel/object-curly-spacing
462 "object-curly-spacing": ["off", "never"], // http://eslint.org/docs/rules/object-curly-spacing
463 "object-property-newline": [
464 "warn",
465 {
466 allowAllPropertiesOnSameLine: true,
467 },
468 ], // http://eslint.org/docs/rules/object-property-newline
469 "object-shorthand": ["warn", "always"], // http://eslint.org/docs/rules/object-shorthand
470 "one-var": ["warn", "never"], // http://eslint.org/docs/rules/one-var
471 "one-var-declaration-per-line": "off", // http://eslint.org/docs/rules/one-var-declaration-per-line
472 "operator-assignment": ["off", "always"], // http://eslint.org/docs/rules/operator-assignment
473 "operator-linebreak": ["warn", "after"], // http://eslint.org/docs/rules/operator-linebreak
474 "optimize-regex/optimize-regex": "warn",
475 "padded-blocks": ["warn", "never"], // http://eslint.org/docs/rules/padded-blocks
476 "padding-line-between-statements": [
477 "warn",
478 {
479 blankLine: "always",
480 next: "return",
481 prev: "*",
482 },
483 {
484 blankLine: "always",
485 next: "*",
486 prev: ["const", "let", "var"],
487 },
488 {
489 blankLine: "any",
490 next: ["const", "let", "var"],
491 prev: ["const", "let", "var"],
492 },
493 {
494 blankLine: "always",
495 next: "*",
496 prev: "directive",
497 },
498 {
499 blankLine: "any",
500 next: "directive",
501 prev: "directive",
502 },
503 {
504 blankLine: "always",
505 next: "function",
506 prev: "*",
507 },
508 {
509 blankLine: "always",
510 next: "*",
511 prev: "function",
512 },
513 {
514 blankLine: "always",
515 next: "*",
516 prev: ["import", "cjs-import"],
517 },
518 {
519 blankLine: "never",
520 next: ["import", "cjs-import"],
521 prev: ["import", "cjs-import"],
522 },
523 ], // http://eslint.org/docs/rules/padding-line-between-statements
524 "prefer-arrow-callback": "warn", // http://eslint.org/docs/rules/prefer-arrow-callback
525 "prefer-const": "warn", // http://eslint.org/docs/rules/prefer-const
526 "prefer-destructuring": "off", // http://eslint.org/docs/rules/prefer-destructuring
527 "prefer-exponentiation-operator": "warn", // https://eslint.org/docs/rules/prefer-exponentiation-operator
528 "prefer-named-capture-group": "off", // https://eslint.org/docs/rules/prefer-named-capture-group
529 "prefer-numeric-literals": "warn", // http://eslint.org/docs/rules/prefer-numeric-literals
530 "prefer-object-spread": "off", // https://eslint.org/docs/rules/prefer-object-spread
531 "prefer-promise-reject-errors": "warn", // http://eslint.org/docs/rules/prefer-promise-reject-errors
532 "prefer-regex-literals": "warn", // https://eslint.org/docs/rules/prefer-regex-literals
533 "prefer-rest-params": "warn", // http://eslint.org/docs/rules/prefer-rest-params
534 "prefer-spread": "warn", // http://eslint.org/docs/rules/prefer-spread
535 // Using regular string concatentation can sometimes be easier to read
536 // We leave it up to the developer to decide
537 "prefer-template": "off", // http://eslint.org/docs/rules/prefer-template
538 "promise/always-return": "off", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/always-return.md
539 "promise/avoid-new": "off", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/avoid-new.md
540 "promise/catch-or-return": ["off", { allowFinally: true }], // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/catch-or-return.md
541 "promise/no-callback-in-promise": "warn", // https://github.com/xjamundx/eslint-plugin-promise
542 "promise/no-native": "off", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-native.md
543 // Nesting is rarely necessary and often the sign of confusing code.
544 // You can often simplify it, see https://github.com/xjamundx/eslint-plugin-promise/issues/42
545 // In rare cases where nesting is desired, disable this rule.
546 "promise/no-nesting": "warn", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-nesting.md
547 "promise/no-new-statics": "warn", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-new-statics.md
548 "promise/no-promise-in-callback": "warn", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-promise-in-callback.md
549 "promise/no-return-in-finally": "warn", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-return-in-finally.md
550 "promise/no-return-wrap": "warn", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-return-wrap.md
551 "promise/param-names": "warn", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/param-names.md
552 "promise/prefer-await-to-callbacks": "off", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/prefer-await-to-callbacks.md
553 "promise/prefer-await-to-then": "off", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/prefer-await-to-then.md
554 "promise/valid-params": "warn", // https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/valid-params.md
555 "quote-props": ["warn", "as-needed"], // http://eslint.org/docs/rules/quote-props
556 quotes: ["warn", "double", options.quotes], // http://eslint.org/docs/rules/quotes
557 radix: "off", // http://eslint.org/docs/rules/radix
558 // This rule would be nice but there are too many false positives :(
559 "require-atomic-updates": "off", // https://eslint.org/docs/rules/require-atomic-updates
560 "require-await": "off", // http://eslint.org/docs/rules/require-await
561 // We would like to use this rule but there is currently a bug that would show
562 // an ESLint error at a lot of RegExp, like /\./u
563 // See https://github.com/DmitrySoshnikov/regexp-tree/issues/162
564 // TODO: Enables this rule once the issue gets addressed
565 "require-unicode-regexp": "off", // https://eslint.org/docs/rules/require-unicode-regexp
566 "require-yield": "off", // http://eslint.org/docs/rules/require-yield
567 "rest-spread-spacing": ["warn", "never"], // http://eslint.org/docs/rules/rest-spread-spacing
568 // Handled by babel/semi
569 semi: "off", // http://eslint.org/docs/rules/semi
570 "semi-spacing": [
571 "warn",
572 {
573 after: true,
574 before: false,
575 },
576 ], // http://eslint.org/docs/rules/semi-spacing
577 "semi-style": ["warn", "last"], // http://eslint.org/docs/rules/semi-style
578 "sort-imports": "off", // http://eslint.org/docs/rules/sort-imports
579 "sort-keys": "off", // http://eslint.org/docs/rules/sort-keys
580 "sort-vars": "off", // http://eslint.org/docs/rules/sort-vars
581 "space-before-blocks": ["warn", "always"], // http://eslint.org/docs/rules/space-before-blocks
582 "space-before-function-paren": [
583 "warn",
584 options["space-before-function-paren"],
585 ], // http://eslint.org/docs/rules/space-before-function-paren
586 "space-in-parens": ["warn", "never"], // http://eslint.org/docs/rules/space-in-parens
587 "space-infix-ops": "warn", // http://eslint.org/docs/rules/space-infix-ops
588 "space-unary-ops": [
589 "warn",
590 {
591 nonwords: false,
592 words: true,
593 },
594 ], // http://eslint.org/docs/rules/space-unary-ops
595 "spaced-comment": ["warn", "always", { exceptions: ["-"] }], // http://eslint.org/docs/rules/spaced-comment
596 strict: "warn", // http://eslint.org/docs/rules/strict
597 "switch-colon-spacing": [
598 "warn",
599 {
600 after: true,
601 before: false,
602 },
603 ], // "switch-colon-spacing": ["warn", {"after": true, "before": false}]
604 "symbol-description": "warn", // http://eslint.org/docs/rules/symbol-description
605 "template-curly-spacing": ["warn", "never"], // http://eslint.org/docs/rules/template-curly-spacing
606 "template-tag-spacing": ["warn", "never"], // http://eslint.org/docs/rules/template-tag-spacing
607 "unicode-bom": ["warn", "never"], // http://eslint.org/docs/rules/unicode-bom
608 "valid-typeof": "error", // http://eslint.org/docs/rules/valid-typeof
609 "vars-on-top": "warn", // http://eslint.org/docs/rules/vars-on-top
610 "wrap-iife": "off", // http://eslint.org/docs/rules/wrap-iife
611 "wrap-regex": "off", // http://eslint.org/docs/rules/wrap-regex
612 "yield-star-spacing": ["warn", "after"], // http://eslint.org/docs/rules/yield-star-spacing
613 yoda: ["warn", "never"], // http://eslint.org/docs/rules/yoda
614 /* eslint-disable sort-keys */
615 },
616 overrides: [
617 {
618 files: globPatterns.tests,
619 ...tests,
620 },
621 ],
622};