Skip to content

Commit

Permalink
add fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pri1311 committed Mar 18, 2022
1 parent d51eb51 commit 2c829c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/rules/order.js
Expand Up @@ -257,10 +257,10 @@ function getSorter(ascending) {
} else {
const A = importA.split('/');
const B = importB.split('/');
const a = A.length
const b = B.length
const a = A.length;
const b = B.length;

for (var i = 0; i < Math.min(a,b); i++) {
for (let i = 0; i < Math.min(a,b); i++) {
if (A[i] < B[i]) {
result = -1;
break;
Expand All @@ -270,8 +270,8 @@ function getSorter(ascending) {
}
}

if (!result && a != b) {
result = a < b ? -1 : 1
if (!result && a !== b) {
result = a < b ? -1 : 1;
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/src/rules/order.js
Expand Up @@ -713,8 +713,8 @@ ruleTester.run('order', rule, {
import d from "foo/barfoo";
import a from "foo";`,
options: [{
alphabetize: { order: 'desc' },
}],
alphabetize: { order: 'desc' },
}],
}),
// Option alphabetize with newlines-between: {order: 'asc', newlines-between: 'always'}
test({
Expand Down

0 comments on commit 2c829c3

Please sign in to comment.