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/camelcase.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: "enforce camelcase naming convention",
|
16
18
|
category: "Stylistic Issues",
|
@@ -27,6 +29,16 @@ module.exports = {
|
|
27
29
|
},
|
28
30
|
properties: {
|
29
31
|
enum: ["always", "never"]
|
32
|
+
},
|
33
|
+
allow: {
|
34
|
+
type: "array",
|
35
|
+
items: [
|
36
|
+
{
|
37
|
+
type: "string"
|
38
|
+
}
|
39
|
+
],
|
40
|
+
minItems: 0,
|
41
|
+
uniqueItems: true
|
30
42
|
}
|
31
43
|
},
|
32
44
|
additionalProperties: false
|
@@ -40,6 +52,15 @@ module.exports = {
|
|
40
52
|
|
41
53
|
create(context) {
|
42
54
|
|
55
|
+
const options = context.options[0] || {};
|
56
|
+
let properties = options.properties || "";
|
57
|
+
const ignoreDestructuring = options.ignoreDestructuring || false;
|
58
|
+
const allow = options.allow || [];
|
59
|
+
|
60
|
+
if (properties !== "always" && properties !== "never") {
|
61
|
+
properties = "always";
|
62
|
+
}
|
63
|
+
|
43
64
|
//--------------------------------------------------------------------------
|
44
65
|
// Helpers
|
45
66
|
//--------------------------------------------------------------------------
|
@@ -60,6 +81,18 @@ module.exports = {
|
|
60
81
|
return name.indexOf("_") > -1 && name !== name.toUpperCase();
|
61
82
|
}
|
62
83
|
|
84
|
+
/**
|
85
|
+
* Checks if a string match the ignore list
|
86
|
+
* @param {string} name The string to check.
|
87
|
+
* @returns {boolean} if the string is ignored
|
88
|
+
* @private
|
89
|
+
*/
|
90
|
+
function isAllowed(name) {
|
91
|
+
return allow.findIndex(
|
92
|
+
entry => name === entry || name.match(new RegExp(entry))
|
93
|
+
) !== -1;
|
94
|
+
}
|
95
|
+
|
63
96
|
/**
|
64
97
|
* Checks if a parent of a node is an ObjectPattern.
|
65
98
|
* @param {ASTNode} node The node to check.
|
@@ -93,14 +126,6 @@ module.exports = {
|
|
93
126
|
}
|
94
127
|
}
|
95
128
|
|
96
|
-
const options = context.options[0] || {};
|
97
|
-
let properties = options.properties || "";
|
98
|
-
const ignoreDestructuring = options.ignoreDestructuring || false;
|
99
|
-
|
100
|
-
if (properties !== "always" && properties !== "never") {
|
101
|
-
properties = "always";
|
102
|
-
}
|
103
|
-
|
104
129
|
return {
|
105
130
|
|
106
131
|
Identifier(node) {
|
@@ -112,6 +137,11 @@ module.exports = {
|
|
112
137
|
const name = node.name.replace(/^_+|_+$/g, ""),
|
113
138
|
effectiveParent = (node.parent.type === "MemberExpression") ? node.parent.parent : node.parent;
|
114
139
|
|
140
|
+
// First, we ignore the node if it match the ignore list
|
141
|
+
if (isAllowed(name)) {
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
|
115
145
|
// MemberExpressions get special rules
|
116
146
|
if (node.parent.type === "MemberExpression") {
|
117
147
|
|
@@ -108,13 +108,17 @@ function createRegExpForIgnorePatterns(normalizedOptions) {
|
|
108
108
|
|
109
109
|
module.exports = {
|
110
110
|
meta: {
|
111
|
+
type: "suggestion",
|
112
|
+
|
111
113
|
docs: {
|
112
114
|
description: "enforce or disallow capitalization of the first letter of a comment",
|
113
115
|
category: "Stylistic Issues",
|
114
116
|
recommended: false,
|
115
117
|
url: "https://eslint.org/docs/rules/capitalized-comments"
|
116
118
|
},
|
119
|
+
|
117
120
|
fixable: "code",
|
121
|
+
|
118
122
|
schema: [
|
119
123
|
{ enum: ["always", "never"] },
|
120
124
|
{
|
@@ -11,12 +11,15 @@
|
|
11
11
|
|
12
12
|
module.exports = {
|
13
13
|
meta: {
|
14
|
+
type: "suggestion",
|
15
|
+
|
14
16
|
docs: {
|
15
17
|
description: "enforce that class methods utilize `this`",
|
16
18
|
category: "Best Practices",
|
17
19
|
recommended: false,
|
18
20
|
url: "https://eslint.org/docs/rules/class-methods-use-this"
|
19
21
|
},
|
22
|
+
|
20
23
|
schema: [{
|
21
24
|
type: "object",
|
22
25
|
properties: {
|
@@ -76,13 +76,17 @@ function normalizeOptions(optionValue) {
|
|
76
76
|
|
77
77
|
module.exports = {
|
78
78
|
meta: {
|
79
|
+
type: "layout",
|
80
|
+
|
79
81
|
docs: {
|
80
82
|
description: "require or disallow trailing commas",
|
81
83
|
category: "Stylistic Issues",
|
82
84
|
recommended: false,
|
83
85
|
url: "https://eslint.org/docs/rules/comma-dangle"
|
84
86
|
},
|
87
|
+
|
85
88
|
fixable: "code",
|
89
|
+
|
86
90
|
schema: {
|
87
91
|
definitions: {
|
88
92
|
value: {
|
package/lib/rules/comma-style.js
CHANGED
@@ -13,13 +13,17 @@ 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 consistent comma style",
|
18
20
|
category: "Stylistic Issues",
|
19
21
|
recommended: false,
|
20
22
|
url: "https://eslint.org/docs/rules/comma-style"
|
21
23
|
},
|
24
|
+
|
22
25
|
fixable: "code",
|
26
|
+
|
23
27
|
schema: [
|
24
28
|
{
|
25
29
|
enum: ["first", "last"]
|
@@ -37,6 +41,7 @@ module.exports = {
|
|
37
41
|
additionalProperties: false
|
38
42
|
}
|
39
43
|
],
|
44
|
+
|
40
45
|
messages: {
|
41
46
|
unexpectedLineBeforeAndAfterComma: "Bad line breaking before and after ','.",
|
42
47
|
expectedCommaFirst: "',' should be placed first.",
|
package/lib/rules/complexity.js
CHANGED
package/lib/rules/curly.js
CHANGED
package/lib/rules/eol-last.js
CHANGED
@@ -16,18 +16,23 @@ const lodash = require("lodash");
|
|
16
16
|
|
17
17
|
module.exports = {
|
18
18
|
meta: {
|
19
|
+
type: "layout",
|
20
|
+
|
19
21
|
docs: {
|
20
22
|
description: "require or disallow newline at the end of files",
|
21
23
|
category: "Stylistic Issues",
|
22
24
|
recommended: false,
|
23
25
|
url: "https://eslint.org/docs/rules/eol-last"
|
24
26
|
},
|
27
|
+
|
25
28
|
fixable: "whitespace",
|
29
|
+
|
26
30
|
schema: [
|
27
31
|
{
|
28
32
|
enum: ["always", "never", "unix", "windows"]
|
29
33
|
}
|
30
34
|
],
|
35
|
+
|
31
36
|
messages: {
|
32
37
|
missing: "Newline required at end of file but not found.",
|
33
38
|
unexpected: "Newline not allowed at end of file."
|
package/lib/rules/eqeqeq.js
CHANGED
@@ -11,14 +11,18 @@
|
|
11
11
|
|
12
12
|
module.exports = {
|
13
13
|
meta: {
|
14
|
+
type: "problem",
|
15
|
+
|
14
16
|
docs: {
|
15
17
|
description: "enforce \"for\" loop update clause moving the counter in the right direction.",
|
16
18
|
category: "Possible Errors",
|
17
19
|
recommended: true,
|
18
20
|
url: "https://eslint.org/docs/rules/for-direction"
|
19
21
|
},
|
22
|
+
|
20
23
|
fixable: null,
|
21
24
|
schema: [],
|
25
|
+
|
22
26
|
messages: {
|
23
27
|
incorrectDirection: "The update clause in this loop moves the variable in the wrong direction."
|
24
28
|
}
|
@@ -17,6 +17,8 @@ const astUtils = require("../util/ast-utils");
|
|
17
17
|
|
18
18
|
module.exports = {
|
19
19
|
meta: {
|
20
|
+
type: "layout",
|
21
|
+
|
20
22
|
docs: {
|
21
23
|
description: "require or disallow spacing between function identifiers and their invocations",
|
22
24
|
category: "Stylistic Issues",
|
@@ -25,6 +27,7 @@ module.exports = {
|
|
25
27
|
},
|
26
28
|
|
27
29
|
fixable: "whitespace",
|
30
|
+
|
28
31
|
schema: {
|
29
32
|
anyOf: [
|
30
33
|
{
|
@@ -58,6 +61,7 @@ module.exports = {
|
|
58
61
|
}
|
59
62
|
]
|
60
63
|
},
|
64
|
+
|
61
65
|
messages: {
|
62
66
|
unexpected: "Unexpected newline between function name and paren.",
|
63
67
|
missing: "Missing space between function name and paren."
|
@@ -70,6 +70,8 @@ const optionsObject = {
|
|
70
70
|
|
71
71
|
module.exports = {
|
72
72
|
meta: {
|
73
|
+
type: "suggestion",
|
74
|
+
|
73
75
|
docs: {
|
74
76
|
description: "require function names to match the name of the variable or property to which they are assigned",
|
75
77
|
category: "Stylistic Issues",
|
@@ -88,6 +90,7 @@ module.exports = {
|
|
88
90
|
items: [optionsObject]
|
89
91
|
}]
|
90
92
|
},
|
93
|
+
|
91
94
|
messages: {
|
92
95
|
matchProperty: "Function name `{{funcName}}` should match property name `{{name}}`",
|
93
96
|
matchVariable: "Function name `{{funcName}}` should match variable name `{{name}}`",
|
package/lib/rules/func-names.js
CHANGED
@@ -26,6 +26,8 @@ function isFunctionName(variable) {
|
|
26
26
|
|
27
27
|
module.exports = {
|
28
28
|
meta: {
|
29
|
+
type: "suggestion",
|
30
|
+
|
29
31
|
docs: {
|
30
32
|
description: "require or disallow named `function` expressions",
|
31
33
|
category: "Stylistic Issues",
|
@@ -58,6 +60,7 @@ module.exports = {
|
|
58
60
|
}
|
59
61
|
]
|
60
62
|
},
|
63
|
+
|
61
64
|
messages: {
|
62
65
|
unnamed: "Unexpected unnamed {{name}}.",
|
63
66
|
named: "Unexpected named {{name}}."
|
package/lib/rules/func-style.js
CHANGED
@@ -10,6 +10,8 @@
|
|
10
10
|
|
11
11
|
module.exports = {
|
12
12
|
meta: {
|
13
|
+
type: "suggestion",
|
14
|
+
|
13
15
|
docs: {
|
14
16
|
description: "enforce the consistent use of either `function` declarations or expressions",
|
15
17
|
category: "Stylistic Issues",
|
@@ -31,6 +33,7 @@ module.exports = {
|
|
31
33
|
additionalProperties: false
|
32
34
|
}
|
33
35
|
],
|
36
|
+
|
34
37
|
messages: {
|
35
38
|
expression: "Expected a function expression.",
|
36
39
|
declaration: "Expected a function declaration."
|
@@ -16,13 +16,17 @@ const astUtils = require("../util/ast-utils");
|
|
16
16
|
|
17
17
|
module.exports = {
|
18
18
|
meta: {
|
19
|
+
type: "layout",
|
20
|
+
|
19
21
|
docs: {
|
20
22
|
description: "enforce consistent line breaks inside function parentheses",
|
21
23
|
category: "Stylistic Issues",
|
22
24
|
recommended: false,
|
23
25
|
url: "https://eslint.org/docs/rules/function-paren-newline"
|
24
26
|
},
|
27
|
+
|
25
28
|
fixable: "whitespace",
|
29
|
+
|
26
30
|
schema: [
|
27
31
|
{
|
28
32
|
oneOf: [
|
@@ -42,6 +46,7 @@ module.exports = {
|
|
42
46
|
]
|
43
47
|
}
|
44
48
|
],
|
49
|
+
|
45
50
|
messages: {
|
46
51
|
expectedBefore: "Expected newline before ')'.",
|
47
52
|
expectedAfter: "Expected newline after '('.",
|
@@ -27,6 +27,8 @@ const OVERRIDE_SCHEMA = {
|
|
27
27
|
|
28
28
|
module.exports = {
|
29
29
|
meta: {
|
30
|
+
type: "layout",
|
31
|
+
|
30
32
|
docs: {
|
31
33
|
description: "enforce consistent spacing around `*` operators in generator functions",
|
32
34
|
category: "ECMAScript 6",
|
@@ -56,6 +58,7 @@ module.exports = {
|
|
56
58
|
]
|
57
59
|
}
|
58
60
|
],
|
61
|
+
|
59
62
|
messages: {
|
60
63
|
missingBefore: "Missing space before *.",
|
61
64
|
missingAfter: "Missing space after *.",
|
@@ -44,13 +44,17 @@ function getId(node) {
|
|
44
44
|
|
45
45
|
module.exports = {
|
46
46
|
meta: {
|
47
|
+
type: "problem",
|
48
|
+
|
47
49
|
docs: {
|
48
50
|
description: "enforce `return` statements in getters",
|
49
51
|
category: "Possible Errors",
|
50
52
|
recommended: true,
|
51
53
|
url: "https://eslint.org/docs/rules/getter-return"
|
52
54
|
},
|
55
|
+
|
53
56
|
fixable: null,
|
57
|
+
|
54
58
|
schema: [
|
55
59
|
{
|
56
60
|
type: "object",
|
@@ -62,6 +66,7 @@ module.exports = {
|
|
62
66
|
additionalProperties: false
|
63
67
|
}
|
64
68
|
],
|
69
|
+
|
65
70
|
messages: {
|
66
71
|
expected: "Expected to return a value in {{name}}.",
|
67
72
|
expectedAlways: "Expected {{name}} to always return a value."
|