flatlint 1.92.0 → 1.93.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,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
closeRoundBrace,
|
|
3
|
+
isDeclarationKeyword,
|
|
4
|
+
} from '#types';
|
|
2
5
|
|
|
3
6
|
export const report = () => 'Add missing round brace';
|
|
4
7
|
|
|
@@ -12,6 +15,9 @@ export const match = () => ({
|
|
|
12
15
|
'if (__a(__args)': (vars, path) => {
|
|
13
16
|
return path.isNextKeyword();
|
|
14
17
|
},
|
|
18
|
+
'{__a} = __expr;': (vars, path) => {
|
|
19
|
+
return !path.isPrevDeclarationKeyword();
|
|
20
|
+
},
|
|
15
21
|
});
|
|
16
22
|
|
|
17
23
|
export const replace = () => ({
|
package/lib/runner/path.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
isNoSubstitutionTemplate,
|
|
8
8
|
getNext,
|
|
9
9
|
getPrev,
|
|
10
|
+
isDeclarationKeyword,
|
|
10
11
|
} from '#types';
|
|
11
12
|
|
|
12
13
|
export const createPath = ({tokens, start, end}) => ({
|
|
@@ -25,6 +26,10 @@ export const createPath = ({tokens, start, end}) => ({
|
|
|
25
26
|
tokens,
|
|
26
27
|
start,
|
|
27
28
|
}),
|
|
29
|
+
isPrevDeclarationKeyword: createIsPrevDeclarationKeyword({
|
|
30
|
+
tokens,
|
|
31
|
+
start,
|
|
32
|
+
}),
|
|
28
33
|
isNextKeyword: createIsNextKeyword({
|
|
29
34
|
tokens,
|
|
30
35
|
end,
|
|
@@ -114,6 +119,15 @@ const createGetPrev = ({tokens, start}) => () => {
|
|
|
114
119
|
});
|
|
115
120
|
};
|
|
116
121
|
|
|
122
|
+
const createIsPrevDeclarationKeyword = ({tokens, start}) => () => {
|
|
123
|
+
const prev = getPrev({
|
|
124
|
+
tokens,
|
|
125
|
+
start,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
return isDeclarationKeyword(prev);
|
|
129
|
+
};
|
|
130
|
+
|
|
117
131
|
const createIsPrevPunctuator = ({tokens, start}) => (punctuators) => {
|
|
118
132
|
const current = getPrev({
|
|
119
133
|
tokens,
|
package/lib/types/types.js
CHANGED