flatlint 1.4.1 → 1.5.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
+ 2024.12.29, v1.5.0
2
+
3
+ feature:
4
+ - 5ff09d3 flatlint: add-missing-quote: call
5
+
1
6
  2024.12.29, v1.4.1
2
7
 
3
8
  feature:
package/README.md CHANGED
@@ -53,6 +53,9 @@ npm i flatlint
53
53
  ```diff
54
54
  -const a = 'hello
55
55
  +const a = 'hello'
56
+
57
+ -fn('hello);
58
+ +fn('hello');
56
59
  ```
57
60
 
58
61
  </details>
@@ -5,5 +5,6 @@ export function report() {
5
5
  export function replace() {
6
6
  return {
7
7
  'const __a = "__b': 'const __a = "__b"',
8
+ '__a("__b)': '__a("__b")',
8
9
  };
9
10
  }
@@ -18,19 +18,30 @@ const closeQuotes = (tokens) => {
18
18
  const {closed, value} = token;
19
19
 
20
20
  const quote = Punctuator(value.at(0));
21
- const newTokens = [];
21
+ const newTokens = [quote];
22
22
 
23
23
  if (closed) {
24
24
  const literal = StringLiteral(value.slice(1, -1));
25
- newTokens.push(quote, literal, quote);
25
+ newTokens.push(literal, quote);
26
+ } else if (value.endsWith(');')) {
27
+ const literal = StringLiteral(value.slice(1, -2));
28
+ const brace = Punctuator(')');
29
+ const semicolon = Punctuator(';');
30
+
31
+ newTokens.push(literal, brace, semicolon);
32
+ } else if (value.endsWith(')')) {
33
+ const literal = StringLiteral(value.slice(1, -1));
34
+ const brace = Punctuator(')');
35
+
36
+ newTokens.push(literal, brace);
26
37
  } else if (value.endsWith(';')) {
27
38
  const literal = StringLiteral(value.slice(1, -1));
28
39
  const semicolon = Punctuator(';');
29
40
 
30
- newTokens.push(quote, literal, semicolon);
41
+ newTokens.push(literal, semicolon);
31
42
  } else {
32
43
  const literal = StringLiteral(value.slice(1));
33
- newTokens.push(quote, literal);
44
+ newTokens.push(literal);
34
45
  }
35
46
 
36
47
  tokens.splice(i, 1, ...newTokens);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",