flatlint 1.78.0 → 1.80.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
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
isOneOfKeywords,
|
|
7
7
|
isOneOfPunctuators,
|
|
8
8
|
isPunctuator,
|
|
9
|
+
openCurlyBrace,
|
|
9
10
|
openRoundBrace,
|
|
10
11
|
openSquireBrace,
|
|
11
12
|
quote,
|
|
@@ -38,9 +39,7 @@ export const match = () => ({
|
|
|
38
39
|
|
|
39
40
|
return !path.isNextPunctuator(quote);
|
|
40
41
|
},
|
|
41
|
-
'__a.__b = __expr,': ({
|
|
42
|
-
return !path.isNextPunctuator(quote);
|
|
43
|
-
},
|
|
42
|
+
'__a.__b = __expr,': ({}, path) => !path.isNextPunctuator([quote, openCurlyBrace]),
|
|
44
43
|
});
|
|
45
44
|
|
|
46
45
|
export const replace = () => ({
|
|
@@ -52,7 +51,7 @@ export const replace = () => ({
|
|
|
52
51
|
'__a.__b = __expr,': '__a.__b = __expr;',
|
|
53
52
|
});
|
|
54
53
|
|
|
55
|
-
const check = ({__x
|
|
54
|
+
const check = ({__x}, path) => {
|
|
56
55
|
if (!isOneOfKeywords(__x, ['var', 'let', 'const']))
|
|
57
56
|
return false;
|
|
58
57
|
|
|
@@ -64,4 +63,3 @@ const check = ({__x, __a}, path) => {
|
|
|
64
63
|
|
|
65
64
|
return path.isNextKeyword() && !path.isNextIdentifier('new');
|
|
66
65
|
};
|
|
67
|
-
|
package/lib/runner/path.js
CHANGED
package/lib/types/types.js
CHANGED
|
@@ -25,7 +25,10 @@ export const isStringLiteral = ({type}) => type === 'StringLiteral';
|
|
|
25
25
|
export const isNumericLiteral = ({type}) => type === 'NumericLiteral';
|
|
26
26
|
export const isNewLine = ({type}) => type === 'LineTerminatorSequence';
|
|
27
27
|
export const notWhiteSpace = (a) => !isWhiteSpace(a);
|
|
28
|
-
export const isKeyword = (token) => {
|
|
28
|
+
export const isKeyword = (token, name) => {
|
|
29
|
+
if (!token)
|
|
30
|
+
return false;
|
|
31
|
+
|
|
29
32
|
const keywords = [
|
|
30
33
|
'as',
|
|
31
34
|
'await',
|
|
@@ -200,3 +203,4 @@ export const isBalancedRoundBraces = (tokens) => {
|
|
|
200
203
|
|
|
201
204
|
return !roundBalance;
|
|
202
205
|
};
|
|
206
|
+
|