flatlint 3.8.0 → 3.10.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.12.30, v3.10.0
2
+
3
+ feature:
4
+ - 85beee6 flatlint: convert-colon-to-as: add
5
+
6
+ 2025.12.29, v3.9.0
7
+
8
+ feature:
9
+ - 9b7cf85 flatlint: apply-import-from: add
10
+
1
11
  2025.12.29, v3.8.0
2
12
 
3
13
  feature:
package/README.md CHANGED
@@ -28,6 +28,15 @@ npm i flatlint
28
28
 
29
29
  </details>
30
30
 
31
+ <details><summary>apply import <code>from</code></summary>
32
+
33
+ ```diff
34
+ -import fs form 'node:fs';
35
+ +import fs from 'node:fs';
36
+ ```
37
+
38
+ </details>
39
+
31
40
  <details><summary>assignment without parentheses after <code>&&</code></summary>
32
41
 
33
42
  ```diff
@@ -87,6 +96,15 @@ export const rules = [
87
96
 
88
97
  </details>
89
98
 
99
+ <details><summary>convert colon to <code>as</code></summary>
100
+
101
+ ```diff
102
+ -import {simpleImport: _simpleImport} from './simple-import.js';
103
+ +import {simpleImport as _simpleImport} from './simple-import.js';
104
+ ```
105
+
106
+ </details>
107
+
90
108
  <details><summary>convert <code>from</code> to <code>require</code></summary>
91
109
 
92
110
  ```diff
@@ -17,13 +17,13 @@ export const match = () => ({
17
17
  if (isType && path.isNextCompare('__a ='))
18
18
  return false;
19
19
 
20
- if (!isType && isKeyword(__a))
20
+ if (path.isPrevKeyword())
21
21
  return false;
22
22
 
23
- if (path.isNextKeyword())
23
+ if (!isType && isKeyword(__a))
24
24
  return false;
25
25
 
26
- if (!path.isNext())
26
+ if (path.isNextKeyword())
27
27
  return false;
28
28
 
29
29
  if (path.isInsideTemplate())
@@ -59,4 +59,3 @@ export const replace = () => ({
59
59
  '"__a"': '"__a",',
60
60
  '}': '},',
61
61
  });
62
-
@@ -0,0 +1,6 @@
1
+ export const report = () => `Use 'import from' instead of 'import form'`;
2
+
3
+ export const replace = () => ({
4
+ 'import __a form "__b"': 'import __a from "__b"',
5
+ 'import {__a} form "__b"': 'import {__a} from "__b"',
6
+ });
@@ -0,0 +1,4 @@
1
+ export const report = () => `Use 'as' instead of ':'`;
2
+ export const replace = () => ({
3
+ 'import {__a: __b} from "__c"': 'import {__a as __b} from "__c"',
4
+ });
package/lib/plugins.js CHANGED
@@ -8,6 +8,7 @@ import * as addMissingSemicolon from './plugins/add-missing-semicolon/index.js';
8
8
  import * as addMissingComma from './plugins/add-missing-comma/index.js';
9
9
  import * as addConstToExport from './plugins/add-const-to-export/index.js';
10
10
  import * as applyImportOrder from './plugins/apply-import-order/index.js';
11
+ import * as applyImportFrom from './plugins/apply-import-from/index.js';
11
12
  import * as convertAssertToWith from './plugins/convert-assert-to-with/index.js';
12
13
  import * as convertCommaToSemicolon from './plugins/convert-comma-to-semicolon/index.js';
13
14
  import * as convertFromToRequire from './plugins/convert-from-to-require/index.js';
@@ -18,22 +19,25 @@ import * as removeUselessRoundBrace from './plugins/remove-useless-round-brace/i
18
19
  import * as convertSemicolonToComma from './plugins/convert-semicolon-to-comma/index.js';
19
20
  import * as convertColonToComma from './plugins/convert-colon-to-comma/index.js';
20
21
  import * as convertColonToSemicolon from './plugins/convert-colon-to-semicolon/index.js';
22
+ import * as convertColonToAs from './plugins/convert-colon-to-as/index.js';
21
23
  import * as wrapAssignmentInParens from './plugins/wrap-assignment-in-parens/index.js';
22
24
 
23
25
  export const plugins = [
26
+ ['add-missing-comma', addMissingComma],
27
+ ['add-missing-quote', addMissingQuote],
28
+ ['add-const-to-export', addConstToExport],
24
29
  ['add-missing-semicolon', addMissingSemicolon],
25
30
  ['add-missing-arrow', addMissingArrow],
26
31
  ['add-missing-assign', addMissingAssign],
27
32
  ['add-missing-curly-brace', addMissingCurlyBrace],
28
33
  ['add-missing-round-brace', addMissingRoundBrace],
29
34
  ['add-missing-squire-brace', addMissingSquireBrace],
30
- ['add-missing-comma', addMissingComma],
31
- ['add-missing-quote', addMissingQuote],
32
- ['add-const-to-export', addConstToExport],
35
+ ['apply-import-from', applyImportFrom],
33
36
  ['apply-import-order', applyImportOrder],
34
37
  ['convert-assert-to-with', convertAssertToWith],
35
38
  ['convert-comma-to-semicolon', convertCommaToSemicolon],
36
39
  ['convert-colon-to-comma', convertColonToComma],
40
+ ['convert-colon-to-as', convertColonToAs],
37
41
  ['convert-colon-to-semicolon', convertColonToSemicolon],
38
42
  ['convert-semicolon-to-comma', convertSemicolonToComma],
39
43
  ['convert-from-to-require', convertFromToRequire],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "3.8.0",
3
+ "version": "3.10.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",