diff --git a/crates/rome_cli/tests/commands/format.rs b/crates/rome_cli/tests/commands/format.rs index a216d86f834..d09b870edb6 100644 --- a/crates/rome_cli/tests/commands/format.rs +++ b/crates/rome_cli/tests/commands/format.rs @@ -55,13 +55,6 @@ const APPLY_TRAILING_COMMA_AFTER: &str = r#"const a = [ const APPLY_ARROW_PARENTHESES_BEFORE: &str = r#" action => {} (action) => {} -(action?) => {} -(action: h) => {} -(action): h => {} -( - action - // hhhhhhhh -) => {} ({ action }) => {} ([ action ]) => {} (...action) => {} @@ -70,13 +63,6 @@ action => {} const APPLY_ARROW_PARENTHESES_AFTER: &str = r#"action => {}; action => {}; -(action?) => {}; -(action: h) => {}; -(action): h => {}; -( - action - // hhhhhhhh -) => {} ({ action }) => {}; ([action]) => {}; (...action) => {}; diff --git a/crates/rome_js_formatter/tests/specs/ts/arrow/arrow_parentheses.ts b/crates/rome_js_formatter/tests/specs/ts/arrow/arrow_parentheses.ts new file mode 100644 index 00000000000..47dd080ee33 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/ts/arrow/arrow_parentheses.ts @@ -0,0 +1,13 @@ +action => {} +(action) => {} +(action?) => {} +(action: string) => {} +(action): void => {} +( + action + // hhhhhhhh +) => {} +({ action }) => {} +([ action ]) => {} +(...action) => {} +(action = 1) => {} diff --git a/crates/rome_js_formatter/tests/specs/ts/arrow/arrow_parentheses.ts.snap b/crates/rome_js_formatter/tests/specs/ts/arrow/arrow_parentheses.ts.snap new file mode 100644 index 00000000000..2ca93d44a6a --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/ts/arrow/arrow_parentheses.ts.snap @@ -0,0 +1,88 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +info: ts/arrow/arrow_parentheses.ts +--- + +# Input + +```ts +action => {} +(action) => {} +(action?) => {} +(action: string) => {} +(action): void => {} +( + action + // hhhhhhhh +) => {} +({ action }) => {} +([ action ]) => {} +(...action) => {} +(action = 1) => {} + +``` + + +============================= + +# Outputs + +## Output 1 + +----- +Indent style: Tab +Line width: 80 +Quote style: Double Quotes +JSX quote style: Double Quotes +Quote properties: As needed +Trailing comma: All +Semicolons: Always +Arrow parentheses: Always +----- + +```ts +(action) => {}; +(action) => {}; +(action?) => {}; +(action: string) => {}; +(action): void => {}; +( + action, + // hhhhhhhh +) => {}; +({ action }) => {}; +([action]) => {}; +(...action) => {}; +(action = 1) => {}; +``` + +## Output 2 + +----- +Indent style: Tab +Line width: 80 +Quote style: Double Quotes +JSX quote style: Double Quotes +Quote properties: As needed +Trailing comma: All +Semicolons: Always +Arrow parentheses: As needed +----- + +```ts +action => {}; +action => {}; +(action?) => {}; +(action: string) => {}; +(action): void => {}; +( + action, + // hhhhhhhh +) => {}; +({ action }) => {}; +([action]) => {}; +(...action) => {}; +(action = 1) => {}; +``` + + diff --git a/crates/rome_js_formatter/tests/specs/ts/arrow/options.json b/crates/rome_js_formatter/tests/specs/ts/arrow/options.json new file mode 100644 index 00000000000..7ef4276dd98 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/ts/arrow/options.json @@ -0,0 +1,7 @@ +{ + "cases": [ + { + "arrow_parentheses": "AsNeeded" + } + ] +}