Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revert back default type only named imports/exports sorting to "none" #666

Merged
merged 2 commits into from
Sep 18, 2024
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
2 changes: 1 addition & 1 deletion deployment/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
"typeOnlyImportsExportsSortOrder": {
"description": "The kind of sort ordering to use for typed imports and exports.",
"type": "string",
"default": "last",
"default": "none",
"oneOf": [{
"const": "first",
"description": "Puts type-only named imports and exports first."
Expand Down
4 changes: 2 additions & 2 deletions src/configuration/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ impl ConfigurationBuilder {
.ignore_file_comment_text("deno-fmt-ignore-file")
.module_sort_import_declarations(SortOrder::Maintain)
.module_sort_export_declarations(SortOrder::Maintain)
.export_declaration_sort_type_only_exports(NamedTypeImportsExportsOrder::Last)
.import_declaration_sort_type_only_imports(NamedTypeImportsExportsOrder::Last)
.export_declaration_sort_type_only_exports(NamedTypeImportsExportsOrder::None)
.import_declaration_sort_type_only_imports(NamedTypeImportsExportsOrder::None)
}

/// The width of a line the printer will try to stay under. Note that the printer may exceed this width in certain cases.
Expand Down
4 changes: 2 additions & 2 deletions src/configuration/resolve_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ pub fn resolve_config(config: ConfigKeyMap, global_config: &GlobalConfiguration)
import_declaration_sort_type_only_imports: get_value(
&mut config,
"importDeclaration.sortTypeOnlyImports",
NamedTypeImportsExportsOrder::Last,
NamedTypeImportsExportsOrder::None,
&mut diagnostics,
),
export_declaration_sort_type_only_exports: get_value(
&mut config,
"exportDeclaration.sortTypeOnlyExports",
NamedTypeImportsExportsOrder::Last,
NamedTypeImportsExportsOrder::None,
&mut diagnostics,
),
/* ignore comments */
Expand Down
2 changes: 1 addition & 1 deletion src/configuration/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ generate_str_to_from![
#[serde(rename_all = "camelCase")]
pub enum NamedTypeImportsExportsOrder {
First,
#[default]
Last,
#[default]
None,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export { // test
testing,
} from "asdf";

== should sort type imports last by default ==
== should not sort type imports by default in order to reduce merge conflicts ==
export {
type a,
testing,
Expand All @@ -84,9 +84,9 @@ export {

[expect]
export {
type a,
other,
outttttttttttttttt,
testing,
type a,
type z,
} from "asdf";
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,20 @@ import { // test
testing,
} from "asdf";

== should sort with types last ==
== should not sort type only imports by default to reduce merge conflicts ==
import {
type a,
testing,
other,
outttttttttttttttt,
type b,
type z,
} from "asdf";

[expect]
import {
type a,
other,
outttttttttttttttt,
testing,
type a,
type b,
type z,
} from "asdf";
Loading