flatlint 1.96.0 → 1.97.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
|
@@ -7,7 +7,10 @@ import {
|
|
|
7
7
|
export const report = () => 'Add missing comma';
|
|
8
8
|
|
|
9
9
|
export const match = () => ({
|
|
10
|
-
__a: (
|
|
10
|
+
'"__a"': (vars, path) => {
|
|
11
|
+
return path.isNextIdentifier();
|
|
12
|
+
},
|
|
13
|
+
'__a': ({__a}, path) => {
|
|
11
14
|
if (isKeyword(__a))
|
|
12
15
|
return false;
|
|
13
16
|
|
|
@@ -25,5 +28,6 @@ export const match = () => ({
|
|
|
25
28
|
});
|
|
26
29
|
|
|
27
30
|
export const replace = () => ({
|
|
28
|
-
__a: '__a,',
|
|
31
|
+
'__a': '__a,',
|
|
32
|
+
'"__a"': '"__a",',
|
|
29
33
|
});
|
package/lib/runner/path.js
CHANGED
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
getNext,
|
|
9
9
|
getPrev,
|
|
10
10
|
isDeclarationKeyword,
|
|
11
|
+
isNewLine,
|
|
12
|
+
isWhiteSpace,
|
|
11
13
|
} from '#types';
|
|
12
14
|
|
|
13
15
|
export const createPath = ({tokens, start, end}) => ({
|
|
@@ -172,8 +174,17 @@ const createGetAllPrev = ({tokens, start}) => function*() {
|
|
|
172
174
|
};
|
|
173
175
|
|
|
174
176
|
const createGetAllNext = ({tokens, end}) => function*() {
|
|
175
|
-
for (let i = end; i < tokens.length; ++i)
|
|
177
|
+
for (let i = end; i < tokens.length; ++i) {
|
|
178
|
+
const current = tokens[i];
|
|
179
|
+
|
|
180
|
+
if (isNewLine(current))
|
|
181
|
+
continue;
|
|
182
|
+
|
|
183
|
+
if (isWhiteSpace(current))
|
|
184
|
+
continue;
|
|
185
|
+
|
|
176
186
|
yield tokens[i];
|
|
187
|
+
}
|
|
177
188
|
/* c8 ignore start */
|
|
178
189
|
/* c8 ignore end */
|
|
179
190
|
};
|