eslint 8.52.0 → 8.54.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/README.md +1 -1
- package/bin/eslint.js +24 -2
- package/lib/cli-engine/lint-result-cache.js +18 -6
- package/lib/linter/linter.js +2 -2
- package/lib/rules/array-bracket-newline.js +3 -0
- package/lib/rules/array-bracket-spacing.js +3 -0
- package/lib/rules/array-element-newline.js +3 -0
- package/lib/rules/arrow-parens.js +3 -0
- package/lib/rules/arrow-spacing.js +3 -0
- package/lib/rules/block-spacing.js +3 -0
- package/lib/rules/brace-style.js +3 -0
- package/lib/rules/comma-dangle.js +3 -0
- package/lib/rules/comma-spacing.js +3 -0
- package/lib/rules/comma-style.js +3 -0
- package/lib/rules/computed-property-spacing.js +3 -0
- package/lib/rules/dot-location.js +3 -0
- package/lib/rules/eol-last.js +3 -0
- package/lib/rules/for-direction.js +23 -16
- package/lib/rules/func-call-spacing.js +3 -0
- package/lib/rules/function-call-argument-newline.js +3 -0
- package/lib/rules/function-paren-newline.js +3 -0
- package/lib/rules/generator-star-spacing.js +3 -0
- package/lib/rules/implicit-arrow-linebreak.js +3 -0
- package/lib/rules/indent.js +3 -0
- package/lib/rules/jsx-quotes.js +3 -0
- package/lib/rules/key-spacing.js +3 -0
- package/lib/rules/keyword-spacing.js +3 -0
- package/lib/rules/linebreak-style.js +3 -0
- package/lib/rules/lines-around-comment.js +3 -0
- package/lib/rules/lines-between-class-members.js +3 -0
- package/lib/rules/max-len.js +3 -0
- package/lib/rules/max-statements-per-line.js +3 -0
- package/lib/rules/multiline-ternary.js +3 -0
- package/lib/rules/new-parens.js +3 -0
- package/lib/rules/newline-per-chained-call.js +3 -0
- package/lib/rules/no-array-constructor.js +85 -6
- package/lib/rules/no-confusing-arrow.js +3 -0
- package/lib/rules/no-console.js +74 -2
- package/lib/rules/no-extra-parens.js +3 -0
- package/lib/rules/no-extra-semi.js +3 -0
- package/lib/rules/no-floating-decimal.js +3 -0
- package/lib/rules/no-mixed-operators.js +3 -0
- package/lib/rules/no-mixed-spaces-and-tabs.js +3 -0
- package/lib/rules/no-multi-spaces.js +3 -0
- package/lib/rules/no-multiple-empty-lines.js +3 -0
- package/lib/rules/no-object-constructor.js +7 -106
- package/lib/rules/no-prototype-builtins.js +90 -2
- package/lib/rules/no-tabs.js +3 -0
- package/lib/rules/no-trailing-spaces.js +3 -0
- package/lib/rules/no-whitespace-before-property.js +3 -0
- package/lib/rules/nonblock-statement-body-position.js +3 -0
- package/lib/rules/object-curly-newline.js +3 -0
- package/lib/rules/object-curly-spacing.js +3 -0
- package/lib/rules/object-property-newline.js +3 -0
- package/lib/rules/one-var-declaration-per-line.js +3 -0
- package/lib/rules/operator-linebreak.js +3 -0
- package/lib/rules/padded-blocks.js +3 -0
- package/lib/rules/padding-line-between-statements.js +3 -0
- package/lib/rules/quote-props.js +3 -0
- package/lib/rules/quotes.js +3 -0
- package/lib/rules/rest-spread-spacing.js +3 -0
- package/lib/rules/semi-spacing.js +3 -0
- package/lib/rules/semi-style.js +3 -0
- package/lib/rules/semi.js +3 -0
- package/lib/rules/space-before-blocks.js +3 -0
- package/lib/rules/space-before-function-paren.js +3 -0
- package/lib/rules/space-in-parens.js +3 -0
- package/lib/rules/space-infix-ops.js +3 -0
- package/lib/rules/space-unary-ops.js +3 -0
- package/lib/rules/spaced-comment.js +3 -0
- package/lib/rules/switch-colon-spacing.js +3 -0
- package/lib/rules/template-curly-spacing.js +3 -0
- package/lib/rules/template-tag-spacing.js +3 -0
- package/lib/rules/utils/ast-utils.js +111 -1
- package/lib/rules/wrap-iife.js +3 -0
- package/lib/rules/wrap-regex.js +3 -0
- package/lib/rules/yield-star-spacing.js +3 -0
- package/package.json +8 -8
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to disallow whitespace before properties
|
3
3
|
* @author Kai Cataldo
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -17,6 +18,8 @@ const astUtils = require("./utils/ast-utils");
|
|
17
18
|
/** @type {import('../shared/types').Rule} */
|
18
19
|
module.exports = {
|
19
20
|
meta: {
|
21
|
+
deprecated: true,
|
22
|
+
replacedBy: [],
|
20
23
|
type: "layout",
|
21
24
|
|
22
25
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview enforce the location of single-line statements
|
3
3
|
* @author Teddy Katz
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -13,6 +14,8 @@ const POSITION_SCHEMA = { enum: ["beside", "below", "any"] };
|
|
13
14
|
/** @type {import('../shared/types').Rule} */
|
14
15
|
module.exports = {
|
15
16
|
meta: {
|
17
|
+
deprecated: true,
|
18
|
+
replacedBy: [],
|
16
19
|
type: "layout",
|
17
20
|
|
18
21
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to require or disallow line breaks inside braces.
|
3
3
|
* @author Toru Nagashima
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -147,6 +148,8 @@ function areLineBreaksRequired(node, options, first, last) {
|
|
147
148
|
/** @type {import('../shared/types').Rule} */
|
148
149
|
module.exports = {
|
149
150
|
meta: {
|
151
|
+
deprecated: true,
|
152
|
+
replacedBy: [],
|
150
153
|
type: "layout",
|
151
154
|
|
152
155
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Disallows or enforces spaces inside of object literals.
|
3
3
|
* @author Jamund Ferguson
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -13,6 +14,8 @@ const astUtils = require("./utils/ast-utils");
|
|
13
14
|
/** @type {import('../shared/types').Rule} */
|
14
15
|
module.exports = {
|
15
16
|
meta: {
|
17
|
+
deprecated: true,
|
18
|
+
replacedBy: [],
|
16
19
|
type: "layout",
|
17
20
|
|
18
21
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to enforce placing object properties on separate lines.
|
3
3
|
* @author Vitor Balocco
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -12,6 +13,8 @@
|
|
12
13
|
/** @type {import('../shared/types').Rule} */
|
13
14
|
module.exports = {
|
14
15
|
meta: {
|
16
|
+
deprecated: true,
|
17
|
+
replacedBy: [],
|
15
18
|
type: "layout",
|
16
19
|
|
17
20
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to check multiple var declarations per line
|
3
3
|
* @author Alberto Rodríguez
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -11,6 +12,8 @@
|
|
11
12
|
/** @type {import('../shared/types').Rule} */
|
12
13
|
module.exports = {
|
13
14
|
meta: {
|
15
|
+
deprecated: true,
|
16
|
+
replacedBy: [],
|
14
17
|
type: "suggestion",
|
15
18
|
|
16
19
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Operator linebreak - enforces operator linebreak style of two types: after and before
|
3
3
|
* @author Benoît Zugmeyer
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -18,6 +19,8 @@ const astUtils = require("./utils/ast-utils");
|
|
18
19
|
/** @type {import('../shared/types').Rule} */
|
19
20
|
module.exports = {
|
20
21
|
meta: {
|
22
|
+
deprecated: true,
|
23
|
+
replacedBy: [],
|
21
24
|
type: "layout",
|
22
25
|
|
23
26
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview A rule to ensure blank lines within blocks.
|
3
3
|
* @author Mathias Schreck <https://github.com/lo1tuma>
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -18,6 +19,8 @@ const astUtils = require("./utils/ast-utils");
|
|
18
19
|
/** @type {import('../shared/types').Rule} */
|
19
20
|
module.exports = {
|
20
21
|
meta: {
|
22
|
+
deprecated: true,
|
23
|
+
replacedBy: [],
|
21
24
|
type: "layout",
|
22
25
|
|
23
26
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to require or disallow newlines between statements
|
3
3
|
* @author Toru Nagashima
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -383,6 +384,8 @@ const StatementTypes = {
|
|
383
384
|
/** @type {import('../shared/types').Rule} */
|
384
385
|
module.exports = {
|
385
386
|
meta: {
|
387
|
+
deprecated: true,
|
388
|
+
replacedBy: [],
|
386
389
|
type: "layout",
|
387
390
|
|
388
391
|
docs: {
|
package/lib/rules/quote-props.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to flag non-quoted property names in object literals.
|
3
3
|
* @author Mathias Bynens <http://mathiasbynens.be/>
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -19,6 +20,8 @@ const keywords = require("./utils/keywords");
|
|
19
20
|
/** @type {import('../shared/types').Rule} */
|
20
21
|
module.exports = {
|
21
22
|
meta: {
|
23
|
+
deprecated: true,
|
24
|
+
replacedBy: [],
|
22
25
|
type: "suggestion",
|
23
26
|
|
24
27
|
docs: {
|
package/lib/rules/quotes.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview A rule to choose between single and double quote marks
|
3
3
|
* @author Matt DuVall <http://www.mattduvall.com/>, Brandon Payton
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -77,6 +78,8 @@ const AVOID_ESCAPE = "avoid-escape";
|
|
77
78
|
/** @type {import('../shared/types').Rule} */
|
78
79
|
module.exports = {
|
79
80
|
meta: {
|
81
|
+
deprecated: true,
|
82
|
+
replacedBy: [],
|
80
83
|
type: "layout",
|
81
84
|
|
82
85
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Enforce spacing between rest and spread operators and their expressions.
|
3
3
|
* @author Kai Cataldo
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -12,6 +13,8 @@
|
|
12
13
|
/** @type {import('../shared/types').Rule} */
|
13
14
|
module.exports = {
|
14
15
|
meta: {
|
16
|
+
deprecated: true,
|
17
|
+
replacedBy: [],
|
15
18
|
type: "layout",
|
16
19
|
|
17
20
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Validates spacing before and after semicolon
|
3
3
|
* @author Mathias Schreck
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -14,6 +15,8 @@ const astUtils = require("./utils/ast-utils");
|
|
14
15
|
/** @type {import('../shared/types').Rule} */
|
15
16
|
module.exports = {
|
16
17
|
meta: {
|
18
|
+
deprecated: true,
|
19
|
+
replacedBy: [],
|
17
20
|
type: "layout",
|
18
21
|
|
19
22
|
docs: {
|
package/lib/rules/semi-style.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to enforce location of semicolons.
|
3
3
|
* @author Toru Nagashima
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -70,6 +71,8 @@ function isLastChild(node) {
|
|
70
71
|
/** @type {import('../shared/types').Rule} */
|
71
72
|
module.exports = {
|
72
73
|
meta: {
|
74
|
+
deprecated: true,
|
75
|
+
replacedBy: [],
|
73
76
|
type: "layout",
|
74
77
|
|
75
78
|
docs: {
|
package/lib/rules/semi.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to flag missing semicolons.
|
3
3
|
* @author Nicholas C. Zakas
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -18,6 +19,8 @@ const astUtils = require("./utils/ast-utils");
|
|
18
19
|
/** @type {import('../shared/types').Rule} */
|
19
20
|
module.exports = {
|
20
21
|
meta: {
|
22
|
+
deprecated: true,
|
23
|
+
replacedBy: [],
|
21
24
|
type: "layout",
|
22
25
|
|
23
26
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview A rule to ensure whitespace before blocks.
|
3
3
|
* @author Mathias Schreck <https://github.com/lo1tuma>
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -37,6 +38,8 @@ function isFunctionBody(node) {
|
|
37
38
|
/** @type {import('../shared/types').Rule} */
|
38
39
|
module.exports = {
|
39
40
|
meta: {
|
41
|
+
deprecated: true,
|
42
|
+
replacedBy: [],
|
40
43
|
type: "layout",
|
41
44
|
|
42
45
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to validate spacing before function paren.
|
3
3
|
* @author Mathias Schreck <https://github.com/lo1tuma>
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -17,6 +18,8 @@ const astUtils = require("./utils/ast-utils");
|
|
17
18
|
/** @type {import('../shared/types').Rule} */
|
18
19
|
module.exports = {
|
19
20
|
meta: {
|
21
|
+
deprecated: true,
|
22
|
+
replacedBy: [],
|
20
23
|
type: "layout",
|
21
24
|
|
22
25
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Disallows or enforces spaces inside of parentheses.
|
3
3
|
* @author Jonathan Rajavuori
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -13,6 +14,8 @@ const astUtils = require("./utils/ast-utils");
|
|
13
14
|
/** @type {import('../shared/types').Rule} */
|
14
15
|
module.exports = {
|
15
16
|
meta: {
|
17
|
+
deprecated: true,
|
18
|
+
replacedBy: [],
|
16
19
|
type: "layout",
|
17
20
|
|
18
21
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Require spaces around infix operators
|
3
3
|
* @author Michael Ficarra
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -13,6 +14,8 @@ const { isEqToken } = require("./utils/ast-utils");
|
|
13
14
|
/** @type {import('../shared/types').Rule} */
|
14
15
|
module.exports = {
|
15
16
|
meta: {
|
17
|
+
deprecated: true,
|
18
|
+
replacedBy: [],
|
16
19
|
type: "layout",
|
17
20
|
|
18
21
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview This rule should require or disallow spaces before or after unary operations.
|
3
3
|
* @author Marcin Kumorek
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -17,6 +18,8 @@ const astUtils = require("./utils/ast-utils");
|
|
17
18
|
/** @type {import('../shared/types').Rule} */
|
18
19
|
module.exports = {
|
19
20
|
meta: {
|
21
|
+
deprecated: true,
|
22
|
+
replacedBy: [],
|
20
23
|
type: "layout",
|
21
24
|
|
22
25
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Source code for spaced-comments rule
|
3
3
|
* @author Gyandeep Singh
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
"use strict";
|
6
7
|
|
@@ -149,6 +150,8 @@ function createNeverStylePattern(markers) {
|
|
149
150
|
/** @type {import('../shared/types').Rule} */
|
150
151
|
module.exports = {
|
151
152
|
meta: {
|
153
|
+
deprecated: true,
|
154
|
+
replacedBy: [],
|
152
155
|
type: "suggestion",
|
153
156
|
|
154
157
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to enforce spacing around colons of switch statements.
|
3
3
|
* @author Toru Nagashima
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -18,6 +19,8 @@ const astUtils = require("./utils/ast-utils");
|
|
18
19
|
/** @type {import('../shared/types').Rule} */
|
19
20
|
module.exports = {
|
20
21
|
meta: {
|
22
|
+
deprecated: true,
|
23
|
+
replacedBy: [],
|
21
24
|
type: "layout",
|
22
25
|
|
23
26
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to enforce spacing around embedded expressions of template strings
|
3
3
|
* @author Toru Nagashima
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -18,6 +19,8 @@ const astUtils = require("./utils/ast-utils");
|
|
18
19
|
/** @type {import('../shared/types').Rule} */
|
19
20
|
module.exports = {
|
20
21
|
meta: {
|
22
|
+
deprecated: true,
|
23
|
+
replacedBy: [],
|
21
24
|
type: "layout",
|
22
25
|
|
23
26
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to check spacing between template tags and their literals
|
3
3
|
* @author Jonathan Wilsson
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -12,6 +13,8 @@
|
|
12
13
|
/** @type {import('../shared/types').Rule} */
|
13
14
|
module.exports = {
|
14
15
|
meta: {
|
16
|
+
deprecated: true,
|
17
|
+
replacedBy: [],
|
15
18
|
type: "layout",
|
16
19
|
|
17
20
|
docs: {
|
@@ -1015,6 +1015,114 @@ function isDirective(node) {
|
|
1015
1015
|
return node.type === "ExpressionStatement" && typeof node.directive === "string";
|
1016
1016
|
}
|
1017
1017
|
|
1018
|
+
/**
|
1019
|
+
* Tests if a node appears at the beginning of an ancestor ExpressionStatement node.
|
1020
|
+
* @param {ASTNode} node The node to check.
|
1021
|
+
* @returns {boolean} Whether the node appears at the beginning of an ancestor ExpressionStatement node.
|
1022
|
+
*/
|
1023
|
+
function isStartOfExpressionStatement(node) {
|
1024
|
+
const start = node.range[0];
|
1025
|
+
let ancestor = node;
|
1026
|
+
|
1027
|
+
while ((ancestor = ancestor.parent) && ancestor.range[0] === start) {
|
1028
|
+
if (ancestor.type === "ExpressionStatement") {
|
1029
|
+
return true;
|
1030
|
+
}
|
1031
|
+
}
|
1032
|
+
return false;
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
/**
|
1036
|
+
* Determines whether an opening parenthesis `(`, bracket `[` or backtick ``` ` ``` needs to be preceded by a semicolon.
|
1037
|
+
* This opening parenthesis or bracket should be at the start of an `ExpressionStatement` or at the start of the body of an `ArrowFunctionExpression`.
|
1038
|
+
* @type {(sourceCode: SourceCode, node: ASTNode) => boolean}
|
1039
|
+
* @param {SourceCode} sourceCode The source code object.
|
1040
|
+
* @param {ASTNode} node A node at the position where an opening parenthesis or bracket will be inserted.
|
1041
|
+
* @returns {boolean} Whether a semicolon is required before the opening parenthesis or braket.
|
1042
|
+
*/
|
1043
|
+
let needsPrecedingSemicolon;
|
1044
|
+
|
1045
|
+
{
|
1046
|
+
const BREAK_OR_CONTINUE = new Set(["BreakStatement", "ContinueStatement"]);
|
1047
|
+
|
1048
|
+
// Declaration types that must contain a string Literal node at the end.
|
1049
|
+
const DECLARATIONS = new Set(["ExportAllDeclaration", "ExportNamedDeclaration", "ImportDeclaration"]);
|
1050
|
+
|
1051
|
+
const IDENTIFIER_OR_KEYWORD = new Set(["Identifier", "Keyword"]);
|
1052
|
+
|
1053
|
+
// Keywords that can immediately precede an ExpressionStatement node, mapped to the their node types.
|
1054
|
+
const NODE_TYPES_BY_KEYWORD = {
|
1055
|
+
__proto__: null,
|
1056
|
+
break: "BreakStatement",
|
1057
|
+
continue: "ContinueStatement",
|
1058
|
+
debugger: "DebuggerStatement",
|
1059
|
+
do: "DoWhileStatement",
|
1060
|
+
else: "IfStatement",
|
1061
|
+
return: "ReturnStatement",
|
1062
|
+
yield: "YieldExpression"
|
1063
|
+
};
|
1064
|
+
|
1065
|
+
/*
|
1066
|
+
* Before an opening parenthesis, postfix `++` and `--` always trigger ASI;
|
1067
|
+
* the tokens `:`, `;`, `{` and `=>` don't expect a semicolon, as that would count as an empty statement.
|
1068
|
+
*/
|
1069
|
+
const PUNCTUATORS = new Set([":", ";", "{", "=>", "++", "--"]);
|
1070
|
+
|
1071
|
+
/*
|
1072
|
+
* Statements that can contain an `ExpressionStatement` after a closing parenthesis.
|
1073
|
+
* DoWhileStatement is an exception in that it always triggers ASI after the closing parenthesis.
|
1074
|
+
*/
|
1075
|
+
const STATEMENTS = new Set([
|
1076
|
+
"DoWhileStatement",
|
1077
|
+
"ForInStatement",
|
1078
|
+
"ForOfStatement",
|
1079
|
+
"ForStatement",
|
1080
|
+
"IfStatement",
|
1081
|
+
"WhileStatement",
|
1082
|
+
"WithStatement"
|
1083
|
+
]);
|
1084
|
+
|
1085
|
+
needsPrecedingSemicolon =
|
1086
|
+
function(sourceCode, node) {
|
1087
|
+
const prevToken = sourceCode.getTokenBefore(node);
|
1088
|
+
|
1089
|
+
if (!prevToken || prevToken.type === "Punctuator" && PUNCTUATORS.has(prevToken.value)) {
|
1090
|
+
return false;
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
const prevNode = sourceCode.getNodeByRangeIndex(prevToken.range[0]);
|
1094
|
+
|
1095
|
+
if (isClosingParenToken(prevToken)) {
|
1096
|
+
return !STATEMENTS.has(prevNode.type);
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
if (isClosingBraceToken(prevToken)) {
|
1100
|
+
return (
|
1101
|
+
prevNode.type === "BlockStatement" && prevNode.parent.type === "FunctionExpression" ||
|
1102
|
+
prevNode.type === "ClassBody" && prevNode.parent.type === "ClassExpression" ||
|
1103
|
+
prevNode.type === "ObjectExpression"
|
1104
|
+
);
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
if (IDENTIFIER_OR_KEYWORD.has(prevToken.type)) {
|
1108
|
+
if (BREAK_OR_CONTINUE.has(prevNode.parent.type)) {
|
1109
|
+
return false;
|
1110
|
+
}
|
1111
|
+
|
1112
|
+
const keyword = prevToken.value;
|
1113
|
+
const nodeType = NODE_TYPES_BY_KEYWORD[keyword];
|
1114
|
+
|
1115
|
+
return prevNode.type !== nodeType;
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
if (prevToken.type === "String") {
|
1119
|
+
return !DECLARATIONS.has(prevNode.parent.type);
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
return true;
|
1123
|
+
};
|
1124
|
+
}
|
1125
|
+
|
1018
1126
|
//------------------------------------------------------------------------------
|
1019
1127
|
// Public Interface
|
1020
1128
|
//------------------------------------------------------------------------------
|
@@ -2168,5 +2276,7 @@ module.exports = {
|
|
2168
2276
|
getModuleExportName,
|
2169
2277
|
isConstant,
|
2170
2278
|
isTopLevelExpressionStatement,
|
2171
|
-
isDirective
|
2279
|
+
isDirective,
|
2280
|
+
isStartOfExpressionStatement,
|
2281
|
+
needsPrecedingSemicolon
|
2172
2282
|
};
|
package/lib/rules/wrap-iife.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to flag when IIFE is not wrapped in parens
|
3
3
|
* @author Ilya Volodin
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -40,6 +41,8 @@ function isCalleeOfNewExpression(node) {
|
|
40
41
|
/** @type {import('../shared/types').Rule} */
|
41
42
|
module.exports = {
|
42
43
|
meta: {
|
44
|
+
deprecated: true,
|
45
|
+
replacedBy: [],
|
43
46
|
type: "layout",
|
44
47
|
|
45
48
|
docs: {
|
package/lib/rules/wrap-regex.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to flag when regex literals are not wrapped in parens
|
3
3
|
* @author Matt DuVall <http://www.mattduvall.com>
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -12,6 +13,8 @@
|
|
12
13
|
/** @type {import('../shared/types').Rule} */
|
13
14
|
module.exports = {
|
14
15
|
meta: {
|
16
|
+
deprecated: true,
|
17
|
+
replacedBy: [],
|
15
18
|
type: "layout",
|
16
19
|
|
17
20
|
docs: {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Rule to check the spacing around the * in yield* expressions.
|
3
3
|
* @author Bryan Smith
|
4
|
+
* @deprecated in ESLint v8.53.0
|
4
5
|
*/
|
5
6
|
|
6
7
|
"use strict";
|
@@ -12,6 +13,8 @@
|
|
12
13
|
/** @type {import('../shared/types').Rule} */
|
13
14
|
module.exports = {
|
14
15
|
meta: {
|
16
|
+
deprecated: true,
|
17
|
+
replacedBy: [],
|
15
18
|
type: "layout",
|
16
19
|
|
17
20
|
docs: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.54.0",
|
4
4
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
5
5
|
"description": "An AST-based pattern checker for JavaScript.",
|
6
6
|
"bin": {
|
@@ -62,8 +62,8 @@
|
|
62
62
|
"dependencies": {
|
63
63
|
"@eslint-community/eslint-utils": "^4.2.0",
|
64
64
|
"@eslint-community/regexpp": "^4.6.1",
|
65
|
-
"@eslint/eslintrc": "^2.1.
|
66
|
-
"@eslint/js": "8.
|
65
|
+
"@eslint/eslintrc": "^2.1.3",
|
66
|
+
"@eslint/js": "8.54.0",
|
67
67
|
"@humanwhocodes/config-array": "^0.11.13",
|
68
68
|
"@humanwhocodes/module-importer": "^1.0.1",
|
69
69
|
"@nodelib/fs.walk": "^1.2.8",
|
@@ -132,8 +132,8 @@
|
|
132
132
|
"gray-matter": "^4.0.3",
|
133
133
|
"lint-staged": "^11.0.0",
|
134
134
|
"load-perf": "^0.2.0",
|
135
|
-
"markdownlint": "^0.
|
136
|
-
"markdownlint-cli": "^0.
|
135
|
+
"markdownlint": "^0.31.1",
|
136
|
+
"markdownlint-cli": "^0.37.0",
|
137
137
|
"marked": "^4.0.8",
|
138
138
|
"memfs": "^3.0.1",
|
139
139
|
"metascraper": "^5.25.7",
|
@@ -149,13 +149,13 @@
|
|
149
149
|
"pirates": "^4.0.5",
|
150
150
|
"progress": "^2.0.3",
|
151
151
|
"proxyquire": "^2.0.1",
|
152
|
-
"recast": "^0.
|
153
|
-
"regenerator-runtime": "^0.
|
152
|
+
"recast": "^0.23.0",
|
153
|
+
"regenerator-runtime": "^0.14.0",
|
154
154
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
155
155
|
"semver": "^7.5.3",
|
156
156
|
"shelljs": "^0.8.2",
|
157
157
|
"sinon": "^11.0.0",
|
158
|
-
"vite-plugin-commonjs": "^0.
|
158
|
+
"vite-plugin-commonjs": "^0.10.0",
|
159
159
|
"webdriverio": "^8.14.6",
|
160
160
|
"webpack": "^5.23.0",
|
161
161
|
"webpack-cli": "^4.5.0",
|