flatlint 1.70.0 → 1.72.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,13 @@
1
+ 2025.01.22, v1.72.0
2
+
3
+ feature:
4
+ - 6cab396 remove-useless-comma: object
5
+
6
+ 2025.01.22, v1.71.0
7
+
8
+ feature:
9
+ - 628cab1 flatlint: add-missing-assign: exclude or
10
+
1
11
  2025.01.22, v1.70.0
2
12
 
3
13
  feature:
@@ -2,6 +2,7 @@ import {
2
2
  assign,
3
3
  isOneOfKeywords,
4
4
  isOneOfPunctuators,
5
+ semicolon,
5
6
  } from '#types';
6
7
 
7
8
  export const report = () => 'Add missing assign';
@@ -16,7 +17,12 @@ export const match = () => ({
16
17
 
17
18
  return !isOneOfPunctuators(assign, __expr);
18
19
  },
19
- '__a.__b __expr': ({__expr}) => !isOneOfPunctuators(assign, __expr),
20
+ '__a.__b __expr': ({__expr}, path) => {
21
+ if (path.isNextPunctuator() && !path.isNextPunctuator(semicolon))
22
+ return false;
23
+
24
+ return !isOneOfPunctuators(assign, __expr);
25
+ },
20
26
  });
21
27
 
22
28
  export const replace = () => ({
@@ -39,11 +39,22 @@ export const match = () => ({
39
39
 
40
40
  return !path.isNext();
41
41
  },
42
+ '__a(__args),': (vars, path) => {
43
+ if (!path.isNext())
44
+ return true;
45
+
46
+ for (const current of path.getAllPrev()) {
47
+ if (isPunctuator(current, colon))
48
+ return false;
49
+ }
50
+
51
+ return true;
52
+ },
42
53
  });
43
54
 
44
55
  export const replace = () => ({
45
56
  '__a(__args) {},': '__a(__args) {}',
46
- '__a(),': '__a()',
57
+ '__a(__args),': '__a(__args)',
47
58
  '},': '}',
48
59
  '}),': '})',
49
60
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.70.0",
3
+ "version": "1.72.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",