flatlint 1.82.0 → 1.83.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,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
closeRoundBrace,
|
|
3
|
+
isLastPunctuator,
|
|
4
|
+
semicolon,
|
|
5
|
+
} from '#types';
|
|
2
6
|
|
|
3
7
|
export const report = () => 'Add missing round brace';
|
|
4
8
|
|
|
5
9
|
export const match = () => ({
|
|
6
|
-
'__a(__args': (
|
|
10
|
+
'__a(__args': ({__args}, path) => {
|
|
11
|
+
if (isLastPunctuator(__args, semicolon))
|
|
12
|
+
return false;
|
|
13
|
+
|
|
7
14
|
if (path.isCurrentPunctuator(closeRoundBrace))
|
|
8
15
|
return false;
|
|
9
16
|
|
|
@@ -39,7 +39,7 @@ export const match = () => ({
|
|
|
39
39
|
|
|
40
40
|
return !path.isNextPunctuator(quote);
|
|
41
41
|
},
|
|
42
|
-
'__a.__b = __expr,': (
|
|
42
|
+
'__a.__b = __expr,': (vars, path) => {
|
|
43
43
|
if (path.isPrevPunctuator())
|
|
44
44
|
return false;
|
|
45
45
|
|
|
@@ -68,4 +68,3 @@ const check = ({__x}, path) => {
|
|
|
68
68
|
|
|
69
69
|
return path.isNextKeyword() && !path.isNextIdentifier('new');
|
|
70
70
|
};
|
|
71
|
-
|
package/lib/runner/path.js
CHANGED
|
@@ -120,7 +120,7 @@ const createIsInsideTemplate = ({tokens, end}) => () => {
|
|
|
120
120
|
return isTemplateMiddle(current);
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
const createIsNextKeyword = ({tokens, end}) => (
|
|
123
|
+
const createIsNextKeyword = ({tokens, end}) => () => {
|
|
124
124
|
const current = next({
|
|
125
125
|
tokens,
|
|
126
126
|
end,
|
package/lib/types/types.js
CHANGED
|
@@ -28,6 +28,15 @@ export const isNumericLiteral = ({type}) => type === 'NumericLiteral';
|
|
|
28
28
|
export const isNewLine = ({type}) => type === 'LineTerminatorSequence';
|
|
29
29
|
export const notWhiteSpace = (a) => !isWhiteSpace(a);
|
|
30
30
|
|
|
31
|
+
export const isLastPunctuator = (tokens, punctuator) => {
|
|
32
|
+
if (!tokens.length)
|
|
33
|
+
return false;
|
|
34
|
+
|
|
35
|
+
const last = tokens.at(-1);
|
|
36
|
+
|
|
37
|
+
return isPunctuator(last, punctuator);
|
|
38
|
+
};
|
|
39
|
+
|
|
31
40
|
export const isKeyword = (token, name) => {
|
|
32
41
|
if (!token)
|
|
33
42
|
return false;
|
|
@@ -183,4 +192,3 @@ export const isBalancedRoundBraces = (tokens) => {
|
|
|
183
192
|
|
|
184
193
|
return !roundBalance;
|
|
185
194
|
};
|
|
186
|
-
|