flatlint 1.24.0 → 1.24.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/plugins/add-missing-semicolon/index.js +9 -2
- package/lib/plugins.js +2 -0
- package/lib/types/types.js +1 -0
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
comma,
|
|
3
|
+
isPunctuator,
|
|
4
|
+
semicolon,
|
|
5
|
+
} from '#types';
|
|
2
6
|
|
|
3
7
|
export const report = () => 'Add missing semicolon';
|
|
4
8
|
|
|
@@ -13,8 +17,11 @@ export const replace = () => ({
|
|
|
13
17
|
});
|
|
14
18
|
|
|
15
19
|
function check(vars, path) {
|
|
20
|
+
if (path.isEndsWithPunctuator(comma))
|
|
21
|
+
return false;
|
|
22
|
+
|
|
16
23
|
for (const token of path.getAllNext()) {
|
|
17
|
-
if (isPunctuator(token))
|
|
24
|
+
if (isPunctuator(token, semicolon))
|
|
18
25
|
return false;
|
|
19
26
|
}
|
|
20
27
|
|
package/lib/plugins.js
CHANGED
|
@@ -6,12 +6,14 @@ import * as convertCommaToSemicolon from './plugins/convert-comma-to-semicolon/i
|
|
|
6
6
|
import * as convertFromToRequire from './plugins/convert-from-to-require/index.js';
|
|
7
7
|
import * as removeUselessRoundBrace from './plugins/remove-useless-round-brace/index.js';
|
|
8
8
|
import * as addConstToExport from './plugins/add-const-to-export/index.js';
|
|
9
|
+
import * as addMissingSemicolon from './plugins/add-missing-semicolon/index.js';
|
|
9
10
|
|
|
10
11
|
export const plugins = [
|
|
11
12
|
['wrap-assignment-in-parens', wrapAssignmentInParens],
|
|
12
13
|
['add-missing-round-braces', addMissingRoundBraces],
|
|
13
14
|
['add-missing-squire-brace', addMissingSquireBrace],
|
|
14
15
|
['add-missing-quote', addMissingQuote],
|
|
16
|
+
['add-missing-semicolon', addMissingSemicolon],
|
|
15
17
|
['add-const-to-export', addConstToExport],
|
|
16
18
|
['convert-comma-to-semicolon', convertCommaToSemicolon],
|
|
17
19
|
['convert-from-to-require', convertFromToRequire],
|
package/lib/types/types.js
CHANGED
|
@@ -81,6 +81,7 @@ export const openRoundBrace = Punctuator('(');
|
|
|
81
81
|
export const closeRoundBrace = Punctuator(')');
|
|
82
82
|
export const closeSquareBrace = Punctuator(']');
|
|
83
83
|
export const semicolon = Punctuator(';');
|
|
84
|
+
export const comma = Punctuator(',');
|
|
84
85
|
|
|
85
86
|
export const OK = true;
|
|
86
87
|
export const NOT_OK = false;
|