flatlint 1.96.0 → 1.97.1

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.02.03, v1.97.1
2
+
3
+ fix:
4
+ - 88fc720 flatlint: add-missing-comma: const
5
+
6
+ 2025.02.03, v1.97.0
7
+
8
+ feature:
9
+ - 1068221 flatlint: add-missing-comma: add object
10
+
1
11
  2025.02.02, v1.96.0
2
12
 
3
13
  feature:
@@ -2,12 +2,19 @@ import {
2
2
  colon,
3
3
  isKeyword,
4
4
  quote,
5
+ assign,
5
6
  } from '#types';
6
7
 
7
8
  export const report = () => 'Add missing comma';
8
9
 
9
10
  export const match = () => ({
10
- __a: ({__a}, path) => {
11
+ '"__a"': (vars, path) => {
12
+ if (path.isPrevPunctuator(assign))
13
+ return false;
14
+
15
+ return path.isNextIdentifier();
16
+ },
17
+ '__a': ({__a}, path) => {
11
18
  if (isKeyword(__a))
12
19
  return false;
13
20
 
@@ -25,5 +32,6 @@ export const match = () => ({
25
32
  });
26
33
 
27
34
  export const replace = () => ({
28
- __a: '__a,',
35
+ '__a': '__a,',
36
+ '"__a"': '"__a",',
29
37
  });
@@ -58,4 +58,3 @@ export const replace = () => ({
58
58
  '{__a} = __expr': '({__a} = __expr)',
59
59
  '__a;': '__a);',
60
60
  });
61
-
@@ -8,6 +8,8 @@ import {
8
8
  getNext,
9
9
  getPrev,
10
10
  isDeclarationKeyword,
11
+ isNewLine,
12
+ isWhiteSpace,
11
13
  } from '#types';
12
14
 
13
15
  export const createPath = ({tokens, start, end}) => ({
@@ -172,8 +174,17 @@ const createGetAllPrev = ({tokens, start}) => function*() {
172
174
  };
173
175
 
174
176
  const createGetAllNext = ({tokens, end}) => function*() {
175
- for (let i = end; i < tokens.length; ++i)
177
+ for (let i = end; i < tokens.length; ++i) {
178
+ const current = tokens[i];
179
+
180
+ if (isNewLine(current))
181
+ continue;
182
+
183
+ if (isWhiteSpace(current))
184
+ continue;
185
+
176
186
  yield tokens[i];
187
+ }
177
188
  /* c8 ignore start */
178
189
  /* c8 ignore end */
179
190
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.96.0",
3
+ "version": "1.97.1",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",