flatlint 1.21.0 → 1.21.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,8 @@
1
+ 2025.01.03, v1.21.1
2
+
3
+ feature:
4
+ - eea4c32 flatlint: collect-args: simplify
5
+
1
6
  2025.01.03, v1.21.0
2
7
 
3
8
  feature:
@@ -3,7 +3,6 @@ import {
3
3
  closeSquareBrace,
4
4
  NOT_OK,
5
5
  OK,
6
- OpenRoundBrace,
7
6
  } from '#types';
8
7
  import {equal} from './equal.js';
9
8
 
@@ -11,7 +10,7 @@ export const collectArgs = ({currentTokenIndex, tokens, nextTemplateToken = clos
11
10
  const n = tokens.length;
12
11
  let index = currentTokenIndex;
13
12
 
14
- if (equal(tokens[index - 1], OpenRoundBrace) && equal(tokens[index], closeRoundBrace))
13
+ if (equal(tokens[index], closeRoundBrace))
15
14
  return [NOT_OK];
16
15
 
17
16
  for (; index < n; index++) {
@@ -1,11 +1,12 @@
1
- import {Punctuator} from '#types';
1
+ import {
2
+ closeRoundBrace,
3
+ openRoundBrace,
4
+ semicolon,
5
+ } from '#types';
2
6
  import {equal} from './equal.js';
3
7
 
4
- export const collectExpression = ({currentTokenIndex, tokens, nextTemplateToken = Punctuator(';')}) => {
8
+ export const collectExpression = ({currentTokenIndex, tokens, nextTemplateToken = semicolon}) => {
5
9
  const n = tokens.length;
6
- const closeBrace = Punctuator(')');
7
- const openBrace = Punctuator('(');
8
- const semicolon = Punctuator(';');
9
10
  let index = currentTokenIndex;
10
11
 
11
12
  for (; index < n; index++) {
@@ -17,10 +18,10 @@ export const collectExpression = ({currentTokenIndex, tokens, nextTemplateToken
17
18
  if (equal(token, nextTemplateToken))
18
19
  break;
19
20
 
20
- if (equal(token, openBrace))
21
+ if (equal(token, openRoundBrace))
21
22
  break;
22
23
 
23
- if (equal(token, closeBrace))
24
+ if (equal(token, closeRoundBrace))
24
25
  break;
25
26
  }
26
27
 
@@ -147,4 +147,3 @@ function setValues({to, waysTo, values}) {
147
147
  to.splice(index, 1, ...values[name]);
148
148
  }
149
149
  }
150
-
@@ -67,7 +67,7 @@ export const isTemplateArrayToken = (a) => isIdentifier(a) && isTemplateArray(a.
67
67
  export const isTemplateExpressionToken = (a) => isIdentifier(a) && isTemplateExpression(a.value);
68
68
  export const isTemplateArgsToken = (a) => isIdentifier(a) && isTemplateArgs(a.value);
69
69
 
70
- export const OpenRoundBrace = Punctuator('(');
70
+ export const openRoundBrace = Punctuator('(');
71
71
  export const closeRoundBrace = Punctuator(')');
72
72
  export const closeSquareBrace = Punctuator(']');
73
73
  export const semicolon = Punctuator(';');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.21.0",
3
+ "version": "1.21.1",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",