flatlint 1.116.0 → 2.0.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,13 @@
1
+ 2025.02.17, v2.0.1
2
+
3
+ fix:
4
+ - 544a124 flatlint: add-missing-round-brace: exclude const
5
+
6
+ 2025.02.17, v2.0.0
7
+
8
+ feature:
9
+ - a650691 flatlint: convert-colon-to-semicolon: add
10
+
1
11
  2025.02.15, v1.116.0
2
12
 
3
13
  feature:
package/README.md CHANGED
@@ -1,4 +1,13 @@
1
- # FlatLint
1
+ # FlatLint[![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
2
+
3
+ [NPMURL]: https://npmjs.org/package/flatlint "npm"
4
+ [NPMIMGURL]: https://img.shields.io/npm/v/flatlint.svg?style=flat
5
+ [BuildStatusURL]: https://github.com/coderaiser/flatlint/actions?query=workflow%3A%22Node+CI%22 "Build Status"
6
+ [BuildStatusIMGURL]: https://github.com/coderaiser/flatlint/workflows/Node%20CI/badge.svg
7
+ [LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
8
+ [LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
9
+ [CoverageURL]: https://coveralls.io/github/coderaiser/flatlint?branch=master
10
+ [CoverageIMGURL]: https://coveralls.io/repos/coderaiser/flatlint/badge.svg?branch=master&service=github
2
11
 
3
12
  Token-based JavaScript linter that fixes Syntax Errors
4
13
 
@@ -10,7 +19,7 @@ npm i flatlint
10
19
 
11
20
  ## Available fixes
12
21
 
13
- <details><summary>Assignment without parentheses after <code>&&</code></summary>
22
+ <details><summary>assignment without parentheses after <code>&&</code></summary>
14
23
 
15
24
  ```diff
16
25
  -a && b = c;
@@ -40,6 +49,15 @@ module.exports = 2;
40
49
 
41
50
  </details>
42
51
 
52
+ <details><summary>convert colon to semicolon</summary>
53
+
54
+ ```diff
55
+ -console.log(a, b):
56
+ +console.log(a, b);
57
+ ```
58
+
59
+ </details>
60
+
43
61
  <details><summary>convert <code>from</code> to <code>require</code></summary>
44
62
 
45
63
  ```diff
@@ -356,3 +374,4 @@ const [code] = lint(`a && b = c`, {
356
374
  ## License
357
375
 
358
376
  MIT
377
+
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  closeRoundBrace,
3
+ closeSquareBrace,
3
4
  colon,
5
+ comma,
4
6
  isKeyword,
5
7
  isPunctuator,
6
8
  openRoundBrace,
@@ -48,7 +50,18 @@ export const match = () => ({
48
50
  return balance;
49
51
  },
50
52
  '"__a"': (vars, path) => {
51
- return path.isNextKeyword();
53
+ for (const current of path.getAllPrev()) {
54
+ if (path.isNextPunctuator([comma, closeRoundBrace, closeSquareBrace]))
55
+ return false;
56
+
57
+ if (isPunctuator(current, closeRoundBrace))
58
+ return false;
59
+
60
+ if (isPunctuator(current, openRoundBrace))
61
+ return true;
62
+ }
63
+
64
+ return false;
52
65
  },
53
66
  });
54
67
 
@@ -0,0 +1,5 @@
1
+ export const report = () => `Use ';' instead of ':'`;
2
+ export const replace = () => ({
3
+ '):': ');',
4
+ });
5
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.116.0",
3
+ "version": "2.0.1",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",