flatlint 1.48.0 → 1.50.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.01.14, v1.50.0
2
+
3
+ feature:
4
+ - fab4760 flatlint: add-missing-round-brace: exclude: arrow
5
+
6
+ 2025.01.14, v1.49.0
7
+
8
+ feature:
9
+ - ffade65 flatlint: remove-useless-comma: exclude: property
10
+
1
11
  2025.01.14, v1.48.0
2
12
 
3
13
  feature:
@@ -1,4 +1,5 @@
1
1
  import {
2
+ arrow,
2
3
  closeRoundBrace,
3
4
  isPunctuator,
4
5
  openRoundBrace,
@@ -8,6 +9,9 @@ export const report = () => 'Add missing round brace';
8
9
 
9
10
  export const match = () => ({
10
11
  '(__args) {': ({__args}) => {
12
+ if (isPunctuator(arrow, __args))
13
+ return false;
14
+
11
15
  if (!isPunctuator(openRoundBrace, __args))
12
16
  return false;
13
17
 
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  closeCurlyBrace,
3
+ colon,
3
4
  isIdentifier,
4
5
  isPunctuator,
5
6
  openSquireBrace,
@@ -30,6 +31,14 @@ export const match = () => ({
30
31
 
31
32
  return path.isNextIdentifier('const');
32
33
  },
34
+ '}),': (vars, path) => {
35
+ for (const token of path.getAllPrev()) {
36
+ if (isPunctuator(token, colon))
37
+ return false;
38
+ }
39
+
40
+ return !path.isNext();
41
+ },
33
42
  });
34
43
 
35
44
  export const replace = () => ({
@@ -4,14 +4,19 @@ const isString = (a) => typeof a === 'string';
4
4
 
5
5
  export const isTemplateTail = (a) => a?.type === 'TemplateTail';
6
6
  export const isWhiteSpace = ({type}) => type === 'WhiteSpace';
7
- export const isIdentifier = (token, value = token.value) => {
7
+ export const isIdentifier = (token, newToken) => {
8
8
  const {type} = token;
9
9
  const is = type === 'IdentifierName';
10
10
 
11
11
  if (!is)
12
12
  return false;
13
13
 
14
- return value === token.value;
14
+ if (!newToken)
15
+ return true;
16
+
17
+ const newValue = newToken.value || newToken;
18
+
19
+ return newValue === token.value;
15
20
  };
16
21
 
17
22
  export const isStringLiteral = ({type}) => type === 'StringLiteral';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.48.0",
3
+ "version": "1.50.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",