flatlint 5.2.0 → 5.2.2

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,13 @@
1
+ 2026.03.29, v5.2.2
2
+
3
+ feature:
4
+ - 6315ff5 flatlint: convert-comma-to-semicolon: exclude import with
5
+
6
+ 2026.03.14, v5.2.1
7
+
8
+ feature:
9
+ - 961c259 flatlint: convert-colon-to-semicolon: type: exclude
10
+
1
11
  2026.03.11, v5.2.0
2
12
 
3
13
  feature:
@@ -22,9 +22,7 @@ export const match = () => ({
22
22
  'if (__a(__args)': (vars, path) => {
23
23
  return path.isNextKeyword();
24
24
  },
25
- '{__a} = __expr;': (vars, path) => {
26
- return !path.isPrevAnyDeclarationKeyword();
27
- },
25
+ '{__a} = __expr;': (vars, path) => !path.isPrevAnyDeclarationKeyword(),
28
26
  '{__a} = __expr': (vars, path) => {
29
27
  return path.isNextKeyword();
30
28
  },
@@ -109,4 +107,3 @@ export const replace = () => ({
109
107
  '__a(__b(__c);': '__a(__b(__c));',
110
108
  '__a([__b, __c]) =>': '__a(([__b, __c]) =>',
111
109
  });
112
-
@@ -1,4 +1,12 @@
1
1
  export const report = () => `Use ';' instead of ':'`;
2
+ export const match = () => ({
3
+ '):': (vars, path) => {
4
+ if (!path.isNext())
5
+ return true;
6
+
7
+ return path.isNextKeyword();
8
+ },
9
+ });
2
10
  export const replace = () => ({
3
11
  '):': ');',
4
12
  });
@@ -3,6 +3,7 @@ import {
3
3
  closeRoundBrace,
4
4
  closeSquareBrace,
5
5
  colon,
6
+ isBalancedRoundBraces,
6
7
  isOneOfIdentifiers,
7
8
  isPunctuator,
8
9
  openCurlyBrace,
@@ -31,7 +32,19 @@ export const match = () => ({
31
32
 
32
33
  return path.isNextKeyword();
33
34
  },
34
- '__x __a = __expr,': check,
35
+ '__x __a = __expr,': ({__expr}, path) => {
36
+ if (!isBalancedRoundBraces(__expr))
37
+ return false;
38
+
39
+ if (!path.isNext())
40
+ return true;
41
+
42
+ if (path.isNextIdentifier('module'))
43
+ return true;
44
+
45
+ if (path.isNextKeyword() && !path.isNextIdentifier('new'))
46
+ return true;
47
+ },
35
48
  '__x __a,': check,
36
49
  'return __expr,': ({__expr}, path) => {
37
50
  if (isPunctuator(openRoundBrace, __expr) && !isPunctuator(closeRoundBrace, __expr))
@@ -105,11 +118,5 @@ const check = ({__x}, path) => {
105
118
  if (!isOneOfIdentifiers(__x, ['var', 'let', 'const']))
106
119
  return false;
107
120
 
108
- if (!path.isNext())
109
- return true;
110
-
111
- if (path.isNextIdentifier('module'))
112
- return true;
113
-
114
121
  return path.isNextKeyword() && !path.isNextIdentifier('new');
115
122
  };
package/lib/plugins.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as removeUselessAssign from '#plugin-remove-useless-assign';
1
2
  import * as addMissingArrow from './plugins/add-missing-arrow/index.js';
2
3
  import * as addMissingAssign from './plugins/add-missing-assign/index.js';
3
4
  import * as addMissingCurlyBrace from './plugins/add-missing-curly-brace/index.js';
@@ -15,7 +16,6 @@ import * as convertCommaToSemicolon from './plugins/convert-comma-to-semicolon/i
15
16
  import * as convertFromToRequire from './plugins/convert-from-to-require/index.js';
16
17
  import * as removeUselessComma from './plugins/remove-useless-comma/index.js';
17
18
  import * as removeUselessArrow from './plugins/remove-useless-arrow/index.js';
18
- import * as removeUselessAssign from '#plugin-remove-useless-assign';
19
19
  import * as removeUselessDot from './plugins/remove-useless-dot/index.js';
20
20
  import * as removeInvalidCharacter from './plugins/remove-invalid-character/index.js';
21
21
  import * as removeUselessRoundBrace from './plugins/remove-useless-round-brace/index.js';
@@ -76,7 +76,7 @@ export const isDeclarationKeyword = (token, name) => {
76
76
  return isIdentifier(token, name);
77
77
  };
78
78
 
79
- export const isAnyDeclarationKeyword = (token, name) => {
79
+ export const isAnyDeclarationKeyword = (token) => {
80
80
  if (!token)
81
81
  return false;
82
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",