flatlint 1.102.0 → 1.104.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,16 @@
1
+ 2025.02.05, v1.104.0
2
+
3
+ feature:
4
+ - 9dfac2e flatlint: add-missing-comma: declare
5
+ - 2819e82 flatlint: convert-semicolon-to-comma: exclude interface
6
+ - 97a4a43 flatlint: add-missing-comma: exclude interface
7
+ - 775ead0 flatlint: add-missing-round-brace: exclude interface
8
+
9
+ 2025.02.05, v1.103.0
10
+
11
+ feature:
12
+ - a6d96c8 flatlint: convert-semicolon-to-comma: typings
13
+
1
14
  2025.02.05, v1.102.0
2
15
 
3
16
  feature:
@@ -29,24 +29,23 @@ export const match = () => ({
29
29
  return path.isNextKeyword();
30
30
  },
31
31
  '__a;': (vars, path) => {
32
- let result = false;
33
-
34
32
  if (path.isPrevPunctuator(colon))
35
33
  return false;
36
34
 
35
+ let balance = 1;
36
+
37
37
  for (const current of path.getAllPrev()) {
38
- if (isPunctuator(current, openRoundBrace)) {
39
- result = true;
40
- break;
41
- }
38
+ if (isPunctuator(current, openRoundBrace))
39
+ ++balance;
40
+
41
+ if (isPunctuator(current, openRoundBrace))
42
+ --balance;
42
43
 
43
- if (isKeyword(current)) {
44
- result = false;
45
- break;
46
- }
44
+ if (isKeyword(current))
45
+ return false;
47
46
  }
48
47
 
49
- return result;
48
+ return balance;
50
49
  },
51
50
  });
52
51
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  closeSquareBrace,
3
- isIdentifier,
3
+ isOneOfKeywords,
4
4
  isPunctuator,
5
5
  } from '#types';
6
6
 
@@ -8,6 +8,16 @@ export const report = () => `Use ',' instead of ';'`;
8
8
 
9
9
  export const match = () => ({
10
10
  '__a;': (vars, path) => {
11
+ for (const token of path.getAllPrev()) {
12
+ if (isOneOfKeywords(token, [
13
+ 'readonly',
14
+ 'static',
15
+ 'implements',
16
+ 'interface',
17
+ ]))
18
+ return false;
19
+ }
20
+
11
21
  for (const token of path.getAllNext()) {
12
22
  if (isPunctuator(token, closeSquareBrace))
13
23
  return true;
@@ -15,7 +25,7 @@ export const match = () => ({
15
25
  },
16
26
  '__a: __expr;': (vars, path) => {
17
27
  for (const token of path.getAllPrev()) {
18
- if (isIdentifier(token, 'interface'))
28
+ if (isOneOfKeywords(token, ['readonly', 'static', 'implements']))
19
29
  return false;
20
30
  }
21
31
 
@@ -145,9 +145,11 @@ export const comma = Punctuator(',');
145
145
  export const dot = Punctuator('.');
146
146
  export const question = Punctuator('?');
147
147
  export const more = Punctuator('>');
148
+ export const less = Punctuator('<');
148
149
  export const assign = Punctuator('=');
149
150
  export const openRoundBrace = Punctuator('(');
150
151
  export const or = Punctuator('||');
152
+ export const binaryOr = Punctuator('|');
151
153
  export const spread = Punctuator('...');
152
154
  export const rest = Punctuator('...');
153
155
  export const semicolon = Punctuator(';');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.102.0",
3
+ "version": "1.104.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",