Skip to content

Commit be928ae

Browse files
committed
[Refactor] no-internal-modules: simplify a reduce
1 parent e7c2486 commit be928ae

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/rules/no-internal-modules.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,14 @@ module.exports = {
5858
}
5959

6060
function toSteps(somePath) {
61-
return normalizeSep(somePath)
61+
return normalizeSep(somePath)
6262
.split('/')
63+
.filter((step) => step && step !== '.')
6364
.reduce((acc, step) => {
64-
if (!step || step === '.') {
65-
return acc;
66-
} else if (step === '..') {
65+
if (step === '..') {
6766
return acc.slice(0, -1);
68-
} else {
69-
return acc.concat(step);
7067
}
68+
return acc.concat(step);
7169
}, []);
7270
}
7371

0 commit comments

Comments
 (0)