eslint 5.8.0 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/lib/cli-engine.js +128 -31
- package/lib/cli.js +6 -1
- package/lib/options.js +5 -0
- package/lib/rules/accessor-pairs.js +4 -0
- package/lib/rules/array-bracket-newline.js +5 -0
- package/lib/rules/array-bracket-spacing.js +5 -0
- package/lib/rules/array-callback-return.js +2 -0
- package/lib/rules/array-element-newline.js +4 -0
- package/lib/rules/arrow-body-style.js +2 -0
- package/lib/rules/arrow-parens.js +2 -0
- package/lib/rules/arrow-spacing.js +2 -0
- package/lib/rules/block-scoped-var.js +2 -0
- package/lib/rules/block-spacing.js +2 -0
- package/lib/rules/brace-style.js +2 -0
- package/lib/rules/callback-return.js +2 -0
- package/lib/rules/camelcase.js +2 -0
- package/lib/rules/capitalized-comments.js +4 -0
- package/lib/rules/class-methods-use-this.js +3 -0
- package/lib/rules/comma-dangle.js +4 -0
- package/lib/rules/comma-spacing.js +2 -0
- package/lib/rules/comma-style.js +5 -0
- package/lib/rules/complexity.js +2 -0
- package/lib/rules/computed-property-spacing.js +2 -0
- package/lib/rules/consistent-return.js +2 -0
- package/lib/rules/consistent-this.js +2 -0
- package/lib/rules/constructor-super.js +2 -0
- package/lib/rules/curly.js +2 -0
- package/lib/rules/default-case.js +2 -0
- package/lib/rules/dot-location.js +2 -0
- package/lib/rules/dot-notation.js +2 -0
- package/lib/rules/eol-last.js +5 -0
- package/lib/rules/eqeqeq.js +2 -0
- package/lib/rules/for-direction.js +4 -0
- package/lib/rules/func-call-spacing.js +4 -0
- package/lib/rules/func-name-matching.js +3 -0
- package/lib/rules/func-names.js +3 -0
- package/lib/rules/func-style.js +3 -0
- package/lib/rules/function-paren-newline.js +5 -0
- package/lib/rules/generator-star-spacing.js +3 -0
- package/lib/rules/getter-return.js +5 -0
- package/lib/rules/global-require.js +2 -0
- package/lib/rules/guard-for-in.js +2 -0
- package/lib/rules/handle-callback-err.js +2 -0
- package/lib/rules/id-blacklist.js +2 -0
- package/lib/rules/id-length.js +2 -0
- package/lib/rules/id-match.js +101 -27
- package/lib/rules/implicit-arrow-linebreak.js +4 -0
- package/lib/rules/indent-legacy.js +4 -1
- package/lib/rules/indent.js +2 -0
- package/lib/rules/init-declarations.js +2 -0
- package/lib/rules/jsx-quotes.js +2 -0
- package/lib/rules/key-spacing.js +4 -3
- package/lib/rules/keyword-spacing.js +2 -0
- package/lib/rules/line-comment-position.js +2 -0
- package/lib/rules/linebreak-style.js +2 -0
- package/lib/rules/lines-around-comment.js +2 -0
- package/lib/rules/lines-around-directive.js +6 -2
- package/lib/rules/lines-between-class-members.js +2 -0
- package/lib/rules/max-classes-per-file.js +4 -0
- package/lib/rules/max-depth.js +2 -0
- package/lib/rules/max-len.js +2 -0
- package/lib/rules/max-lines-per-function.js +2 -0
- package/lib/rules/max-lines.js +2 -0
- package/lib/rules/max-nested-callbacks.js +2 -0
- package/lib/rules/max-params.js +2 -0
- package/lib/rules/max-statements-per-line.js +2 -0
- package/lib/rules/max-statements.js +2 -0
- package/lib/rules/multiline-comment-style.js +3 -0
- package/lib/rules/multiline-ternary.js +3 -0
- package/lib/rules/new-cap.js +2 -0
- package/lib/rules/new-parens.js +2 -1
- package/lib/rules/newline-after-var.js +5 -2
- package/lib/rules/newline-before-return.js +5 -2
- package/lib/rules/newline-per-chained-call.js +4 -0
- package/lib/rules/no-alert.js +2 -0
- package/lib/rules/no-array-constructor.js +2 -0
- package/lib/rules/no-async-promise-executor.js +3 -0
- package/lib/rules/no-await-in-loop.js +4 -0
- package/lib/rules/no-bitwise.js +2 -0
- package/lib/rules/no-buffer-constructor.js +4 -0
- package/lib/rules/no-caller.js +2 -0
- package/lib/rules/no-case-declarations.js +2 -0
- package/lib/rules/no-catch-shadow.js +6 -3
- package/lib/rules/no-class-assign.js +2 -0
- package/lib/rules/no-compare-neg-zero.js +4 -0
- package/lib/rules/no-cond-assign.js +2 -0
- package/lib/rules/no-confusing-arrow.js +2 -0
- package/lib/rules/no-console.js +2 -0
- package/lib/rules/no-const-assign.js +2 -0
- package/lib/rules/no-constant-condition.js +2 -0
- package/lib/rules/no-continue.js +2 -0
- package/lib/rules/no-control-regex.js +4 -2
- package/lib/rules/no-debugger.js +4 -0
- package/lib/rules/no-delete-var.js +2 -0
- package/lib/rules/no-div-regex.js +2 -0
- package/lib/rules/no-dupe-args.js +2 -0
- package/lib/rules/no-dupe-class-members.js +2 -0
- package/lib/rules/no-dupe-keys.js +2 -0
- package/lib/rules/no-duplicate-case.js +2 -0
- package/lib/rules/no-duplicate-imports.js +2 -0
- package/lib/rules/no-else-return.js +2 -0
- package/lib/rules/no-empty-character-class.js +2 -0
- package/lib/rules/no-empty-function.js +2 -0
- package/lib/rules/no-empty-pattern.js +2 -0
- package/lib/rules/no-empty.js +2 -0
- package/lib/rules/no-eq-null.js +2 -0
- package/lib/rules/no-eval.js +2 -0
- package/lib/rules/no-ex-assign.js +2 -0
- package/lib/rules/no-extend-native.js +2 -0
- package/lib/rules/no-extra-bind.js +2 -1
- package/lib/rules/no-extra-boolean-cast.js +2 -1
- package/lib/rules/no-extra-label.js +2 -1
- package/lib/rules/no-extra-parens.js +5 -6
- package/lib/rules/no-extra-semi.js +2 -0
- package/lib/rules/no-fallthrough.js +2 -0
- package/lib/rules/no-floating-decimal.js +2 -1
- package/lib/rules/no-func-assign.js +2 -0
- package/lib/rules/no-global-assign.js +2 -0
- package/lib/rules/no-implicit-coercion.js +3 -0
- package/lib/rules/no-implicit-globals.js +2 -0
- package/lib/rules/no-implied-eval.js +2 -0
- package/lib/rules/no-inline-comments.js +2 -0
- package/lib/rules/no-inner-declarations.js +2 -0
- package/lib/rules/no-invalid-regexp.js +2 -0
- package/lib/rules/no-invalid-this.js +2 -0
- package/lib/rules/no-irregular-whitespace.js +2 -0
- package/lib/rules/no-iterator.js +2 -0
- package/lib/rules/no-label-var.js +2 -0
- package/lib/rules/no-labels.js +2 -0
- package/lib/rules/no-lone-blocks.js +2 -0
- package/lib/rules/no-lonely-if.js +2 -1
- package/lib/rules/no-loop-func.js +2 -0
- package/lib/rules/no-magic-numbers.js +3 -0
- package/lib/rules/no-misleading-character-class.js +4 -0
- package/lib/rules/no-mixed-operators.js +3 -0
- package/lib/rules/no-mixed-requires.js +2 -0
- package/lib/rules/no-mixed-spaces-and-tabs.js +2 -0
- package/lib/rules/no-multi-assign.js +3 -0
- package/lib/rules/no-multi-spaces.js +2 -0
- package/lib/rules/no-multi-str.js +2 -0
- package/lib/rules/no-multiple-empty-lines.js +2 -0
- package/lib/rules/no-native-reassign.js +4 -1
- package/lib/rules/no-negated-condition.js +2 -0
- package/lib/rules/no-negated-in-lhs.js +5 -2
- package/lib/rules/no-nested-ternary.js +2 -0
- package/lib/rules/no-new-func.js +2 -0
- package/lib/rules/no-new-object.js +2 -0
- package/lib/rules/no-new-require.js +2 -0
- package/lib/rules/no-new-symbol.js +2 -0
- package/lib/rules/no-new-wrappers.js +2 -0
- package/lib/rules/no-new.js +2 -0
- package/lib/rules/no-obj-calls.js +2 -0
- package/lib/rules/no-octal-escape.js +2 -0
- package/lib/rules/no-octal.js +2 -0
- package/lib/rules/no-param-reassign.js +2 -0
- package/lib/rules/no-path-concat.js +2 -0
- package/lib/rules/no-plusplus.js +2 -0
- package/lib/rules/no-process-env.js +2 -0
- package/lib/rules/no-process-exit.js +2 -0
- package/lib/rules/no-proto.js +2 -0
- package/lib/rules/no-prototype-builtins.js +2 -0
- package/lib/rules/no-redeclare.js +2 -0
- package/lib/rules/no-regex-spaces.js +2 -1
- package/lib/rules/no-restricted-globals.js +2 -0
- package/lib/rules/no-restricted-imports.js +40 -22
- package/lib/rules/no-restricted-modules.js +2 -0
- package/lib/rules/no-restricted-properties.js +2 -0
- package/lib/rules/no-restricted-syntax.js +2 -0
- package/lib/rules/no-return-assign.js +2 -0
- package/lib/rules/no-return-await.js +4 -0
- package/lib/rules/no-script-url.js +2 -0
- package/lib/rules/no-self-assign.js +2 -0
- package/lib/rules/no-self-compare.js +2 -0
- package/lib/rules/no-sequences.js +2 -0
- package/lib/rules/no-shadow-restricted-names.js +2 -0
- package/lib/rules/no-shadow.js +2 -0
- package/lib/rules/no-spaced-func.js +4 -1
- package/lib/rules/no-sparse-arrays.js +2 -0
- package/lib/rules/no-sync.js +2 -0
- package/lib/rules/no-tabs.js +2 -0
- package/lib/rules/no-template-curly-in-string.js +2 -0
- package/lib/rules/no-ternary.js +2 -0
- package/lib/rules/no-this-before-super.js +2 -0
- package/lib/rules/no-throw-literal.js +2 -0
- package/lib/rules/no-trailing-spaces.js +2 -0
- package/lib/rules/no-undef-init.js +2 -1
- package/lib/rules/no-undef.js +2 -0
- package/lib/rules/no-undefined.js +2 -0
- package/lib/rules/no-underscore-dangle.js +2 -0
- package/lib/rules/no-unexpected-multiline.js +2 -0
- package/lib/rules/no-unmodified-loop-condition.js +2 -0
- package/lib/rules/no-unneeded-ternary.js +2 -0
- package/lib/rules/no-unreachable.js +2 -1
- package/lib/rules/no-unsafe-finally.js +2 -0
- package/lib/rules/no-unsafe-negation.js +3 -0
- package/lib/rules/no-unused-expressions.js +2 -0
- package/lib/rules/no-unused-labels.js +2 -1
- package/lib/rules/no-unused-vars.js +36 -12
- package/lib/rules/no-use-before-define.js +2 -0
- package/lib/rules/no-useless-call.js +2 -0
- package/lib/rules/no-useless-computed-key.js +2 -1
- package/lib/rules/no-useless-concat.js +2 -0
- package/lib/rules/no-useless-constructor.js +2 -0
- package/lib/rules/no-useless-escape.js +2 -0
- package/lib/rules/no-useless-rename.js +4 -0
- package/lib/rules/no-useless-return.js +3 -0
- package/lib/rules/no-var.js +2 -0
- package/lib/rules/no-void.js +2 -0
- package/lib/rules/no-warning-comments.js +2 -0
- package/lib/rules/no-whitespace-before-property.js +2 -0
- package/lib/rules/no-with.js +2 -0
- package/lib/rules/nonblock-statement-body-position.js +4 -0
- package/lib/rules/object-curly-newline.js +4 -0
- package/lib/rules/object-curly-spacing.js +2 -0
- package/lib/rules/object-property-newline.js +3 -2
- package/lib/rules/object-shorthand.js +2 -0
- package/lib/rules/one-var-declaration-per-line.js +2 -0
- package/lib/rules/one-var.js +2 -0
- package/lib/rules/operator-assignment.js +2 -0
- package/lib/rules/operator-linebreak.js +2 -0
- package/lib/rules/padded-blocks.js +2 -0
- package/lib/rules/padding-line-between-statements.js +4 -0
- package/lib/rules/prefer-arrow-callback.js +2 -0
- package/lib/rules/prefer-const.js +53 -7
- package/lib/rules/prefer-destructuring.js +3 -0
- package/lib/rules/prefer-numeric-literals.js +2 -1
- package/lib/rules/prefer-object-spread.js +4 -0
- package/lib/rules/prefer-promise-reject-errors.js +4 -0
- package/lib/rules/prefer-reflect.js +4 -1
- package/lib/rules/prefer-rest-params.js +2 -0
- package/lib/rules/prefer-spread.js +2 -1
- package/lib/rules/prefer-template.js +2 -1
- package/lib/rules/quote-props.js +2 -0
- package/lib/rules/quotes.js +2 -0
- package/lib/rules/radix.js +2 -0
- package/lib/rules/require-atomic-updates.js +4 -0
- package/lib/rules/require-await.js +3 -0
- package/lib/rules/require-jsdoc.js +2 -0
- package/lib/rules/require-unicode-regexp.js +4 -0
- package/lib/rules/require-yield.js +2 -0
- package/lib/rules/rest-spread-spacing.js +4 -0
- package/lib/rules/semi-spacing.js +2 -0
- package/lib/rules/semi-style.js +3 -0
- package/lib/rules/semi.js +2 -0
- package/lib/rules/sort-imports.js +2 -0
- package/lib/rules/sort-keys.js +3 -0
- package/lib/rules/sort-vars.js +2 -0
- package/lib/rules/space-before-blocks.js +46 -35
- package/lib/rules/space-before-function-paren.js +2 -0
- package/lib/rules/space-in-parens.js +2 -0
- package/lib/rules/space-infix-ops.js +2 -0
- package/lib/rules/space-unary-ops.js +2 -0
- package/lib/rules/spaced-comment.js +2 -0
- package/lib/rules/strict.js +2 -0
- package/lib/rules/switch-colon-spacing.js +4 -0
- package/lib/rules/symbol-description.js +2 -0
- package/lib/rules/template-curly-spacing.js +2 -0
- package/lib/rules/template-tag-spacing.js +2 -0
- package/lib/rules/unicode-bom.js +2 -0
- package/lib/rules/use-isnan.js +2 -0
- package/lib/rules/valid-jsdoc.js +2 -0
- package/lib/rules/valid-typeof.js +2 -0
- package/lib/rules/vars-on-top.js +2 -0
- package/lib/rules/wrap-iife.js +2 -0
- package/lib/rules/wrap-regex.js +3 -1
- package/lib/rules/yield-star-spacing.js +2 -0
- package/lib/rules/yoda.js +2 -0
- package/package.json +3 -3
@@ -11,13 +11,17 @@
|
|
11
11
|
|
12
12
|
module.exports = {
|
13
13
|
meta: {
|
14
|
+
type: "suggestion",
|
15
|
+
|
14
16
|
docs: {
|
15
17
|
description: "disallow renaming import, export, and destructured assignments to the same name",
|
16
18
|
category: "ECMAScript 6",
|
17
19
|
recommended: false,
|
18
20
|
url: "https://eslint.org/docs/rules/no-useless-rename"
|
19
21
|
},
|
22
|
+
|
20
23
|
fixable: "code",
|
24
|
+
|
21
25
|
schema: [
|
22
26
|
{
|
23
27
|
type: "object",
|
@@ -66,12 +66,15 @@ function isInFinally(node) {
|
|
66
66
|
|
67
67
|
module.exports = {
|
68
68
|
meta: {
|
69
|
+
type: "suggestion",
|
70
|
+
|
69
71
|
docs: {
|
70
72
|
description: "disallow redundant return statements",
|
71
73
|
category: "Best Practices",
|
72
74
|
recommended: false,
|
73
75
|
url: "https://eslint.org/docs/rules/no-useless-return"
|
74
76
|
},
|
77
|
+
|
75
78
|
fixable: "code",
|
76
79
|
schema: []
|
77
80
|
},
|
package/lib/rules/no-var.js
CHANGED
package/lib/rules/no-void.js
CHANGED
package/lib/rules/no-with.js
CHANGED
@@ -12,13 +12,17 @@ const POSITION_SCHEMA = { enum: ["beside", "below", "any"] };
|
|
12
12
|
|
13
13
|
module.exports = {
|
14
14
|
meta: {
|
15
|
+
type: "layout",
|
16
|
+
|
15
17
|
docs: {
|
16
18
|
description: "enforce the location of single-line statements",
|
17
19
|
category: "Stylistic Issues",
|
18
20
|
recommended: false,
|
19
21
|
url: "https://eslint.org/docs/rules/nonblock-statement-body-position"
|
20
22
|
},
|
23
|
+
|
21
24
|
fixable: "whitespace",
|
25
|
+
|
22
26
|
schema: [
|
23
27
|
POSITION_SCHEMA,
|
24
28
|
{
|
@@ -134,13 +134,17 @@ function areLineBreaksRequired(node, options, first, last) {
|
|
134
134
|
|
135
135
|
module.exports = {
|
136
136
|
meta: {
|
137
|
+
type: "layout",
|
138
|
+
|
137
139
|
docs: {
|
138
140
|
description: "enforce consistent line breaks inside braces",
|
139
141
|
category: "Stylistic Issues",
|
140
142
|
recommended: false,
|
141
143
|
url: "https://eslint.org/docs/rules/object-curly-newline"
|
142
144
|
},
|
145
|
+
|
143
146
|
fixable: "whitespace",
|
147
|
+
|
144
148
|
schema: [
|
145
149
|
{
|
146
150
|
oneOf: [
|
@@ -11,6 +11,8 @@
|
|
11
11
|
|
12
12
|
module.exports = {
|
13
13
|
meta: {
|
14
|
+
type: "layout",
|
15
|
+
|
14
16
|
docs: {
|
15
17
|
description: "enforce placing object properties on separate lines",
|
16
18
|
category: "Stylistic Issues",
|
@@ -38,8 +40,7 @@ module.exports = {
|
|
38
40
|
|
39
41
|
create(context) {
|
40
42
|
const allowSameLine = context.options[0] && (
|
41
|
-
Boolean(context.options[0].allowAllPropertiesOnSameLine) ||
|
42
|
-
Boolean(context.options[0].allowMultiplePropertiesPerLine) // Deprecated
|
43
|
+
(Boolean(context.options[0].allowAllPropertiesOnSameLine) || Boolean(context.options[0].allowMultiplePropertiesPerLine)) // Deprecated
|
43
44
|
);
|
44
45
|
const errorMessage = allowSameLine
|
45
46
|
? "Object properties must go on a new line if they aren't all on the same line."
|
@@ -24,6 +24,8 @@ const astUtils = require("../util/ast-utils");
|
|
24
24
|
//------------------------------------------------------------------------------
|
25
25
|
module.exports = {
|
26
26
|
meta: {
|
27
|
+
type: "suggestion",
|
28
|
+
|
27
29
|
docs: {
|
28
30
|
description: "require or disallow method and property shorthand syntax for object literals",
|
29
31
|
category: "ECMAScript 6",
|
package/lib/rules/one-var.js
CHANGED
@@ -400,13 +400,17 @@ const StatementTypes = {
|
|
400
400
|
|
401
401
|
module.exports = {
|
402
402
|
meta: {
|
403
|
+
type: "layout",
|
404
|
+
|
403
405
|
docs: {
|
404
406
|
description: "require or disallow padding lines between statements",
|
405
407
|
category: "Stylistic Issues",
|
406
408
|
recommended: false,
|
407
409
|
url: "https://eslint.org/docs/rules/padding-line-between-statements"
|
408
410
|
},
|
411
|
+
|
409
412
|
fixable: "whitespace",
|
413
|
+
|
410
414
|
schema: {
|
411
415
|
definitions: {
|
412
416
|
paddingType: {
|
@@ -330,6 +330,8 @@ function findUp(node, type, shouldStop) {
|
|
330
330
|
|
331
331
|
module.exports = {
|
332
332
|
meta: {
|
333
|
+
type: "suggestion",
|
334
|
+
|
333
335
|
docs: {
|
334
336
|
description: "require `const` declarations for variables that are never reassigned after declared",
|
335
337
|
category: "ECMAScript 6",
|
@@ -357,6 +359,8 @@ module.exports = {
|
|
357
359
|
const shouldMatchAnyDestructuredVariable = options.destructuring !== "all";
|
358
360
|
const ignoreReadBeforeAssign = options.ignoreReadBeforeAssign === true;
|
359
361
|
const variables = [];
|
362
|
+
let reportCount = 0;
|
363
|
+
let name = "";
|
360
364
|
|
361
365
|
/**
|
362
366
|
* Reports given identifier nodes if all of the nodes should be declared
|
@@ -377,14 +381,41 @@ module.exports = {
|
|
377
381
|
|
378
382
|
if (nodes.length && (shouldMatchAnyDestructuredVariable || nodesToReport.length === nodes.length)) {
|
379
383
|
const varDeclParent = findUp(nodes[0], "VariableDeclaration", parentNode => parentNode.type.endsWith("Statement"));
|
380
|
-
const
|
384
|
+
const isVarDecParentNull = varDeclParent === null;
|
385
|
+
|
386
|
+
if (!isVarDecParentNull && varDeclParent.declarations.length > 0) {
|
387
|
+
const firstDeclaration = varDeclParent.declarations[0];
|
388
|
+
|
389
|
+
if (firstDeclaration.init) {
|
390
|
+
const firstDecParent = firstDeclaration.init.parent;
|
391
|
+
|
392
|
+
/*
|
393
|
+
* First we check the declaration type and then depending on
|
394
|
+
* if the type is a "VariableDeclarator" or its an "ObjectPattern"
|
395
|
+
* we compare the name from the first identifier, if the names are different
|
396
|
+
* we assign the new name and reset the count of reportCount and nodeCount in
|
397
|
+
* order to check each block for the number of reported errors and base our fix
|
398
|
+
* based on comparing nodes.length and nodesToReport.length.
|
399
|
+
*/
|
400
|
+
|
401
|
+
if (firstDecParent.type === "VariableDeclarator") {
|
402
|
+
|
403
|
+
if (firstDecParent.id.name !== name) {
|
404
|
+
name = firstDecParent.id.name;
|
405
|
+
reportCount = 0;
|
406
|
+
}
|
407
|
+
|
408
|
+
if (firstDecParent.id.type === "ObjectPattern") {
|
409
|
+
if (firstDecParent.init.name !== name) {
|
410
|
+
name = firstDecParent.init.name;
|
411
|
+
reportCount = 0;
|
412
|
+
}
|
413
|
+
}
|
414
|
+
}
|
415
|
+
}
|
416
|
+
}
|
381
417
|
|
382
|
-
|
383
|
-
* If there are multiple variable declarations, like {let a = 1, b = 2}, then
|
384
|
-
* do not attempt to fix if one of the declarations should be `const`. It's
|
385
|
-
* too hard to know how the developer would want to automatically resolve the issue.
|
386
|
-
*/
|
387
|
-
varDeclParent.declarations.length === 1 &&
|
418
|
+
let shouldFix = varDeclParent &&
|
388
419
|
|
389
420
|
// Don't do a fix unless the variable is initialized (or it's in a for-in or for-of loop)
|
390
421
|
(varDeclParent.parent.type === "ForInStatement" || varDeclParent.parent.type === "ForOfStatement" || varDeclParent.declarations[0].init) &&
|
@@ -396,6 +427,21 @@ module.exports = {
|
|
396
427
|
*/
|
397
428
|
nodesToReport.length === nodes.length;
|
398
429
|
|
430
|
+
if (!isVarDecParentNull && varDeclParent.declarations && varDeclParent.declarations.length !== 1) {
|
431
|
+
|
432
|
+
if (varDeclParent && varDeclParent.declarations && varDeclParent.declarations.length >= 1) {
|
433
|
+
|
434
|
+
/*
|
435
|
+
* Add nodesToReport.length to a count, then comparing the count to the length
|
436
|
+
* of the declarations in the current block.
|
437
|
+
*/
|
438
|
+
|
439
|
+
reportCount += nodesToReport.length;
|
440
|
+
|
441
|
+
shouldFix = shouldFix && (reportCount === varDeclParent.declarations.length);
|
442
|
+
}
|
443
|
+
}
|
444
|
+
|
399
445
|
nodesToReport.forEach(node => {
|
400
446
|
context.report({
|
401
447
|
node,
|
@@ -10,12 +10,15 @@
|
|
10
10
|
|
11
11
|
module.exports = {
|
12
12
|
meta: {
|
13
|
+
type: "suggestion",
|
14
|
+
|
13
15
|
docs: {
|
14
16
|
description: "require destructuring from arrays and/or objects",
|
15
17
|
category: "ECMAScript 6",
|
16
18
|
recommended: false,
|
17
19
|
url: "https://eslint.org/docs/rules/prefer-destructuring"
|
18
20
|
},
|
21
|
+
|
19
22
|
schema: [
|
20
23
|
{
|
21
24
|
|
@@ -38,6 +38,8 @@ function isParseInt(calleeNode) {
|
|
38
38
|
|
39
39
|
module.exports = {
|
40
40
|
meta: {
|
41
|
+
type: "suggestion",
|
42
|
+
|
41
43
|
docs: {
|
42
44
|
description: "disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals",
|
43
45
|
category: "ECMAScript 6",
|
@@ -46,7 +48,6 @@ module.exports = {
|
|
46
48
|
},
|
47
49
|
|
48
50
|
schema: [],
|
49
|
-
|
50
51
|
fixable: "code"
|
51
52
|
},
|
52
53
|
|
@@ -212,6 +212,8 @@ function defineFixer(node, sourceCode) {
|
|
212
212
|
|
213
213
|
module.exports = {
|
214
214
|
meta: {
|
215
|
+
type: "suggestion",
|
216
|
+
|
215
217
|
docs: {
|
216
218
|
description:
|
217
219
|
"disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.",
|
@@ -219,8 +221,10 @@ module.exports = {
|
|
219
221
|
recommended: false,
|
220
222
|
url: "https://eslint.org/docs/rules/prefer-object-spread"
|
221
223
|
},
|
224
|
+
|
222
225
|
schema: [],
|
223
226
|
fixable: "code",
|
227
|
+
|
224
228
|
messages: {
|
225
229
|
useSpreadMessage: "Use an object spread instead of `Object.assign` eg: `{ ...foo }`",
|
226
230
|
useLiteralMessage: "Use an object literal instead of `Object.assign`. eg: `{ foo: bar }`"
|
@@ -12,13 +12,17 @@ const astUtils = require("../util/ast-utils");
|
|
12
12
|
|
13
13
|
module.exports = {
|
14
14
|
meta: {
|
15
|
+
type: "suggestion",
|
16
|
+
|
15
17
|
docs: {
|
16
18
|
description: "require using Error objects as Promise rejection reasons",
|
17
19
|
category: "Best Practices",
|
18
20
|
recommended: false,
|
19
21
|
url: "https://eslint.org/docs/rules/prefer-promise-reject-errors"
|
20
22
|
},
|
23
|
+
|
21
24
|
fixable: null,
|
25
|
+
|
22
26
|
schema: [
|
23
27
|
{
|
24
28
|
type: "object",
|
@@ -11,16 +11,19 @@
|
|
11
11
|
|
12
12
|
module.exports = {
|
13
13
|
meta: {
|
14
|
+
type: "suggestion",
|
15
|
+
|
14
16
|
docs: {
|
15
17
|
description: "require `Reflect` methods where applicable",
|
16
18
|
category: "ECMAScript 6",
|
17
19
|
recommended: false,
|
18
|
-
replacedBy: [],
|
19
20
|
url: "https://eslint.org/docs/rules/prefer-reflect"
|
20
21
|
},
|
21
22
|
|
22
23
|
deprecated: true,
|
23
24
|
|
25
|
+
replacedBy: [],
|
26
|
+
|
24
27
|
schema: [
|
25
28
|
{
|
26
29
|
type: "object",
|
@@ -49,6 +49,8 @@ function isValidThisArg(expectedThis, thisArg, context) {
|
|
49
49
|
|
50
50
|
module.exports = {
|
51
51
|
meta: {
|
52
|
+
type: "suggestion",
|
53
|
+
|
52
54
|
docs: {
|
53
55
|
description: "require spread operators instead of `.apply()`",
|
54
56
|
category: "ECMAScript 6",
|
@@ -57,7 +59,6 @@ module.exports = {
|
|
57
59
|
},
|
58
60
|
|
59
61
|
schema: [],
|
60
|
-
|
61
62
|
fixable: "code"
|
62
63
|
},
|
63
64
|
|
@@ -141,6 +141,8 @@ function endsWithTemplateCurly(node) {
|
|
141
141
|
|
142
142
|
module.exports = {
|
143
143
|
meta: {
|
144
|
+
type: "suggestion",
|
145
|
+
|
144
146
|
docs: {
|
145
147
|
description: "require template literals instead of string concatenation",
|
146
148
|
category: "ECMAScript 6",
|
@@ -149,7 +151,6 @@ module.exports = {
|
|
149
151
|
},
|
150
152
|
|
151
153
|
schema: [],
|
152
|
-
|
153
154
|
fixable: "code"
|
154
155
|
},
|
155
156
|
|
package/lib/rules/quote-props.js
CHANGED
package/lib/rules/quotes.js
CHANGED
package/lib/rules/radix.js
CHANGED
@@ -12,14 +12,18 @@ const astUtils = require("../util/ast-utils");
|
|
12
12
|
|
13
13
|
module.exports = {
|
14
14
|
meta: {
|
15
|
+
type: "problem",
|
16
|
+
|
15
17
|
docs: {
|
16
18
|
description: "disallow assignments that can lead to race conditions due to usage of `await` or `yield`",
|
17
19
|
category: "Possible Errors",
|
18
20
|
recommended: false,
|
19
21
|
url: "https://eslint.org/docs/rules/require-atomic-updates"
|
20
22
|
},
|
23
|
+
|
21
24
|
fixable: null,
|
22
25
|
schema: [],
|
26
|
+
|
23
27
|
messages: {
|
24
28
|
nonAtomicUpdate: "Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`."
|
25
29
|
}
|
@@ -31,12 +31,15 @@ function capitalizeFirstLetter(text) {
|
|
31
31
|
|
32
32
|
module.exports = {
|
33
33
|
meta: {
|
34
|
+
type: "suggestion",
|
35
|
+
|
34
36
|
docs: {
|
35
37
|
description: "disallow async functions which have no `await` expression",
|
36
38
|
category: "Best Practices",
|
37
39
|
recommended: false,
|
38
40
|
url: "https://eslint.org/docs/rules/require-await"
|
39
41
|
},
|
42
|
+
|
40
43
|
schema: []
|
41
44
|
},
|
42
45
|
|
@@ -22,15 +22,19 @@ const {
|
|
22
22
|
|
23
23
|
module.exports = {
|
24
24
|
meta: {
|
25
|
+
type: "suggestion",
|
26
|
+
|
25
27
|
docs: {
|
26
28
|
description: "enforce the use of `u` flag on RegExp",
|
27
29
|
category: "Best Practices",
|
28
30
|
recommended: false,
|
29
31
|
url: "https://eslint.org/docs/rules/require-unicode-regexp"
|
30
32
|
},
|
33
|
+
|
31
34
|
messages: {
|
32
35
|
requireUFlag: "Use the 'u' flag."
|
33
36
|
},
|
37
|
+
|
34
38
|
schema: []
|
35
39
|
},
|
36
40
|
|
@@ -11,13 +11,17 @@
|
|
11
11
|
|
12
12
|
module.exports = {
|
13
13
|
meta: {
|
14
|
+
type: "layout",
|
15
|
+
|
14
16
|
docs: {
|
15
17
|
description: "enforce spacing between rest and spread operators and their expressions",
|
16
18
|
category: "ECMAScript 6",
|
17
19
|
recommended: false,
|
18
20
|
url: "https://eslint.org/docs/rules/rest-spread-spacing"
|
19
21
|
},
|
22
|
+
|
20
23
|
fixable: "whitespace",
|
24
|
+
|
21
25
|
schema: [
|
22
26
|
{
|
23
27
|
enum: ["always", "never"]
|
package/lib/rules/semi-style.js
CHANGED
@@ -65,12 +65,15 @@ function isLastChild(node) {
|
|
65
65
|
|
66
66
|
module.exports = {
|
67
67
|
meta: {
|
68
|
+
type: "layout",
|
69
|
+
|
68
70
|
docs: {
|
69
71
|
description: "enforce location of semicolons",
|
70
72
|
category: "Stylistic Issues",
|
71
73
|
recommended: false,
|
72
74
|
url: "https://eslint.org/docs/rules/semi-style"
|
73
75
|
},
|
76
|
+
|
74
77
|
schema: [{ enum: ["last", "first"] }],
|
75
78
|
fixable: "whitespace"
|
76
79
|
},
|
package/lib/rules/semi.js
CHANGED