Skip to content

Commit 1676dc7

Browse files
authored
fix: revert back default type only named imports/exports sorting to "none" (#666)
1 parent 236289e commit 1676dc7

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

deployment/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@
300300
"typeOnlyImportsExportsSortOrder": {
301301
"description": "The kind of sort ordering to use for typed imports and exports.",
302302
"type": "string",
303-
"default": "last",
303+
"default": "none",
304304
"oneOf": [{
305305
"const": "first",
306306
"description": "Puts type-only named imports and exports first."

src/configuration/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ impl ConfigurationBuilder {
6969
.ignore_file_comment_text("deno-fmt-ignore-file")
7070
.module_sort_import_declarations(SortOrder::Maintain)
7171
.module_sort_export_declarations(SortOrder::Maintain)
72-
.export_declaration_sort_type_only_exports(NamedTypeImportsExportsOrder::Last)
73-
.import_declaration_sort_type_only_imports(NamedTypeImportsExportsOrder::Last)
72+
.export_declaration_sort_type_only_exports(NamedTypeImportsExportsOrder::None)
73+
.import_declaration_sort_type_only_imports(NamedTypeImportsExportsOrder::None)
7474
}
7575

7676
/// The width of a line the printer will try to stay under. Note that the printer may exceed this width in certain cases.

src/configuration/resolve_config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ pub fn resolve_config(config: ConfigKeyMap, global_config: &GlobalConfiguration)
122122
import_declaration_sort_type_only_imports: get_value(
123123
&mut config,
124124
"importDeclaration.sortTypeOnlyImports",
125-
NamedTypeImportsExportsOrder::Last,
125+
NamedTypeImportsExportsOrder::None,
126126
&mut diagnostics,
127127
),
128128
export_declaration_sort_type_only_exports: get_value(
129129
&mut config,
130130
"exportDeclaration.sortTypeOnlyExports",
131-
NamedTypeImportsExportsOrder::Last,
131+
NamedTypeImportsExportsOrder::None,
132132
&mut diagnostics,
133133
),
134134
/* ignore comments */

src/configuration/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ generate_str_to_from![
300300
#[serde(rename_all = "camelCase")]
301301
pub enum NamedTypeImportsExportsOrder {
302302
First,
303-
#[default]
304303
Last,
304+
#[default]
305305
None,
306306
}
307307

tests/specs/declarations/export/NamedExports_SortOrder_CaseInsensitive.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export { // test
7373
testing,
7474
} from "asdf";
7575

76-
== should sort type imports last by default ==
76+
== should not sort type imports by default in order to reduce merge conflicts ==
7777
export {
7878
type a,
7979
testing,
@@ -84,9 +84,9 @@ export {
8484

8585
[expect]
8686
export {
87+
type a,
8788
other,
8889
outttttttttttttttt,
8990
testing,
90-
type a,
9191
type z,
9292
} from "asdf";

tests/specs/declarations/import/NamedImports_SortOrder_CaseInsensitive.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,20 @@ import { // test
7373
testing,
7474
} from "asdf";
7575

76-
== should sort with types last ==
76+
== should not sort type only imports by default to reduce merge conflicts ==
7777
import {
7878
type a,
7979
testing,
8080
other,
8181
outttttttttttttttt,
82-
type b,
82+
type z,
8383
} from "asdf";
8484

8585
[expect]
8686
import {
87+
type a,
8788
other,
8889
outttttttttttttttt,
8990
testing,
90-
type a,
91-
type b,
91+
type z,
9292
} from "asdf";

0 commit comments

Comments
 (0)