flatlint 1.39.0 → 1.39.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,8 @@
1
+ 2025.01.12, v1.39.1
2
+
3
+ feature:
4
+ - 5497596 add-missing-semicolon: improve
5
+
1
6
  2025.01.12, v1.39.0
2
7
 
3
8
  feature:
@@ -83,4 +83,3 @@ export function getCurrentValues({from, start, end, tokens}) {
83
83
 
84
84
  return getValues(current, waysFrom);
85
85
  }
86
-
@@ -1,26 +1,38 @@
1
1
  import {
2
- comma,
3
- isPunctuator,
4
- semicolon,
5
- arrow,
6
- openCurlyBrace,
2
+ assign,
3
+ closeCurlyBrace,
7
4
  closeRoundBrace,
5
+ colon,
6
+ comma,
8
7
  dot,
9
8
  isIdentifier,
10
9
  isOperator,
10
+ more,
11
+ openRoundBrace,
11
12
  } from '#types';
12
13
 
13
14
  export const report = () => 'Add missing comma';
14
15
 
15
16
  export const match = () => ({
16
17
  __a: ({__a}, path) => {
18
+ const punctuators = [
19
+ assign,
20
+ comma,
21
+ openRoundBrace,
22
+ closeRoundBrace,
23
+ closeCurlyBrace,
24
+ colon,
25
+ dot,
26
+ more,
27
+ ];
28
+
17
29
  if (!isIdentifier(__a))
18
30
  return false;
19
31
 
20
32
  if (isOperator(__a))
21
33
  return false;
22
34
 
23
- return !path.isNextPunctuator(comma);
35
+ return !path.isNextPunctuator(punctuators);
24
36
  },
25
37
  });
26
38
 
package/lib/plugins.js CHANGED
@@ -3,18 +3,20 @@ import * as addMissingRoundBraces from './plugins/add-missing-round-braces/index
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';
6
+ import * as addMissingComma from './plugins/add-missing-comma/index.js';
7
+ import * as addConstToExport from './plugins/add-const-to-export/index.js';
6
8
  import * as convertCommaToSemicolon from './plugins/convert-comma-to-semicolon/index.js';
7
9
  import * as convertFromToRequire from './plugins/convert-from-to-require/index.js';
8
10
  import * as removeUselessRoundBrace from './plugins/remove-useless-round-brace/index.js';
9
11
  import * as removeUselessComma from './plugins/remove-useless-comma/index.js';
10
12
  import * as removeInvalidCharacter from './plugins/remove-invalid-character/index.js';
11
- import * as addConstToExport from './plugins/add-const-to-export/index.js';
12
13
 
13
14
  export const plugins = [
14
15
  ['wrap-assignment-in-parens', wrapAssignmentInParens],
15
16
  ['add-missing-round-braces', addMissingRoundBraces],
16
17
  ['add-missing-squire-brace', addMissingSquireBrace],
17
18
  ['add-missing-semicolon', addMissingSemicolon],
19
+ ['add-missing-comma', addMissingComma],
18
20
  ['add-missing-quote', addMissingQuote],
19
21
  ['add-const-to-export', addConstToExport],
20
22
  ['convert-comma-to-semicolon', convertCommaToSemicolon],
@@ -23,6 +23,8 @@ export const isOperator = (token) => {
23
23
  'export',
24
24
  'from',
25
25
  'import',
26
+ 'return',
27
+ 'function',
26
28
  ];
27
29
 
28
30
  for (const operator of operators) {
@@ -100,6 +102,8 @@ export const closeSquareBrace = Punctuator(']');
100
102
  export const colon = Punctuator(':');
101
103
  export const comma = Punctuator(',');
102
104
  export const dot = Punctuator('.');
105
+ export const more = Punctuator('>');
106
+ export const assign = Punctuator('=');
103
107
  export const openRoundBrace = Punctuator('(');
104
108
  export const semicolon = Punctuator(';');
105
109
  export const openCurlyBrace = Punctuator('{');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "1.39.0",
3
+ "version": "1.39.1",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",