flatlint 1.93.0 → 1.94.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 +11 -0
- package/README.md +4 -0
- package/lib/plugins/add-missing-round-brace/index.js +1 -4
- package/lib/plugins/add-missing-semicolon/index.js +3 -0
- package/lib/plugins/remove-useless-comma/index.js +25 -0
- package/lib/runner/path.js +24 -3
- package/lib/types/types.js +3 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
2025.02.01, v1.94.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 22555f6 flatlint: remove-useless-comma: exclude property-array
|
|
5
|
+
- 04c24a4 faltlint: add-missing-semicolon: exclude template tail
|
|
6
|
+
|
|
7
|
+
2025.02.01, v1.93.1
|
|
8
|
+
|
|
9
|
+
feature:
|
|
10
|
+
- 7ed1762 flatlint: remove-useless-comma: declaration
|
|
11
|
+
|
|
1
12
|
2025.02.01, v1.93.0
|
|
2
13
|
|
|
3
14
|
feature:
|
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
closeCurlyBrace,
|
|
3
|
+
closeSquareBrace,
|
|
3
4
|
colon,
|
|
4
5
|
isIdentifier,
|
|
5
6
|
isPunctuator,
|
|
6
7
|
openSquireBrace,
|
|
8
|
+
semicolon,
|
|
7
9
|
spread,
|
|
8
10
|
} from '#types';
|
|
9
11
|
|
|
@@ -54,6 +56,28 @@ export const match = () => ({
|
|
|
54
56
|
|
|
55
57
|
return true;
|
|
56
58
|
},
|
|
59
|
+
'],': (vars, path) => {
|
|
60
|
+
for (const token of path.getAllPrev()) {
|
|
61
|
+
if (isPunctuator(token, colon))
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let result = false;
|
|
66
|
+
|
|
67
|
+
for (const token of path.getAllNext()) {
|
|
68
|
+
if (isPunctuator(token, closeSquareBrace)) {
|
|
69
|
+
result = false;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (isPunctuator(token, semicolon)) {
|
|
74
|
+
result = true;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return result;
|
|
80
|
+
},
|
|
57
81
|
});
|
|
58
82
|
|
|
59
83
|
export const replace = () => ({
|
|
@@ -61,4 +85,5 @@ export const replace = () => ({
|
|
|
61
85
|
'__a(__args),': '__a(__args)',
|
|
62
86
|
'},': '}',
|
|
63
87
|
'}),': '})',
|
|
88
|
+
'],': '];',
|
|
64
89
|
});
|
package/lib/runner/path.js
CHANGED
|
@@ -22,6 +22,10 @@ export const createPath = ({tokens, start, end}) => ({
|
|
|
22
22
|
tokens,
|
|
23
23
|
start,
|
|
24
24
|
}),
|
|
25
|
+
getAllNext: createGetAllNext({
|
|
26
|
+
tokens,
|
|
27
|
+
end,
|
|
28
|
+
}),
|
|
25
29
|
getPrev: createGetPrev({
|
|
26
30
|
tokens,
|
|
27
31
|
start,
|
|
@@ -38,6 +42,10 @@ export const createPath = ({tokens, start, end}) => ({
|
|
|
38
42
|
tokens,
|
|
39
43
|
end,
|
|
40
44
|
}),
|
|
45
|
+
isNextTemplateTail: createIsNextTemplateTail({
|
|
46
|
+
tokens,
|
|
47
|
+
end,
|
|
48
|
+
}),
|
|
41
49
|
isPrevPunctuator: createIsPrevPunctuator({
|
|
42
50
|
tokens,
|
|
43
51
|
start,
|
|
@@ -106,12 +114,18 @@ const createIsNextPunctuator = ({tokens, end}) => (punctuators) => {
|
|
|
106
114
|
end,
|
|
107
115
|
});
|
|
108
116
|
|
|
109
|
-
if (!current)
|
|
110
|
-
return false;
|
|
111
|
-
|
|
112
117
|
return isPunctuator(current, punctuators);
|
|
113
118
|
};
|
|
114
119
|
|
|
120
|
+
const createIsNextTemplateTail = ({tokens, end}) => () => {
|
|
121
|
+
const current = getNext({
|
|
122
|
+
tokens,
|
|
123
|
+
end,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
return isTemplateTail(current);
|
|
127
|
+
};
|
|
128
|
+
|
|
115
129
|
const createGetPrev = ({tokens, start}) => () => {
|
|
116
130
|
return getPrev({
|
|
117
131
|
tokens,
|
|
@@ -156,3 +170,10 @@ const createGetAllPrev = ({tokens, start}) => function*() {
|
|
|
156
170
|
yield tokens[i];
|
|
157
171
|
}
|
|
158
172
|
};
|
|
173
|
+
|
|
174
|
+
const createGetAllNext = ({tokens, end}) => function*() {
|
|
175
|
+
for (let i = end; i < tokens.length; ++i)
|
|
176
|
+
yield tokens[i];
|
|
177
|
+
/* c8 ignore start */
|
|
178
|
+
/* c8 ignore end */
|
|
179
|
+
};
|
package/lib/types/types.js
CHANGED