Skip to content

Commit ad331ae

Browse files
committed
chore(lint): add test case for #15990
1 parent caad188 commit ad331ae

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

crates/oxc_linter/src/rules/eslint/sort_imports.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,8 @@ fn get_number_of_lines_between(left: Span, right: Span, ctx: &LintContext) -> us
471471
return 0;
472472
}
473473

474-
// In different lines, need to subtract 2 because the count includes the first and last line.
474+
// In different lines, need to subtract 1, because we need new line 2 time to have 1 line
475+
// between node
475476
count - 1
476477
}
477478

@@ -580,6 +581,13 @@ fn test() {
580581
(
581582
"import b from 'b';
582583
584+
import a from 'a';",
585+
Some(serde_json::json!([{ "allowSeparatedGroups": true }])),
586+
),
587+
// No leading whitespaces - issue #15990
588+
(
589+
"import b from 'b';
590+
583591
import a from 'a';",
584592
Some(serde_json::json!([{ "allowSeparatedGroups": true }])),
585593
),

0 commit comments

Comments
 (0)