flatlint 1.95.0 → 1.97.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.02.03, v1.97.0
2
+
3
+ feature:
4
+ - 1068221 flatlint: add-missing-comma: add object
5
+
6
+ 2025.02.02, v1.96.0
7
+
8
+ feature:
9
+ - 1aac08c flatlint: add-missing-comma: object
10
+
1
11
  2025.02.01, v1.95.0
2
12
 
3
13
  fix:
package/README.md CHANGED
@@ -110,6 +110,12 @@ import {
110
110
  + a,
111
111
  b,
112
112
  } from 'c';
113
+
114
+ t.transform('declare-imports-first', {
115
+ - 'declare-imports-first': declareImportsFirst
116
+ + 'declare-imports-first': declareImportsFirst,
117
+ 'convert-esm-to-commonjs': convertEsmToCommonJs,
118
+ });
113
119
  ```
114
120
 
115
121
  </details>
@@ -1,9 +1,16 @@
1
- import {isKeyword} from '#types';
1
+ import {
2
+ colon,
3
+ isKeyword,
4
+ quote,
5
+ } from '#types';
2
6
 
3
7
  export const report = () => 'Add missing comma';
4
8
 
5
9
  export const match = () => ({
6
- __a: ({__a}, path) => {
10
+ '"__a"': (vars, path) => {
11
+ return path.isNextIdentifier();
12
+ },
13
+ '__a': ({__a}, path) => {
7
14
  if (isKeyword(__a))
8
15
  return false;
9
16
 
@@ -13,10 +20,14 @@ export const match = () => ({
13
20
  if (path.isInsideTemplate())
14
21
  return false;
15
22
 
23
+ if (path.isPrevPunctuator(colon) && path.isNextPunctuator(quote))
24
+ return true;
25
+
16
26
  return !path.isNextPunctuator();
17
27
  },
18
28
  });
19
29
 
20
30
  export const replace = () => ({
21
- __a: '__a,',
31
+ '__a': '__a,',
32
+ '"__a"': '"__a",',
22
33
  });
@@ -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.95.0",
3
+ "version": "1.97.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",