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