flatlint 1.50.0 → 1.52.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
package/lib/runner/path.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
isPunctuator,
|
|
6
6
|
isWhiteSpace,
|
|
7
7
|
isTemplateTail,
|
|
8
|
+
isTemplateMiddle,
|
|
8
9
|
} from '#types';
|
|
9
10
|
|
|
10
11
|
const {isArray} = Array;
|
|
@@ -34,7 +35,7 @@ export const createPath = ({tokens, start, end}) => ({
|
|
|
34
35
|
tokens,
|
|
35
36
|
end,
|
|
36
37
|
}),
|
|
37
|
-
|
|
38
|
+
isInsideTemplate: createIsInsideTemplate({
|
|
38
39
|
tokens,
|
|
39
40
|
end,
|
|
40
41
|
}),
|
|
@@ -108,13 +109,16 @@ const createIsNextIdentifier = ({tokens, end}) => (value) => {
|
|
|
108
109
|
return isIdentifier(current, value);
|
|
109
110
|
};
|
|
110
111
|
|
|
111
|
-
const
|
|
112
|
+
const createIsInsideTemplate = ({tokens, end}) => () => {
|
|
112
113
|
const current = next({
|
|
113
114
|
tokens,
|
|
114
115
|
end,
|
|
115
116
|
});
|
|
116
117
|
|
|
117
|
-
|
|
118
|
+
if (isTemplateTail(current))
|
|
119
|
+
return true;
|
|
120
|
+
|
|
121
|
+
return isTemplateMiddle(current);
|
|
118
122
|
};
|
|
119
123
|
|
|
120
124
|
const createIsNextKeyword = ({tokens, end}) => () => {
|
package/lib/types/types.js
CHANGED
|
@@ -2,6 +2,7 @@ const {isArray} = Array;
|
|
|
2
2
|
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
3
3
|
const isString = (a) => typeof a === 'string';
|
|
4
4
|
|
|
5
|
+
export const isTemplateMiddle = (a) => a?.type === 'TemplateMiddle';
|
|
5
6
|
export const isTemplateTail = (a) => a?.type === 'TemplateTail';
|
|
6
7
|
export const isWhiteSpace = ({type}) => type === 'WhiteSpace';
|
|
7
8
|
export const isIdentifier = (token, newToken) => {
|
|
@@ -36,6 +37,7 @@ export const isKeyword = (token) => {
|
|
|
36
37
|
'return',
|
|
37
38
|
'function',
|
|
38
39
|
'of',
|
|
40
|
+
'yield',
|
|
39
41
|
'typeof',
|
|
40
42
|
];
|
|
41
43
|
|