Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ fn to_path_kind(source: &str) -> ImportPathKind {
}

// TODO: This can be changed via `options.internalPattern`
if source.starts_with('~') || source.starts_with('@') {
if source.starts_with("~/") || source.starts_with("@/") {
return ImportPathKind::Internal;
}

Expand Down
16 changes: 16 additions & 0 deletions crates/oxc_formatter/tests/ir_transform/sort_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ import("a");
import b from "b";
import c from "c";
import("a");
"#,
);
assert_format(
r#"
import internal from "~/internal";
import internal2 from "@/internal2";
import external from "external";
import external2 from "@external2";
"#,
r#"{ "experimentalSortImports": {} }"#,
r#"
import external2 from "@external2";
import external from "external";

import internal2 from "@/internal2";
import internal from "~/internal";
"#,
);
}
Expand Down
Loading