flatlint 1.6.1 → 1.7.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,9 @@
1
+ 2024.12.30, v1.7.0
2
+
3
+ feature:
4
+ - 5b0c929 flatlint: produce single quotes
5
+ - 536acf8 flatlint: add-missing-squire-brace: add
6
+
1
7
  2024.12.29, v1.6.1
2
8
 
3
9
  feature:
package/README.md CHANGED
@@ -28,7 +28,7 @@ npm i flatlint
28
28
 
29
29
  </details>
30
30
 
31
- <details><summary>forgotten round braces in if statement</summary>
31
+ <details><summary>add missing round braces in if statement</summary>
32
32
 
33
33
  ```diff
34
34
  -if a > 5 {
@@ -39,6 +39,15 @@ npm i flatlint
39
39
 
40
40
  </details>
41
41
 
42
+ <details><summary>add missing squire brace</summary>
43
+
44
+ ```diff
45
+ -const a = ['hello', 'world';
46
+ +const a = ['hello', 'world'];
47
+ ```
48
+
49
+ </details>
50
+
42
51
  <details><summary>remove useless round brace</summary>
43
52
 
44
53
  ```diff
@@ -100,4 +100,3 @@ function equalId(a, b) {
100
100
 
101
101
  return isId(b.value);
102
102
  }
103
-
@@ -4,7 +4,7 @@ export function parseStringLiteral({i, token, tokens}) {
4
4
  const {closed} = token;
5
5
  let {value} = token;
6
6
 
7
- const quote = Punctuator(value.at(0));
7
+ const quote = Punctuator(`'`);
8
8
  const newTokens = [quote];
9
9
 
10
10
  if (closed) {
@@ -0,0 +1,9 @@
1
+ export function report() {
2
+ return 'Add missing squire brace';
3
+ }
4
+
5
+ export function replace() {
6
+ return {
7
+ '["hello", "world";': '["hello", "world"];',
8
+ };
9
+ }
package/lib/plugins.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as wrapAssignmentInParens from './plugins/wrap-assignment-in-parens/index.js';
2
2
  import * as addMissingRoundBraces from './plugins/add-missing-round-braces/index.js';
3
+ import * as addMissingSquireBrace from './plugins/add-missing-square-brace/index.js';
3
4
  import * as addMissingQuote from './plugins/add-missing-quote/index.js';
4
5
  import * as convertCommaToSemicolon from './plugins/convert-comma-to-semicolon/index.js';
5
6
  import * as removeUselessRoundBrace from './plugins/remove-useless-round-brace/index.js';
@@ -7,6 +8,7 @@ import * as removeUselessRoundBrace from './plugins/remove-useless-round-brace/i
7
8
  export const plugins = [
8
9
  ['wrap-assignment-in-parens', wrapAssignmentInParens],
9
10
  ['add-missing-round-braces', addMissingRoundBraces],
11
+ ['add-missing-squire-brace', addMissingSquireBrace],
10
12
  ['add-missing-quote', addMissingQuote],
11
13
  ['convert-comma-to-semicolon', convertCommaToSemicolon],
12
14
  ['remove-useless-round-brace', removeUselessRoundBrace],
@@ -90,4 +90,3 @@ function setValues({to, waysTo, values}) {
90
90
  to[index] = values[name];
91
91
  }
92
92
  }
93
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",