flatlint 1.98.2 → 1.100.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 +10 -0
- package/README.md +16 -0
- package/lib/plugins/add-missing-round-brace/index.js +1 -3
- package/lib/plugins/convert-comma-to-semicolon/index.js +1 -1
- package/lib/plugins/convert-semicolon-to-comma/index.js +12 -1
- package/lib/plugins/remove-useless-comma/index.js +1 -1
- package/lib/plugins/remove-useless-dot/index.js +5 -0
- package/lib/plugins.js +2 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -175,6 +175,13 @@ const a = {
|
|
|
175
175
|
- b: 'hello';
|
|
176
176
|
+ b: 'hello',
|
|
177
177
|
}
|
|
178
|
+
|
|
179
|
+
const b = [
|
|
180
|
+
1,
|
|
181
|
+
- 2;
|
|
182
|
+
+ 2,
|
|
183
|
+
3,
|
|
184
|
+
]
|
|
178
185
|
```
|
|
179
186
|
|
|
180
187
|
</details>
|
|
@@ -194,6 +201,15 @@ t.equal(expected, []);
|
|
|
194
201
|
|
|
195
202
|
</details>
|
|
196
203
|
|
|
204
|
+
<details><summary>remove useless dot</summary>
|
|
205
|
+
|
|
206
|
+
```diff
|
|
207
|
+
-fn([].);
|
|
208
|
+
+fn([].);
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
</details>
|
|
212
|
+
|
|
197
213
|
<details><summary>remove invalid character</summary>
|
|
198
214
|
|
|
199
215
|
```diff
|
|
@@ -23,9 +23,7 @@ export const match = () => ({
|
|
|
23
23
|
'if (__a(__args)': (vars, path) => {
|
|
24
24
|
return path.isNextKeyword();
|
|
25
25
|
},
|
|
26
|
-
'{__a} = __expr;': (vars, path) =>
|
|
27
|
-
return !path.isPrevDeclarationKeyword();
|
|
28
|
-
},
|
|
26
|
+
'{__a} = __expr;': (vars, path) => !path.isPrevDeclarationKeyword(),
|
|
29
27
|
'{__a} = __expr': (vars, path) => {
|
|
30
28
|
return path.isNextKeyword();
|
|
31
29
|
},
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
spread,
|
|
14
14
|
} from '#types';
|
|
15
15
|
|
|
16
|
-
export const report = () =>
|
|
16
|
+
export const report = () => `Use ';' instead of ','`;
|
|
17
17
|
export const match = () => ({
|
|
18
18
|
'__a(__args),': (vars, path) => {
|
|
19
19
|
const punctuators = [colon, spread];
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
closeSquareBrace,
|
|
3
|
+
isIdentifier,
|
|
4
|
+
isPunctuator,
|
|
5
|
+
} from '#types';
|
|
2
6
|
|
|
3
7
|
export const report = () => `Use ',' instead of ';'`;
|
|
4
8
|
|
|
5
9
|
export const match = () => ({
|
|
10
|
+
'__a;': (vars, path) => {
|
|
11
|
+
for (const token of path.getAllNext()) {
|
|
12
|
+
if (isPunctuator(token, closeSquareBrace))
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
},
|
|
6
16
|
'__a: __expr;': (vars, path) => {
|
|
7
17
|
for (const token of path.getAllPrev()) {
|
|
8
18
|
if (isIdentifier(token, 'interface'))
|
|
@@ -15,4 +25,5 @@ export const match = () => ({
|
|
|
15
25
|
|
|
16
26
|
export const replace = () => ({
|
|
17
27
|
'__a: __expr;': '__a: __expr,',
|
|
28
|
+
'__a;': '__a,',
|
|
18
29
|
});
|
package/lib/plugins.js
CHANGED
|
@@ -10,6 +10,7 @@ import * as addConstToExport from './plugins/add-const-to-export/index.js';
|
|
|
10
10
|
import * as convertCommaToSemicolon from './plugins/convert-comma-to-semicolon/index.js';
|
|
11
11
|
import * as convertFromToRequire from './plugins/convert-from-to-require/index.js';
|
|
12
12
|
import * as removeUselessComma from './plugins/remove-useless-comma/index.js';
|
|
13
|
+
import * as removeUselessDot from './plugins/remove-useless-dot/index.js';
|
|
13
14
|
import * as removeInvalidCharacter from './plugins/remove-invalid-character/index.js';
|
|
14
15
|
import * as removeUselessRoundBrace from './plugins/remove-useless-round-brace/index.js';
|
|
15
16
|
import * as convertSemicolonToComma from './plugins/convert-semicolon-to-comma/index.js';
|
|
@@ -30,6 +31,7 @@ export const plugins = [
|
|
|
30
31
|
['convert-semicolon-to-comma', convertSemicolonToComma],
|
|
31
32
|
['convert-from-to-require', convertFromToRequire],
|
|
32
33
|
['remove-useless-round-brace', removeUselessRoundBrace],
|
|
34
|
+
['remove-useless-dot', removeUselessDot],
|
|
33
35
|
['remove-invalid-character', removeInvalidCharacter],
|
|
34
36
|
['wrap-assignment-in-parens', wrapAssignmentInParens],
|
|
35
37
|
];
|