eslint 5.6.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 +65 -0
- package/bin/eslint.js +0 -1
- package/lib/cli-engine.js +128 -31
- package/lib/cli.js +6 -1
- package/lib/linter.js +9 -0
- 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 +38 -8
- 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 +24 -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 +6 -8
- 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 +25 -6
- 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 +37 -13
- 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 +13 -1
- 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 +7 -0
- package/lib/rules/prefer-arrow-callback.js +2 -0
- package/lib/rules/prefer-const.js +116 -11
- 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 +91 -30
- 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 +18 -25
- 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/lib/testers/rule-tester.js +2 -2
- package/lib/util/source-code-fixer.js +1 -1
- package/package.json +12 -12
package/lib/rules/id-match.js
CHANGED
@@ -11,6 +11,8 @@
|
|
11
11
|
|
12
12
|
module.exports = {
|
13
13
|
meta: {
|
14
|
+
type: "suggestion",
|
15
|
+
|
14
16
|
docs: {
|
15
17
|
description: "require identifiers to match a specified regular expression",
|
16
18
|
category: "Stylistic Issues",
|
@@ -27,6 +29,12 @@ module.exports = {
|
|
27
29
|
properties: {
|
28
30
|
properties: {
|
29
31
|
type: "boolean"
|
32
|
+
},
|
33
|
+
onlyDeclarations: {
|
34
|
+
type: "boolean"
|
35
|
+
},
|
36
|
+
ignoreDestructuring: {
|
37
|
+
type: "boolean"
|
30
38
|
}
|
31
39
|
}
|
32
40
|
}
|
@@ -36,15 +44,25 @@ module.exports = {
|
|
36
44
|
create(context) {
|
37
45
|
|
38
46
|
//--------------------------------------------------------------------------
|
39
|
-
//
|
47
|
+
// Options
|
40
48
|
//--------------------------------------------------------------------------
|
41
|
-
|
42
49
|
const pattern = context.options[0] || "^.+$",
|
43
50
|
regexp = new RegExp(pattern);
|
44
51
|
|
45
52
|
const options = context.options[1] || {},
|
46
53
|
properties = !!options.properties,
|
47
|
-
onlyDeclarations = !!options.onlyDeclarations
|
54
|
+
onlyDeclarations = !!options.onlyDeclarations,
|
55
|
+
ignoreDestructuring = !!options.ignoreDestructuring;
|
56
|
+
|
57
|
+
//--------------------------------------------------------------------------
|
58
|
+
// Helpers
|
59
|
+
//--------------------------------------------------------------------------
|
60
|
+
|
61
|
+
// contains reported nodes to avoid reporting twice on destructuring with shorthand notation
|
62
|
+
const reported = new Map();
|
63
|
+
const ALLOWED_PARENT_TYPES = new Set(["CallExpression", "NewExpression"]);
|
64
|
+
const DECLARATION_TYPES = new Set(["FunctionDeclaration", "VariableDeclarator"]);
|
65
|
+
const IMPORT_TYPES = new Set(["ImportSpecifier", "ImportNamespaceSpecifier", "ImportDefaultSpecifier"]);
|
48
66
|
|
49
67
|
/**
|
50
68
|
* Checks if a string matches the provided pattern
|
@@ -56,6 +74,26 @@ module.exports = {
|
|
56
74
|
return !regexp.test(name);
|
57
75
|
}
|
58
76
|
|
77
|
+
/**
|
78
|
+
* Checks if a parent of a node is an ObjectPattern.
|
79
|
+
* @param {ASTNode} node The node to check.
|
80
|
+
* @returns {boolean} if the node is inside an ObjectPattern
|
81
|
+
* @private
|
82
|
+
*/
|
83
|
+
function isInsideObjectPattern(node) {
|
84
|
+
let { parent } = node;
|
85
|
+
|
86
|
+
while (parent) {
|
87
|
+
if (parent.type === "ObjectPattern") {
|
88
|
+
return true;
|
89
|
+
}
|
90
|
+
|
91
|
+
parent = parent.parent;
|
92
|
+
}
|
93
|
+
|
94
|
+
return false;
|
95
|
+
}
|
96
|
+
|
59
97
|
/**
|
60
98
|
* Verifies if we should report an error or not based on the effective
|
61
99
|
* parent node and the identifier name.
|
@@ -64,9 +102,8 @@ module.exports = {
|
|
64
102
|
* @returns {boolean} whether an error should be reported or not
|
65
103
|
*/
|
66
104
|
function shouldReport(effectiveParent, name) {
|
67
|
-
return effectiveParent.type
|
68
|
-
effectiveParent.type
|
69
|
-
isInvalid(name);
|
105
|
+
return (!onlyDeclarations || DECLARATION_TYPES.has(effectiveParent.type)) &&
|
106
|
+
!ALLOWED_PARENT_TYPES.has(effectiveParent.type) && isInvalid(name);
|
70
107
|
}
|
71
108
|
|
72
109
|
/**
|
@@ -76,14 +113,17 @@ module.exports = {
|
|
76
113
|
* @private
|
77
114
|
*/
|
78
115
|
function report(node) {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
116
|
+
if (!reported.has(node)) {
|
117
|
+
context.report({
|
118
|
+
node,
|
119
|
+
message: "Identifier '{{name}}' does not match the pattern '{{pattern}}'.",
|
120
|
+
data: {
|
121
|
+
name: node.name,
|
122
|
+
pattern
|
123
|
+
}
|
124
|
+
});
|
125
|
+
reported.set(node, true);
|
126
|
+
}
|
87
127
|
}
|
88
128
|
|
89
129
|
return {
|
@@ -106,36 +146,70 @@ module.exports = {
|
|
106
146
|
report(node);
|
107
147
|
}
|
108
148
|
|
109
|
-
// Report AssignmentExpressions
|
149
|
+
// Report AssignmentExpressions left side's assigned variable id
|
110
150
|
} else if (effectiveParent.type === "AssignmentExpression" &&
|
111
|
-
(effectiveParent.right.type !== "MemberExpression" ||
|
112
151
|
effectiveParent.left.type === "MemberExpression" &&
|
113
|
-
effectiveParent.left.property.name === name)
|
152
|
+
effectiveParent.left.property.name === node.name) {
|
153
|
+
if (isInvalid(name)) {
|
154
|
+
report(node);
|
155
|
+
}
|
156
|
+
|
157
|
+
// Report AssignmentExpressions only if they are the left side of the assignment
|
158
|
+
} else if (effectiveParent.type === "AssignmentExpression" && effectiveParent.right.type !== "MemberExpression") {
|
114
159
|
if (isInvalid(name)) {
|
115
160
|
report(node);
|
116
161
|
}
|
117
162
|
}
|
118
163
|
|
119
|
-
|
164
|
+
/*
|
165
|
+
* Properties have their own rules, and
|
166
|
+
* AssignmentPattern nodes can be treated like Properties:
|
167
|
+
* e.g.: const { no_camelcased = false } = bar;
|
168
|
+
*/
|
169
|
+
} else if (parent.type === "Property" || parent.type === "AssignmentPattern") {
|
170
|
+
|
171
|
+
if (parent.parent && parent.parent.type === "ObjectPattern") {
|
172
|
+
if (parent.shorthand && parent.value.left && isInvalid(name)) {
|
173
|
+
|
174
|
+
report(node);
|
175
|
+
}
|
176
|
+
|
177
|
+
const assignmentKeyEqualsValue = parent.key.name === parent.value.name;
|
120
178
|
|
121
|
-
|
179
|
+
// prevent checking righthand side of destructured object
|
180
|
+
if (!assignmentKeyEqualsValue && parent.key === node) {
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
|
184
|
+
const valueIsInvalid = parent.value.name && isInvalid(name);
|
185
|
+
|
186
|
+
// ignore destructuring if the option is set, unless a new identifier is created
|
187
|
+
if (valueIsInvalid && !(assignmentKeyEqualsValue && ignoreDestructuring)) {
|
188
|
+
report(node);
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
// never check properties or always ignore destructuring
|
193
|
+
if (!properties || (ignoreDestructuring && isInsideObjectPattern(node))) {
|
122
194
|
return;
|
123
195
|
}
|
124
196
|
|
125
|
-
|
197
|
+
// don't check right hand side of AssignmentExpression to prevent duplicate warnings
|
198
|
+
if (parent.right !== node && shouldReport(effectiveParent, name)) {
|
126
199
|
report(node);
|
127
200
|
}
|
128
201
|
|
129
|
-
|
130
|
-
|
202
|
+
// Check if it's an import specifier
|
203
|
+
} else if (IMPORT_TYPES.has(parent.type)) {
|
131
204
|
|
132
|
-
if
|
133
|
-
|
134
|
-
}
|
135
|
-
|
136
|
-
if (shouldReport(effectiveParent, name)) {
|
205
|
+
// Report only if the local imported identifier is invalid
|
206
|
+
if (parent.local && parent.local.name === node.name && isInvalid(name)) {
|
137
207
|
report(node);
|
138
208
|
}
|
209
|
+
|
210
|
+
// Report anything that is invalid that isn't a CallExpression
|
211
|
+
} else if (shouldReport(effectiveParent, name)) {
|
212
|
+
report(node);
|
139
213
|
}
|
140
214
|
}
|
141
215
|
|
@@ -9,13 +9,17 @@
|
|
9
9
|
//------------------------------------------------------------------------------
|
10
10
|
module.exports = {
|
11
11
|
meta: {
|
12
|
+
type: "layout",
|
13
|
+
|
12
14
|
docs: {
|
13
15
|
description: "enforce the location of arrow function bodies",
|
14
16
|
category: "Stylistic Issues",
|
15
17
|
recommended: false,
|
16
18
|
url: "https://eslint.org/docs/rules/implicit-arrow-linebreak"
|
17
19
|
},
|
20
|
+
|
18
21
|
fixable: "whitespace",
|
22
|
+
|
19
23
|
schema: [
|
20
24
|
{
|
21
25
|
enum: ["beside", "below"]
|
@@ -21,16 +21,19 @@ const astUtils = require("../util/ast-utils");
|
|
21
21
|
/* istanbul ignore next: this rule has known coverage issues, but it's deprecated and shouldn't be updated in the future anyway. */
|
22
22
|
module.exports = {
|
23
23
|
meta: {
|
24
|
+
type: "layout",
|
25
|
+
|
24
26
|
docs: {
|
25
27
|
description: "enforce consistent indentation",
|
26
28
|
category: "Stylistic Issues",
|
27
29
|
recommended: false,
|
28
|
-
replacedBy: ["indent"],
|
29
30
|
url: "https://eslint.org/docs/rules/indent-legacy"
|
30
31
|
},
|
31
32
|
|
32
33
|
deprecated: true,
|
33
34
|
|
35
|
+
replacedBy: ["indent"],
|
36
|
+
|
34
37
|
fixable: "whitespace",
|
35
38
|
|
36
39
|
schema: [
|
package/lib/rules/indent.js
CHANGED
package/lib/rules/jsx-quotes.js
CHANGED
package/lib/rules/key-spacing.js
CHANGED
@@ -128,6 +128,8 @@ const messages = {
|
|
128
128
|
|
129
129
|
module.exports = {
|
130
130
|
meta: {
|
131
|
+
type: "layout",
|
132
|
+
|
131
133
|
docs: {
|
132
134
|
description: "enforce consistent spacing between keys and values in object literal properties",
|
133
135
|
category: "Stylistic Issues",
|
@@ -360,10 +362,9 @@ module.exports = {
|
|
360
362
|
*/
|
361
363
|
function isKeyValueProperty(property) {
|
362
364
|
return !(
|
363
|
-
property.method ||
|
365
|
+
(property.method ||
|
364
366
|
property.shorthand ||
|
365
|
-
property.kind !== "init" ||
|
366
|
-
property.type !== "Property" // Could be "ExperimentalSpreadProperty" or "SpreadElement"
|
367
|
+
property.kind !== "init" || property.type !== "Property") // Could be "ExperimentalSpreadProperty" or "SpreadElement"
|
367
368
|
);
|
368
369
|
}
|
369
370
|
|
@@ -14,13 +14,15 @@ const astUtils = require("../util/ast-utils");
|
|
14
14
|
|
15
15
|
module.exports = {
|
16
16
|
meta: {
|
17
|
+
type: "layout",
|
18
|
+
|
17
19
|
docs: {
|
18
20
|
description: "require or disallow newlines around directives",
|
19
21
|
category: "Stylistic Issues",
|
20
22
|
recommended: false,
|
21
|
-
replacedBy: ["padding-line-between-statements"],
|
22
23
|
url: "https://eslint.org/docs/rules/lines-around-directive"
|
23
24
|
},
|
25
|
+
|
24
26
|
schema: [{
|
25
27
|
oneOf: [
|
26
28
|
{
|
@@ -41,8 +43,10 @@ module.exports = {
|
|
41
43
|
}
|
42
44
|
]
|
43
45
|
}],
|
46
|
+
|
44
47
|
fixable: "whitespace",
|
45
|
-
deprecated: true
|
48
|
+
deprecated: true,
|
49
|
+
replacedBy: ["padding-line-between-statements"]
|
46
50
|
},
|
47
51
|
|
48
52
|
create(context) {
|
@@ -15,18 +15,22 @@
|
|
15
15
|
|
16
16
|
module.exports = {
|
17
17
|
meta: {
|
18
|
+
type: "suggestion",
|
19
|
+
|
18
20
|
docs: {
|
19
21
|
description: "enforce a maximum number of classes per file",
|
20
22
|
category: "Best Practices",
|
21
23
|
recommended: false,
|
22
24
|
url: "https://eslint.org/docs/rules/max-classes-per-file"
|
23
25
|
},
|
26
|
+
|
24
27
|
schema: [
|
25
28
|
{
|
26
29
|
type: "integer",
|
27
30
|
minimum: 1
|
28
31
|
}
|
29
32
|
],
|
33
|
+
|
30
34
|
messages: {
|
31
35
|
maximumExceeded: "Number of classes per file must not exceed {{ max }}"
|
32
36
|
}
|
package/lib/rules/max-depth.js
CHANGED
package/lib/rules/max-len.js
CHANGED
package/lib/rules/max-lines.js
CHANGED
package/lib/rules/max-params.js
CHANGED
@@ -12,12 +12,15 @@ 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: "enforce a particular style for multiline comments",
|
17
19
|
category: "Stylistic Issues",
|
18
20
|
recommended: false,
|
19
21
|
url: "https://eslint.org/docs/rules/multiline-comment-style"
|
20
22
|
},
|
23
|
+
|
21
24
|
fixable: "whitespace",
|
22
25
|
schema: [{ enum: ["starred-block", "separate-lines", "bare-block"] }]
|
23
26
|
},
|
@@ -13,12 +13,15 @@ const astUtils = require("../util/ast-utils");
|
|
13
13
|
|
14
14
|
module.exports = {
|
15
15
|
meta: {
|
16
|
+
type: "layout",
|
17
|
+
|
16
18
|
docs: {
|
17
19
|
description: "enforce newlines between operands of ternary expressions",
|
18
20
|
category: "Stylistic Issues",
|
19
21
|
recommended: false,
|
20
22
|
url: "https://eslint.org/docs/rules/multiline-ternary"
|
21
23
|
},
|
24
|
+
|
22
25
|
schema: [
|
23
26
|
{
|
24
27
|
enum: ["always", "always-multiline", "never"]
|
package/lib/rules/new-cap.js
CHANGED
package/lib/rules/new-parens.js
CHANGED
@@ -21,6 +21,8 @@ const astUtils = require("../util/ast-utils");
|
|
21
21
|
|
22
22
|
module.exports = {
|
23
23
|
meta: {
|
24
|
+
type: "layout",
|
25
|
+
|
24
26
|
docs: {
|
25
27
|
description: "require parentheses when invoking a constructor with no arguments",
|
26
28
|
category: "Stylistic Issues",
|
@@ -29,7 +31,6 @@ module.exports = {
|
|
29
31
|
},
|
30
32
|
|
31
33
|
schema: [],
|
32
|
-
|
33
34
|
fixable: "code"
|
34
35
|
},
|
35
36
|
|
@@ -18,11 +18,12 @@ const astUtils = require("../util/ast-utils");
|
|
18
18
|
|
19
19
|
module.exports = {
|
20
20
|
meta: {
|
21
|
+
type: "layout",
|
22
|
+
|
21
23
|
docs: {
|
22
24
|
description: "require or disallow an empty line after variable declarations",
|
23
25
|
category: "Stylistic Issues",
|
24
26
|
recommended: false,
|
25
|
-
replacedBy: ["padding-line-between-statements"],
|
26
27
|
url: "https://eslint.org/docs/rules/newline-after-var"
|
27
28
|
},
|
28
29
|
|
@@ -34,7 +35,9 @@ module.exports = {
|
|
34
35
|
|
35
36
|
fixable: "whitespace",
|
36
37
|
|
37
|
-
deprecated: true
|
38
|
+
deprecated: true,
|
39
|
+
|
40
|
+
replacedBy: ["padding-line-between-statements"]
|
38
41
|
},
|
39
42
|
|
40
43
|
create(context) {
|
@@ -11,16 +11,19 @@
|
|
11
11
|
|
12
12
|
module.exports = {
|
13
13
|
meta: {
|
14
|
+
type: "layout",
|
15
|
+
|
14
16
|
docs: {
|
15
17
|
description: "require an empty line before `return` statements",
|
16
18
|
category: "Stylistic Issues",
|
17
19
|
recommended: false,
|
18
|
-
replacedBy: ["padding-line-between-statements"],
|
19
20
|
url: "https://eslint.org/docs/rules/newline-before-return"
|
20
21
|
},
|
22
|
+
|
21
23
|
fixable: "whitespace",
|
22
24
|
schema: [],
|
23
|
-
deprecated: true
|
25
|
+
deprecated: true,
|
26
|
+
replacedBy: ["padding-line-between-statements"]
|
24
27
|
},
|
25
28
|
|
26
29
|
create(context) {
|
@@ -14,13 +14,17 @@ const astUtils = require("../util/ast-utils");
|
|
14
14
|
|
15
15
|
module.exports = {
|
16
16
|
meta: {
|
17
|
+
type: "layout",
|
18
|
+
|
17
19
|
docs: {
|
18
20
|
description: "require a newline after each call in a method chain",
|
19
21
|
category: "Stylistic Issues",
|
20
22
|
recommended: false,
|
21
23
|
url: "https://eslint.org/docs/rules/newline-per-chained-call"
|
22
24
|
},
|
25
|
+
|
23
26
|
fixable: "whitespace",
|
27
|
+
|
24
28
|
schema: [{
|
25
29
|
type: "object",
|
26
30
|
properties: {
|
package/lib/rules/no-alert.js
CHANGED
@@ -10,12 +10,15 @@
|
|
10
10
|
|
11
11
|
module.exports = {
|
12
12
|
meta: {
|
13
|
+
type: "problem",
|
14
|
+
|
13
15
|
docs: {
|
14
16
|
description: "disallow using an async function as a Promise executor",
|
15
17
|
category: "Possible Errors",
|
16
18
|
recommended: false,
|
17
19
|
url: "https://eslint.org/docs/rules/no-async-promise-executor"
|
18
20
|
},
|
21
|
+
|
19
22
|
fixable: null,
|
20
23
|
schema: []
|
21
24
|
},
|
@@ -55,13 +55,17 @@ function isLooped(node, parent) {
|
|
55
55
|
|
56
56
|
module.exports = {
|
57
57
|
meta: {
|
58
|
+
type: "problem",
|
59
|
+
|
58
60
|
docs: {
|
59
61
|
description: "disallow `await` inside of loops",
|
60
62
|
category: "Possible Errors",
|
61
63
|
recommended: false,
|
62
64
|
url: "https://eslint.org/docs/rules/no-await-in-loop"
|
63
65
|
},
|
66
|
+
|
64
67
|
schema: [],
|
68
|
+
|
65
69
|
messages: {
|
66
70
|
unexpectedAwait: "Unexpected `await` inside a loop."
|
67
71
|
}
|