We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
no-useless-path-segments
.filter
.reduce
1 parent 89f5d0d commit e7c2486Copy full SHA for e7c2486
src/rules/no-useless-path-segments.js
@@ -33,7 +33,7 @@ function normalize(fn) {
33
}
34
35
function countRelativeParents(pathSegments) {
36
- return pathSegments.reduce((sum, pathSegment) => pathSegment === '..' ? sum + 1 : sum, 0);
+ return pathSegments.filter((x) => x === '..').length;
37
38
39
module.exports = {
0 commit comments