flatlint 1.21.0 → 1.21.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
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
closeSquareBrace,
|
|
4
4
|
NOT_OK,
|
|
5
5
|
OK,
|
|
6
|
-
OpenRoundBrace,
|
|
7
6
|
} from '#types';
|
|
8
7
|
import {equal} from './equal.js';
|
|
9
8
|
|
|
@@ -11,7 +10,7 @@ export const collectArgs = ({currentTokenIndex, tokens, nextTemplateToken = clos
|
|
|
11
10
|
const n = tokens.length;
|
|
12
11
|
let index = currentTokenIndex;
|
|
13
12
|
|
|
14
|
-
if (equal(tokens[index
|
|
13
|
+
if (equal(tokens[index], closeRoundBrace))
|
|
15
14
|
return [NOT_OK];
|
|
16
15
|
|
|
17
16
|
for (; index < n; index++) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
closeRoundBrace,
|
|
3
|
+
openRoundBrace,
|
|
4
|
+
semicolon,
|
|
5
|
+
} from '#types';
|
|
2
6
|
import {equal} from './equal.js';
|
|
3
7
|
|
|
4
|
-
export const collectExpression = ({currentTokenIndex, tokens, nextTemplateToken =
|
|
8
|
+
export const collectExpression = ({currentTokenIndex, tokens, nextTemplateToken = semicolon}) => {
|
|
5
9
|
const n = tokens.length;
|
|
6
|
-
const closeBrace = Punctuator(')');
|
|
7
|
-
const openBrace = Punctuator('(');
|
|
8
|
-
const semicolon = Punctuator(';');
|
|
9
10
|
let index = currentTokenIndex;
|
|
10
11
|
|
|
11
12
|
for (; index < n; index++) {
|
|
@@ -17,10 +18,10 @@ export const collectExpression = ({currentTokenIndex, tokens, nextTemplateToken
|
|
|
17
18
|
if (equal(token, nextTemplateToken))
|
|
18
19
|
break;
|
|
19
20
|
|
|
20
|
-
if (equal(token,
|
|
21
|
+
if (equal(token, openRoundBrace))
|
|
21
22
|
break;
|
|
22
23
|
|
|
23
|
-
if (equal(token,
|
|
24
|
+
if (equal(token, closeRoundBrace))
|
|
24
25
|
break;
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
import {isIdentifier} from '#types';
|
|
2
|
-
|
|
3
1
|
export const report = () => 'Use semicolon instead of trailing comma';
|
|
4
|
-
export const match = () => ({
|
|
5
|
-
'__a: __expr;': (vars, path) => {
|
|
6
|
-
for (const token of path.getPrev()) {
|
|
7
|
-
if (isIdentifier(token, 'interface'))
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return true;
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
2
|
export const replace = () => ({
|
|
15
3
|
'const __a = __b,': 'const __a = __b;',
|
|
16
4
|
});
|
package/lib/runner/replacer.js
CHANGED
package/lib/types/types.js
CHANGED
|
@@ -67,7 +67,7 @@ export const isTemplateArrayToken = (a) => isIdentifier(a) && isTemplateArray(a.
|
|
|
67
67
|
export const isTemplateExpressionToken = (a) => isIdentifier(a) && isTemplateExpression(a.value);
|
|
68
68
|
export const isTemplateArgsToken = (a) => isIdentifier(a) && isTemplateArgs(a.value);
|
|
69
69
|
|
|
70
|
-
export const
|
|
70
|
+
export const openRoundBrace = Punctuator('(');
|
|
71
71
|
export const closeRoundBrace = Punctuator(')');
|
|
72
72
|
export const closeSquareBrace = Punctuator(']');
|
|
73
73
|
export const semicolon = Punctuator(';');
|