flatlint 3.7.0 → 3.8.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,8 @@
1
+ 2025.12.29, v3.8.0
2
+
3
+ feature:
4
+ - bf8cb8a flatlint: remove-useless-round-brace: ')]' -> ']'
5
+
1
6
  2025.12.29, v3.7.0
2
7
 
3
8
  feature:
@@ -24,19 +24,8 @@ export const match = () => ({
24
24
 
25
25
  return true;
26
26
  },
27
- '})': (vars, path) => {
28
- let balance = 0;
29
-
30
- for (const current of path.getAllPrev()) {
31
- if (isPunctuator(current, openRoundBrace))
32
- ++balance;
33
-
34
- if (isPunctuator(current, closeRoundBrace))
35
- --balance;
36
- }
37
-
38
- return !balance;
39
- },
27
+ '})': (vars, path) => isBracesBalanced(path),
28
+ ')]': (vars, path) => !isBracesBalanced(path),
40
29
  });
41
30
 
42
31
  export const replace = () => ({
@@ -44,5 +33,20 @@ export const replace = () => ({
44
33
  'from "__b")': 'from "__b"',
45
34
  '__a);': '__a;',
46
35
  '})': '}',
36
+ ')]': ']',
47
37
  'for (__a __b of __c))': 'for (__a __b of __c)',
48
38
  });
39
+
40
+ function isBracesBalanced(path) {
41
+ let balance = 0;
42
+
43
+ for (const current of path.getAllPrev()) {
44
+ if (isPunctuator(current, openRoundBrace))
45
+ ++balance;
46
+
47
+ if (isPunctuator(current, closeRoundBrace))
48
+ --balance;
49
+ }
50
+
51
+ return !balance;
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "3.7.0",
3
+ "version": "3.8.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",