flatlint 1.94.0 → 1.96.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
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
2025.02.02, v1.96.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 1aac08c flatlint: add-missing-comma: object
|
|
5
|
+
|
|
6
|
+
2025.02.01, v1.95.0
|
|
7
|
+
|
|
8
|
+
fix:
|
|
9
|
+
- 8697533 flatlint: add-missing-round-brace: when next keyword
|
|
10
|
+
|
|
11
|
+
feature:
|
|
12
|
+
- 978c283 flatlint: add-missing-round-brace: before semicolon
|
|
13
|
+
|
|
1
14
|
2025.02.01, v1.94.0
|
|
2
15
|
|
|
3
16
|
feature:
|
package/README.md
CHANGED
|
@@ -83,6 +83,9 @@ const m = {
|
|
|
83
83
|
|
|
84
84
|
-{hello} = world;
|
|
85
85
|
+({hello} = world);
|
|
86
|
+
|
|
87
|
+
-assign(oldPath, currentPath;
|
|
88
|
+
+assign(oldPath, currentPath);
|
|
86
89
|
```
|
|
87
90
|
|
|
88
91
|
</details>
|
|
@@ -107,6 +110,12 @@ import {
|
|
|
107
110
|
+ a,
|
|
108
111
|
b,
|
|
109
112
|
} from 'c';
|
|
113
|
+
|
|
114
|
+
t.transform('declare-imports-first', {
|
|
115
|
+
- 'declare-imports-first': declareImportsFirst
|
|
116
|
+
+ 'declare-imports-first': declareImportsFirst,
|
|
117
|
+
'convert-esm-to-commonjs': convertEsmToCommonJs,
|
|
118
|
+
});
|
|
110
119
|
```
|
|
111
120
|
|
|
112
121
|
</details>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
colon,
|
|
3
|
+
isKeyword,
|
|
4
|
+
quote,
|
|
5
|
+
} from '#types';
|
|
2
6
|
|
|
3
7
|
export const report = () => 'Add missing comma';
|
|
4
8
|
|
|
@@ -13,6 +17,9 @@ export const match = () => ({
|
|
|
13
17
|
if (path.isInsideTemplate())
|
|
14
18
|
return false;
|
|
15
19
|
|
|
20
|
+
if (path.isPrevPunctuator(colon) && path.isNextPunctuator(quote))
|
|
21
|
+
return true;
|
|
22
|
+
|
|
16
23
|
return !path.isNextPunctuator();
|
|
17
24
|
},
|
|
18
25
|
});
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
closeRoundBrace,
|
|
3
|
+
isKeyword,
|
|
4
|
+
isPunctuator,
|
|
5
|
+
openRoundBrace,
|
|
6
|
+
semicolon,
|
|
7
|
+
} from '#types';
|
|
2
8
|
|
|
3
9
|
export const report = () => 'Add missing round brace';
|
|
4
10
|
|
|
5
11
|
export const match = () => ({
|
|
6
|
-
'__a(__args': (
|
|
12
|
+
'__a(__args': ({__args}, path) => {
|
|
13
|
+
const last = __args.at(-1);
|
|
14
|
+
|
|
15
|
+
if (isPunctuator(last, semicolon))
|
|
16
|
+
return false;
|
|
17
|
+
|
|
7
18
|
if (path.isCurrentPunctuator(closeRoundBrace))
|
|
8
19
|
return false;
|
|
9
20
|
|
|
@@ -15,6 +26,26 @@ export const match = () => ({
|
|
|
15
26
|
'{__a} = __expr;': (vars, path) => {
|
|
16
27
|
return !path.isPrevDeclarationKeyword();
|
|
17
28
|
},
|
|
29
|
+
'{__a} = __expr': (vars, path) => {
|
|
30
|
+
return path.isNextKeyword();
|
|
31
|
+
},
|
|
32
|
+
'__a;': (vars, path) => {
|
|
33
|
+
let result = false;
|
|
34
|
+
|
|
35
|
+
for (const current of path.getAllPrev()) {
|
|
36
|
+
if (isPunctuator(current, openRoundBrace)) {
|
|
37
|
+
result = true;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (isKeyword(current)) {
|
|
42
|
+
result = false;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return result;
|
|
48
|
+
},
|
|
18
49
|
});
|
|
19
50
|
|
|
20
51
|
export const replace = () => ({
|
|
@@ -24,4 +55,7 @@ export const replace = () => ({
|
|
|
24
55
|
'if (__a(__args) {': 'if (__a(__args)) {',
|
|
25
56
|
'if (__a(__args)': 'if (__a(__args))',
|
|
26
57
|
'{__a} = __expr;': '({__a} = __expr);',
|
|
58
|
+
'{__a} = __expr': '({__a} = __expr)',
|
|
59
|
+
'__a;': '__a);',
|
|
27
60
|
});
|
|
61
|
+
|