flatlint 1.56.0 → 1.58.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
+ 2025.01.18, v1.58.0
2
+
3
+ feature:
4
+ - bb2a2db flatlint: convert-comma-to-semicolon: for, while
5
+
6
+ 2025.01.18, v1.57.0
7
+
8
+ feature:
9
+ - 93b8c50 flatlint: convert-comma-to-semicolon: module
10
+
1
11
  2025.01.17, v1.56.0
2
12
 
3
13
  feature:
package/README.md CHANGED
@@ -19,7 +19,7 @@ npm i flatlint
19
19
 
20
20
  </details>
21
21
 
22
- <details><summary>convert <code>,</code> to <code>;</code> at the end of statement</summary>
22
+ <details><summary>convert comma to semicolon</summary>
23
23
 
24
24
  ```diff
25
25
  -const a = 5,
@@ -32,6 +32,10 @@ function x() {
32
32
 
33
33
  -import a from 'a',
34
34
  +import a from 'a';
35
+
36
+ -const a = 3,
37
+ +const a = 3;
38
+ module.exports = 2;
35
39
  ```
36
40
 
37
41
  </details>
@@ -1,16 +1,9 @@
1
- import {
2
- arrow,
3
- closeCurlyBrace,
4
- closeRoundBrace,
5
- isPunctuator,
6
- openCurlyBrace,
7
- openRoundBrace,
8
- } from '#types';
1
+ import {closeRoundBrace} from '#types';
9
2
 
10
3
  export const report = () => 'Add missing round brace';
11
4
 
12
5
  export const match = () => ({
13
- '__a(__args': ({__args}, path) => {
6
+ '__a(__args': (vars, path) => {
14
7
  if (path.isCurrentPunctuator(closeRoundBrace))
15
8
  return false;
16
9
 
@@ -24,4 +17,3 @@ export const replace = () => ({
24
17
  'if (__a.__b(__args) {': 'if (__a.__b(__args)) {',
25
18
  'if (__a(__args) {': 'if (__a(__args)) {',
26
19
  });
27
-
@@ -50,5 +50,8 @@ const check = ({__x}, path) => {
50
50
  if (!path.isNext())
51
51
  return true;
52
52
 
53
+ if (path.isNextIdentifier('module'))
54
+ return true;
55
+
53
56
  return path.isNextKeyword();
54
57
  };
@@ -140,11 +140,6 @@ const createGetAllPrev = ({tokens, start}) => function*() {
140
140
 
141
141
  const createGetAllNext = ({tokens, end}) => function*() {
142
142
  for (let i = end; i < tokens.length; ++i) {
143
- const current = tokens[i];
144
-
145
- if (isNewLine(current))
146
- continue;
147
-
148
- yield current;
143
+ yield tokens[i];
149
144
  }
150
145
  };
@@ -30,6 +30,7 @@ export const isKeyword = (token) => {
30
30
  'await',
31
31
  'const',
32
32
  'continue',
33
+ 'for',
33
34
  'var',
34
35
  'let',
35
36
  'export',
@@ -40,6 +41,7 @@ export const isKeyword = (token) => {
40
41
  'of',
41
42
  'yield',
42
43
  'typeof',
44
+ 'while',
43
45
  ];
44
46
 
45
47
  for (const keyword of keywords) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.56.0",
3
+ "version": "1.58.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",