flatlint 2.0.10 → 2.1.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,15 @@
1
+ 2025.02.28, v2.1.1
2
+
3
+ fix:
4
+ - 56b5b01 flatlint: convert-semicolon-to-comma: close curly brace
5
+
6
+ 2025.02.28, v2.1.0
7
+
8
+ feature:
9
+ - 0a5ca63 flatlint: convert-semicolon-to-comma: call
10
+ - 84b03a9 flatlint: @putout/test v12.0.1
11
+ - 38ecf70 flatlint: eslint-plugin-putout v25.0.2
12
+
1
13
  2025.02.21, v2.0.10
2
14
 
3
15
  fix:
@@ -1,9 +1,19 @@
1
1
  import {
2
+ closeCurlyBrace,
2
3
  closeSquareBrace,
4
+ colon,
3
5
  isOneOfKeywords,
4
6
  isPunctuator,
5
7
  } from '#types';
6
8
 
9
+ const keywords = [
10
+ 'readonly',
11
+ 'static',
12
+ 'implements',
13
+ 'interface',
14
+ 'class',
15
+ ];
16
+
7
17
  export const report = () => `Use ',' instead of ';'`;
8
18
 
9
19
  export const match = () => ({
@@ -12,12 +22,7 @@ export const match = () => ({
12
22
  return false;
13
23
 
14
24
  for (const token of path.getAllPrev()) {
15
- if (isOneOfKeywords(token, [
16
- 'readonly',
17
- 'static',
18
- 'implements',
19
- 'interface',
20
- ]))
25
+ if (isOneOfKeywords(token, keywords))
21
26
  return false;
22
27
  }
23
28
 
@@ -25,27 +30,42 @@ export const match = () => ({
25
30
  if (isPunctuator(token, closeSquareBrace))
26
31
  return true;
27
32
  }
33
+
34
+ return false;
28
35
  },
29
36
  '__a: __expr;': (vars, path) => {
30
37
  if (path.isPrevDeclarationKeyword())
31
38
  return false;
32
39
 
33
- const keywords = [
34
- 'class',
35
- 'readonly',
36
- 'static',
37
- 'implements',
38
- ];
39
-
40
40
  for (const token of path.getAllPrev())
41
41
  if (isOneOfKeywords(token, keywords))
42
42
  return false;
43
43
 
44
44
  return true;
45
45
  },
46
+ ');': (vars, path) => {
47
+ if (!path.isNext())
48
+ return false;
49
+
50
+ if (path.isPrevPunctuator(closeCurlyBrace))
51
+ return false;
52
+
53
+ for (const token of path.getAllPrev()) {
54
+ if (isOneOfKeywords(token, keywords))
55
+ return false;
56
+ }
57
+
58
+ for (const token of path.getAllPrev()) {
59
+ if (isPunctuator(token, colon))
60
+ return true;
61
+ }
62
+
63
+ return false;
64
+ },
46
65
  });
47
66
 
48
67
  export const replace = () => ({
49
68
  '__a: __expr;': '__a: __expr,',
50
69
  '__a;': '__a,',
70
+ ');': '),',
51
71
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "2.0.10",
3
+ "version": "2.1.1",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",
@@ -88,10 +88,10 @@
88
88
  "devDependencies": {
89
89
  "@putout/eslint-flat": "^2.0.0",
90
90
  "@putout/formatter-json": "^2.0.0",
91
- "@putout/test": "^11.1.0",
91
+ "@putout/test": "^12.0.1",
92
92
  "c8": "^10.1.2",
93
93
  "eslint": "^9.7.0",
94
- "eslint-plugin-putout": "^24.0.0",
94
+ "eslint-plugin-putout": "^25.0.2",
95
95
  "madrun": "^10.2.2",
96
96
  "mock-require": "^3.0.3",
97
97
  "montag": "^1.0.0",