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 +5 -0
- package/lib/compare/values.js +0 -1
- package/lib/plugins/add-missing-comma/index.js +18 -6
- package/lib/plugins.js +3 -1
- package/lib/types/types.js +4 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/lib/compare/values.js
CHANGED
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
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(
|
|
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],
|
package/lib/types/types.js
CHANGED
|
@@ -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('{');
|