flatlint 1.48.0 → 1.49.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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
closeCurlyBrace,
|
|
3
|
+
colon,
|
|
3
4
|
isIdentifier,
|
|
4
5
|
isPunctuator,
|
|
5
6
|
openSquireBrace,
|
|
@@ -30,6 +31,14 @@ export const match = () => ({
|
|
|
30
31
|
|
|
31
32
|
return path.isNextIdentifier('const');
|
|
32
33
|
},
|
|
34
|
+
'}),': (vars, path) => {
|
|
35
|
+
for (const token of path.getAllPrev()) {
|
|
36
|
+
if (isPunctuator(token, colon))
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return !path.isNext();
|
|
41
|
+
},
|
|
33
42
|
});
|
|
34
43
|
|
|
35
44
|
export const replace = () => ({
|
package/lib/types/types.js
CHANGED
|
@@ -4,14 +4,19 @@ const isString = (a) => typeof a === 'string';
|
|
|
4
4
|
|
|
5
5
|
export const isTemplateTail = (a) => a?.type === 'TemplateTail';
|
|
6
6
|
export const isWhiteSpace = ({type}) => type === 'WhiteSpace';
|
|
7
|
-
export const isIdentifier = (token,
|
|
7
|
+
export const isIdentifier = (token, newToken) => {
|
|
8
8
|
const {type} = token;
|
|
9
9
|
const is = type === 'IdentifierName';
|
|
10
10
|
|
|
11
11
|
if (!is)
|
|
12
12
|
return false;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
if (!newToken)
|
|
15
|
+
return true;
|
|
16
|
+
|
|
17
|
+
const newValue = newToken.value || newToken;
|
|
18
|
+
|
|
19
|
+
return newValue === token.value;
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
export const isStringLiteral = ({type}) => type === 'StringLiteral';
|