flatlint 1.103.0 → 1.105.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,19 @@
|
|
|
1
|
+
2025.02.06, v1.105.0
|
|
2
|
+
|
|
3
|
+
fix:
|
|
4
|
+
- b308df6 flatlint: types: isTSKeyword
|
|
5
|
+
|
|
6
|
+
feature:
|
|
7
|
+
- 8b7e4c5 flatlint: @putout/operator-keyword v2.0.0
|
|
8
|
+
|
|
9
|
+
2025.02.05, v1.104.0
|
|
10
|
+
|
|
11
|
+
feature:
|
|
12
|
+
- 9dfac2e flatlint: add-missing-comma: declare
|
|
13
|
+
- 2819e82 flatlint: convert-semicolon-to-comma: exclude interface
|
|
14
|
+
- 97a4a43 flatlint: add-missing-comma: exclude interface
|
|
15
|
+
- 775ead0 flatlint: add-missing-round-brace: exclude interface
|
|
16
|
+
|
|
1
17
|
2025.02.05, v1.103.0
|
|
2
18
|
|
|
3
19
|
feature:
|
|
@@ -29,24 +29,23 @@ export const match = () => ({
|
|
|
29
29
|
return path.isNextKeyword();
|
|
30
30
|
},
|
|
31
31
|
'__a;': (vars, path) => {
|
|
32
|
-
let result = false;
|
|
33
|
-
|
|
34
32
|
if (path.isPrevPunctuator(colon))
|
|
35
33
|
return false;
|
|
36
34
|
|
|
35
|
+
let balance = 1;
|
|
36
|
+
|
|
37
37
|
for (const current of path.getAllPrev()) {
|
|
38
|
-
if (isPunctuator(current, openRoundBrace))
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
if (isPunctuator(current, openRoundBrace))
|
|
39
|
+
++balance;
|
|
40
|
+
|
|
41
|
+
if (isPunctuator(current, openRoundBrace))
|
|
42
|
+
--balance;
|
|
42
43
|
|
|
43
|
-
if (isKeyword(current))
|
|
44
|
-
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
44
|
+
if (isKeyword(current))
|
|
45
|
+
return false;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
return
|
|
48
|
+
return balance;
|
|
50
49
|
},
|
|
51
50
|
});
|
|
52
51
|
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
closeSquareBrace,
|
|
3
|
-
isIdentifier,
|
|
4
3
|
isOneOfKeywords,
|
|
5
|
-
isOneOfPunctuators,
|
|
6
4
|
isPunctuator,
|
|
7
|
-
more,
|
|
8
5
|
} from '#types';
|
|
9
6
|
|
|
10
7
|
export const report = () => `Use ',' instead of ';'`;
|
|
@@ -12,7 +9,12 @@ export const report = () => `Use ',' instead of ';'`;
|
|
|
12
9
|
export const match = () => ({
|
|
13
10
|
'__a;': (vars, path) => {
|
|
14
11
|
for (const token of path.getAllPrev()) {
|
|
15
|
-
if (isOneOfKeywords(token, [
|
|
12
|
+
if (isOneOfKeywords(token, [
|
|
13
|
+
'readonly',
|
|
14
|
+
'static',
|
|
15
|
+
'implements',
|
|
16
|
+
'interface',
|
|
17
|
+
]))
|
|
16
18
|
return false;
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -21,7 +23,7 @@ export const match = () => ({
|
|
|
21
23
|
return true;
|
|
22
24
|
}
|
|
23
25
|
},
|
|
24
|
-
'__a: __expr;': (
|
|
26
|
+
'__a: __expr;': (vars, path) => {
|
|
25
27
|
for (const token of path.getAllPrev()) {
|
|
26
28
|
if (isOneOfKeywords(token, ['readonly', 'static', 'implements']))
|
|
27
29
|
return false;
|
package/lib/types/types.js
CHANGED
|
@@ -32,8 +32,10 @@ export const isNewLine = ({type}) => type === 'LineTerminatorSequence';
|
|
|
32
32
|
|
|
33
33
|
export const isKeyword = (token, name) => {
|
|
34
34
|
const {value} = token;
|
|
35
|
+
const is = keyword.isKeyword(value);
|
|
36
|
+
const isTS = keyword.isTSKeyword(value);
|
|
35
37
|
|
|
36
|
-
if (!
|
|
38
|
+
if (!is && !isTS)
|
|
37
39
|
return false;
|
|
38
40
|
|
|
39
41
|
return isIdentifier(token, name);
|
|
@@ -231,3 +233,4 @@ export const getPrev = ({tokens, start}) => {
|
|
|
231
233
|
return token;
|
|
232
234
|
}
|
|
233
235
|
};
|
|
236
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flatlint",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.105.0",
|
|
4
4
|
"description": "JavaScript tokens-based linter",
|
|
5
5
|
"main": "lib/flatlint.js",
|
|
6
6
|
"type": "module",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@putout/engine-loader": "^15.1.1",
|
|
84
|
-
"@putout/operator-keyword": "^
|
|
84
|
+
"@putout/operator-keyword": "^2.0.0",
|
|
85
85
|
"debug": "^4.4.0",
|
|
86
86
|
"js-tokens": "^9.0.1"
|
|
87
87
|
},
|