Skip to content

Commit fc702a0

Browse files
committed
Pluralize option values.
1 parent d3f0aeb commit fc702a0

File tree

8 files changed

+32
-32
lines changed

8 files changed

+32
-32
lines changed

src/configuration/builder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -387,17 +387,17 @@ impl ConfigurationBuilder {
387387
}
388388

389389
/// The kind of separator to use in type literals.
390-
pub fn type_literal_separator_kind(&mut self, value: SemiColonOrComma) -> &mut Self {
390+
pub fn type_literal_separator_kind(&mut self, value: SemiColonsOrCommas) -> &mut Self {
391391
self.insert("typeLiteral.separatorKind", value.to_string().into())
392392
}
393393

394394
/// The kind of separator to use in type literals when single line.
395-
pub fn type_literal_separator_kind_single_line(&mut self, value: SemiColonOrComma) -> &mut Self {
395+
pub fn type_literal_separator_kind_single_line(&mut self, value: SemiColonsOrCommas) -> &mut Self {
396396
self.insert("typeLiteral.separatorKind.singleLine", value.to_string().into())
397397
}
398398

399399
/// The kind of separator to use in type literals when multi-line.
400-
pub fn type_literal_separator_kind_multi_line(&mut self, value: SemiColonOrComma) -> &mut Self {
400+
pub fn type_literal_separator_kind_multi_line(&mut self, value: SemiColonsOrCommas) -> &mut Self {
401401
self.insert("typeLiteral.separatorKind.multiLine", value.to_string().into())
402402
}
403403

@@ -856,9 +856,9 @@ mod tests {
856856
.arrow_function_use_parentheses(UseParentheses::Maintain)
857857
.binary_expression_line_per_expression(false)
858858
.member_expression_line_per_expression(false)
859-
.type_literal_separator_kind(SemiColonOrComma::Comma)
860-
.type_literal_separator_kind_single_line(SemiColonOrComma::Comma)
861-
.type_literal_separator_kind_multi_line(SemiColonOrComma::Comma)
859+
.type_literal_separator_kind(SemiColonsOrCommas::Commas)
860+
.type_literal_separator_kind_single_line(SemiColonsOrCommas::Commas)
861+
.type_literal_separator_kind_multi_line(SemiColonsOrCommas::Commas)
862862
/* ignore comments */
863863
.ignore_node_comment_text("ignore")
864864
.ignore_file_comment_text("ignore-file")

src/configuration/resolve_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn resolve_config(config: ConfigKeyMap, global_config: &GlobalConfiguration)
4141
let use_braces = get_value(&mut config, "useBraces", UseBraces::WhenNotSingleLine, &mut diagnostics);
4242
let prefer_hanging = get_value(&mut config, "preferHanging", false, &mut diagnostics);
4343
let prefer_single_line = get_value(&mut config, "preferSingleLine", false, &mut diagnostics);
44-
let type_literal_separator_kind = get_value(&mut config, "typeLiteral.separatorKind", SemiColonOrComma::SemiColon, &mut diagnostics);
44+
let type_literal_separator_kind = get_value(&mut config, "typeLiteral.separatorKind", SemiColonsOrCommas::SemiColons, &mut diagnostics);
4545

4646
let resolved_config = Configuration {
4747
line_width: get_value(&mut config, "lineWidth", global_config.line_width.unwrap_or(DEFAULT_GLOBAL_CONFIGURATION.line_width), &mut diagnostics),

src/configuration/types.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,20 +217,20 @@ generate_str_to_from![
217217
[PreferSingle, "preferSingle"]
218218
];
219219

220-
/// Whether to use a semi-colon or comma.
220+
/// Whether to use semi-colons or commas.
221221
#[derive(Clone, PartialEq, Copy, Serialize, Deserialize)]
222222
#[serde(rename_all = "camelCase")]
223-
pub enum SemiColonOrComma {
223+
pub enum SemiColonsOrCommas {
224224
/// Use semi colons (default).
225-
SemiColon,
225+
SemiColons,
226226
/// Use commas.
227-
Comma,
227+
Commas,
228228
}
229229

230230
generate_str_to_from![
231-
SemiColonOrComma,
232-
[SemiColon, "semiColon"],
233-
[Comma, "comma"]
231+
SemiColonsOrCommas,
232+
[SemiColons, "semiColons"],
233+
[Commas, "commas"]
234234
];
235235

236236
#[derive(Clone, Serialize, Deserialize)]
@@ -250,9 +250,9 @@ pub struct Configuration {
250250
#[serde(rename = "memberExpression.linePerExpression")]
251251
pub member_expression_line_per_expression: bool,
252252
#[serde(rename = "typeLiteral.separatorKind.singleLine")]
253-
pub type_literal_separator_kind_single_line: SemiColonOrComma,
253+
pub type_literal_separator_kind_single_line: SemiColonsOrCommas,
254254
#[serde(rename = "typeLiteral.separatorKind.multiLine")]
255-
pub type_literal_separator_kind_multi_line: SemiColonOrComma,
255+
pub type_literal_separator_kind_multi_line: SemiColonsOrCommas,
256256
/* ignore comments */
257257
pub ignore_node_comment_text: String,
258258
pub ignore_file_comment_text: String,

src/parsing/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,10 +2409,10 @@ fn parse_type_lit<'a>(node: &'a TsTypeLit, context: &mut Context<'a>) -> PrintIt
24092409
surround_single_line_with_spaces: true,
24102410
}, context);
24112411

2412-
fn semi_colon_or_comma_to_separator_value(value: SemiColonOrComma, context: &mut Context) -> SeparatorValue {
2412+
fn semi_colon_or_comma_to_separator_value(value: SemiColonsOrCommas, context: &mut Context) -> SeparatorValue {
24132413
match value {
2414-
SemiColonOrComma::Comma => SeparatorValue::Comma(context.config.type_literal_trailing_commas),
2415-
SemiColonOrComma::SemiColon => SeparatorValue::SemiColon(context.config.semi_colons),
2414+
SemiColonsOrCommas::Commas => SeparatorValue::Comma(context.config.type_literal_trailing_commas),
2415+
SemiColonsOrCommas::SemiColons => SeparatorValue::SemiColon(context.config.semi_colons),
24162416
}
24172417
}
24182418
}

tests/specs/issues/issue0011.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
~~ semiColons: asi, typeLiteral.separatorKind.singleLine: comma ~~
2-
== should use a comma when single line ==
1+
~~ semiColons: asi, typeLiteral.separatorKind.singleLine: commas ~~
2+
== should use commas when single line ==
33
type Test = { p: string, u: number };
44

55
[expect]

tests/specs/types/TypeLiteral/TypeLiteral_SeparatorKind_Comma.txt renamed to tests/specs/types/TypeLiteral/TypeLiteral_SeparatorKind_Commas.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
~~ typeLiteral.separatorKind: comma ~~
2-
== should use a comma when single line ==
1+
~~ typeLiteral.separatorKind: commas ~~
2+
== should use commas when single line ==
33
type Test = { p: string, u: number };
44

55
[expect]
66
type Test = { p: string, u: number };
77

8-
== should use a comma when multi-line ==
8+
== should use commas when multi-line ==
99
type Test = {
1010
p: string, u: number };
1111

tests/specs/types/TypeLiteral/TypeLiteral_SeparatorKind_CommaSingle_SemiColonMulti.txt renamed to tests/specs/types/TypeLiteral/TypeLiteral_SeparatorKind_CommasSingle_SemiColonsMulti.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
~~ typeLiteral.separatorKind.singleLine: comma, typeLiteral.separatorKind.multiLine: semiColon, lineWidth: 40 ~~
2-
== should use a comma when single line ==
1+
~~ typeLiteral.separatorKind.singleLine: commas, typeLiteral.separatorKind.multiLine: semiColons, lineWidth: 40 ~~
2+
== should use commas when single line ==
33
type Test = { p: string, u: number };
44

55
[expect]
66
type Test = { p: string, u: number };
77

8-
== should use semi-colon when multi-line ==
8+
== should use semi-colons when multi-line ==
99
type Test = {
1010
p: string, u: number };
1111

@@ -15,7 +15,7 @@ type Test = {
1515
u: number;
1616
};
1717

18-
== should use a semi-colon going from single line to multi ==
18+
== should use semi-colons going from single line to multi ==
1919
type Test = { p: string, u: number, test: other };
2020

2121
[expect]

tests/specs/types/TypeLiteral/TypeLiteral_SeparatorKind_SemiColonSingle_CommaMulti.txt renamed to tests/specs/types/TypeLiteral/TypeLiteral_SeparatorKind_SemiColonsSingle_CommasMulti.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
~~ typeLiteral.separatorKind.singleLine: semiColon, typeLiteral.separatorKind.multiLine: comma, lineWidth: 40 ~~
2-
== should use a comma when single line ==
1+
~~ typeLiteral.separatorKind.singleLine: semiColons, typeLiteral.separatorKind.multiLine: commas, lineWidth: 40 ~~
2+
== should use commas when single line ==
33
type Test = { p: string, u: number };
44

55
[expect]
66
type Test = { p: string; u: number };
77

8-
== should use semi-colon when multi-line ==
8+
== should use semi-colons when multi-line ==
99
type Test = {
1010
p: string, u: number };
1111

@@ -15,7 +15,7 @@ type Test = {
1515
u: number,
1616
};
1717

18-
== should use a comma going from single line to multi ==
18+
== should use commas going from single line to multi ==
1919
type Test = { p: string; u: number; test: other };
2020

2121
[expect]

0 commit comments

Comments
 (0)