Skip to content

Commit

Permalink
fix: revert back default type only named imports/exports sorting to "…
Browse files Browse the repository at this point in the history
…none" (#666)
  • Loading branch information
dsherret authored Sep 18, 2024
1 parent 236289e commit 1676dc7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
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";

0 comments on commit 1676dc7

Please sign in to comment.