flatlint 2.1.7 → 2.3.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
|
@@ -39,18 +39,16 @@ export const collectArgs = ({currentTokenIndex, tokens}) => {
|
|
|
39
39
|
if (equal(token, openCurlyBrace))
|
|
40
40
|
++curlyBracesBalance;
|
|
41
41
|
|
|
42
|
-
if (equal(token, closeCurlyBrace))
|
|
42
|
+
if (equal(token, closeCurlyBrace))
|
|
43
43
|
--curlyBracesBalance;
|
|
44
|
-
const next = getNext({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
}
|
|
44
|
+
//const next = getNext({
|
|
45
|
+
// tokens,
|
|
46
|
+
// end: index + 1,
|
|
47
|
+
//});
|
|
48
|
+
// if (isIdentifier(next)) {
|
|
49
|
+
// ++index;
|
|
50
|
+
// break;
|
|
51
|
+
// }
|
|
54
52
|
|
|
55
53
|
if (equal(token, semicolon) && !curlyBracesBalance)
|
|
56
54
|
break;
|
|
@@ -70,3 +68,4 @@ export const collectArgs = ({currentTokenIndex, tokens}) => {
|
|
|
70
68
|
--index,
|
|
71
69
|
];
|
|
72
70
|
};
|
|
71
|
+
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
assign,
|
|
2
3
|
closeRoundBrace,
|
|
3
4
|
closeSquareBrace,
|
|
4
5
|
colon,
|
|
@@ -6,12 +7,13 @@ import {
|
|
|
6
7
|
isKeyword,
|
|
7
8
|
isPunctuator,
|
|
8
9
|
openRoundBrace,
|
|
10
|
+
semicolon,
|
|
9
11
|
} from '#types';
|
|
10
12
|
|
|
11
13
|
export const report = () => 'Add missing round brace';
|
|
12
14
|
|
|
13
15
|
export const match = () => ({
|
|
14
|
-
'__a(__args': (
|
|
16
|
+
'__a(__args': ({__a, __args}, path) => {
|
|
15
17
|
if (path.isCurrentPunctuator(closeRoundBrace))
|
|
16
18
|
return false;
|
|
17
19
|
|
|
@@ -60,6 +62,12 @@ export const match = () => ({
|
|
|
60
62
|
|
|
61
63
|
return false;
|
|
62
64
|
},
|
|
65
|
+
'}': (vars, path) => {
|
|
66
|
+
if (path.isNextKeyword())
|
|
67
|
+
return false;
|
|
68
|
+
|
|
69
|
+
return path.isNextCompare('__a(');
|
|
70
|
+
},
|
|
63
71
|
});
|
|
64
72
|
|
|
65
73
|
export const replace = () => ({
|
|
@@ -72,4 +80,6 @@ export const replace = () => ({
|
|
|
72
80
|
'{__a} = __expr;': '({__a} = __expr);',
|
|
73
81
|
'{__a} = __expr': '({__a} = __expr)',
|
|
74
82
|
'__a;': '__a);',
|
|
83
|
+
'}': '})',
|
|
75
84
|
});
|
|
85
|
+
|
package/lib/types/types.js
CHANGED
|
@@ -9,9 +9,6 @@ export const isNoSubstitutionTemplate = (a) => a?.type === 'NoSubstitutionTempla
|
|
|
9
9
|
export const isTemplateTail = (a) => a?.type === 'TemplateTail';
|
|
10
10
|
export const isWhiteSpace = ({type}) => type === 'WhiteSpace';
|
|
11
11
|
export const isIdentifier = (token, newToken) => {
|
|
12
|
-
if (!token)
|
|
13
|
-
return false;
|
|
14
|
-
|
|
15
12
|
const {type} = token;
|
|
16
13
|
const is = type === 'IdentifierName' || type === 'PrivateIdentifier';
|
|
17
14
|
|