Skip to content

Commit e7c2486

Browse files
committed
[Refactor] no-useless-path-segments: use .filter instead of .reduce
1 parent 89f5d0d commit e7c2486

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/rules/no-useless-path-segments.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function normalize(fn) {
3333
}
3434

3535
function countRelativeParents(pathSegments) {
36-
return pathSegments.reduce((sum, pathSegment) => pathSegment === '..' ? sum + 1 : sum, 0);
36+
return pathSegments.filter((x) => x === '..').length;
3737
}
3838

3939
module.exports = {

0 commit comments

Comments
 (0)