flatlint 1.68.0 → 1.70.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.70.0
2
+
3
+ feature:
4
+ - c6a7229 flatlint: add-missing-comma: exclude else
5
+
6
+ 2025.01.21, v1.69.0
7
+
8
+ feature:
9
+ - 0c0632b flatlint: add-missing-assign: assignment
10
+
1
11
  2025.01.21, v1.68.0
2
12
 
3
13
  feature:
package/README.md CHANGED
@@ -86,6 +86,9 @@ const m = {
86
86
  ```diff
87
87
  -const a 5;
88
88
  +const a = 5;
89
+
90
+ -module.exports {};
91
+ +module.exports = {};
89
92
  ```
90
93
 
91
94
  </details>
@@ -1,13 +1,25 @@
1
- import {isOneOfKeywords} from '#types';
1
+ import {
2
+ assign,
3
+ isOneOfKeywords,
4
+ isOneOfPunctuators,
5
+ } from '#types';
2
6
 
3
7
  export const report = () => 'Add missing assign';
4
8
 
5
9
  export const match = () => ({
6
- '__x __a __b': ({__x}) => {
7
- return isOneOfKeywords(__x, ['const', 'let', 'var']);
10
+ '__x __a __expr': ({__expr, __x}, path) => {
11
+ if (path.isNextPunctuator(assign))
12
+ return false;
13
+
14
+ if (!isOneOfKeywords(__x, ['const', 'let', 'var']))
15
+ return false;
16
+
17
+ return !isOneOfPunctuators(assign, __expr);
8
18
  },
19
+ '__a.__b __expr': ({__expr}) => !isOneOfPunctuators(assign, __expr),
9
20
  });
10
21
 
11
22
  export const replace = () => ({
12
- '__x __a __b': '__x __a = __b',
23
+ '__x __a __expr': '__x __a = __expr',
24
+ '__a.__b __expr': '__a.__b = __expr',
13
25
  });
@@ -1,10 +1,6 @@
1
1
  import {
2
- closeRoundBrace,
3
2
  hasRoundBraces,
4
3
  isBalancedRoundBraces,
5
- isOneOfPunctuators,
6
- isPunctuator,
7
- openRoundBrace,
8
4
  } from '#types';
9
5
 
10
6
  export const report = () => 'Remove useless round brace';
@@ -34,6 +34,7 @@ export const isKeyword = (token) => {
34
34
  'for',
35
35
  'var',
36
36
  'let',
37
+ 'else',
37
38
  'export',
38
39
  'from',
39
40
  'import',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.68.0",
3
+ "version": "1.70.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",