eslint 9.39.1 → 10.0.0-alpha.1
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 +3 -3
- package/bin/eslint.js +1 -2
- package/lib/api.js +4 -15
- package/lib/cli.js +14 -56
- package/lib/config/config-loader.js +6 -154
- package/lib/eslint/eslint-helpers.js +5 -8
- package/lib/eslint/eslint.js +1 -1
- package/lib/eslint/index.js +0 -2
- package/lib/languages/js/source-code/source-code.js +66 -252
- package/lib/languages/js/source-code/token-store/index.js +0 -26
- package/lib/languages/js/source-code/token-store/utils.js +29 -8
- package/lib/linter/apply-disable-directives.js +0 -1
- package/lib/linter/file-context.js +0 -56
- package/lib/linter/file-report.js +0 -4
- package/lib/linter/linter.js +45 -1086
- package/lib/linter/rule-fixer.js +30 -0
- package/lib/options.js +62 -182
- package/lib/rule-tester/rule-tester.js +265 -194
- package/lib/rules/array-bracket-spacing.js +4 -4
- package/lib/rules/block-spacing.js +1 -1
- package/lib/rules/comma-spacing.js +2 -5
- package/lib/rules/computed-property-spacing.js +4 -4
- package/lib/rules/dot-notation.js +2 -2
- package/lib/rules/func-names.js +2 -0
- package/lib/rules/keyword-spacing.js +4 -4
- package/lib/rules/no-eval.js +1 -1
- package/lib/rules/no-extra-parens.js +1 -1
- package/lib/rules/no-invalid-regexp.js +1 -0
- package/lib/rules/no-shadow-restricted-names.js +1 -1
- package/lib/rules/no-spaced-func.js +1 -1
- package/lib/rules/no-unassigned-vars.js +1 -1
- package/lib/rules/no-useless-assignment.js +1 -1
- package/lib/rules/no-useless-constructor.js +13 -3
- package/lib/rules/no-whitespace-before-property.js +1 -1
- package/lib/rules/object-curly-spacing.js +2 -8
- package/lib/rules/preserve-caught-error.js +1 -1
- package/lib/rules/radix.js +25 -48
- package/lib/rules/require-yield.js +11 -1
- package/lib/rules/rest-spread-spacing.js +1 -4
- package/lib/rules/semi-spacing.js +2 -2
- package/lib/rules/space-before-blocks.js +1 -1
- package/lib/rules/space-before-function-paren.js +1 -4
- package/lib/rules/space-in-parens.js +4 -4
- package/lib/rules/space-infix-ops.js +4 -7
- package/lib/rules/switch-colon-spacing.js +1 -1
- package/lib/rules/template-tag-spacing.js +1 -1
- package/lib/rules/utils/ast-utils.js +114 -22
- package/lib/rules/yield-star-spacing.js +1 -2
- package/lib/services/parser-service.js +0 -1
- package/lib/services/processor-service.js +0 -1
- package/lib/services/warning-service.js +0 -11
- package/lib/shared/flags.js +0 -19
- package/lib/shared/translate-cli-options.js +106 -164
- package/lib/types/index.d.ts +7 -81
- package/lib/types/rules.d.ts +11 -2
- package/lib/types/use-at-your-own-risk.d.ts +1 -54
- package/lib/unsupported-api.js +3 -6
- package/package.json +15 -20
- package/conf/default-cli-options.js +0 -32
- package/lib/cli-engine/cli-engine.js +0 -1109
- package/lib/cli-engine/file-enumerator.js +0 -541
- package/lib/cli-engine/index.js +0 -7
- package/lib/cli-engine/load-rules.js +0 -46
- package/lib/eslint/legacy-eslint.js +0 -786
|
@@ -203,13 +203,13 @@ module.exports = {
|
|
|
203
203
|
if (astUtils.isTokenOnSameLine(before, first)) {
|
|
204
204
|
if (propertyNameMustBeSpaced) {
|
|
205
205
|
if (
|
|
206
|
-
!sourceCode.
|
|
206
|
+
!sourceCode.isSpaceBetween(before, first) &&
|
|
207
207
|
astUtils.isTokenOnSameLine(before, first)
|
|
208
208
|
) {
|
|
209
209
|
reportRequiredBeginningSpace(node, before);
|
|
210
210
|
}
|
|
211
211
|
} else {
|
|
212
|
-
if (sourceCode.
|
|
212
|
+
if (sourceCode.isSpaceBetween(before, first)) {
|
|
213
213
|
reportNoBeginningSpace(node, before, first);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
@@ -218,13 +218,13 @@ module.exports = {
|
|
|
218
218
|
if (astUtils.isTokenOnSameLine(last, after)) {
|
|
219
219
|
if (propertyNameMustBeSpaced) {
|
|
220
220
|
if (
|
|
221
|
-
!sourceCode.
|
|
221
|
+
!sourceCode.isSpaceBetween(last, after) &&
|
|
222
222
|
astUtils.isTokenOnSameLine(last, after)
|
|
223
223
|
) {
|
|
224
224
|
reportRequiredEndingSpace(node, after);
|
|
225
225
|
}
|
|
226
226
|
} else {
|
|
227
|
-
if (sourceCode.
|
|
227
|
+
if (sourceCode.isSpaceBetween(last, after)) {
|
|
228
228
|
reportNoEndingSpace(node, after, last);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -76,7 +76,7 @@ module.exports = {
|
|
|
76
76
|
/**
|
|
77
77
|
* Check if the property is valid dot notation
|
|
78
78
|
* @param {ASTNode} node The dot notation node
|
|
79
|
-
* @param {string} value Value which is to be checked
|
|
79
|
+
* @param {string|boolean|null} value Value which is to be checked
|
|
80
80
|
* @returns {void}
|
|
81
81
|
*/
|
|
82
82
|
function checkComputedProperty(node, value) {
|
|
@@ -125,7 +125,7 @@ module.exports = {
|
|
|
125
125
|
}
|
|
126
126
|
yield fixer.replaceTextRange(
|
|
127
127
|
[leftBracket.range[0], rightBracket.range[1]],
|
|
128
|
-
value,
|
|
128
|
+
String(value),
|
|
129
129
|
);
|
|
130
130
|
|
|
131
131
|
// Insert a space after the property if it will be connected to the next token.
|
package/lib/rules/func-names.js
CHANGED
|
@@ -43,6 +43,7 @@ module.exports = {
|
|
|
43
43
|
enum: ["always", "as-needed", "never"],
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
|
+
type: "array",
|
|
46
47
|
items: [
|
|
47
48
|
{
|
|
48
49
|
$ref: "#/definitions/value",
|
|
@@ -57,6 +58,7 @@ module.exports = {
|
|
|
57
58
|
additionalProperties: false,
|
|
58
59
|
},
|
|
59
60
|
],
|
|
61
|
+
additionalItems: false,
|
|
60
62
|
},
|
|
61
63
|
|
|
62
64
|
messages: {
|
|
@@ -163,7 +163,7 @@ module.exports = {
|
|
|
163
163
|
!isOpenParenOfTemplate(prevToken) &&
|
|
164
164
|
!tokensToIgnore.has(prevToken) &&
|
|
165
165
|
astUtils.isTokenOnSameLine(prevToken, token) &&
|
|
166
|
-
!sourceCode.
|
|
166
|
+
!sourceCode.isSpaceBetween(prevToken, token)
|
|
167
167
|
) {
|
|
168
168
|
context.report({
|
|
169
169
|
loc: token.loc,
|
|
@@ -192,7 +192,7 @@ module.exports = {
|
|
|
192
192
|
!isOpenParenOfTemplate(prevToken) &&
|
|
193
193
|
!tokensToIgnore.has(prevToken) &&
|
|
194
194
|
astUtils.isTokenOnSameLine(prevToken, token) &&
|
|
195
|
-
sourceCode.
|
|
195
|
+
sourceCode.isSpaceBetween(prevToken, token)
|
|
196
196
|
) {
|
|
197
197
|
context.report({
|
|
198
198
|
loc: { start: prevToken.loc.end, end: token.loc.start },
|
|
@@ -224,7 +224,7 @@ module.exports = {
|
|
|
224
224
|
!isCloseParenOfTemplate(nextToken) &&
|
|
225
225
|
!tokensToIgnore.has(nextToken) &&
|
|
226
226
|
astUtils.isTokenOnSameLine(token, nextToken) &&
|
|
227
|
-
!sourceCode.
|
|
227
|
+
!sourceCode.isSpaceBetween(token, nextToken)
|
|
228
228
|
) {
|
|
229
229
|
context.report({
|
|
230
230
|
loc: token.loc,
|
|
@@ -253,7 +253,7 @@ module.exports = {
|
|
|
253
253
|
!isCloseParenOfTemplate(nextToken) &&
|
|
254
254
|
!tokensToIgnore.has(nextToken) &&
|
|
255
255
|
astUtils.isTokenOnSameLine(token, nextToken) &&
|
|
256
|
-
sourceCode.
|
|
256
|
+
sourceCode.isSpaceBetween(token, nextToken)
|
|
257
257
|
) {
|
|
258
258
|
context.report({
|
|
259
259
|
loc: { start: token.loc.end, end: nextToken.loc.start },
|
package/lib/rules/no-eval.js
CHANGED
|
@@ -185,6 +185,8 @@ module.exports = {
|
|
|
185
185
|
},
|
|
186
186
|
|
|
187
187
|
create(context) {
|
|
188
|
+
const { sourceCode } = context;
|
|
189
|
+
|
|
188
190
|
/**
|
|
189
191
|
* Checks whether a node is a redundant constructor
|
|
190
192
|
* @param {ASTNode} node node to check
|
|
@@ -211,6 +213,14 @@ module.exports = {
|
|
|
211
213
|
const body = node.value.body.body;
|
|
212
214
|
const ctorParams = node.value.params;
|
|
213
215
|
const superClass = node.parent.parent.superClass;
|
|
216
|
+
const parenToken = sourceCode.getFirstToken(
|
|
217
|
+
node,
|
|
218
|
+
astUtils.isOpeningParenToken,
|
|
219
|
+
);
|
|
220
|
+
const loc = {
|
|
221
|
+
start: node.loc.start,
|
|
222
|
+
end: sourceCode.getTokenBefore(parenToken).loc.end,
|
|
223
|
+
};
|
|
214
224
|
|
|
215
225
|
if (
|
|
216
226
|
superClass
|
|
@@ -218,19 +228,19 @@ module.exports = {
|
|
|
218
228
|
: body.length === 0
|
|
219
229
|
) {
|
|
220
230
|
context.report({
|
|
221
|
-
|
|
231
|
+
loc,
|
|
222
232
|
messageId: "noUselessConstructor",
|
|
223
233
|
suggest: [
|
|
224
234
|
{
|
|
225
235
|
messageId: "removeConstructor",
|
|
226
236
|
*fix(fixer) {
|
|
227
237
|
const nextToken =
|
|
228
|
-
|
|
238
|
+
sourceCode.getTokenAfter(node);
|
|
229
239
|
const addSemiColon =
|
|
230
240
|
nextToken.type === "Punctuator" &&
|
|
231
241
|
nextToken.value === "[" &&
|
|
232
242
|
astUtils.needsPrecedingSemicolon(
|
|
233
|
-
|
|
243
|
+
sourceCode,
|
|
234
244
|
node,
|
|
235
245
|
);
|
|
236
246
|
|
|
@@ -141,7 +141,7 @@ module.exports = {
|
|
|
141
141
|
leftToken = sourceCode.getTokenBefore(rightToken, 1);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
if (sourceCode.
|
|
144
|
+
if (sourceCode.isSpaceBetween(leftToken, rightToken)) {
|
|
145
145
|
reportError(node, leftToken, rightToken);
|
|
146
146
|
}
|
|
147
147
|
},
|
|
@@ -204,10 +204,7 @@ module.exports = {
|
|
|
204
204
|
*/
|
|
205
205
|
function validateBraceSpacing(node, first, second, penultimate, last) {
|
|
206
206
|
if (astUtils.isTokenOnSameLine(first, second)) {
|
|
207
|
-
const firstSpaced = sourceCode.
|
|
208
|
-
first,
|
|
209
|
-
second,
|
|
210
|
-
);
|
|
207
|
+
const firstSpaced = sourceCode.isSpaceBetween(first, second);
|
|
211
208
|
|
|
212
209
|
if (options.spaced && !firstSpaced) {
|
|
213
210
|
reportRequiredBeginningSpace(node, first);
|
|
@@ -236,10 +233,7 @@ module.exports = {
|
|
|
236
233
|
? !options.spaced
|
|
237
234
|
: options.spaced;
|
|
238
235
|
|
|
239
|
-
const lastSpaced = sourceCode.
|
|
240
|
-
penultimate,
|
|
241
|
-
last,
|
|
242
|
-
);
|
|
236
|
+
const lastSpaced = sourceCode.isSpaceBetween(penultimate, last);
|
|
243
237
|
|
|
244
238
|
if (closingCurlyBraceMustBeSpaced && !lastSpaced) {
|
|
245
239
|
reportRequiredEndingSpace(node, last);
|
|
@@ -158,7 +158,7 @@ module.exports = {
|
|
|
158
158
|
docs: {
|
|
159
159
|
description:
|
|
160
160
|
"Disallow losing originally caught error when re-throwing custom errors",
|
|
161
|
-
recommended:
|
|
161
|
+
recommended: true,
|
|
162
162
|
url: "https://eslint.org/docs/latest/rules/preserve-caught-error", // URL to the documentation page for this rule
|
|
163
163
|
},
|
|
164
164
|
/*
|
package/lib/rules/radix.js
CHANGED
|
@@ -15,9 +15,6 @@ const astUtils = require("./utils/ast-utils");
|
|
|
15
15
|
// Helpers
|
|
16
16
|
//------------------------------------------------------------------------------
|
|
17
17
|
|
|
18
|
-
const MODE_ALWAYS = "always",
|
|
19
|
-
MODE_AS_NEEDED = "as-needed";
|
|
20
|
-
|
|
21
18
|
const validRadixValues = new Set(
|
|
22
19
|
Array.from({ length: 37 - 2 }, (_, index) => index + 2),
|
|
23
20
|
);
|
|
@@ -63,15 +60,6 @@ function isValidRadix(radix) {
|
|
|
63
60
|
);
|
|
64
61
|
}
|
|
65
62
|
|
|
66
|
-
/**
|
|
67
|
-
* Checks whether a given node is a default value of radix or not.
|
|
68
|
-
* @param {ASTNode} radix A node of radix to check.
|
|
69
|
-
* @returns {boolean} `true` if the node is the literal node of `10`.
|
|
70
|
-
*/
|
|
71
|
-
function isDefaultRadix(radix) {
|
|
72
|
-
return radix.type === "Literal" && radix.value === 10;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
63
|
//------------------------------------------------------------------------------
|
|
76
64
|
// Rule Definition
|
|
77
65
|
//------------------------------------------------------------------------------
|
|
@@ -81,11 +69,9 @@ module.exports = {
|
|
|
81
69
|
meta: {
|
|
82
70
|
type: "suggestion",
|
|
83
71
|
|
|
84
|
-
defaultOptions: [MODE_ALWAYS],
|
|
85
|
-
|
|
86
72
|
docs: {
|
|
87
73
|
description:
|
|
88
|
-
"Enforce the
|
|
74
|
+
"Enforce the use of the radix argument when using `parseInt()`",
|
|
89
75
|
recommended: false,
|
|
90
76
|
url: "https://eslint.org/docs/latest/rules/radix",
|
|
91
77
|
},
|
|
@@ -93,6 +79,7 @@ module.exports = {
|
|
|
93
79
|
hasSuggestions: true,
|
|
94
80
|
|
|
95
81
|
schema: [
|
|
82
|
+
// deprecated
|
|
96
83
|
{
|
|
97
84
|
enum: ["always", "as-needed"],
|
|
98
85
|
},
|
|
@@ -100,7 +87,6 @@ module.exports = {
|
|
|
100
87
|
|
|
101
88
|
messages: {
|
|
102
89
|
missingParameters: "Missing parameters.",
|
|
103
|
-
redundantRadix: "Redundant radix parameter.",
|
|
104
90
|
missingRadix: "Missing radix parameter.",
|
|
105
91
|
invalidRadix:
|
|
106
92
|
"Invalid radix parameter, must be an integer between 2 and 36.",
|
|
@@ -110,7 +96,6 @@ module.exports = {
|
|
|
110
96
|
},
|
|
111
97
|
|
|
112
98
|
create(context) {
|
|
113
|
-
const [mode] = context.options;
|
|
114
99
|
const sourceCode = context.sourceCode;
|
|
115
100
|
|
|
116
101
|
/**
|
|
@@ -131,41 +116,33 @@ module.exports = {
|
|
|
131
116
|
break;
|
|
132
117
|
|
|
133
118
|
case 1:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
hasTrailingComma ? " 10," : ", 10",
|
|
154
|
-
);
|
|
155
|
-
},
|
|
119
|
+
context.report({
|
|
120
|
+
node,
|
|
121
|
+
messageId: "missingRadix",
|
|
122
|
+
suggest: [
|
|
123
|
+
{
|
|
124
|
+
messageId: "addRadixParameter10",
|
|
125
|
+
fix(fixer) {
|
|
126
|
+
const tokens = sourceCode.getTokens(node);
|
|
127
|
+
const lastToken = tokens.at(-1); // Parenthesis.
|
|
128
|
+
const secondToLastToken = tokens.at(-2); // May or may not be a comma.
|
|
129
|
+
const hasTrailingComma =
|
|
130
|
+
secondToLastToken.type ===
|
|
131
|
+
"Punctuator" &&
|
|
132
|
+
secondToLastToken.value === ",";
|
|
133
|
+
|
|
134
|
+
return fixer.insertTextBefore(
|
|
135
|
+
lastToken,
|
|
136
|
+
hasTrailingComma ? " 10," : ", 10",
|
|
137
|
+
);
|
|
156
138
|
},
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
});
|
|
160
142
|
break;
|
|
161
143
|
|
|
162
144
|
default:
|
|
163
|
-
if (
|
|
164
|
-
context.report({
|
|
165
|
-
node,
|
|
166
|
-
messageId: "redundantRadix",
|
|
167
|
-
});
|
|
168
|
-
} else if (!isValidRadix(args[1])) {
|
|
145
|
+
if (!isValidRadix(args[1])) {
|
|
169
146
|
context.report({
|
|
170
147
|
node,
|
|
171
148
|
messageId: "invalidRadix",
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
|
+
//------------------------------------------------------------------------------
|
|
9
|
+
// Requirements
|
|
10
|
+
//------------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
const astUtils = require("./utils/ast-utils");
|
|
13
|
+
|
|
8
14
|
//------------------------------------------------------------------------------
|
|
9
15
|
// Rule Definition
|
|
10
16
|
//------------------------------------------------------------------------------
|
|
@@ -29,6 +35,7 @@ module.exports = {
|
|
|
29
35
|
|
|
30
36
|
create(context) {
|
|
31
37
|
const stack = [];
|
|
38
|
+
const sourceCode = context.sourceCode;
|
|
32
39
|
|
|
33
40
|
/**
|
|
34
41
|
* If the node is a generator function, start counting `yield` keywords.
|
|
@@ -55,7 +62,10 @@ module.exports = {
|
|
|
55
62
|
const countYield = stack.pop();
|
|
56
63
|
|
|
57
64
|
if (countYield === 0 && node.body.body.length > 0) {
|
|
58
|
-
context.report({
|
|
65
|
+
context.report({
|
|
66
|
+
loc: astUtils.getFunctionHeadLoc(node, sourceCode),
|
|
67
|
+
messageId: "missingYield",
|
|
68
|
+
});
|
|
59
69
|
}
|
|
60
70
|
}
|
|
61
71
|
|
|
@@ -74,10 +74,7 @@ module.exports = {
|
|
|
74
74
|
function checkWhiteSpace(node) {
|
|
75
75
|
const operator = sourceCode.getFirstToken(node),
|
|
76
76
|
nextToken = sourceCode.getTokenAfter(operator),
|
|
77
|
-
hasWhitespace = sourceCode.
|
|
78
|
-
operator,
|
|
79
|
-
nextToken,
|
|
80
|
-
);
|
|
77
|
+
hasWhitespace = sourceCode.isSpaceBetween(operator, nextToken);
|
|
81
78
|
let type;
|
|
82
79
|
|
|
83
80
|
switch (node.type) {
|
|
@@ -95,7 +95,7 @@ module.exports = {
|
|
|
95
95
|
return (
|
|
96
96
|
tokenBefore &&
|
|
97
97
|
astUtils.isTokenOnSameLine(tokenBefore, token) &&
|
|
98
|
-
sourceCode.
|
|
98
|
+
sourceCode.isSpaceBetween(tokenBefore, token)
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -110,7 +110,7 @@ module.exports = {
|
|
|
110
110
|
return (
|
|
111
111
|
tokenAfter &&
|
|
112
112
|
astUtils.isTokenOnSameLine(token, tokenAfter) &&
|
|
113
|
-
sourceCode.
|
|
113
|
+
sourceCode.isSpaceBetween(token, tokenAfter)
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -164,7 +164,7 @@ module.exports = {
|
|
|
164
164
|
!isConflicted(precedingToken, node) &&
|
|
165
165
|
astUtils.isTokenOnSameLine(precedingToken, node)
|
|
166
166
|
) {
|
|
167
|
-
const hasSpace = sourceCode.
|
|
167
|
+
const hasSpace = sourceCode.isSpaceBetween(
|
|
168
168
|
precedingToken,
|
|
169
169
|
node,
|
|
170
170
|
);
|
|
@@ -155,10 +155,7 @@ module.exports = {
|
|
|
155
155
|
astUtils.isOpeningParenToken,
|
|
156
156
|
);
|
|
157
157
|
const leftToken = sourceCode.getTokenBefore(rightToken);
|
|
158
|
-
const hasSpacing = sourceCode.
|
|
159
|
-
leftToken,
|
|
160
|
-
rightToken,
|
|
161
|
-
);
|
|
158
|
+
const hasSpacing = sourceCode.isSpaceBetween(leftToken, rightToken);
|
|
162
159
|
|
|
163
160
|
if (hasSpacing && functionConfig === "never") {
|
|
164
161
|
context.report({
|
|
@@ -153,7 +153,7 @@ module.exports = {
|
|
|
153
153
|
*/
|
|
154
154
|
function openerMissingSpace(openingParenToken, tokenAfterOpeningParen) {
|
|
155
155
|
if (
|
|
156
|
-
sourceCode.
|
|
156
|
+
sourceCode.isSpaceBetween(
|
|
157
157
|
openingParenToken,
|
|
158
158
|
tokenAfterOpeningParen,
|
|
159
159
|
)
|
|
@@ -195,7 +195,7 @@ module.exports = {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
if (
|
|
198
|
-
!sourceCode.
|
|
198
|
+
!sourceCode.isSpaceBetween(
|
|
199
199
|
openingParenToken,
|
|
200
200
|
tokenAfterOpeningParen,
|
|
201
201
|
)
|
|
@@ -220,7 +220,7 @@ module.exports = {
|
|
|
220
220
|
closingParenToken,
|
|
221
221
|
) {
|
|
222
222
|
if (
|
|
223
|
-
sourceCode.
|
|
223
|
+
sourceCode.isSpaceBetween(
|
|
224
224
|
tokenBeforeClosingParen,
|
|
225
225
|
closingParenToken,
|
|
226
226
|
)
|
|
@@ -261,7 +261,7 @@ module.exports = {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
if (
|
|
264
|
-
!sourceCode.
|
|
264
|
+
!sourceCode.isSpaceBetween(
|
|
265
265
|
tokenBeforeClosingParen,
|
|
266
266
|
closingParenToken,
|
|
267
267
|
)
|
|
@@ -87,8 +87,8 @@ module.exports = {
|
|
|
87
87
|
const next = sourceCode.getTokenAfter(operator);
|
|
88
88
|
|
|
89
89
|
if (
|
|
90
|
-
!sourceCode.
|
|
91
|
-
!sourceCode.
|
|
90
|
+
!sourceCode.isSpaceBetween(prev, operator) ||
|
|
91
|
+
!sourceCode.isSpaceBetween(operator, next)
|
|
92
92
|
) {
|
|
93
93
|
return operator;
|
|
94
94
|
}
|
|
@@ -238,11 +238,8 @@ module.exports = {
|
|
|
238
238
|
const rightToken = sourceCode.getTokenAfter(operatorToken);
|
|
239
239
|
|
|
240
240
|
if (
|
|
241
|
-
!sourceCode.
|
|
242
|
-
|
|
243
|
-
operatorToken,
|
|
244
|
-
) ||
|
|
245
|
-
!sourceCode.isSpaceBetweenTokens(operatorToken, rightToken)
|
|
241
|
+
!sourceCode.isSpaceBetween(leftToken, operatorToken) ||
|
|
242
|
+
!sourceCode.isSpaceBetween(operatorToken, rightToken)
|
|
246
243
|
) {
|
|
247
244
|
report(node, operatorToken);
|
|
248
245
|
}
|
|
@@ -66,7 +66,7 @@ module.exports = {
|
|
|
66
66
|
function checkSpacing(node) {
|
|
67
67
|
const tagToken = sourceCode.getTokenBefore(node.quasi);
|
|
68
68
|
const literalToken = sourceCode.getFirstToken(node.quasi);
|
|
69
|
-
const hasWhitespace = sourceCode.
|
|
69
|
+
const hasWhitespace = sourceCode.isSpaceBetween(
|
|
70
70
|
tagToken,
|
|
71
71
|
literalToken,
|
|
72
72
|
);
|