flatlint 4.12.0 → 4.13.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
+ 2026.02.17, v4.13.0
2
+
3
+ feature:
4
+ - 06aafe9 flatlint: add-missing-square-brace: inner ]
5
+
6
+ 2026.02.15, v4.12.1
7
+
8
+ fix:
9
+ - 6534da4 flatlint: add-missing-round-brace: quote: exclude
10
+
1
11
  2026.02.13, v4.12.0
2
12
 
3
13
  feature:
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  and,
3
+ quote,
3
4
  closeRoundBrace,
4
5
  closeSquareBrace,
5
6
  colon,
@@ -46,6 +47,7 @@ export const match = () => ({
46
47
  closeRoundBrace,
47
48
  closeSquareBrace,
48
49
  and,
50
+ quote,
49
51
  ]))
50
52
  return false;
51
53
 
@@ -1,9 +1,41 @@
1
+ import {
2
+ closeCurlyBrace,
3
+ comma,
4
+ isPunctuator,
5
+ openSquireBrace,
6
+ } from '#types';
7
+
1
8
  export const report = () => 'Add missing square brace';
2
9
 
10
+ const addIndex = (a, i) => [i, a];
11
+
3
12
  export const match = () => ({
4
13
  '["__a"': (vars, path) => !path.isNext(),
14
+ '[__array;': ({__array}) => {
15
+ const last = __array.at(-1);
16
+ return !isPunctuator(last, closeCurlyBrace);
17
+ },
18
+ '"__a",\n}': (vars, path) => {
19
+ const allPrevs = path
20
+ .getAllPrev()
21
+ .map(addIndex);
22
+
23
+ let is = false;
24
+
25
+ for (const [i, prev] of allPrevs) {
26
+ const COMMA_POSITION = '\n",'.length;
27
+
28
+ if (i === COMMA_POSITION) {
29
+ is = isPunctuator(prev, [comma, openSquireBrace]);
30
+ break;
31
+ }
32
+ }
33
+
34
+ return is;
35
+ },
5
36
  });
6
37
  export const replace = () => ({
38
+ '"__a",\n}': '"__a",\n]}',
7
39
  '[__array;': '[__array];',
8
40
  '["__a"': '["__a"];',
9
41
  '[;': '[];',
@@ -12,3 +44,4 @@ export const replace = () => ({
12
44
  '(__a, [__b)': '(__a, [__b])',
13
45
  '(__a, [__b, __c)': '(__a, [__b, __c])',
14
46
  });
47
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "4.12.0",
3
+ "version": "4.13.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",