flatlint 1.39.1 → 1.39.2
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 +5 -0
- package/lib/plugins/add-missing-comma/index.js +2 -26
- package/lib/runner/path.js +3 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -1,43 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assign,
|
|
3
|
-
closeCurlyBrace,
|
|
4
|
-
closeRoundBrace,
|
|
5
|
-
colon,
|
|
6
|
-
comma,
|
|
7
|
-
dot,
|
|
8
|
-
isIdentifier,
|
|
9
|
-
isOperator,
|
|
10
|
-
more,
|
|
11
|
-
openRoundBrace,
|
|
12
|
-
} from '#types';
|
|
1
|
+
import {isIdentifier, isOperator} from '#types';
|
|
13
2
|
|
|
14
3
|
export const report = () => 'Add missing comma';
|
|
15
4
|
|
|
16
5
|
export const match = () => ({
|
|
17
6
|
__a: ({__a}, path) => {
|
|
18
|
-
const punctuators = [
|
|
19
|
-
assign,
|
|
20
|
-
comma,
|
|
21
|
-
openRoundBrace,
|
|
22
|
-
closeRoundBrace,
|
|
23
|
-
closeCurlyBrace,
|
|
24
|
-
colon,
|
|
25
|
-
dot,
|
|
26
|
-
more,
|
|
27
|
-
];
|
|
28
|
-
|
|
29
7
|
if (!isIdentifier(__a))
|
|
30
8
|
return false;
|
|
31
9
|
|
|
32
10
|
if (isOperator(__a))
|
|
33
11
|
return false;
|
|
34
12
|
|
|
35
|
-
return !path.isNextPunctuator(
|
|
13
|
+
return !path.isNextPunctuator();
|
|
36
14
|
},
|
|
37
15
|
});
|
|
38
16
|
|
|
39
17
|
export const replace = () => ({
|
|
40
18
|
__a: '__a,',
|
|
41
19
|
});
|
|
42
|
-
|
|
43
|
-
|
package/lib/runner/path.js
CHANGED
|
@@ -121,6 +121,9 @@ const createIsNextPunctuator = ({tokens, end}) => (punctuators) => {
|
|
|
121
121
|
if (!current)
|
|
122
122
|
return false;
|
|
123
123
|
|
|
124
|
+
if (!punctuators)
|
|
125
|
+
return isPunctuator(current);
|
|
126
|
+
|
|
124
127
|
for (const punctuator of maybeArray(punctuators)) {
|
|
125
128
|
if (isPunctuator(current, punctuator))
|
|
126
129
|
return true;
|