flatlint 1.47.0 → 1.47.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,11 @@
1
+ 2025.01.14, v1.47.1
2
+
3
+ fix:
4
+ - 77b0023 flatlint: add-missing-round-braces -> add-missing-round-brace
5
+
6
+ feature:
7
+ - 41cd4c4 flatlint: add-missing-round-brace: if
8
+
1
9
  2025.01.14, v1.47.0
2
10
 
3
11
  feature:
package/README.md CHANGED
@@ -53,6 +53,10 @@ function x() {
53
53
  alert();
54
54
  }
55
55
 
56
+ -if (a.b() {
57
+ +if (a.b()) {
58
+ }
59
+
56
60
  -a('hello'
57
61
  +a('hello');
58
62
 
@@ -1,11 +1,18 @@
1
1
  import {
2
2
  closeRoundBrace,
3
3
  isPunctuator,
4
+ openRoundBrace,
4
5
  } from '#types';
5
6
 
6
- export const report = () => 'Add missing round braces';
7
+ export const report = () => 'Add missing round brace';
7
8
 
8
9
  export const match = () => ({
10
+ '(__args) {': ({__args}) => {
11
+ if (!isPunctuator(openRoundBrace, __args))
12
+ return false;
13
+
14
+ return !isPunctuator(closeRoundBrace, __args);
15
+ },
9
16
  '__a(__args': (vars, path) => {
10
17
  if (path.isCurrentPunctuator(closeRoundBrace))
11
18
  return false;
@@ -22,4 +29,5 @@ export const match = () => ({
22
29
  export const replace = () => ({
23
30
  'if __a > __b': 'if (__a > __b)',
24
31
  '__a(__args': '__a(__args)',
32
+ '(__args) {': '(__args)) {',
25
33
  });
package/lib/plugins.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as addMissingArrow from './plugins/add-missing-arrow/index.js';
2
- import * as addMissingRoundBraces from './plugins/add-missing-round-braces/index.js';
2
+ import * as addMissingRoundBrace from './plugins/add-missing-round-brace/index.js';
3
3
  import * as addMissingSquireBrace from './plugins/add-missing-square-brace/index.js';
4
4
  import * as addMissingQuote from './plugins/add-missing-quote/index.js';
5
5
  import * as addMissingSemicolon from './plugins/add-missing-semicolon/index.js';
@@ -14,7 +14,7 @@ import * as wrapAssignmentInParens from './plugins/wrap-assignment-in-parens/ind
14
14
 
15
15
  export const plugins = [
16
16
  ['add-missing-arrow', addMissingArrow],
17
- ['add-missing-round-braces', addMissingRoundBraces],
17
+ ['add-missing-round-brace', addMissingRoundBrace],
18
18
  ['add-missing-squire-brace', addMissingSquireBrace],
19
19
  ['add-missing-semicolon', addMissingSemicolon],
20
20
  ['add-missing-comma', addMissingComma],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.47.0",
3
+ "version": "1.47.1",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",