flatlint 1.44.0 → 1.45.1
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,3 +1,13 @@
|
|
|
1
|
+
2025.01.14, v1.45.1
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- df7b4e8 flatlint: add-missing-semicolon: exclude destructuring
|
|
5
|
+
|
|
6
|
+
2025.01.14, v1.45.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- 2c72c37 flatlint: convert-comma-to-semicolon: openRoundBrace without closeRoundBrace
|
|
10
|
+
|
|
1
11
|
2025.01.14, v1.44.0
|
|
2
12
|
|
|
3
13
|
feature:
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
closeRoundBrace,
|
|
2
3
|
colon,
|
|
3
4
|
isOneOfKeywords,
|
|
4
5
|
isPunctuator,
|
|
6
|
+
openRoundBrace,
|
|
5
7
|
quote,
|
|
6
8
|
} from '#types';
|
|
7
9
|
|
|
@@ -17,7 +19,12 @@ export const match = () => ({
|
|
|
17
19
|
},
|
|
18
20
|
'__x __a = __b,': check,
|
|
19
21
|
'__x __a,': check,
|
|
20
|
-
'return __expr,': ({}, path) =>
|
|
22
|
+
'return __expr,': ({__expr}, path) => {
|
|
23
|
+
if (isPunctuator(openRoundBrace, __expr) && !isPunctuator(closeRoundBrace, __expr))
|
|
24
|
+
return false;
|
|
25
|
+
|
|
26
|
+
return !path.isNextPunctuator(quote);
|
|
27
|
+
},
|
|
21
28
|
});
|
|
22
29
|
|
|
23
30
|
export const replace = () => ({
|
package/lib/runner/path.js
CHANGED
|
@@ -138,15 +138,12 @@ const createIsNextPunctuator = ({tokens, end}) => (punctuators) => {
|
|
|
138
138
|
if (!current)
|
|
139
139
|
return false;
|
|
140
140
|
|
|
141
|
-
if (!punctuators)
|
|
142
|
-
return isPunctuator(current);
|
|
143
|
-
|
|
144
141
|
for (const punctuator of maybeArray(punctuators)) {
|
|
145
142
|
if (isPunctuator(current, punctuator))
|
|
146
143
|
return true;
|
|
147
144
|
}
|
|
148
145
|
|
|
149
|
-
return
|
|
146
|
+
return isPunctuator(current, punctuators);
|
|
150
147
|
};
|
|
151
148
|
|
|
152
149
|
const createIsPrevPunctuator = ({tokens, start, end}) => (punctuators) => {
|
package/lib/types/types.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const {isArray} = Array;
|
|
2
|
+
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
1
3
|
const isString = (a) => typeof a === 'string';
|
|
2
4
|
|
|
3
5
|
export const isTemplateTail = (a) => a?.type === 'TemplateTail';
|
|
@@ -55,9 +57,12 @@ export const isPunctuator = (token, punctuator) => {
|
|
|
55
57
|
if (!punctuator)
|
|
56
58
|
return true;
|
|
57
59
|
|
|
58
|
-
const
|
|
60
|
+
for (const {value} of maybeArray(punctuator)) {
|
|
61
|
+
if (token.value === value)
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
59
64
|
|
|
60
|
-
return
|
|
65
|
+
return false;
|
|
61
66
|
};
|
|
62
67
|
|
|
63
68
|
export const StringLiteral = (value) => ({
|