flatlint 2.0.8 → 2.0.10

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.21, v2.0.10
2
+
3
+ fix:
4
+ - 16f5d44 flatlint: add-missing-comma: before broken quote
5
+
6
+ 2025.02.21, v2.0.9
7
+
8
+ feature:
9
+ - c6b7938 flatlint: convert-comma-to-semicolon: []
10
+
1
11
  2025.02.21, v2.0.8
2
12
 
3
13
  feature:
@@ -30,6 +30,9 @@ export const match = () => ({
30
30
  if (path.isInsideTemplate())
31
31
  return false;
32
32
 
33
+ if (path.isNextCompare(`',`))
34
+ return false;
35
+
33
36
  if (path.isPrevPunctuator(colon) && path.isNextPunctuator(quote))
34
37
  return true;
35
38
 
@@ -69,18 +69,13 @@ export const match = () => ({
69
69
  '__a,': (vars, path) => !path.isNext(),
70
70
  '],': (vars, path) => {
71
71
  for (const token of path.getAllPrev()) {
72
- if (isPunctuator(token, colon))
72
+ if (isPunctuator(token, [colon, openRoundBrace]))
73
73
  return false;
74
74
  }
75
75
 
76
76
  let result = false;
77
77
 
78
78
  for (const token of path.getAllNext()) {
79
- if (isPunctuator(token, closeSquareBrace)) {
80
- result = false;
81
- break;
82
- }
83
-
84
79
  if (isPunctuator(token, semicolon)) {
85
80
  result = true;
86
81
  break;
@@ -1,3 +1,4 @@
1
+ import {prepare} from '#parser';
1
2
  import {
2
3
  isIdentifier,
3
4
  isKeyword,
@@ -11,6 +12,7 @@ import {
11
12
  isNewLine,
12
13
  isWhiteSpace,
13
14
  } from '#types';
15
+ import {equal} from '../compare/equal.js';
14
16
 
15
17
  export const createPath = ({tokens, start, end}) => ({
16
18
  tokens,
@@ -44,6 +46,10 @@ export const createPath = ({tokens, start, end}) => ({
44
46
  tokens,
45
47
  end,
46
48
  }),
49
+ isNextCompare: createIsNextCompare({
50
+ tokens,
51
+ end,
52
+ }),
47
53
  isNextDeclarationKeyword: createIsNextDeclarationKeyword({
48
54
  tokens,
49
55
  end,
@@ -214,3 +220,26 @@ const createGetAllNext = ({tokens, end}) => function*() {
214
220
  /* c8 ignore start */
215
221
  /* c8 ignore end */
216
222
  };
223
+
224
+ const createIsNextCompare = ({tokens, end}) => (template) => {
225
+ const getAllNext = createGetAllNext({
226
+ tokens,
227
+ end,
228
+ });
229
+
230
+ const n = template.length;
231
+ const templateTokens = prepare(template);
232
+ let i = 0;
233
+
234
+ for (const token of getAllNext()) {
235
+ if (i === n)
236
+ break;
237
+
238
+ if (!equal(token, templateTokens[i]))
239
+ return false;
240
+
241
+ ++i;
242
+ }
243
+
244
+ return true;
245
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",