Skip to content

Commit 5b7320e

Browse files
authored
refactor: rename onlyWhenMultiple to whenMultiple (#619)
1 parent f8e1615 commit 5b7320e

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

deployment/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
"const": "never",
294294
"description": ""
295295
}, {
296-
"const": "onlyWhenMultiple",
296+
"const": "whenMultiple",
297297
"description": "Force multiple lines only if importing more than one thing."
298298
}]
299299
},

src/configuration/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ pub enum ForceMultiLine {
6666
/// Always force multiline imports/exports.
6767
Always,
6868
/// Mulitline imports/exports should be forced only when importing/exporting multiple items.
69-
OnlyWhenMultiple,
69+
WhenMultiple,
7070
}
7171

72-
generate_str_to_from![ForceMultiLine, [Always, "always"], [Never, "never"], [OnlyWhenMultiple, "onlyWhenMultiple"]];
72+
generate_str_to_from![ForceMultiLine, [Always, "always"], [Never, "never"], [WhenMultiple, "whenMultiple"]];
7373

7474
/// Where to place the opening brace.
7575
#[derive(Clone, PartialEq, Copy, Serialize, Deserialize)]

src/generation/generate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ fn gen_export_named_decl<'a>(node: &NamedExport<'a>, context: &mut Context<'a>)
10361036

10371037
let force_multi_line = !force_single_line
10381038
&& ((context.config.export_declaration_force_multi_line == ForceMultiLine::Always)
1039-
|| (named_exports.len() > 1 && context.config.export_declaration_force_multi_line == ForceMultiLine::OnlyWhenMultiple));
1039+
|| (named_exports.len() > 1 && context.config.export_declaration_force_multi_line == ForceMultiLine::WhenMultiple));
10401040

10411041
let should_single_line = force_single_line
10421042
|| (default_export.is_none()
@@ -1226,7 +1226,7 @@ fn gen_import_decl<'a>(node: &ImportDecl<'a>, context: &mut Context<'a>) -> Prin
12261226
let force_single_line = context.config.import_declaration_force_single_line && !contains_line_or_multiline_comment(node.into(), context.program);
12271227

12281228
let force_multi_line = context.config.import_declaration_force_multi_line == ForceMultiLine::Always
1229-
|| (named_imports.len() > 1 && context.config.import_declaration_force_multi_line == ForceMultiLine::OnlyWhenMultiple);
1229+
|| (named_imports.len() > 1 && context.config.import_declaration_force_multi_line == ForceMultiLine::WhenMultiple);
12301230

12311231
let should_single_line = force_single_line
12321232
|| (default_import.is_none()

tests/specs/declarations/export/ExportDeclaration_ForceMultiLine_OnlyWhenMultiple.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
~~ exportDeclaration.forceMultiLine: onlyWhenMultiple, lineWidth: 40 ~~
1+
~~ exportDeclaration.forceMultiLine: whenMultiple, lineWidth: 40 ~~
22
== should never add a new line between exports ==
33
export { testing, a, b, c, d, e } from "./test.ts";
44
export { testing, a, b, c, d, e // test

tests/specs/declarations/import/ImportDeclaration_ForceMultiLine_OnlyWhenMultiple.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
~~ importDeclaration.forceMultiLine: onlyWhenMultiple, lineWidth: 40 ~~
1+
~~ importDeclaration.forceMultiLine: whenMultiple, lineWidth: 40 ~~
22
== should break imports when more than one ==
33
import { a, b } from "./test.ts";
44

0 commit comments

Comments
 (0)