redlint 3.22.2 → 3.22.4
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
package/lib/edit/edit.js
CHANGED
|
@@ -8,7 +8,7 @@ const {
|
|
|
8
8
|
getFilename,
|
|
9
9
|
getParentDirectory,
|
|
10
10
|
removeFile,
|
|
11
|
-
|
|
11
|
+
removeEmptyDirectory,
|
|
12
12
|
} = operator;
|
|
13
13
|
|
|
14
14
|
export const report = (filePath, {from, to}) => `Rename '${from}' to '${to}'`;
|
|
@@ -24,7 +24,7 @@ export const fix = (filePath, {to}) => {
|
|
|
24
24
|
const dir = getParentDirectory(filePath);
|
|
25
25
|
|
|
26
26
|
removeFile(filePath);
|
|
27
|
-
|
|
27
|
+
removeEmptyDirectory(dir);
|
|
28
28
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
@@ -46,10 +46,7 @@ const addFromTo = (namesFrom, namesTo) => (a, i) => [
|
|
|
46
46
|
];
|
|
47
47
|
|
|
48
48
|
export const scan = (path, {push, trackFile, options}) => {
|
|
49
|
-
const {
|
|
50
|
-
from = [],
|
|
51
|
-
to = [],
|
|
52
|
-
} = options;
|
|
49
|
+
const {from = [], to = []} = options;
|
|
53
50
|
|
|
54
51
|
if (from.length !== to.length)
|
|
55
52
|
return;
|
|
@@ -107,18 +104,3 @@ function isEqual(a, b) {
|
|
|
107
104
|
|
|
108
105
|
return is;
|
|
109
106
|
}
|
|
110
|
-
|
|
111
|
-
function removeEmptyNestedDirectory(parentDir) {
|
|
112
|
-
let nextParentDir = parentDir;
|
|
113
|
-
|
|
114
|
-
while (!readDirectory(parentDir).length) {
|
|
115
|
-
const name = getFilename(parentDir);
|
|
116
|
-
|
|
117
|
-
if (name === '/')
|
|
118
|
-
break;
|
|
119
|
-
|
|
120
|
-
nextParentDir = getParentDirectory(parentDir);
|
|
121
|
-
removeFile(parentDir);
|
|
122
|
-
parentDir = nextParentDir;
|
|
123
|
-
}
|
|
124
|
-
}
|