@putout/plugin-putout-config 12.2.1 → 12.3.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/lib/remove-empty/index.js +19 -4
- package/package.json +1 -1
|
@@ -15,15 +15,12 @@ export const include = () => [
|
|
|
15
15
|
|
|
16
16
|
export const filter = (path) => {
|
|
17
17
|
const {parentPath, node} = path;
|
|
18
|
-
|
|
19
18
|
const {properties, elements} = node;
|
|
20
19
|
|
|
21
20
|
if (!parentPath.isObjectProperty())
|
|
22
21
|
return false;
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (!/rules|match|plugins/.test(key))
|
|
23
|
+
if (!isKey(parentPath))
|
|
27
24
|
return false;
|
|
28
25
|
|
|
29
26
|
if (path.isObjectExpression())
|
|
@@ -31,3 +28,21 @@ export const filter = (path) => {
|
|
|
31
28
|
|
|
32
29
|
return !elements.length;
|
|
33
30
|
};
|
|
31
|
+
|
|
32
|
+
function isKey(parentPath) {
|
|
33
|
+
const key = parentPath.get('key').node.value;
|
|
34
|
+
|
|
35
|
+
if (!/rules|plugins|match/.test(key)) {
|
|
36
|
+
const keyPath = parentPath.parentPath.parentPath.get('key');
|
|
37
|
+
|
|
38
|
+
if (!keyPath.node)
|
|
39
|
+
return false;
|
|
40
|
+
|
|
41
|
+
const {value} = keyPath.node;
|
|
42
|
+
|
|
43
|
+
if (value !== 'match')
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return true;
|
|
48
|
+
}
|
package/package.json
CHANGED