flatlint 1.34.0 → 1.35.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,8 @@
1
+ 2025.01.10, v1.35.0
2
+
3
+ feature:
4
+ - aeb79de flatlint: add-missing-semicolon: open round brace
5
+
1
6
  2025.01.10, v1.34.0
2
7
 
3
8
  feature:
@@ -4,6 +4,7 @@ import {
4
4
  semicolon,
5
5
  arrow,
6
6
  openCurlyBrace,
7
+ closeRoundBrace,
7
8
  } from '#types';
8
9
 
9
10
  export const report = () => 'Add missing semicolon';
@@ -27,13 +28,15 @@ export const match = () => ({
27
28
  return true;
28
29
  },
29
30
  '__a(__args)': (vars, path) => {
30
- if (path.isNextPunctuator(comma))
31
- return false;
32
-
33
- if (path.isNextPunctuator(semicolon))
34
- return false;
35
-
36
- if (path.isNextPunctuator(arrow))
31
+ const punctuators = [
32
+ comma,
33
+ semicolon,
34
+ arrow,
35
+ closeRoundBrace,
36
+ openCurlyBrace,
37
+ ];
38
+
39
+ if (path.isNextPunctuator(punctuators))
37
40
  return false;
38
41
 
39
42
  if (path.isNextPunctuator(openCurlyBrace))
@@ -6,6 +6,9 @@ import {
6
6
  isWhiteSpace,
7
7
  } from '#types';
8
8
 
9
+ const {isArray} = Array;
10
+ const maybeArray = (a) => isArray(a) ? a : [a];
11
+
9
12
  export const createPath = ({tokens, start, end}) => ({
10
13
  tokens,
11
14
  start,
@@ -88,7 +91,7 @@ const createIsNextOperator = ({tokens, end}) => () => {
88
91
  return isOperator(current);
89
92
  };
90
93
 
91
- const createIsNextPunctuator = ({tokens, end}) => (punctuator) => {
94
+ const createIsNextPunctuator = ({tokens, end}) => (punctuators) => {
92
95
  const current = next({
93
96
  tokens,
94
97
  end,
@@ -97,7 +100,12 @@ const createIsNextPunctuator = ({tokens, end}) => (punctuator) => {
97
100
  if (!current)
98
101
  return false;
99
102
 
100
- return isPunctuator(current, punctuator);
103
+ for (const punctuator of maybeArray(punctuators)) {
104
+ if (isPunctuator(current, punctuator))
105
+ return true;
106
+ }
107
+
108
+ return false;
101
109
  };
102
110
 
103
111
  const createIsPrevIdentifier = ({tokens, start}) => (value) => {
@@ -127,3 +135,4 @@ const createGetAllNext = ({tokens, end}) => function*() {
127
135
  yield current;
128
136
  }
129
137
  };
138
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.34.0",
3
+ "version": "1.35.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",