flatlint 1.40.0 → 1.42.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
|
@@ -7,6 +7,9 @@ export const match = () => ({
|
|
|
7
7
|
if (isKeyword(__a))
|
|
8
8
|
return false;
|
|
9
9
|
|
|
10
|
+
if (path.isNextKeyword())
|
|
11
|
+
return false;
|
|
12
|
+
|
|
10
13
|
return !path.isNextPunctuator();
|
|
11
14
|
},
|
|
12
15
|
});
|
|
@@ -14,4 +17,3 @@ export const match = () => ({
|
|
|
14
17
|
export const replace = () => ({
|
|
15
18
|
__a: '__a,',
|
|
16
19
|
});
|
|
17
|
-
|
package/lib/runner/path.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
isKeyword,
|
|
5
5
|
isPunctuator,
|
|
6
6
|
isWhiteSpace,
|
|
7
|
+
isTemplateTail,
|
|
7
8
|
} from '#types';
|
|
8
9
|
|
|
9
10
|
const {isArray} = Array;
|
|
@@ -33,6 +34,10 @@ export const createPath = ({tokens, start, end}) => ({
|
|
|
33
34
|
tokens,
|
|
34
35
|
end,
|
|
35
36
|
}),
|
|
37
|
+
isNextTemplateTail: createIsNextTemplateTail({
|
|
38
|
+
tokens,
|
|
39
|
+
end,
|
|
40
|
+
}),
|
|
36
41
|
isNext: createIsNext({
|
|
37
42
|
tokens,
|
|
38
43
|
end,
|
|
@@ -103,6 +108,15 @@ const createIsNextIdentifier = ({tokens, end}) => (value) => {
|
|
|
103
108
|
return isIdentifier(current, value);
|
|
104
109
|
};
|
|
105
110
|
|
|
111
|
+
const createIsNextTemplateTail = ({tokens, end}) => () => {
|
|
112
|
+
const current = next({
|
|
113
|
+
tokens,
|
|
114
|
+
end,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return isTemplateTail(current);
|
|
118
|
+
};
|
|
119
|
+
|
|
106
120
|
const createIsNextKeyword = ({tokens, end}) => () => {
|
|
107
121
|
const current = next({
|
|
108
122
|
tokens,
|
package/lib/types/types.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
const {isArray} = Array;
|
|
2
|
-
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
3
1
|
const isString = (a) => typeof a === 'string';
|
|
4
2
|
|
|
3
|
+
export const isTemplateTail = (a) => a?.type === 'TemplateTail';
|
|
5
4
|
export const isWhiteSpace = ({type}) => type === 'WhiteSpace';
|
|
6
5
|
export const isIdentifier = (token, value = token.value) => {
|
|
7
6
|
const {type} = token;
|
|
@@ -19,6 +18,7 @@ export const isNewLine = ({type}) => type === 'LineTerminatorSequence';
|
|
|
19
18
|
export const notWhiteSpace = (a) => !isWhiteSpace(a);
|
|
20
19
|
export const isKeyword = (token) => {
|
|
21
20
|
const keywords = [
|
|
21
|
+
'as',
|
|
22
22
|
'await',
|
|
23
23
|
'var',
|
|
24
24
|
'let',
|
|
@@ -126,4 +126,3 @@ export const quote = Punctuator(`'`);
|
|
|
126
126
|
|
|
127
127
|
export const OK = true;
|
|
128
128
|
export const NOT_OK = false;
|
|
129
|
-
|