Skip to content

Commit

Permalink
[Refactor] no-useless-path-segments: use .filter instead of `.red…
Browse files Browse the repository at this point in the history
…uce`
  • Loading branch information
ljharb committed Jul 28, 2023
1 parent 89f5d0d commit e7c2486
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/no-useless-path-segments.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function normalize(fn) {
}

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

module.exports = {
Expand Down

0 comments on commit e7c2486

Please sign in to comment.