flatlint 3.6.0 → 3.8.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
|
@@ -24,19 +24,8 @@ export const match = () => ({
|
|
|
24
24
|
|
|
25
25
|
return true;
|
|
26
26
|
},
|
|
27
|
-
'})': (vars, path) =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
for (const current of path.getAllPrev()) {
|
|
31
|
-
if (isPunctuator(current, openRoundBrace))
|
|
32
|
-
++balance;
|
|
33
|
-
|
|
34
|
-
if (isPunctuator(current, closeRoundBrace))
|
|
35
|
-
--balance;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return !balance;
|
|
39
|
-
},
|
|
27
|
+
'})': (vars, path) => isBracesBalanced(path),
|
|
28
|
+
')]': (vars, path) => !isBracesBalanced(path),
|
|
40
29
|
});
|
|
41
30
|
|
|
42
31
|
export const replace = () => ({
|
|
@@ -44,5 +33,20 @@ export const replace = () => ({
|
|
|
44
33
|
'from "__b")': 'from "__b"',
|
|
45
34
|
'__a);': '__a;',
|
|
46
35
|
'})': '}',
|
|
36
|
+
')]': ']',
|
|
47
37
|
'for (__a __b of __c))': 'for (__a __b of __c)',
|
|
48
38
|
});
|
|
39
|
+
|
|
40
|
+
function isBracesBalanced(path) {
|
|
41
|
+
let balance = 0;
|
|
42
|
+
|
|
43
|
+
for (const current of path.getAllPrev()) {
|
|
44
|
+
if (isPunctuator(current, openRoundBrace))
|
|
45
|
+
++balance;
|
|
46
|
+
|
|
47
|
+
if (isPunctuator(current, closeRoundBrace))
|
|
48
|
+
--balance;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return !balance;
|
|
52
|
+
}
|
package/lib/runner/replacer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {createDebug} from 'obug';
|
|
2
2
|
import {compare} from '#compare';
|
|
3
3
|
import {prepare} from '#parser';
|
|
4
4
|
import {
|
|
@@ -10,8 +10,12 @@ import {createPath} from './path.js';
|
|
|
10
10
|
|
|
11
11
|
const returns = (a) => () => a;
|
|
12
12
|
const {entries} = Object;
|
|
13
|
-
const logCompare =
|
|
14
|
-
|
|
13
|
+
const logCompare = createDebug('flatlint:compare', {
|
|
14
|
+
useColors: true,
|
|
15
|
+
});
|
|
16
|
+
const logFix = createDebug('flatlint:fix', {
|
|
17
|
+
useColors: true,
|
|
18
|
+
});
|
|
15
19
|
|
|
16
20
|
export const replace = (tokens, {fix, rule, plugin}) => {
|
|
17
21
|
const places = [];
|
package/lib/with-plugins.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flatlint",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "JavaScript tokens-based linter",
|
|
5
5
|
"main": "lib/flatlint.js",
|
|
6
6
|
"type": "module",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@putout/engine-loader": "^16.0.0",
|
|
81
81
|
"@putout/operator-keyword": "^3.0.0",
|
|
82
|
-
"
|
|
83
|
-
"
|
|
82
|
+
"js-tokens": "^10.0.0",
|
|
83
|
+
"obug": "^2.1.1"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@putout/test": "^14.0.0",
|