redlint 6.9.0 → 6.9.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,5 +1,7 @@
|
|
|
1
1
|
import {operator} from 'putout';
|
|
2
2
|
|
|
3
|
+
const {stringify} = JSON;
|
|
4
|
+
|
|
3
5
|
const {
|
|
4
6
|
getTemplateValues,
|
|
5
7
|
compare,
|
|
@@ -7,18 +9,24 @@ const {
|
|
|
7
9
|
|
|
8
10
|
const TRANSFORM = 't.transform(__a)';
|
|
9
11
|
const TRANSFORM_COUPLE = 't.transform(__a, __b)';
|
|
12
|
+
const TRANSFORM_WITH_OPTIONS = 't.transformWithOptions(__a, __b)';
|
|
10
13
|
|
|
11
|
-
export const report =
|
|
14
|
+
export const report = (path) => {
|
|
15
|
+
const name = parseName(path);
|
|
16
|
+
const options = parseOptions(path);
|
|
17
|
+
|
|
18
|
+
return `${name} -> ${options}`;
|
|
19
|
+
};
|
|
12
20
|
|
|
13
21
|
export const fix = () => {};
|
|
14
22
|
|
|
15
|
-
export const include = () => [TRANSFORM, TRANSFORM_COUPLE];
|
|
23
|
+
export const include = () => [TRANSFORM, TRANSFORM_COUPLE, TRANSFORM_WITH_OPTIONS];
|
|
16
24
|
|
|
17
25
|
export const filter = (path) => {
|
|
18
26
|
return compare(path.parentPath.parentPath, 'test.only(__a, __b)');
|
|
19
27
|
};
|
|
20
28
|
|
|
21
|
-
function
|
|
29
|
+
function parseName(path) {
|
|
22
30
|
const {length} = path.node.arguments;
|
|
23
31
|
|
|
24
32
|
if (length === 1) {
|
|
@@ -30,3 +38,12 @@ function parseValue(path) {
|
|
|
30
38
|
|
|
31
39
|
return __a.value;
|
|
32
40
|
}
|
|
41
|
+
|
|
42
|
+
function parseOptions(path) {
|
|
43
|
+
if (!compare(path, TRANSFORM_WITH_OPTIONS))
|
|
44
|
+
return '{}';
|
|
45
|
+
|
|
46
|
+
const {value} = path.get('arguments.1').evaluate();
|
|
47
|
+
|
|
48
|
+
return stringify(value, null, 4);
|
|
49
|
+
}
|