flatlint 1.94.0 → 1.95.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,11 @@
1
+ 2025.02.01, v1.95.0
2
+
3
+ fix:
4
+ - 8697533 flatlint: add-missing-round-brace: when next keyword
5
+
6
+ feature:
7
+ - 978c283 flatlint: add-missing-round-brace: before semicolon
8
+
1
9
  2025.02.01, v1.94.0
2
10
 
3
11
  feature:
package/README.md CHANGED
@@ -83,6 +83,9 @@ const m = {
83
83
 
84
84
  -{hello} = world;
85
85
  +({hello} = world);
86
+
87
+ -assign(oldPath, currentPath;
88
+ +assign(oldPath, currentPath);
86
89
  ```
87
90
 
88
91
  </details>
@@ -1,9 +1,20 @@
1
- import {closeRoundBrace} from '#types';
1
+ import {
2
+ closeRoundBrace,
3
+ isKeyword,
4
+ isPunctuator,
5
+ openRoundBrace,
6
+ semicolon,
7
+ } from '#types';
2
8
 
3
9
  export const report = () => 'Add missing round brace';
4
10
 
5
11
  export const match = () => ({
6
- '__a(__args': (vars, path) => {
12
+ '__a(__args': ({__args}, path) => {
13
+ const last = __args.at(-1);
14
+
15
+ if (isPunctuator(last, semicolon))
16
+ return false;
17
+
7
18
  if (path.isCurrentPunctuator(closeRoundBrace))
8
19
  return false;
9
20
 
@@ -15,6 +26,26 @@ export const match = () => ({
15
26
  '{__a} = __expr;': (vars, path) => {
16
27
  return !path.isPrevDeclarationKeyword();
17
28
  },
29
+ '{__a} = __expr': (vars, path) => {
30
+ return path.isNextKeyword();
31
+ },
32
+ '__a;': (vars, path) => {
33
+ let result = false;
34
+
35
+ for (const current of path.getAllPrev()) {
36
+ if (isPunctuator(current, openRoundBrace)) {
37
+ result = true;
38
+ break;
39
+ }
40
+
41
+ if (isKeyword(current)) {
42
+ result = false;
43
+ break;
44
+ }
45
+ }
46
+
47
+ return result;
48
+ },
18
49
  });
19
50
 
20
51
  export const replace = () => ({
@@ -24,4 +55,7 @@ export const replace = () => ({
24
55
  'if (__a(__args) {': 'if (__a(__args)) {',
25
56
  'if (__a(__args)': 'if (__a(__args))',
26
57
  '{__a} = __expr;': '({__a} = __expr);',
58
+ '{__a} = __expr': '({__a} = __expr)',
59
+ '__a;': '__a);',
27
60
  });
61
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.94.0",
3
+ "version": "1.95.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",