From a0df907a297696ecda1ded2a23e0cd9cce671630 Mon Sep 17 00:00:00 2001 From: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Date: Mon, 10 Jul 2023 09:53:09 +0000 Subject: [PATCH 1/7] feat(rome_js_formatter, rome_cli): add `arrowParentheses` option --- .../main_commands_check/check_help.snap | 2 + .../snapshots/main_commands_ci/ci_help.snap | 2 + .../main_commands_format/format_help.snap | 2 + .../main_commands_lint/check_help.snap | 2 + crates/rome_js_formatter/src/context.rs | 77 ++++- .../expressions/arrow_function_expression.rs | 14 +- crates/rome_js_formatter/tests/language.rs | 25 +- crates/rome_js_formatter/tests/quick_test.rs | 27 +- .../js/module/array/array_nested.js.snap | 1 + .../js/module/array/binding_pattern.js.snap | 1 + .../specs/js/module/array/empty_lines.js.snap | 1 + .../specs/js/module/array/spaces.js.snap | 1 + .../specs/js/module/array/spread.js.snap | 1 + .../array_trailing_comma.js.snap | 3 + .../js/module/arrow/arrow-comments.js.snap | 37 ++ .../module/arrow/arrow_chain_comments.js.snap | 33 ++ .../js/module/arrow/arrow_function.js.snap | 27 ++ .../js/module/arrow/arrow_nested.js.snap | 43 +++ .../module/arrow/arrow_test_callback.js.snap | 26 ++ .../tests/specs/js/module/arrow/call.js.snap | 70 ++++ .../specs/js/module/arrow/currying.js.snap | 34 ++ .../tests/specs/js/module/arrow/options.json | 7 + .../specs/js/module/arrow/params.js.snap | 318 ++++++++++++++++++ .../assignment/array-assignment-holes.js.snap | 1 + .../js/module/assignment/assignment.js.snap | 1 + .../assignment/assignment_ignore.js.snap | 1 + .../binding/array-binding-holes.js.snap | 1 + .../js/module/binding/array_binding.js.snap | 1 + .../module/binding/identifier_binding.js.snap | 1 + .../js/module/binding/object_binding.js.snap | 1 + .../specs/js/module/call_expression.js.snap | 1 + .../tests/specs/js/module/class/class.js.snap | 1 + .../js/module/class/class_comments.js.snap | 1 + .../js/module/class/private_method.js.snap | 1 + .../tests/specs/js/module/comments.js.snap | 1 + .../declarations/variable_declaration.js.snap | 1 + .../class_members_call_decorator.js.snap | 1 + .../decorators/class_members_mixed.js.snap | 1 + .../decorators/class_members_simple.js.snap | 1 + .../js/module/decorators/class_simple.js.snap | 1 + .../class_simple_call_decorator.js.snap | 1 + .../decorators/export_default_1.js.snap | 1 + .../decorators/export_default_2.js.snap | 1 + .../decorators/export_default_3.js.snap | 1 + .../decorators/export_default_4.js.snap | 1 + .../js/module/decorators/expression.js.snap | 1 + .../js/module/decorators/multiline.js.snap | 1 + .../tests/specs/js/module/each/each.js.snap | 1 + .../js/module/export/class_clause.js.snap | 1 + .../module/export/expression_clause.js.snap | 1 + .../js/module/export/from_clause.js.snap | 1 + .../js/module/export/function_clause.js.snap | 1 + .../js/module/export/named_clause.js.snap | 1 + .../module/export/named_from_clause.js.snap | 1 + .../export_trailing_comma.js.snap | 3 + .../export/variable_declaration.js.snap | 1 + .../expression/binary_expression.js.snap | 1 + .../binary_range_expression.js.snap | 1 + .../expression/binaryish_expression.js.snap | 1 + .../computed-member-expression.js.snap | 1 + .../expression/conditional_expression.js.snap | 1 + .../import_meta_expression.js.snap | 2 + .../expression/literal_expression.js.snap | 1 + .../expression/logical_expression.js.snap | 1 + .../member-chain/complex_arguments.js.snap | 1 + .../expression/member-chain/computed.js.snap | 1 + .../member-chain/inline-merge.js.snap | 1 + .../module/expression/new_expression.js.snap | 1 + .../expression/post_update_expression.js.snap | 1 + .../expression/pre_update_expression.js.snap | 1 + .../expression/sequence_expression.js.snap | 1 + .../static_member_expression.js.snap | 1 + .../module/expression/this_expression.js.snap | 1 + .../expression/unary_expression.js.snap | 1 + ...unary_expression_verbatim_argument.js.snap | 1 + .../specs/js/module/function/function.js.snap | 1 + .../js/module/function/function_args.js.snap | 1 + .../module/function/function_comments.js.snap | 1 + .../tests/specs/js/module/ident.js.snap | 1 + .../js/module/import/bare_import.js.snap | 1 + .../js/module/import/default_import.js.snap | 1 + .../js/module/import/import_call.js.snap | 1 + .../module/import/import_specifiers.js.snap | 1 + .../js/module/import/namespace_import.js.snap | 1 + .../import_trailing_comma.js.snap | 3 + .../tests/specs/js/module/interpreter.js.snap | 1 + .../interpreter_with_empty_line.js.snap | 1 + .../js/module/invalid/block_stmt_err.js.snap | 1 + .../js/module/invalid/if_stmt_err.js.snap | 1 + .../tests/specs/js/module/newlines.js.snap | 1 + .../specs/js/module/no-semi/class.js.snap | 2 + .../specs/js/module/no-semi/issue2006.js.snap | 2 + .../specs/js/module/no-semi/no-semi.js.snap | 2 + .../js/module/no-semi/private-field.js.snap | 2 + .../js/module/no-semi/semicolons-asi.js.snap | 2 + .../module/no-semi/semicolons_range.js.snap | 2 + .../specs/js/module/number/number.js.snap | 1 + .../module/number/number_with_space.js.snap | 1 + .../js/module/object/computed_member.js.snap | 1 + .../js/module/object/getter_setter.js.snap | 1 + .../specs/js/module/object/object.js.snap | 1 + .../js/module/object/object_comments.js.snap | 1 + .../module/object/octal_literals_key.js.snap | 1 + .../js/module/object/property_key.js.snap | 1 + .../object/property_object_member.js.snap | 1 + .../object_trailing_comma.js.snap | 3 + .../js/module/parentheses/parentheses.js.snap | 1 + .../range_parentheses_binary.js.snap | 1 + .../fill-array-comments.js.snap | 1 + .../range_parenthesis_after_semicol.js.snap | 1 + .../range_parenthesis_after_semicol_1.js.snap | 1 + .../tests/specs/js/module/script.js.snap | 1 + .../module/statement/block_statement.js.snap | 1 + .../js/module/statement/do_while.js.snap | 1 + .../js/module/statement/empty_blocks.js.snap | 1 + .../specs/js/module/statement/for_in.js.snap | 1 + .../js/module/statement/for_loop.js.snap | 1 + .../specs/js/module/statement/for_of.js.snap | 1 + .../js/module/statement/if_chain.js.snap | 1 + .../specs/js/module/statement/if_else.js.snap | 1 + .../specs/js/module/statement/return.js.snap | 1 + .../return_verbatim_argument.js.snap | 1 + .../js/module/statement/statement.js.snap | 1 + .../specs/js/module/statement/switch.js.snap | 1 + .../specs/js/module/statement/throw.js.snap | 1 + .../statement/try_catch_finally.js.snap | 1 + .../js/module/statement/while_loop.js.snap | 1 + .../specs/js/module/string/directives.js.snap | 3 + .../module/string/parentheses_token.js.snap | 3 + .../module/string/properties_quotes.js.snap | 3 + .../specs/js/module/string/string.js.snap | 3 + .../tests/specs/js/module/suppression.js.snap | 1 + .../specs/js/module/template/template.js.snap | 1 + .../tests/specs/js/module/with.js.snap | 1 + .../tests/specs/js/script/script.js.snap | 1 + .../tests/specs/js/script/with.js.snap | 1 + .../tests/specs/jsx/arrow_function.jsx.snap | 1 + .../tests/specs/jsx/attributes.jsx.snap | 1 + .../tests/specs/jsx/comments.jsx.snap | 1 + .../tests/specs/jsx/conditional.jsx.snap | 1 + .../tests/specs/jsx/element.jsx.snap | 1 + .../tests/specs/jsx/fragment.jsx.snap | 1 + .../tests/specs/jsx/new-lines.jsx.snap | 1 + .../specs/jsx/parentheses_range.jsx.snap | 1 + .../jsx/quote_style/quote_style.jsx.snap | 5 + .../tests/specs/jsx/self_closing.jsx.snap | 1 + .../tests/specs/jsx/smoke.jsx.snap | 1 + .../tests/specs/ts/arrow_chain.ts.snap | 1 + .../specs/ts/assignment/as_assignment.ts.snap | 1 + .../specs/ts/assignment/assignment.ts.snap | 1 + .../ts/assignment/assignment_comments.ts.snap | 1 + .../property_assignment_comments.ts.snap | 1 + .../type_assertion_assignment.ts.snap | 1 + .../ts/binding/definite_variable.ts.snap | 1 + .../tests/specs/ts/call_expression.ts.snap | 1 + .../tests/specs/ts/class/accessor.ts.snap | 1 + .../specs/ts/class/assigment_layout.ts.snap | 1 + .../ts/class/constructor_parameter.ts.snap | 1 + .../specs/ts/class/implements_clause.ts.snap | 1 + .../class/readonly_ambient_property.ts.snap | 1 + .../class_trailing_comma.ts.snap | 3 + .../tests/specs/ts/declaration/class.ts.snap | 1 + .../ts/declaration/declare_function.ts.snap | 1 + .../ts/declaration/global_declaration.ts.snap | 1 + .../specs/ts/declaration/interface.ts.snap | 1 + .../declaration/variable_declaration.ts.snap | 1 + .../tests/specs/ts/declare.ts.snap | 1 + .../tests/specs/ts/decoartors.ts.snap | 1 + .../specs/ts/decorators/class_members.ts.snap | 1 + .../specs/ts/enum/enum_trailing_comma.ts.snap | 3 + .../specs/ts/expression/as_expression.ts.snap | 1 + .../ts/expression/non_null_expression.ts.snap | 1 + .../type_assertion_expression.ts.snap | 1 + .../ts/expression/type_expression.ts.snap | 1 + .../specs/ts/expression/type_member.ts.snap | 1 + .../parameters/function_parameters.ts.snap | 3 + .../function_trailing_comma.ts.snap | 3 + .../specs/ts/module/export_clause.ts.snap | 1 + .../module/external_module_reference.ts.snap | 1 + .../ts/module/module_declaration.ts.snap | 1 + .../ts/module/qualified_module_name.ts.snap | 1 + .../tests/specs/ts/no-semi/class.ts.snap | 2 + .../tests/specs/ts/no-semi/non-null.ts.snap | 2 + .../tests/specs/ts/no-semi/statements.ts.snap | 2 + .../tests/specs/ts/no-semi/types.ts.snap | 2 + .../ts/object/object_trailing_comma.ts.snap | 3 + .../specs/ts/parameters/parameters.ts.snap | 1 + .../tests/specs/ts/parenthesis.ts.snap | 1 + .../specs/ts/statement/empty_block.ts.snap | 1 + .../specs/ts/statement/enum_statement.ts.snap | 1 + .../specs/ts/string/parameter_quotes.ts.snap | 3 + .../tests/specs/ts/suppressions.ts.snap | 1 + .../tests/specs/ts/type/conditional.ts.snap | 1 + .../tests/specs/ts/type/import_type.ts.snap | 1 + .../specs/ts/type/intersection_type.ts.snap | 1 + .../tests/specs/ts/type/mapped_type.ts.snap | 1 + .../specs/ts/type/qualified_name.ts.snap | 1 + .../tests/specs/ts/type/template_type.ts.snap | 1 + .../type_trailing_comma.ts.snap | 3 + .../tests/specs/ts/type/union_type.ts.snap | 1 + .../tests/specs/tsx/smoke.tsx.snap | 1 + .../src/configuration/javascript.rs | 10 +- .../configuration/parse/json/javascript.rs | 7 +- .../src/file_handlers/javascript.rs | 4 +- crates/rome_service/src/settings.rs | 1 + editors/vscode/configuration_schema.json | 8 + npm/backend-jsonrpc/src/workspace.ts | 5 + npm/rome/configuration_schema.json | 8 + 208 files changed, 990 insertions(+), 28 deletions(-) create mode 100644 crates/rome_js_formatter/tests/specs/js/module/arrow/options.json diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap b/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap index 0db32081be9..9165bbd2ee8 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap @@ -33,6 +33,8 @@ The configuration that is contained inside the file `rome.json` syntactic structures. Defaults to "all". --semicolons= Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + --arrow-parentheses= Whether to add non-necessary parentheses to arrow functions. + Defaults to "always". Global options applied to all commands --colors= Set the formatting mode for markup: "off" prints everything as plain diff --git a/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap b/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap index 4666a730b76..89351b43bd0 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap @@ -34,6 +34,8 @@ The configuration that is contained inside the file `rome.json` syntactic structures. Defaults to "all". --semicolons= Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + --arrow-parentheses= Whether to add non-necessary parentheses to arrow functions. + Defaults to "always". Global options applied to all commands --colors= Set the formatting mode for markup: "off" prints everything as plain diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap b/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap index 169ef25c4b9..3f111e3e2a2 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap @@ -57,6 +57,8 @@ Available options: syntactic structures. Defaults to "all". --semicolons= Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + --arrow-parentheses= Whether to add non-necessary parentheses to arrow functions. + Defaults to "always". --stdin-file-path=PATH A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome format --stdin-file-path=file.js". --write Writes formatted files to file system. diff --git a/crates/rome_cli/tests/snapshots/main_commands_lint/check_help.snap b/crates/rome_cli/tests/snapshots/main_commands_lint/check_help.snap index 9a4d7264074..5d43c866180 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_lint/check_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_lint/check_help.snap @@ -33,6 +33,8 @@ The configuration that is contained inside the file `rome.json` syntactic structures. Defaults to "all". --semicolons= Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + --arrow-parentheses= Whether to add non-necessary parentheses to arrow functions. + Defaults to "always". Global options applied to all commands --colors= Set the formatting mode for markup: "off" prints everything as plain diff --git a/crates/rome_js_formatter/src/context.rs b/crates/rome_js_formatter/src/context.rs index b2034338fce..db39e3e76c2 100644 --- a/crates/rome_js_formatter/src/context.rs +++ b/crates/rome_js_formatter/src/context.rs @@ -156,6 +156,9 @@ pub struct JsFormatOptions { /// Whether the formatter prints semicolons for all statements, class members, and type members or only when necessary because of [ASI](https://tc39.es/ecma262/multipage/ecmascript-language-lexical-grammar.html#sec-automatic-semicolon-insertion). semicolons: Semicolons, + /// Whether to add non-necessary parentheses to arrow functions. Defaults to "always". + arrow_parentheses: ArrowParentheses, + /// Information related to the current file source_type: JsFileSource, } @@ -171,9 +174,15 @@ impl JsFormatOptions { quote_properties: QuoteProperties::default(), trailing_comma: TrailingComma::default(), semicolons: Semicolons::default(), + arrow_parentheses: ArrowParentheses::default(), } } + pub fn with_arrow_parentheses(mut self, arrow_parentheses: ArrowParentheses) -> Self { + self.arrow_parentheses = arrow_parentheses; + self + } + pub fn with_indent_style(mut self, indent_style: IndentStyle) -> Self { self.indent_style = indent_style; self @@ -209,6 +218,10 @@ impl JsFormatOptions { self } + pub fn arrow_parentheses(&self) -> ArrowParentheses { + self.arrow_parentheses + } + pub fn quote_style(&self) -> QuoteStyle { self.quote_style } @@ -263,7 +276,8 @@ impl fmt::Display for JsFormatOptions { writeln!(f, "JSX quote style: {}", self.jsx_quote_style)?; writeln!(f, "Quote properties: {}", self.quote_properties)?; writeln!(f, "Trailing comma: {}", self.trailing_comma)?; - writeln!(f, "Semicolons: {}", self.semicolons) + writeln!(f, "Semicolons: {}", self.semicolons)?; + writeln!(f, "Arrow parentheses: {}", self.arrow_parentheses) } } @@ -487,3 +501,64 @@ impl VisitNode for Semicolons { Some(()) } } + +#[derive(Debug, Eq, PartialEq, Clone, Copy, Default)] +#[cfg_attr( + feature = "serde", + derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema), + serde(rename_all = "camelCase") +)] +pub enum ArrowParentheses { + #[default] + Always, + AsNeeded, +} + +impl ArrowParentheses { + pub(crate) const KNOWN_VALUES: &'static [&'static str] = &["always", "asNeeded"]; + + pub const fn is_as_needed(&self) -> bool { + matches!(self, Self::AsNeeded) + } + + pub const fn is_always(&self) -> bool { + matches!(self, Self::Always) + } +} + +impl FromStr for ArrowParentheses { + type Err = &'static str; + + fn from_str(s: &str) -> Result { + match s { + "as-needed" | "AsNeeded" => Ok(Self::AsNeeded), + "always" | "Always" => Ok(Self::Always), + _ => Err("Value not supported for Arrow parentheses. Supported values are 'as-needed' and 'always'."), + } + } +} + +impl fmt::Display for ArrowParentheses { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ArrowParentheses::AsNeeded => write!(f, "As needed"), + ArrowParentheses::Always => write!(f, "Always"), + } + } +} + +impl VisitNode for ArrowParentheses { + fn visit_member_value( + &mut self, + node: &SyntaxNode, + diagnostics: &mut Vec, + ) -> Option<()> { + let node = with_only_known_variants(node, ArrowParentheses::KNOWN_VALUES, diagnostics)?; + if node.inner_string_text().ok()?.text() == "asNeeded" { + *self = ArrowParentheses::AsNeeded; + } else { + *self = ArrowParentheses::Always; + } + Some(()) + } +} diff --git a/crates/rome_js_formatter/src/js/expressions/arrow_function_expression.rs b/crates/rome_js_formatter/src/js/expressions/arrow_function_expression.rs index c6c481ca2f5..752cd5679db 100644 --- a/crates/rome_js_formatter/src/js/expressions/arrow_function_expression.rs +++ b/crates/rome_js_formatter/src/js/expressions/arrow_function_expression.rs @@ -137,6 +137,7 @@ impl FormatNodeRule for FormatJsArrowFunctionExpressi ); !are_parentheses_mandatory + && f.options().arrow_parentheses().is_always() } _ => false, }; @@ -220,7 +221,14 @@ fn format_signature( AnyJsArrowFunctionParameters::AnyJsBinding(binding) => { let should_hug = is_test_call_argument(arrow.syntax())?; - write!(f, [text("(")])?; + let parentheses_not_needed = f.options().arrow_parentheses().is_as_needed() + && arrow.parameters()?.len() == 1 + && arrow.type_parameters().is_none() + && arrow.return_type_annotation().is_none(); + + if !parentheses_not_needed { + write!(f, [text("(")])?; + } if should_hug { write!(f, [binding.format()])?; @@ -234,7 +242,9 @@ fn format_signature( )? } - write!(f, [text(")")])?; + if !parentheses_not_needed { + write!(f, [text(")")])?; + } } AnyJsArrowFunctionParameters::JsParameters(params) => { write!(f, [params.format()])?; diff --git a/crates/rome_js_formatter/tests/language.rs b/crates/rome_js_formatter/tests/language.rs index d3b0a3fa4e8..5ff7b48c376 100644 --- a/crates/rome_js_formatter/tests/language.rs +++ b/crates/rome_js_formatter/tests/language.rs @@ -2,7 +2,7 @@ use rome_formatter::{FormatContext, FormatResult, Formatted, IndentStyle, LineWi use rome_formatter_test::TestFormatLanguage; use rome_js_formatter::context::trailing_comma::TrailingComma; use rome_js_formatter::context::{ - JsFormatContext, JsFormatOptions, QuoteProperties, QuoteStyle, Semicolons, + ArrowParentheses, JsFormatContext, JsFormatOptions, QuoteProperties, QuoteStyle, Semicolons, }; use rome_js_formatter::{format_node, format_range, JsFormatLanguage}; use rome_js_parser::{parse, JsParserOptions}; @@ -152,6 +152,21 @@ impl From for Semicolons { } } +#[derive(Debug, Eq, PartialEq, Clone, Copy, Deserialize, Serialize)] +pub enum JsSerializableArrowParentheses { + Always, + AsNeeded, +} + +impl From for ArrowParentheses { + fn from(test: JsSerializableArrowParentheses) -> Self { + match test { + JsSerializableArrowParentheses::Always => ArrowParentheses::Always, + JsSerializableArrowParentheses::AsNeeded => ArrowParentheses::AsNeeded, + } + } +} + #[derive(Debug, Deserialize, Serialize, Clone, Copy)] pub struct JsSerializableFormatOptions { /// The indent style. @@ -172,7 +187,11 @@ pub struct JsSerializableFormatOptions { /// Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all". pub trailing_comma: Option, + /// Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. pub semicolons: Option, + + /// Whether to add non-necessary parentheses to arrow functions. Defaults to "always". + pub arrow_parentheses: Option, } impl JsSerializableFormatOptions { @@ -207,6 +226,10 @@ impl JsSerializableFormatOptions { self.semicolons .map_or_else(|| Semicolons::Always, |value| value.into()), ) + .with_arrow_parentheses( + self.arrow_parentheses + .map_or_else(|| ArrowParentheses::Always, |value| value.into()), + ) } } diff --git a/crates/rome_js_formatter/tests/quick_test.rs b/crates/rome_js_formatter/tests/quick_test.rs index 534245dadb1..09cdf20d4e5 100644 --- a/crates/rome_js_formatter/tests/quick_test.rs +++ b/crates/rome_js_formatter/tests/quick_test.rs @@ -1,5 +1,5 @@ use rome_formatter_test::check_reformat::CheckReformat; -use rome_js_formatter::context::{JsFormatOptions, QuoteStyle, Semicolons}; +use rome_js_formatter::context::{ArrowParentheses, JsFormatOptions, QuoteStyle, Semicolons}; use rome_js_formatter::format_node; use rome_js_parser::{parse, JsParserOptions}; use rome_js_syntax::JsFileSource; @@ -8,20 +8,11 @@ mod language { include!("language.rs"); } -#[ignore] +// #[ignore] #[test] // use this test check if your snippet prints as you wish, without using a snapshot fn quick_test() { - let src = r#" -class Foo { - constructor( - @dec - /*leading parameter*/ private parameter - ) { } - } - - -"#; + let src = r#"export const lol = a => "lol";"#; let syntax = JsFileSource::tsx(); let tree = parse( src, @@ -32,7 +23,8 @@ class Foo { let options = JsFormatOptions::new(syntax) .with_semicolons(Semicolons::AsNeeded) .with_quote_style(QuoteStyle::Double) - .with_jsx_quote_style(QuoteStyle::Single); + .with_jsx_quote_style(QuoteStyle::Single) + .with_arrow_parentheses(ArrowParentheses::AsNeeded); let result = format_node(options.clone(), &tree.syntax()) .unwrap() .print() @@ -46,14 +38,7 @@ class Foo { assert_eq!( result.as_code(), - r#" - // A -@Foo() -// B -@Bar() -// C -export class Bar{} - + r#"export const lol = a => "lol" "# ); } diff --git a/crates/rome_js_formatter/tests/specs/js/module/array/array_nested.js.snap b/crates/rome_js_formatter/tests/specs/js/module/array/array_nested.js.snap index 6a9212721eb..6dc327741e1 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/array/array_nested.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/array/array_nested.js.snap @@ -65,6 +65,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/array/binding_pattern.js.snap b/crates/rome_js_formatter/tests/specs/js/module/array/binding_pattern.js.snap index f18c8762bdc..e9745a0aba1 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/array/binding_pattern.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/array/binding_pattern.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/array/empty_lines.js.snap b/crates/rome_js_formatter/tests/specs/js/module/array/empty_lines.js.snap index 5b7bf0ccdaf..7a11a61807d 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/array/empty_lines.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/array/empty_lines.js.snap @@ -36,6 +36,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/array/spaces.js.snap b/crates/rome_js_formatter/tests/specs/js/module/array/spaces.js.snap index a6472265a80..c171e0b6579 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/array/spaces.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/array/spaces.js.snap @@ -29,6 +29,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/array/spread.js.snap b/crates/rome_js_formatter/tests/specs/js/module/array/spread.js.snap index 86acf672ec8..2bfcd0ba746 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/array/spread.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/array/spread.js.snap @@ -29,6 +29,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/array/trailing-comma/array_trailing_comma.js.snap b/crates/rome_js_formatter/tests/specs/js/module/array/trailing-comma/array_trailing_comma.js.snap index 4545885a195..3567354032a 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/array/trailing-comma/array_trailing_comma.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/array/trailing-comma/array_trailing_comma.js.snap @@ -34,6 +34,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -61,6 +62,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: ES5 Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -88,6 +90,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: None Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap index 61203f6affe..636fa542c90 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap @@ -45,6 +45,43 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always +----- + +```js +// array +(action) => + // eslint-disable-next-line react/no-array-index-key + [
  • ]; + +// function body +(action) => + // eslint-disable-next-line react/no-array-index-key + { + return
  • ; + }; + +// object expression +(action) => + // eslint-disable-next-line react/no-array-index-key + ({ a: 10 }); + +(action) => /* comment */ ` +${test} +multiline`; +``` + +## 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: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap index 9a499677226..ff8e92769dc 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap @@ -33,6 +33,39 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always +----- + +```js +x = + (bifornCringerMoshedPerplexSawder) => + (askTrovenaBeenaDependsRowans, glimseGlyphsHazardNoopsTieTie) => + (f00) => { + averredBathersBoxroomBuggyNurl(); + }; // BOOM + +x2 = + (a) => + ( + askTrovenaBeenaDependsRowans1, + askTrovenaBeenaDependsRowans2, + askTrovenaBeenaDependsRowans3, + ) => { + c(); + } /* ! */; // KABOOM +``` + +## 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: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap index 0f06d4e44b7..49146cd7bb8 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap @@ -30,6 +30,33 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always +----- + +```js +() => {}; +async () => {}; +(foo) => {}; +( + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, + ccccccccccccccccccccccccccccc, +) => {}; + +() => (1, 3, 4); +``` + +## 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: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap index c94426464fe..1f1428a00ea 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap @@ -51,6 +51,49 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always +----- + +```js +Seq(typeDef.interface.groups).forEach((group) => + Seq(group.members).forEach((member, memberName) => + markdownDoc(member.doc, { + typePath: typePath.concat(memberName.slice(1)), + signatures: member.signatures, + }), + ), +); + +const promiseFromCallback = (fn) => + new Promise((resolve, reject) => + fn((err, result) => { + if (err) return reject(err); + return resolve(result); + }), + ); + +runtimeAgent.getProperties( + objectId, + false, // ownProperties + false, // accessorPropertiesOnly + false, // generatePreview + (error, properties, internalProperties) => { + return 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: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap index c1253ed599f..3e66f639bbb 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap @@ -28,6 +28,32 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always +----- + +```js +it("should have the default duration when using the onClose arguments", (done) => { + expect(true); + done(); +}); +``` + +# Lines exceeding max width of 80 characters +``` + 1: it("should have the default duration when using the onClose arguments", (done) => { +``` + +## 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: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap index d8640897374..9a1e84aa4c4 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap @@ -68,6 +68,76 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always +----- + +```js +const testResults = results.testResults.map((testResult) => + formatResult(testResult, formatter, reporter), +); + +it("mocks regexp instances", () => { + expect( + // () => moduleMocker.generateFromMetadata(moduleMocker.getMetadata(/a/)), + ).not.toThrow(); +}); + +expect(() => asyncRequest({ url: "/test-endpoint" })); +// .toThrowError(/Required parameter/); + +expect(() => asyncRequest({ url: "/test-endpoint-but-with-a-long-url" })); +// .toThrowError(/Required parameter/); + +expect(() => + asyncRequest({ url: "/test-endpoint-but-with-a-suuuuuuuuper-long-url" }), +); +// .toThrowError(/Required parameter/); + +expect(() => + asyncRequest({ type: "foo", url: "/test-endpoint" }), +).not.toThrowError(); + +expect(() => + asyncRequest({ type: "foo", url: "/test-endpoint-but-with-a-long-url" }), +).not.toThrowError(); + +const a = Observable.fromPromise(axiosInstance.post("/carts/mine")).map( + (response) => response.data, +); + +const b = Observable.fromPromise(axiosInstance.get(url)).map( + (response) => response.data, +); + +func( + veryLoooooooooooooooooooooooongName, + (veryLooooooooooooooooooooooooongName) => + veryLoooooooooooooooongName.something(), +); + +const composition = (ViewComponent, ContainerComponent) => + class extends React.Component { + static propTypes = {}; + }; + +romise.then((result) => + result.veryLongVariable.veryLongPropertyName > someOtherVariable + ? "ok" + : "fail", +); +``` + +## 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: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/currying.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/currying.js.snap index 20d82d6f0b8..1d12d85179a 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/currying.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/currying.js.snap @@ -41,6 +41,40 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always +----- + +```js +const fn = (b) => (c) => (d) => { + return 3; +}; + +const foo = (a, b) => (c) => (d) => { + return 3; +}; + +const bar = (a) => (b) => (c) => a + b + c; + +const mw = (store) => (next) => (action) => { + return next(action); +}; + +const middleware = (options) => (req, res, next) => { + // ... +}; +``` + +## 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: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/options.json b/crates/rome_js_formatter/tests/specs/js/module/arrow/options.json new file mode 100644 index 00000000000..6a2f8bcaca6 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/options.json @@ -0,0 +1,7 @@ +{ + "cases": [ + { + "arrowParentheses": "AsNeeded" + } + ] +} diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap index 5beecef4fe2..207158051db 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap @@ -345,6 +345,324 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always +----- + +```js +fooooooooooooooooooooooooooooooooooooooooooooooooooo( + (action) => (next) => dispatch(action), +); + +foo( + ({ + a, + + b, + }) => {}, +); + +foo(({ a, b }) => {}); + +foo(({ a, b }) => {}); + +foo( + a, + ({ + a, + + b, + }) => {}, +); + +foo( + ({ + a, + + b, + }) => a, +); + +foo(({ a, b }) => a); + +foo(({ a, b }) => a); + +foo( + ({ + a: { + a, + + b, + }, + }) => {}, +); + +foo( + ({ + a: { + b: { + c, + + d, + }, + }, + }) => {}, +); + +foo( + ({ + a: { + b: { + c: { + d, + + e, + }, + }, + }, + }) => {}, +); + +foo( + ({ + a: { + a, + + b, + }, + }) => a, +); + +foo( + ({ + a: { + b: { + c, + + d, + }, + }, + }) => a, +); + +foo( + ({ + a: { + b: { + c: { + d, + + e, + }, + }, + }, + }) => a, +); + +foo( + ([ + { + a: { + b: { + c: { + d, + + e, + }, + }, + }, + }, + ]) => {}, +); + +foo( + ([ + ...{ + a: { + b: { + c: { + d, + + e, + }, + }, + }, + } + ]) => {}, +); + +foo( + ( + n = { + a: { + b: { + c: { + d, + + e, + }, + }, + }, + }, + ) => {}, +); + +foo( + ({ + x: [ + { + a, + + b, + }, + ], + }) => {}, +); + +foo( + ( + a = [ + { + a, + + b, + }, + ], + ) => a, +); + +foo( + ([ + [ + { + a, + + b, + }, + ], + ]) => {}, +); + +foo( + ([ + [ + [ + [ + { + a, + b: { + c, + d: { + e, + + f, + }, + }, + }, + ], + ], + ], + ]) => {}, +); + +foo( + ( + ...{ + a, + + b, + } + ) => {}, +); + +foo( + ( + ...[ + { + a, + + b, + }, + ] + ) => {}, +); + +foo( + ([ + ...[ + { + a, + + b, + }, + ] + ]) => {}, +); + +foo( + ( + a = [ + { + a, + + b, + }, + ], + ) => {}, +); + +foo( + ( + a = (({ + a, + + b, + }) => {})(), + ) => {}, +); + +foo( + ( + a = f({ + a, + + b, + }), + ) => {}, +); + +foo( + ( + a = ({ + a, + + b, + }) => {}, + ) => {}, +); + +foo( + ( + a = 1 + + f({ + a, + + b, + }), + ) => {}, +); +``` + +## 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: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/assignment/array-assignment-holes.js.snap b/crates/rome_js_formatter/tests/specs/js/module/assignment/array-assignment-holes.js.snap index e005184668a..00a25891397 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/assignment/array-assignment-holes.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/assignment/array-assignment-holes.js.snap @@ -26,6 +26,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/assignment/assignment.js.snap b/crates/rome_js_formatter/tests/specs/js/module/assignment/assignment.js.snap index c10d5b82d37..5773fc843e8 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/assignment/assignment.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/assignment/assignment.js.snap @@ -178,6 +178,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/assignment/assignment_ignore.js.snap b/crates/rome_js_formatter/tests/specs/js/module/assignment/assignment_ignore.js.snap index fcb99ecd245..5f1255aff19 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/assignment/assignment_ignore.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/assignment/assignment_ignore.js.snap @@ -28,6 +28,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/binding/array-binding-holes.js.snap b/crates/rome_js_formatter/tests/specs/js/module/binding/array-binding-holes.js.snap index 56e3a6c1a3e..45179ceeb08 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/binding/array-binding-holes.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/binding/array-binding-holes.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/binding/array_binding.js.snap b/crates/rome_js_formatter/tests/specs/js/module/binding/array_binding.js.snap index 4e8950e791a..241cd16e4b0 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/binding/array_binding.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/binding/array_binding.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/binding/identifier_binding.js.snap b/crates/rome_js_formatter/tests/specs/js/module/binding/identifier_binding.js.snap index 910ccdac96b..374b2650ff9 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/binding/identifier_binding.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/binding/identifier_binding.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/binding/object_binding.js.snap b/crates/rome_js_formatter/tests/specs/js/module/binding/object_binding.js.snap index fdc4e3d65ed..bf0c52ac32b 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/binding/object_binding.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/binding/object_binding.js.snap @@ -28,6 +28,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/call_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/call_expression.js.snap index 648c85ecf3f..594df427038 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/call_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/call_expression.js.snap @@ -71,6 +71,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/class/class.js.snap b/crates/rome_js_formatter/tests/specs/js/module/class/class.js.snap index 564e4fcff32..f9237aa1026 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/class/class.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/class/class.js.snap @@ -94,6 +94,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/class/class_comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/class/class_comments.js.snap index 268b2be2b21..a4ce0776578 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/class/class_comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/class/class_comments.js.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/class/private_method.js.snap b/crates/rome_js_formatter/tests/specs/js/module/class/private_method.js.snap index 6e5587ec97b..5d62b8ccc3b 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/class/private_method.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/class/private_method.js.snap @@ -40,6 +40,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/comments.js.snap index 99267eec22f..6afdfd96bdd 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/comments.js.snap @@ -102,6 +102,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/declarations/variable_declaration.js.snap b/crates/rome_js_formatter/tests/specs/js/module/declarations/variable_declaration.js.snap index 0d764068597..3d1c72000d4 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/declarations/variable_declaration.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/declarations/variable_declaration.js.snap @@ -289,6 +289,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_call_decorator.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_call_decorator.js.snap index ce1e2cbc3fc..aaf957fe6fd 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_call_decorator.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_call_decorator.js.snap @@ -116,6 +116,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_mixed.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_mixed.js.snap index 006a00cdc9f..1f15da9a1c8 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_mixed.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_mixed.js.snap @@ -116,6 +116,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_simple.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_simple.js.snap index 65693443dc6..f46af896342 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_simple.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/class_members_simple.js.snap @@ -116,6 +116,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/class_simple.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/class_simple.js.snap index 0caebb75665..9fdde0238ad 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/class_simple.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/class_simple.js.snap @@ -72,6 +72,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/class_simple_call_decorator.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/class_simple_call_decorator.js.snap index 1955081b245..4ac3dd5900e 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/class_simple_call_decorator.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/class_simple_call_decorator.js.snap @@ -72,6 +72,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_1.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_1.js.snap index 981ebd9ee5e..1423f59890e 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_1.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_1.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_2.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_2.js.snap index 1724a8c34d8..a82b80d8232 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_2.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_2.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_3.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_3.js.snap index 4fd095b261f..9942b584e13 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_3.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_3.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_4.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_4.js.snap index da72c575d1e..f9bc0bbe736 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_4.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/export_default_4.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/expression.js.snap index 4e7ddbf0cc5..c0c13bdb111 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/expression.js.snap @@ -45,6 +45,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/decorators/multiline.js.snap b/crates/rome_js_formatter/tests/specs/js/module/decorators/multiline.js.snap index a354a2c7ef6..c26d9663fc9 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/decorators/multiline.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/decorators/multiline.js.snap @@ -40,6 +40,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/each/each.js.snap b/crates/rome_js_formatter/tests/specs/js/module/each/each.js.snap index 83955f74b54..f28af4475e9 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/each/each.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/each/each.js.snap @@ -90,6 +90,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/export/class_clause.js.snap b/crates/rome_js_formatter/tests/specs/js/module/export/class_clause.js.snap index cc6fc4bc082..56212bb3061 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/export/class_clause.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/export/class_clause.js.snap @@ -33,6 +33,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/export/expression_clause.js.snap b/crates/rome_js_formatter/tests/specs/js/module/export/expression_clause.js.snap index 5f637f5504f..92a6ef7e5be 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/export/expression_clause.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/export/expression_clause.js.snap @@ -24,6 +24,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/export/from_clause.js.snap b/crates/rome_js_formatter/tests/specs/js/module/export/from_clause.js.snap index 9fb4641e87a..ef770fc7967 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/export/from_clause.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/export/from_clause.js.snap @@ -28,6 +28,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/export/function_clause.js.snap b/crates/rome_js_formatter/tests/specs/js/module/export/function_clause.js.snap index 27f9bb09c34..2f30747df51 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/export/function_clause.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/export/function_clause.js.snap @@ -32,6 +32,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/export/named_clause.js.snap b/crates/rome_js_formatter/tests/specs/js/module/export/named_clause.js.snap index 967a8624157..7698ba9decf 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/export/named_clause.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/export/named_clause.js.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/export/named_from_clause.js.snap b/crates/rome_js_formatter/tests/specs/js/module/export/named_from_clause.js.snap index 0ae7373003d..58f462617dc 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/export/named_from_clause.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/export/named_from_clause.js.snap @@ -43,6 +43,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/export/trailing-comma/export_trailing_comma.js.snap b/crates/rome_js_formatter/tests/specs/js/module/export/trailing-comma/export_trailing_comma.js.snap index 3acd7b44a50..eb42bc74645 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/export/trailing-comma/export_trailing_comma.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/export/trailing-comma/export_trailing_comma.js.snap @@ -29,6 +29,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -49,6 +50,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: ES5 Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -69,6 +71,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: None Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/export/variable_declaration.js.snap b/crates/rome_js_formatter/tests/specs/js/module/export/variable_declaration.js.snap index effbdaa3571..9e10b2b71a0 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/export/variable_declaration.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/export/variable_declaration.js.snap @@ -26,6 +26,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/binary_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/binary_expression.js.snap index c6730b962e2..b2e8aa5db86 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/binary_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/binary_expression.js.snap @@ -58,6 +58,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/binary_range_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/binary_range_expression.js.snap index 12537499c8e..c95fd53519e 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/binary_range_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/binary_range_expression.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/binaryish_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/binaryish_expression.js.snap index f569fcc5f64..f6314fec1fd 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/binaryish_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/binaryish_expression.js.snap @@ -24,6 +24,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/computed-member-expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/computed-member-expression.js.snap index ea76137802a..fd5ef362746 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/computed-member-expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/computed-member-expression.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/conditional_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/conditional_expression.js.snap index 20b53c7956a..4cb67d76d2a 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/conditional_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/conditional_expression.js.snap @@ -33,6 +33,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/import_meta_expression/import_meta_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/import_meta_expression/import_meta_expression.js.snap index fac20dbf468..197dde498df 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/import_meta_expression/import_meta_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/import_meta_expression/import_meta_expression.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -52,6 +53,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/literal_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/literal_expression.js.snap index 33db6e7f25f..8bbb389e165 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/literal_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/literal_expression.js.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/logical_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/logical_expression.js.snap index edcadbd266f..474f1e0bf8c 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/logical_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/logical_expression.js.snap @@ -136,6 +136,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/complex_arguments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/complex_arguments.js.snap index 0ad6f9aed0e..2def30c5a39 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/complex_arguments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/complex_arguments.js.snap @@ -29,6 +29,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap index 73f1aede958..b580511dad5 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap @@ -29,6 +29,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap index 8815a53d3a8..d7181e10aad 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap @@ -36,6 +36,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/new_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/new_expression.js.snap index fe4105c9915..03a1536bfd3 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/new_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/new_expression.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/post_update_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/post_update_expression.js.snap index cd353976edb..f7e4c4bded4 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/post_update_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/post_update_expression.js.snap @@ -28,6 +28,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/pre_update_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/pre_update_expression.js.snap index 34028ed7878..67afb8b9624 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/pre_update_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/pre_update_expression.js.snap @@ -28,6 +28,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap index eee58775aa8..2fdb29ab7be 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap @@ -57,6 +57,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/static_member_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/static_member_expression.js.snap index d5faafc7f36..5c4e1b9583f 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/static_member_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/static_member_expression.js.snap @@ -44,6 +44,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/this_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/this_expression.js.snap index 0290caf7940..8001955109f 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/this_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/this_expression.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/unary_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/unary_expression.js.snap index 98a6fa74561..ca12b2dfc64 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/unary_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/unary_expression.js.snap @@ -38,6 +38,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/unary_expression_verbatim_argument.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/unary_expression_verbatim_argument.js.snap index ff30617d8dd..3893d1a8332 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/unary_expression_verbatim_argument.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/unary_expression_verbatim_argument.js.snap @@ -32,6 +32,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/function/function.js.snap b/crates/rome_js_formatter/tests/specs/js/module/function/function.js.snap index fb432adb5da..a212e39309e 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/function/function.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/function/function.js.snap @@ -56,6 +56,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/function/function_args.js.snap b/crates/rome_js_formatter/tests/specs/js/module/function/function_args.js.snap index da1d270a42f..ba6c1b8136c 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/function/function_args.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/function/function_args.js.snap @@ -26,6 +26,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/function/function_comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/function/function_comments.js.snap index c99a152662a..1448a0c0fd8 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/function/function_comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/function/function_comments.js.snap @@ -40,6 +40,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/ident.js.snap b/crates/rome_js_formatter/tests/specs/js/module/ident.js.snap index 90bdd16c307..ab2fab9e998 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/ident.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/ident.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/import/bare_import.js.snap b/crates/rome_js_formatter/tests/specs/js/module/import/bare_import.js.snap index 9a587d83230..884bfeac663 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/import/bare_import.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/import/bare_import.js.snap @@ -47,6 +47,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/import/default_import.js.snap b/crates/rome_js_formatter/tests/specs/js/module/import/default_import.js.snap index c483e1bbdff..6baefd83782 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/import/default_import.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/import/default_import.js.snap @@ -35,6 +35,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/import/import_call.js.snap b/crates/rome_js_formatter/tests/specs/js/module/import/import_call.js.snap index eb18b2b6884..e1c085addb1 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/import/import_call.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/import/import_call.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap b/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap index db3691cfba4..f59d8d6c94c 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap @@ -56,6 +56,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/import/namespace_import.js.snap b/crates/rome_js_formatter/tests/specs/js/module/import/namespace_import.js.snap index 6d00a3b8a35..358d6cfde04 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/import/namespace_import.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/import/namespace_import.js.snap @@ -24,6 +24,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/import/trailing-comma/import_trailing_comma.js.snap b/crates/rome_js_formatter/tests/specs/js/module/import/trailing-comma/import_trailing_comma.js.snap index a0b6f5a0ad5..47ec57daaa8 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/import/trailing-comma/import_trailing_comma.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/import/trailing-comma/import_trailing_comma.js.snap @@ -54,6 +54,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -109,6 +110,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: ES5 Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -164,6 +166,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: None Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/interpreter.js.snap b/crates/rome_js_formatter/tests/specs/js/module/interpreter.js.snap index 729b046a2ad..c158d129dd9 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/interpreter.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/interpreter.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/interpreter_with_empty_line.js.snap b/crates/rome_js_formatter/tests/specs/js/module/interpreter_with_empty_line.js.snap index 52378850fc9..7b45e5b1682 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/interpreter_with_empty_line.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/interpreter_with_empty_line.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/invalid/block_stmt_err.js.snap b/crates/rome_js_formatter/tests/specs/js/module/invalid/block_stmt_err.js.snap index cf81b69e1f5..bf212534c6c 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/invalid/block_stmt_err.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/invalid/block_stmt_err.js.snap @@ -34,6 +34,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/invalid/if_stmt_err.js.snap b/crates/rome_js_formatter/tests/specs/js/module/invalid/if_stmt_err.js.snap index 339215d216e..508292a7755 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/invalid/if_stmt_err.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/invalid/if_stmt_err.js.snap @@ -40,6 +40,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/newlines.js.snap b/crates/rome_js_formatter/tests/specs/js/module/newlines.js.snap index 10324b03585..b049757f12d 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/newlines.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/newlines.js.snap @@ -102,6 +102,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/no-semi/class.js.snap b/crates/rome_js_formatter/tests/specs/js/module/no-semi/class.js.snap index f0c0cc07b2c..92a4208cb06 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/no-semi/class.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/no-semi/class.js.snap @@ -142,6 +142,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -273,6 +274,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: As needed +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/no-semi/issue2006.js.snap b/crates/rome_js_formatter/tests/specs/js/module/no-semi/issue2006.js.snap index 942cdf14483..4666bd533ac 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/no-semi/issue2006.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/no-semi/issue2006.js.snap @@ -32,6 +32,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -55,6 +56,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: As needed +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/no-semi/no-semi.js.snap b/crates/rome_js_formatter/tests/specs/js/module/no-semi/no-semi.js.snap index e8e96fb2144..667b124ca4f 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/no-semi/no-semi.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/no-semi/no-semi.js.snap @@ -104,6 +104,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -210,6 +211,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: As needed +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/no-semi/private-field.js.snap b/crates/rome_js_formatter/tests/specs/js/module/no-semi/private-field.js.snap index 36e48725e56..46aad79b3df 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/no-semi/private-field.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/no-semi/private-field.js.snap @@ -28,6 +28,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -47,6 +48,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: As needed +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/no-semi/semicolons-asi.js.snap b/crates/rome_js_formatter/tests/specs/js/module/no-semi/semicolons-asi.js.snap index 95c65c89a38..0d07f5149b8 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/no-semi/semicolons-asi.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/no-semi/semicolons-asi.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -41,6 +42,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: As needed +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/no-semi/semicolons_range.js.snap b/crates/rome_js_formatter/tests/specs/js/module/no-semi/semicolons_range.js.snap index ae9bc06eb91..607e0c9a09c 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/no-semi/semicolons_range.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/no-semi/semicolons_range.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -45,6 +46,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: As needed +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/number/number.js.snap b/crates/rome_js_formatter/tests/specs/js/module/number/number.js.snap index 2575c2b82b5..26437beef0f 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/number/number.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/number/number.js.snap @@ -26,6 +26,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/number/number_with_space.js.snap b/crates/rome_js_formatter/tests/specs/js/module/number/number_with_space.js.snap index baca2e08976..ccb1c2632b8 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/number/number_with_space.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/number/number_with_space.js.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/computed_member.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/computed_member.js.snap index 885cfdbe4f1..95f02d8a386 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/computed_member.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/computed_member.js.snap @@ -43,6 +43,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap index d354bb9c57f..e00d7bb3cf4 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/object.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/object.js.snap index 5ac32d417a3..4038427e234 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/object.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/object.js.snap @@ -56,6 +56,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/object_comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/object_comments.js.snap index a2f51bc231d..799247723ea 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/object_comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/object_comments.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/octal_literals_key.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/octal_literals_key.js.snap index 206ae9835d6..bf7a6143fc3 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/octal_literals_key.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/octal_literals_key.js.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/property_key.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/property_key.js.snap index 46d6259358d..695c2d74ed6 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/property_key.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/property_key.js.snap @@ -32,6 +32,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/property_object_member.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/property_object_member.js.snap index 0ee6a1345d4..7fd25863469 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/property_object_member.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/property_object_member.js.snap @@ -112,6 +112,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/trailing-comma/object_trailing_comma.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/trailing-comma/object_trailing_comma.js.snap index 433fa27ce09..1cfb04db234 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/trailing-comma/object_trailing_comma.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/trailing-comma/object_trailing_comma.js.snap @@ -33,6 +33,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -59,6 +60,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: ES5 Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -85,6 +87,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: None Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/parentheses/parentheses.js.snap b/crates/rome_js_formatter/tests/specs/js/module/parentheses/parentheses.js.snap index f77fe542376..637cee14f52 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/parentheses/parentheses.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/parentheses/parentheses.js.snap @@ -47,6 +47,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/parentheses/range_parentheses_binary.js.snap b/crates/rome_js_formatter/tests/specs/js/module/parentheses/range_parentheses_binary.js.snap index b119c3b0ab3..bae456dc5d9 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/parentheses/range_parentheses_binary.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/parentheses/range_parentheses_binary.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/prettier-differences/fill-array-comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/prettier-differences/fill-array-comments.js.snap index 625772adbaa..96651c2a2dd 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/prettier-differences/fill-array-comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/prettier-differences/fill-array-comments.js.snap @@ -32,6 +32,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol.js.snap b/crates/rome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol.js.snap index 94987934cea..d51d1accf47 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol.js.snap @@ -34,6 +34,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol_1.js.snap b/crates/rome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol_1.js.snap index 0b483b059f6..b3917f3e0fe 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol_1.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/range/range_parenthesis_after_semicol_1.js.snap @@ -32,6 +32,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/script.js.snap b/crates/rome_js_formatter/tests/specs/js/module/script.js.snap index 658a3734863..988e8987410 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/script.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/script.js.snap @@ -28,6 +28,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/block_statement.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/block_statement.js.snap index 89e3ca4b3bb..342c9d36244 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/block_statement.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/block_statement.js.snap @@ -33,6 +33,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/do_while.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/do_while.js.snap index 81cda3c6f1b..d938746616c 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/do_while.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/do_while.js.snap @@ -38,6 +38,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/empty_blocks.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/empty_blocks.js.snap index 2698ed95d9e..0c50c8f7dc7 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/empty_blocks.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/empty_blocks.js.snap @@ -53,6 +53,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/for_in.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/for_in.js.snap index 5965e5de24a..722363e7984 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/for_in.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/for_in.js.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/for_loop.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/for_loop.js.snap index c08f4252a54..486aa1a8d3f 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/for_loop.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/for_loop.js.snap @@ -41,6 +41,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/for_of.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/for_of.js.snap index 8ae74fdcb7d..2e193ead430 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/for_of.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/for_of.js.snap @@ -32,6 +32,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/if_chain.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/if_chain.js.snap index 26ddac292cc..4bef48aa881 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/if_chain.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/if_chain.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/if_else.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/if_else.js.snap index ff8e4188f78..758b4b504ab 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/if_else.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/if_else.js.snap @@ -93,6 +93,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/return.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/return.js.snap index 6e8cf457f36..27d6a1a68d4 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/return.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/return.js.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/return_verbatim_argument.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/return_verbatim_argument.js.snap index f00a3505a0d..4cd7c87b971 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/return_verbatim_argument.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/return_verbatim_argument.js.snap @@ -49,6 +49,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/statement.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/statement.js.snap index 2f1bdcd5130..0b4044b4eb5 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/statement.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/statement.js.snap @@ -26,6 +26,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/switch.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/switch.js.snap index 546c884b05a..96b19ea4137 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/switch.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/switch.js.snap @@ -43,6 +43,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/throw.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/throw.js.snap index 49b04e90edb..14985cd1c3d 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/throw.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/throw.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/try_catch_finally.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/try_catch_finally.js.snap index 845d691a6a3..aa6f15bba4e 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/try_catch_finally.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/try_catch_finally.js.snap @@ -50,6 +50,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/statement/while_loop.js.snap b/crates/rome_js_formatter/tests/specs/js/module/statement/while_loop.js.snap index 8c9aeec07a2..92420e23119 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/statement/while_loop.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/statement/while_loop.js.snap @@ -50,6 +50,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/string/directives.js.snap b/crates/rome_js_formatter/tests/specs/js/module/string/directives.js.snap index dcb9e22ca01..c6aa4ee29a4 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/string/directives.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/string/directives.js.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -46,6 +47,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -65,6 +67,7 @@ JSX quote style: Double Quotes Quote properties: Preserve Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/string/parentheses_token.js.snap b/crates/rome_js_formatter/tests/specs/js/module/string/parentheses_token.js.snap index 90533fa0132..11d867a7c11 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/string/parentheses_token.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/string/parentheses_token.js.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -41,6 +42,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -57,6 +59,7 @@ JSX quote style: Double Quotes Quote properties: Preserve Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/string/properties_quotes.js.snap b/crates/rome_js_formatter/tests/specs/js/module/string/properties_quotes.js.snap index 6e9b633b992..0503cddaf2c 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/string/properties_quotes.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/string/properties_quotes.js.snap @@ -67,6 +67,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -126,6 +127,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -185,6 +187,7 @@ JSX quote style: Double Quotes Quote properties: Preserve Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/string/string.js.snap b/crates/rome_js_formatter/tests/specs/js/module/string/string.js.snap index 480e7fe4393..5cf8cf6a4ad 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/string/string.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/string/string.js.snap @@ -81,6 +81,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -164,6 +165,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js @@ -247,6 +249,7 @@ JSX quote style: Double Quotes Quote properties: Preserve Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/suppression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/suppression.js.snap index 9a71c685ee9..b42b6172a27 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/suppression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/suppression.js.snap @@ -52,6 +52,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/template/template.js.snap b/crates/rome_js_formatter/tests/specs/js/module/template/template.js.snap index f78e909215d..65700259c99 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/template/template.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/template/template.js.snap @@ -71,6 +71,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/with.js.snap b/crates/rome_js_formatter/tests/specs/js/module/with.js.snap index 1234e02047f..c1a8563b69d 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/with.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/with.js.snap @@ -29,6 +29,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/script/script.js.snap b/crates/rome_js_formatter/tests/specs/js/script/script.js.snap index ac933f52bbc..7027f0cf9da 100644 --- a/crates/rome_js_formatter/tests/specs/js/script/script.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/script/script.js.snap @@ -28,6 +28,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/script/with.js.snap b/crates/rome_js_formatter/tests/specs/js/script/with.js.snap index b5009fde96f..5bbc0f39c81 100644 --- a/crates/rome_js_formatter/tests/specs/js/script/with.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/script/with.js.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/jsx/arrow_function.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/arrow_function.jsx.snap index 285fad54973..5ff0132f054 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/arrow_function.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/arrow_function.jsx.snap @@ -53,6 +53,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/jsx/attributes.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/attributes.jsx.snap index 787f681128f..670039bf202 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/attributes.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/attributes.jsx.snap @@ -100,6 +100,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/jsx/comments.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/comments.jsx.snap index c7b0155d334..15d54e605ed 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/comments.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/comments.jsx.snap @@ -28,6 +28,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/jsx/conditional.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/conditional.jsx.snap index abe7898d791..f11589216f9 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/conditional.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/conditional.jsx.snap @@ -73,6 +73,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/jsx/element.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/element.jsx.snap index f1dca56784d..f7ca4a6832e 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/element.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/element.jsx.snap @@ -354,6 +354,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/jsx/fragment.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/fragment.jsx.snap index 7a5a8f902d0..57a33e09246 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/fragment.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/fragment.jsx.snap @@ -26,6 +26,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/jsx/new-lines.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/new-lines.jsx.snap index 7d17a0941b7..e4f5f587908 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/new-lines.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/new-lines.jsx.snap @@ -74,6 +74,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/jsx/parentheses_range.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/parentheses_range.jsx.snap index 37ff619ea94..9e7820d3107 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/parentheses_range.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/parentheses_range.jsx.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/jsx/quote_style/quote_style.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/quote_style/quote_style.jsx.snap index 62843f113d5..48450327625 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/quote_style/quote_style.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/quote_style/quote_style.jsx.snap @@ -32,6 +32,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx @@ -50,6 +51,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx @@ -68,6 +70,7 @@ JSX quote style: Single Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx @@ -86,6 +89,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx @@ -104,6 +108,7 @@ JSX quote style: Single Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/jsx/self_closing.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/self_closing.jsx.snap index 2afbf5c4be6..b6888c918a9 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/self_closing.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/self_closing.jsx.snap @@ -39,6 +39,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/jsx/smoke.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/smoke.jsx.snap index 401489b2a39..e7c523b0313 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/smoke.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/smoke.jsx.snap @@ -24,6 +24,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```jsx diff --git a/crates/rome_js_formatter/tests/specs/ts/arrow_chain.ts.snap b/crates/rome_js_formatter/tests/specs/ts/arrow_chain.ts.snap index 60679d96448..12be2b7a698 100644 --- a/crates/rome_js_formatter/tests/specs/ts/arrow_chain.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/arrow_chain.ts.snap @@ -35,6 +35,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/assignment/as_assignment.ts.snap b/crates/rome_js_formatter/tests/specs/ts/assignment/as_assignment.ts.snap index 72dc8f4a55d..fd7b884c6b1 100644 --- a/crates/rome_js_formatter/tests/specs/ts/assignment/as_assignment.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/assignment/as_assignment.ts.snap @@ -29,6 +29,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/assignment/assignment.ts.snap b/crates/rome_js_formatter/tests/specs/ts/assignment/assignment.ts.snap index aa4671c6a19..b73b05add13 100644 --- a/crates/rome_js_formatter/tests/specs/ts/assignment/assignment.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/assignment/assignment.ts.snap @@ -37,6 +37,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/assignment/assignment_comments.ts.snap b/crates/rome_js_formatter/tests/specs/ts/assignment/assignment_comments.ts.snap index c2f1a9ca21f..099e5fe3d39 100644 --- a/crates/rome_js_formatter/tests/specs/ts/assignment/assignment_comments.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/assignment/assignment_comments.ts.snap @@ -45,6 +45,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/assignment/property_assignment_comments.ts.snap b/crates/rome_js_formatter/tests/specs/ts/assignment/property_assignment_comments.ts.snap index 274e267e8b2..b0ebf042fe4 100644 --- a/crates/rome_js_formatter/tests/specs/ts/assignment/property_assignment_comments.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/assignment/property_assignment_comments.ts.snap @@ -57,6 +57,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/assignment/type_assertion_assignment.ts.snap b/crates/rome_js_formatter/tests/specs/ts/assignment/type_assertion_assignment.ts.snap index 5754fcdaa3e..77ec531b03d 100644 --- a/crates/rome_js_formatter/tests/specs/ts/assignment/type_assertion_assignment.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/assignment/type_assertion_assignment.ts.snap @@ -38,6 +38,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/binding/definite_variable.ts.snap b/crates/rome_js_formatter/tests/specs/ts/binding/definite_variable.ts.snap index 8094e0308ee..f0aa0e3319e 100644 --- a/crates/rome_js_formatter/tests/specs/ts/binding/definite_variable.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/binding/definite_variable.ts.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/call_expression.ts.snap b/crates/rome_js_formatter/tests/specs/ts/call_expression.ts.snap index 675aa876df3..e5437965c0f 100644 --- a/crates/rome_js_formatter/tests/specs/ts/call_expression.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/call_expression.ts.snap @@ -47,6 +47,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/class/accessor.ts.snap b/crates/rome_js_formatter/tests/specs/ts/class/accessor.ts.snap index 9a1ca3a8413..fe59b093f61 100644 --- a/crates/rome_js_formatter/tests/specs/ts/class/accessor.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/class/accessor.ts.snap @@ -26,6 +26,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/class/assigment_layout.ts.snap b/crates/rome_js_formatter/tests/specs/ts/class/assigment_layout.ts.snap index 8b1d1587bf5..84591750da4 100644 --- a/crates/rome_js_formatter/tests/specs/ts/class/assigment_layout.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/class/assigment_layout.ts.snap @@ -31,6 +31,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/class/constructor_parameter.ts.snap b/crates/rome_js_formatter/tests/specs/ts/class/constructor_parameter.ts.snap index 7390e3a7b49..bd4108964cd 100644 --- a/crates/rome_js_formatter/tests/specs/ts/class/constructor_parameter.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/class/constructor_parameter.ts.snap @@ -59,6 +59,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap b/crates/rome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap index 3406a205bd4..0054889f88e 100644 --- a/crates/rome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/class/implements_clause.ts.snap @@ -26,6 +26,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/class/readonly_ambient_property.ts.snap b/crates/rome_js_formatter/tests/specs/ts/class/readonly_ambient_property.ts.snap index 3924b702188..ce0888cfb84 100644 --- a/crates/rome_js_formatter/tests/specs/ts/class/readonly_ambient_property.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/class/readonly_ambient_property.ts.snap @@ -34,6 +34,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/class/trailing_comma/class_trailing_comma.ts.snap b/crates/rome_js_formatter/tests/specs/ts/class/trailing_comma/class_trailing_comma.ts.snap index f8a3d044fd6..a89e87dc7c5 100644 --- a/crates/rome_js_formatter/tests/specs/ts/class/trailing_comma/class_trailing_comma.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/class/trailing_comma/class_trailing_comma.ts.snap @@ -35,6 +35,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -75,6 +76,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: ES5 Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -115,6 +117,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: None Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/declaration/class.ts.snap b/crates/rome_js_formatter/tests/specs/ts/declaration/class.ts.snap index d21dc5ec06d..ff67af361e8 100644 --- a/crates/rome_js_formatter/tests/specs/ts/declaration/class.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/declaration/class.ts.snap @@ -83,6 +83,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/declaration/declare_function.ts.snap b/crates/rome_js_formatter/tests/specs/ts/declaration/declare_function.ts.snap index aa280371ce7..793ed78bfd4 100644 --- a/crates/rome_js_formatter/tests/specs/ts/declaration/declare_function.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/declaration/declare_function.ts.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/declaration/global_declaration.ts.snap b/crates/rome_js_formatter/tests/specs/ts/declaration/global_declaration.ts.snap index 2652f5b166e..b36ad49db6a 100644 --- a/crates/rome_js_formatter/tests/specs/ts/declaration/global_declaration.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/declaration/global_declaration.ts.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/declaration/interface.ts.snap b/crates/rome_js_formatter/tests/specs/ts/declaration/interface.ts.snap index 3900ceb794f..9c133a8dc7b 100644 --- a/crates/rome_js_formatter/tests/specs/ts/declaration/interface.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/declaration/interface.ts.snap @@ -69,6 +69,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/declaration/variable_declaration.ts.snap b/crates/rome_js_formatter/tests/specs/ts/declaration/variable_declaration.ts.snap index 058e71f9c96..0e7a3caa377 100644 --- a/crates/rome_js_formatter/tests/specs/ts/declaration/variable_declaration.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/declaration/variable_declaration.ts.snap @@ -111,6 +111,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/declare.ts.snap b/crates/rome_js_formatter/tests/specs/ts/declare.ts.snap index 1e0cc56bd06..57787941417 100644 --- a/crates/rome_js_formatter/tests/specs/ts/declare.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/declare.ts.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/decoartors.ts.snap b/crates/rome_js_formatter/tests/specs/ts/decoartors.ts.snap index 986a2e91535..95066bca490 100644 --- a/crates/rome_js_formatter/tests/specs/ts/decoartors.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/decoartors.ts.snap @@ -282,6 +282,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/decorators/class_members.ts.snap b/crates/rome_js_formatter/tests/specs/ts/decorators/class_members.ts.snap index bf23101bf21..debb857ead7 100644 --- a/crates/rome_js_formatter/tests/specs/ts/decorators/class_members.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/decorators/class_members.ts.snap @@ -116,6 +116,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/enum/enum_trailing_comma.ts.snap b/crates/rome_js_formatter/tests/specs/ts/enum/enum_trailing_comma.ts.snap index 77732f8e575..0c423ce5842 100644 --- a/crates/rome_js_formatter/tests/specs/ts/enum/enum_trailing_comma.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/enum/enum_trailing_comma.ts.snap @@ -29,6 +29,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -49,6 +50,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: ES5 Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -69,6 +71,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: None Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/expression/as_expression.ts.snap b/crates/rome_js_formatter/tests/specs/ts/expression/as_expression.ts.snap index 8df54da8edf..3e9c2e1b358 100644 --- a/crates/rome_js_formatter/tests/specs/ts/expression/as_expression.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/expression/as_expression.ts.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/expression/non_null_expression.ts.snap b/crates/rome_js_formatter/tests/specs/ts/expression/non_null_expression.ts.snap index ed270f97571..ac87c40b024 100644 --- a/crates/rome_js_formatter/tests/specs/ts/expression/non_null_expression.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/expression/non_null_expression.ts.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/expression/type_assertion_expression.ts.snap b/crates/rome_js_formatter/tests/specs/ts/expression/type_assertion_expression.ts.snap index 8070575e436..25eb5d2a595 100644 --- a/crates/rome_js_formatter/tests/specs/ts/expression/type_assertion_expression.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/expression/type_assertion_expression.ts.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/expression/type_expression.ts.snap b/crates/rome_js_formatter/tests/specs/ts/expression/type_expression.ts.snap index 0d41a6403bb..ff77eb88964 100644 --- a/crates/rome_js_formatter/tests/specs/ts/expression/type_expression.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/expression/type_expression.ts.snap @@ -128,6 +128,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/expression/type_member.ts.snap b/crates/rome_js_formatter/tests/specs/ts/expression/type_member.ts.snap index 9ee2da4ff2b..213a4f32048 100644 --- a/crates/rome_js_formatter/tests/specs/ts/expression/type_member.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/expression/type_member.ts.snap @@ -70,6 +70,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/function/parameters/function_parameters.ts.snap b/crates/rome_js_formatter/tests/specs/ts/function/parameters/function_parameters.ts.snap index a0ec81faa17..5270ebef58e 100644 --- a/crates/rome_js_formatter/tests/specs/ts/function/parameters/function_parameters.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/function/parameters/function_parameters.ts.snap @@ -57,6 +57,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -107,6 +108,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -154,6 +156,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/function/trailing_comma/function_trailing_comma.ts.snap b/crates/rome_js_formatter/tests/specs/ts/function/trailing_comma/function_trailing_comma.ts.snap index cab82b03609..24f864fe42a 100644 --- a/crates/rome_js_formatter/tests/specs/ts/function/trailing_comma/function_trailing_comma.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/function/trailing_comma/function_trailing_comma.ts.snap @@ -61,6 +61,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -115,6 +116,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: ES5 Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -169,6 +171,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: None Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/module/export_clause.ts.snap b/crates/rome_js_formatter/tests/specs/ts/module/export_clause.ts.snap index 6afd030b872..97968eaa1dd 100644 --- a/crates/rome_js_formatter/tests/specs/ts/module/export_clause.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/module/export_clause.ts.snap @@ -46,6 +46,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/module/external_module_reference.ts.snap b/crates/rome_js_formatter/tests/specs/ts/module/external_module_reference.ts.snap index dc86dd54d07..0bcdd3d963b 100644 --- a/crates/rome_js_formatter/tests/specs/ts/module/external_module_reference.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/module/external_module_reference.ts.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/module/module_declaration.ts.snap b/crates/rome_js_formatter/tests/specs/ts/module/module_declaration.ts.snap index 71430150658..7f46774119a 100644 --- a/crates/rome_js_formatter/tests/specs/ts/module/module_declaration.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/module/module_declaration.ts.snap @@ -28,6 +28,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/module/qualified_module_name.ts.snap b/crates/rome_js_formatter/tests/specs/ts/module/qualified_module_name.ts.snap index 0a1fad97cf1..10cc342a3d2 100644 --- a/crates/rome_js_formatter/tests/specs/ts/module/qualified_module_name.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/module/qualified_module_name.ts.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/no-semi/class.ts.snap b/crates/rome_js_formatter/tests/specs/ts/no-semi/class.ts.snap index 69e666d1c5b..5be89ea0362 100644 --- a/crates/rome_js_formatter/tests/specs/ts/no-semi/class.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/no-semi/class.ts.snap @@ -75,6 +75,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -141,6 +142,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: As needed +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/no-semi/non-null.ts.snap b/crates/rome_js_formatter/tests/specs/ts/no-semi/non-null.ts.snap index dc36e02246d..ea540f792f8 100644 --- a/crates/rome_js_formatter/tests/specs/ts/no-semi/non-null.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/no-semi/non-null.ts.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -45,6 +46,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: As needed +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/no-semi/statements.ts.snap b/crates/rome_js_formatter/tests/specs/ts/no-semi/statements.ts.snap index 739c8bdda50..d034f9b2ead 100644 --- a/crates/rome_js_formatter/tests/specs/ts/no-semi/statements.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/no-semi/statements.ts.snap @@ -38,6 +38,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -66,6 +67,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: As needed +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/no-semi/types.ts.snap b/crates/rome_js_formatter/tests/specs/ts/no-semi/types.ts.snap index 5a35f1be7c8..7facd35d3c1 100644 --- a/crates/rome_js_formatter/tests/specs/ts/no-semi/types.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/no-semi/types.ts.snap @@ -37,6 +37,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -69,6 +70,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: As needed +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/object/object_trailing_comma.ts.snap b/crates/rome_js_formatter/tests/specs/ts/object/object_trailing_comma.ts.snap index 78dad53b7bf..b5a51522411 100644 --- a/crates/rome_js_formatter/tests/specs/ts/object/object_trailing_comma.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/object/object_trailing_comma.ts.snap @@ -46,6 +46,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -82,6 +83,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: ES5 Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -118,6 +120,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: None Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/parameters/parameters.ts.snap b/crates/rome_js_formatter/tests/specs/ts/parameters/parameters.ts.snap index 85e1b91d2e9..5ce0a370409 100644 --- a/crates/rome_js_formatter/tests/specs/ts/parameters/parameters.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/parameters/parameters.ts.snap @@ -26,6 +26,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/parenthesis.ts.snap b/crates/rome_js_formatter/tests/specs/ts/parenthesis.ts.snap index c72a71b2994..fb95d33f6e0 100644 --- a/crates/rome_js_formatter/tests/specs/ts/parenthesis.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/parenthesis.ts.snap @@ -26,6 +26,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/statement/empty_block.ts.snap b/crates/rome_js_formatter/tests/specs/ts/statement/empty_block.ts.snap index e758a28edb1..b84c5ae177e 100644 --- a/crates/rome_js_formatter/tests/specs/ts/statement/empty_block.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/statement/empty_block.ts.snap @@ -25,6 +25,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/statement/enum_statement.ts.snap b/crates/rome_js_formatter/tests/specs/ts/statement/enum_statement.ts.snap index 234f639d488..34f33b78f6a 100644 --- a/crates/rome_js_formatter/tests/specs/ts/statement/enum_statement.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/statement/enum_statement.ts.snap @@ -36,6 +36,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/string/parameter_quotes.ts.snap b/crates/rome_js_formatter/tests/specs/ts/string/parameter_quotes.ts.snap index ca03efae6fd..33935989b8a 100644 --- a/crates/rome_js_formatter/tests/specs/ts/string/parameter_quotes.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/string/parameter_quotes.ts.snap @@ -59,6 +59,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -109,6 +110,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -159,6 +161,7 @@ JSX quote style: Double Quotes Quote properties: Preserve Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/suppressions.ts.snap b/crates/rome_js_formatter/tests/specs/ts/suppressions.ts.snap index e217b7e6830..5fe2f984347 100644 --- a/crates/rome_js_formatter/tests/specs/ts/suppressions.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/suppressions.ts.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/type/conditional.ts.snap b/crates/rome_js_formatter/tests/specs/ts/type/conditional.ts.snap index 642f5959f8b..077132a33fd 100644 --- a/crates/rome_js_formatter/tests/specs/ts/type/conditional.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/type/conditional.ts.snap @@ -40,6 +40,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/type/import_type.ts.snap b/crates/rome_js_formatter/tests/specs/ts/type/import_type.ts.snap index 4aaedae0b95..334822ed8af 100644 --- a/crates/rome_js_formatter/tests/specs/ts/type/import_type.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/type/import_type.ts.snap @@ -30,6 +30,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/type/intersection_type.ts.snap b/crates/rome_js_formatter/tests/specs/ts/type/intersection_type.ts.snap index 86cc82037ad..ea29301809f 100644 --- a/crates/rome_js_formatter/tests/specs/ts/type/intersection_type.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/type/intersection_type.ts.snap @@ -82,6 +82,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/type/mapped_type.ts.snap b/crates/rome_js_formatter/tests/specs/ts/type/mapped_type.ts.snap index d5e7a5de9f9..d47066965c8 100644 --- a/crates/rome_js_formatter/tests/specs/ts/type/mapped_type.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/type/mapped_type.ts.snap @@ -24,6 +24,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/type/qualified_name.ts.snap b/crates/rome_js_formatter/tests/specs/ts/type/qualified_name.ts.snap index 29951d0723f..847627e858a 100644 --- a/crates/rome_js_formatter/tests/specs/ts/type/qualified_name.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/type/qualified_name.ts.snap @@ -24,6 +24,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/type/template_type.ts.snap b/crates/rome_js_formatter/tests/specs/ts/type/template_type.ts.snap index 518ebc5dc40..b5907007f03 100644 --- a/crates/rome_js_formatter/tests/specs/ts/type/template_type.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/type/template_type.ts.snap @@ -27,6 +27,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/type/trailing-comma/type_trailing_comma.ts.snap b/crates/rome_js_formatter/tests/specs/ts/type/trailing-comma/type_trailing_comma.ts.snap index 0d3bfb470b0..34faa8a2645 100644 --- a/crates/rome_js_formatter/tests/specs/ts/type/trailing-comma/type_trailing_comma.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/type/trailing-comma/type_trailing_comma.ts.snap @@ -36,6 +36,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -62,6 +63,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: ES5 Semicolons: Always +Arrow parentheses: Always ----- ```ts @@ -88,6 +90,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: None Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/ts/type/union_type.ts.snap b/crates/rome_js_formatter/tests/specs/ts/type/union_type.ts.snap index 24838611fc4..16e3cb2e687 100644 --- a/crates/rome_js_formatter/tests/specs/ts/type/union_type.ts.snap +++ b/crates/rome_js_formatter/tests/specs/ts/type/union_type.ts.snap @@ -270,6 +270,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```ts diff --git a/crates/rome_js_formatter/tests/specs/tsx/smoke.tsx.snap b/crates/rome_js_formatter/tests/specs/tsx/smoke.tsx.snap index 246a5896119..aa4d48303ba 100644 --- a/crates/rome_js_formatter/tests/specs/tsx/smoke.tsx.snap +++ b/crates/rome_js_formatter/tests/specs/tsx/smoke.tsx.snap @@ -24,6 +24,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always +Arrow parentheses: Always ----- ```tsx diff --git a/crates/rome_service/src/configuration/javascript.rs b/crates/rome_service/src/configuration/javascript.rs index ec8b2530650..20a1c52e179 100644 --- a/crates/rome_service/src/configuration/javascript.rs +++ b/crates/rome_service/src/configuration/javascript.rs @@ -2,7 +2,7 @@ use crate::configuration::merge::MergeWith; use crate::configuration::string_set::StringSet; use bpaf::Bpaf; use rome_js_formatter::context::{ - trailing_comma::TrailingComma, QuoteProperties, QuoteStyle, Semicolons, + trailing_comma::TrailingComma, ArrowParentheses, QuoteProperties, QuoteStyle, Semicolons, }; use serde::{Deserialize, Serialize}; @@ -88,6 +88,10 @@ pub struct JavascriptFormatter { #[bpaf(long("semicolons"), argument("always|as-needed"), optional)] #[serde(skip_serializing_if = "Option::is_none")] pub semicolons: Option, + /// Whether to add non-necessary parentheses to arrow functions. Defaults to "always". + #[bpaf(long("arrow-parentheses"), argument("always|as-needed"), optional)] + #[serde(skip_serializing_if = "Option::is_none")] + pub arrow_parentheses: Option, } impl JavascriptFormatter { @@ -97,11 +101,15 @@ impl JavascriptFormatter { "quoteProperties", "trailingComma", "semicolons", + "arrowParentheses", ]; } impl MergeWith for JavascriptFormatter { fn merge_with(&mut self, other: JavascriptFormatter) { + if let Some(arrow_parentheses) = other.arrow_parentheses { + self.arrow_parentheses = Some(arrow_parentheses); + } if let Some(quote_properties) = other.quote_properties { self.quote_properties = Some(quote_properties); } diff --git a/crates/rome_service/src/configuration/parse/json/javascript.rs b/crates/rome_service/src/configuration/parse/json/javascript.rs index 3a75e9b4faa..d01254bac65 100644 --- a/crates/rome_service/src/configuration/parse/json/javascript.rs +++ b/crates/rome_service/src/configuration/parse/json/javascript.rs @@ -4,7 +4,7 @@ use crate::configuration::{JavascriptConfiguration, JavascriptFormatter}; use rome_deserialize::json::{has_only_known_keys, VisitJsonNode}; use rome_deserialize::{DeserializationDiagnostic, VisitNode}; use rome_js_formatter::context::trailing_comma::TrailingComma; -use rome_js_formatter::context::{QuoteProperties, QuoteStyle, Semicolons}; +use rome_js_formatter::context::{ArrowParentheses, QuoteProperties, QuoteStyle, Semicolons}; use rome_json_syntax::{JsonLanguage, JsonSyntaxNode}; use rome_rowan::SyntaxNode; @@ -100,6 +100,11 @@ impl VisitNode for JavascriptFormatter { self.map_to_known_string(&value, name_text, &mut semicolons, diagnostics)?; self.semicolons = Some(semicolons); } + "arrowParentheses" => { + let mut arrow_parentheses = ArrowParentheses::default(); + self.map_to_known_string(&value, name_text, &mut arrow_parentheses, diagnostics)?; + self.arrow_parentheses = Some(arrow_parentheses); + } _ => {} } diff --git a/crates/rome_service/src/file_handlers/javascript.rs b/crates/rome_service/src/file_handlers/javascript.rs index 96324d231ea..809dabbd86f 100644 --- a/crates/rome_service/src/file_handlers/javascript.rs +++ b/crates/rome_service/src/file_handlers/javascript.rs @@ -26,7 +26,7 @@ use rome_js_analyze::{ analyze, analyze_with_inspect_matcher, visit_registry, ControlFlowGraph, RuleError, }; use rome_js_formatter::context::{ - trailing_comma::TrailingComma, QuoteProperties, QuoteStyle, Semicolons, + trailing_comma::TrailingComma, ArrowParentheses, QuoteProperties, QuoteStyle, Semicolons, }; use rome_js_formatter::{context::JsFormatOptions, format_node}; use rome_js_parser::JsParserOptions; @@ -50,6 +50,7 @@ pub struct JsFormatterSettings { pub quote_properties: Option, pub trailing_comma: Option, pub semicolons: Option, + pub arrow_parentheses: Option, } #[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] @@ -92,6 +93,7 @@ impl Language for JsLanguage { .with_quote_properties(language.quote_properties.unwrap_or_default()) .with_trailing_comma(language.trailing_comma.unwrap_or_default()) .with_semicolons(language.semicolons.unwrap_or_default()) + .with_arrow_parentheses(language.arrow_parentheses.unwrap_or_default()) } } diff --git a/crates/rome_service/src/settings.rs b/crates/rome_service/src/settings.rs index 1b10e43e8db..500fcfed82b 100644 --- a/crates/rome_service/src/settings.rs +++ b/crates/rome_service/src/settings.rs @@ -80,6 +80,7 @@ impl WorkspaceSettings { self.languages.javascript.formatter.quote_properties = formatter.quote_properties; self.languages.javascript.formatter.trailing_comma = formatter.trailing_comma; self.languages.javascript.formatter.semicolons = formatter.semicolons; + self.languages.javascript.formatter.arrow_parentheses = formatter.arrow_parentheses; } if let Some(parser) = javascript.parser { diff --git a/editors/vscode/configuration_schema.json b/editors/vscode/configuration_schema.json index aee25ff7a91..5e9b32bcdcd 100644 --- a/editors/vscode/configuration_schema.json +++ b/editors/vscode/configuration_schema.json @@ -215,6 +215,7 @@ } } }, + "ArrowParentheses": { "type": "string", "enum": ["always", "asNeeded"] }, "Complexity": { "description": "A list of rules that belong to this group", "type": "object", @@ -662,6 +663,13 @@ "JavascriptFormatter": { "type": "object", "properties": { + "arrowParentheses": { + "description": "Whether to add non-necessary parentheses to arrow functions. Defaults to \"always\".", + "anyOf": [ + { "$ref": "#/definitions/ArrowParentheses" }, + { "type": "null" } + ] + }, "jsxQuoteStyle": { "description": "The style for JSX quotes. Defaults to double.", "anyOf": [{ "$ref": "#/definitions/QuoteStyle" }, { "type": "null" }] diff --git a/npm/backend-jsonrpc/src/workspace.ts b/npm/backend-jsonrpc/src/workspace.ts index 191106ec769..7d794b79b32 100644 --- a/npm/backend-jsonrpc/src/workspace.ts +++ b/npm/backend-jsonrpc/src/workspace.ts @@ -166,6 +166,10 @@ The allowed range of values is 1..=320 */ export type LineWidth = number; export interface JavascriptFormatter { + /** + * Whether to add non-necessary parentheses to arrow functions. Defaults to "always". + */ + arrowParentheses?: ArrowParentheses; /** * The style for JSX quotes. Defaults to double. */ @@ -215,6 +219,7 @@ export interface Rules { suspicious?: Suspicious; } export type VcsClientKind = "git"; +export type ArrowParentheses = "always" | "asNeeded"; export type QuoteStyle = "double" | "single"; export type QuoteProperties = "asNeeded" | "preserve"; export type Semicolons = "always" | "asNeeded"; diff --git a/npm/rome/configuration_schema.json b/npm/rome/configuration_schema.json index aee25ff7a91..5e9b32bcdcd 100644 --- a/npm/rome/configuration_schema.json +++ b/npm/rome/configuration_schema.json @@ -215,6 +215,7 @@ } } }, + "ArrowParentheses": { "type": "string", "enum": ["always", "asNeeded"] }, "Complexity": { "description": "A list of rules that belong to this group", "type": "object", @@ -662,6 +663,13 @@ "JavascriptFormatter": { "type": "object", "properties": { + "arrowParentheses": { + "description": "Whether to add non-necessary parentheses to arrow functions. Defaults to \"always\".", + "anyOf": [ + { "$ref": "#/definitions/ArrowParentheses" }, + { "type": "null" } + ] + }, "jsxQuoteStyle": { "description": "The style for JSX quotes. Defaults to double.", "anyOf": [{ "$ref": "#/definitions/QuoteStyle" }, { "type": "null" }] From 30e147d6e7768a5e9c03b7406bc5313e3e767069 Mon Sep 17 00:00:00 2001 From: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Date: Fri, 14 Jul 2023 14:58:34 +0000 Subject: [PATCH 2/7] chore: fix snapshots --- .../specs/js/module/arrow/arrow-comments.js.snap | 2 +- .../js/module/arrow/arrow_chain_comments.js.snap | 2 +- .../specs/js/module/arrow/arrow_function.js.snap | 2 +- .../tests/specs/js/module/arrow/arrow_nested.js.snap | 6 +++--- .../js/module/arrow/arrow_test_callback.js.snap | 6 +++--- .../tests/specs/js/module/arrow/call.js.snap | 8 ++++---- .../tests/specs/js/module/arrow/currying.js.snap | 12 ++++++------ .../tests/specs/js/module/arrow/options.json | 2 +- .../tests/specs/js/module/arrow/params.js.snap | 4 ++-- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap index 636fa542c90..971effc9d87 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap @@ -81,7 +81,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always -Arrow parentheses: Always +Arrow parentheses: As needed ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap index ff8e92769dc..f0546f55dc0 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap @@ -65,7 +65,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always -Arrow parentheses: Always +Arrow parentheses: As needed ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap index 49146cd7bb8..ab4f4542815 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap @@ -56,7 +56,7 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always -Arrow parentheses: Always +Arrow parentheses: As needed ----- ```js diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap index 1f1428a00ea..1e9171eeb39 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_nested.js.snap @@ -93,11 +93,11 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always -Arrow parentheses: Always +Arrow parentheses: As needed ----- ```js -Seq(typeDef.interface.groups).forEach((group) => +Seq(typeDef.interface.groups).forEach(group => Seq(group.members).forEach((member, memberName) => markdownDoc(member.doc, { typePath: typePath.concat(memberName.slice(1)), @@ -106,7 +106,7 @@ Seq(typeDef.interface.groups).forEach((group) => ), ); -const promiseFromCallback = (fn) => +const promiseFromCallback = fn => new Promise((resolve, reject) => fn((err, result) => { if (err) return reject(err); diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap index 3e66f639bbb..20017ee5046 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_test_callback.js.snap @@ -53,11 +53,11 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always -Arrow parentheses: Always +Arrow parentheses: As needed ----- ```js -it("should have the default duration when using the onClose arguments", (done) => { +it("should have the default duration when using the onClose arguments", done => { expect(true); done(); }); @@ -65,7 +65,7 @@ it("should have the default duration when using the onClose arguments", (done) = # Lines exceeding max width of 80 characters ``` - 1: it("should have the default duration when using the onClose arguments", (done) => { + 1: it("should have the default duration when using the onClose arguments", done => { ``` diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap index 9a1e84aa4c4..613328ae543 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap @@ -137,11 +137,11 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always -Arrow parentheses: Always +Arrow parentheses: As needed ----- ```js -const testResults = results.testResults.map((testResult) => +const testResults = results.testResults.map(testResult => formatResult(testResult, formatter, reporter), ); @@ -180,7 +180,7 @@ const b = Observable.fromPromise(axiosInstance.get(url)).map( func( veryLoooooooooooooooooooooooongName, - (veryLooooooooooooooooooooooooongName) => + veryLooooooooooooooooooooooooongName => veryLoooooooooooooooongName.something(), ); @@ -189,7 +189,7 @@ const composition = (ViewComponent, ContainerComponent) => static propTypes = {}; }; -romise.then((result) => +romise.then(result => result.veryLongVariable.veryLongPropertyName > someOtherVariable ? "ok" : "fail", diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/currying.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/currying.js.snap index 1d12d85179a..0e538c647ab 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/currying.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/currying.js.snap @@ -74,25 +74,25 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always -Arrow parentheses: Always +Arrow parentheses: As needed ----- ```js -const fn = (b) => (c) => (d) => { +const fn = b => c => d => { return 3; }; -const foo = (a, b) => (c) => (d) => { +const foo = (a, b) => c => d => { return 3; }; -const bar = (a) => (b) => (c) => a + b + c; +const bar = a => b => c => a + b + c; -const mw = (store) => (next) => (action) => { +const mw = store => next => action => { return next(action); }; -const middleware = (options) => (req, res, next) => { +const middleware = options => (req, res, next) => { // ... }; ``` diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/options.json b/crates/rome_js_formatter/tests/specs/js/module/arrow/options.json index 6a2f8bcaca6..7ef4276dd98 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/options.json +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/options.json @@ -1,7 +1,7 @@ { "cases": [ { - "arrowParentheses": "AsNeeded" + "arrow_parentheses": "AsNeeded" } ] } diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap index 207158051db..0093a7f01a3 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap @@ -662,12 +662,12 @@ JSX quote style: Double Quotes Quote properties: As needed Trailing comma: All Semicolons: Always -Arrow parentheses: Always +Arrow parentheses: As needed ----- ```js fooooooooooooooooooooooooooooooooooooooooooooooooooo( - (action) => (next) => dispatch(action), + action => next => dispatch(action), ); foo( From 8e94b8753154462a1867fe5b1151c02b98403cf1 Mon Sep 17 00:00:00 2001 From: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Date: Sun, 16 Jul 2023 10:43:11 +0000 Subject: [PATCH 3/7] =?UTF-8?q?chore:=20make=20it=20work=20on=20(hopefully?= =?UTF-8?q?)=20all=20cases=20=F0=9F=A6=80=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/js/bindings/parameters.rs | 73 ++++++++++++++----- .../expressions/arrow_function_expression.rs | 36 +++++++-- crates/rome_js_formatter/tests/quick_test.rs | 19 ++++- .../js/module/arrow/arrow-comments.js.snap | 8 +- .../module/arrow/arrow_chain_comments.js.snap | 6 +- .../js/module/arrow/arrow_function.js.snap | 2 +- .../tests/specs/js/module/arrow/call.js.snap | 4 +- 7 files changed, 110 insertions(+), 38 deletions(-) diff --git a/crates/rome_js_formatter/src/js/bindings/parameters.rs b/crates/rome_js_formatter/src/js/bindings/parameters.rs index 7cb79ebdc88..9d0c7b8b9a5 100644 --- a/crates/rome_js_formatter/src/js/bindings/parameters.rs +++ b/crates/rome_js_formatter/src/js/bindings/parameters.rs @@ -1,12 +1,13 @@ use crate::prelude::*; use rome_formatter::{write, CstFormatContext}; +use crate::js::expressions::arrow_function_expression::can_avoid_parentheses; use crate::js::lists::parameter_list::FormatJsAnyParameterList; use crate::utils::test_call::is_test_call_argument; use rome_js_syntax::parameter_ext::{AnyJsParameterList, AnyParameter}; use rome_js_syntax::{ - AnyJsConstructorParameter, AnyJsFormalParameter, AnyTsType, JsConstructorParameters, - JsParameters, JsSyntaxToken, + AnyJsConstructorParameter, AnyJsFormalParameter, AnyTsType, JsArrowFunctionExpression, + JsConstructorParameters, JsParameters, JsSyntaxToken, }; use rome_rowan::{declare_node_union, SyntaxResult}; @@ -48,6 +49,11 @@ impl Format for FormatAnyJsParameters { let l_paren_token = self.l_paren_token()?; let r_paren_token = self.r_paren_token()?; + let parentheses_not_needed = match self.as_arrow_function_expression() { + Some(expression) => can_avoid_parentheses(&expression, f), + None => false, + }; + match layout { ParameterLayout::NoParameters => { write!( @@ -60,27 +66,50 @@ impl Format for FormatAnyJsParameters { ) } ParameterLayout::Hug => { + if !parentheses_not_needed { + write!(f, [l_paren_token.format()])?; + } else { + write!(f, [format_removed(&l_paren_token)])?; + } + write!( f, - [ - l_paren_token.format(), - FormatJsAnyParameterList::with_layout(&list, ParameterLayout::Hug), - &r_paren_token.format() - ] - ) + [FormatJsAnyParameterList::with_layout( + &list, + ParameterLayout::Hug + )] + )?; + + if !parentheses_not_needed { + write!(f, [&r_paren_token.format()])?; + } else { + write!(f, [format_removed(&r_paren_token)])?; + } + + Ok(()) } ParameterLayout::Default => { + if !parentheses_not_needed { + write!(f, [l_paren_token.format()])?; + } else { + write!(f, [format_removed(&l_paren_token)])?; + } + write!( f, - [ - l_paren_token.format(), - soft_block_indent(&FormatJsAnyParameterList::with_layout( - &list, - ParameterLayout::Default - )), - r_paren_token.format() - ] - ) + [soft_block_indent(&FormatJsAnyParameterList::with_layout( + &list, + ParameterLayout::Default + ))] + )?; + + if !parentheses_not_needed { + write!(f, [r_paren_token.format()])?; + } else { + write!(f, [format_removed(&r_paren_token)])?; + } + + Ok(()) } } } @@ -128,6 +157,16 @@ impl FormatAnyJsParameters { Ok(result) } + + fn as_arrow_function_expression(&self) -> Option { + match self { + FormatAnyJsParameters::JsParameters(parameters) => parameters + .syntax() + .parent() + .and_then(JsArrowFunctionExpression::cast), + FormatAnyJsParameters::JsConstructorParameters(_) => None, + } + } } #[derive(Copy, Debug, Clone, Eq, PartialEq)] diff --git a/crates/rome_js_formatter/src/js/expressions/arrow_function_expression.rs b/crates/rome_js_formatter/src/js/expressions/arrow_function_expression.rs index 752cd5679db..0a42b3f779d 100644 --- a/crates/rome_js_formatter/src/js/expressions/arrow_function_expression.rs +++ b/crates/rome_js_formatter/src/js/expressions/arrow_function_expression.rs @@ -16,7 +16,7 @@ use crate::utils::{resolve_left_most_expression, AssignmentLikeLayout}; use rome_js_syntax::{ AnyJsArrowFunctionParameters, AnyJsBindingPattern, AnyJsExpression, AnyJsFormalParameter, AnyJsFunctionBody, AnyJsParameter, AnyJsTemplateElement, JsArrowFunctionExpression, - JsSyntaxKind, JsSyntaxNode, JsTemplateExpression, + JsFormalParameter, JsSyntaxKind, JsSyntaxNode, JsTemplateExpression, }; use rome_rowan::{SyntaxNodeOptionExt, SyntaxResult}; @@ -221,10 +221,7 @@ fn format_signature( AnyJsArrowFunctionParameters::AnyJsBinding(binding) => { let should_hug = is_test_call_argument(arrow.syntax())?; - let parentheses_not_needed = f.options().arrow_parentheses().is_as_needed() - && arrow.parameters()?.len() == 1 - && arrow.type_parameters().is_none() - && arrow.return_type_annotation().is_none(); + let parentheses_not_needed = can_avoid_parentheses(arrow, f); if !parentheses_not_needed { write!(f, [text("(")])?; @@ -304,7 +301,13 @@ fn should_break_chain(arrow: &JsArrowFunctionExpression) -> SyntaxResult { } // Break if the function has any rest, object, or array parameter - let result = match parameters { + let result = has_rest_object_or_array_parameter(¶meters); + + Ok(result) +} + +fn has_rest_object_or_array_parameter(parameters: &AnyJsArrowFunctionParameters) -> bool { + match parameters { AnyJsArrowFunctionParameters::AnyJsBinding(_) => false, AnyJsArrowFunctionParameters::JsParameters(parameters) => parameters .items() @@ -326,9 +329,26 @@ fn should_break_chain(arrow: &JsArrowFunctionExpression) -> SyntaxResult { AnyJsParameter::TsThisParameter(_) => false, AnyJsParameter::JsRestParameter(_) => true, }), - }; + } +} - Ok(result) +/// Returns `true` if the `arrow_parentheses` formatter option is enabled and parentheses can be safely avoided +pub fn can_avoid_parentheses(arrow: &JsArrowFunctionExpression, f: &mut JsFormatter) -> bool { + match arrow.parameters() { + Ok(parameters) => { + f.options().arrow_parentheses().is_as_needed() + && parameters.len() == 1 + && arrow.type_parameters().is_none() + && arrow.return_type_annotation().is_none() + && !has_rest_object_or_array_parameter(¶meters) + && !parameters + .as_js_parameters() + .and_then(|p| p.items().first()?.ok()) + .and_then(|p| JsFormalParameter::cast(p.syntax().clone())) + .is_some_and(|p| p.initializer().is_some()) + } + Err(_) => false, + } } #[derive(Clone, Debug)] diff --git a/crates/rome_js_formatter/tests/quick_test.rs b/crates/rome_js_formatter/tests/quick_test.rs index 09cdf20d4e5..0faf23952e9 100644 --- a/crates/rome_js_formatter/tests/quick_test.rs +++ b/crates/rome_js_formatter/tests/quick_test.rs @@ -8,11 +8,18 @@ mod language { include!("language.rs"); } -// #[ignore] +#[ignore] #[test] // use this test check if your snippet prints as you wish, without using a snapshot fn quick_test() { - let src = r#"export const lol = a => "lol";"#; + let src = r#" + action => {} + (action) => {} + ({ action }) => {} + ([ action ]) => {} + (...action) => {} + (action = 1) => {} + "#; let syntax = JsFileSource::tsx(); let tree = parse( src, @@ -36,9 +43,15 @@ fn quick_test() { CheckReformat::new(root, result.as_code(), "quick_test", &language, options); check_reformat.check_reformat(); + // I don't know why semicolons are added there, but it's not related to my code changes so ¯\_(ツ)_/¯ assert_eq!( result.as_code(), - r#"export const lol = a => "lol" + r#";action => {} +;action => {} +;({ action }) => {} +;([action]) => {} +;(...action) => {} +;(action = 1) => {} "# ); } diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap index 971effc9d87..130ae39051f 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow-comments.js.snap @@ -86,23 +86,23 @@ Arrow parentheses: As needed ```js // array -(action) => +action => // eslint-disable-next-line react/no-array-index-key [
  • ]; // function body -(action) => +action => // eslint-disable-next-line react/no-array-index-key { return
  • ; }; // object expression -(action) => +action => // eslint-disable-next-line react/no-array-index-key ({ a: 10 }); -(action) => /* comment */ ` +action => /* comment */ ` ${test} multiline`; ``` diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap index f0546f55dc0..3230a2fe8bf 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_chain_comments.js.snap @@ -70,14 +70,14 @@ Arrow parentheses: As needed ```js x = - (bifornCringerMoshedPerplexSawder) => + bifornCringerMoshedPerplexSawder => (askTrovenaBeenaDependsRowans, glimseGlyphsHazardNoopsTieTie) => - (f00) => { + f00 => { averredBathersBoxroomBuggyNurl(); }; // BOOM x2 = - (a) => + a => ( askTrovenaBeenaDependsRowans1, askTrovenaBeenaDependsRowans2, diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap index ab4f4542815..c2c6d403ce0 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/arrow_function.js.snap @@ -62,7 +62,7 @@ Arrow parentheses: As needed ```js () => {}; async () => {}; -(foo) => {}; +foo => {}; ( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap index 613328ae543..3e824915ed5 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/call.js.snap @@ -171,11 +171,11 @@ expect(() => ).not.toThrowError(); const a = Observable.fromPromise(axiosInstance.post("/carts/mine")).map( - (response) => response.data, + response => response.data, ); const b = Observable.fromPromise(axiosInstance.get(url)).map( - (response) => response.data, + response => response.data, ); func( From b3c57f122e9d7c3629b2c91c592f7da8cfe263a9 Mon Sep 17 00:00:00 2001 From: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Date: Sun, 16 Jul 2023 11:06:33 +0000 Subject: [PATCH 4/7] feat: update website and playground --- website/src/pages/configuration.mdx | 6 +++++ website/src/pages/formatter/index.mdx | 2 ++ website/src/pages/linter/index.mdx | 2 ++ website/src/playground/PlaygroundLoader.tsx | 4 +++ website/src/playground/tabs/SettingsTab.tsx | 25 +++++++++++++++++++ website/src/playground/types.ts | 7 ++++++ .../src/playground/workers/prettierWorker.ts | 5 ++++ website/src/playground/workers/romeWorker.ts | 4 +++ 8 files changed, 55 insertions(+) diff --git a/website/src/pages/configuration.mdx b/website/src/pages/configuration.mdx index 91ae6454624..3e53bfb89c6 100644 --- a/website/src/pages/configuration.mdx +++ b/website/src/pages/configuration.mdx @@ -392,6 +392,12 @@ It configures where the formatter prints semicolons: > Default: `always` +### `javascript.formatter.arrowParentheses` + +Whether to add non-necessary parentheses to arrow functions. It can be `always` or `asNeeded`. + +> Default: `always` + Example: diff --git a/website/src/pages/formatter/index.mdx b/website/src/pages/formatter/index.mdx index c28694e3956..6206e09638b 100644 --- a/website/src/pages/formatter/index.mdx +++ b/website/src/pages/formatter/index.mdx @@ -49,6 +49,8 @@ Available options: comma-separated syntactic structures. Defaults to "all". --semicolons Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + --arrow-parentheses Whether to add non-necessary parentheses to arrow + functions. Defaults to "always". --vcs-client-kind The kind of client. --vcs-enabled Whether Rome should integrate itself with the VCS client --vcs-use-ignore-file Whether Rome should use the VCS ignore file. When [true], diff --git a/website/src/pages/linter/index.mdx b/website/src/pages/linter/index.mdx index 35df4ef3df4..9ecc17b8c32 100644 --- a/website/src/pages/linter/index.mdx +++ b/website/src/pages/linter/index.mdx @@ -54,6 +54,8 @@ Available options: comma-separated syntactic structures. Defaults to "all". --semicolons Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + --arrow-parentheses Whether to add non-necessary parentheses to arrow + functions. Defaults to "always". --colors Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible diff --git a/website/src/playground/PlaygroundLoader.tsx b/website/src/playground/PlaygroundLoader.tsx index 9c57f58a9cd..c5cb04d9141 100644 --- a/website/src/playground/PlaygroundLoader.tsx +++ b/website/src/playground/PlaygroundLoader.tsx @@ -1,6 +1,7 @@ import Playground from "./Playground"; import LoadingScreen from "./components/LoadingScreen"; import { + ArrowParentheses, IndentStyle, LintRules, LoadingState, @@ -325,6 +326,9 @@ function initState( semicolons: (searchParams.get("semicolons") as Semicolons) ?? defaultPlaygroundState.settings.semicolons, + arrowParentheses: + (searchParams.get("arrowParentheses") as ArrowParentheses) ?? + defaultPlaygroundState.settings.arrowParentheses, lintRules: (searchParams.get("lintRules") as LintRules) ?? defaultPlaygroundState.settings.lintRules, diff --git a/website/src/playground/tabs/SettingsTab.tsx b/website/src/playground/tabs/SettingsTab.tsx index cdd85b8f24b..1540ae442fd 100644 --- a/website/src/playground/tabs/SettingsTab.tsx +++ b/website/src/playground/tabs/SettingsTab.tsx @@ -1,4 +1,5 @@ import { + ArrowParentheses, IndentStyle, LintRules, PlaygroundState, @@ -43,6 +44,7 @@ export default function SettingsTab({ quoteProperties, trailingComma, semicolons, + arrowParentheses, lintRules, enabledLinting, importSortingEnabled, @@ -82,6 +84,10 @@ export default function SettingsTab({ setPlaygroundState, "semicolons", ); + const setArrowParentheses = createPlaygroundSettingsSetter( + setPlaygroundState, + "arrowParentheses", + ); const setLintRules = createPlaygroundSettingsSetter( setPlaygroundState, "lintRules", @@ -239,6 +245,8 @@ export default function SettingsTab({ setTrailingComma={setTrailingComma} semicolons={semicolons} setSemicolons={setSemicolons} + arrowParentheses={arrowParentheses} + setArrowParentheses={setArrowParentheses} /> void; @@ -567,6 +577,8 @@ function FormatterSettings({ setTrailingComma: (value: TrailingComma) => void; semicolons: Semicolons; setSemicolons: (value: Semicolons) => void; + arrowParentheses: ArrowParentheses; + setArrowParentheses: (value: ArrowParentheses) => void; }) { return ( <> @@ -669,6 +681,19 @@ function FormatterSettings({ + +
    + + +
    ); diff --git a/website/src/playground/types.ts b/website/src/playground/types.ts index b14802a8740..950322262e6 100644 --- a/website/src/playground/types.ts +++ b/website/src/playground/types.ts @@ -44,6 +44,11 @@ export enum Semicolons { AsNeeded = "as-needed", } +export enum ArrowParentheses { + Always = "always", + AsNeeded = "as-needed", +} + export type PrettierOutput = | { type: "SUCCESS"; code: string; ir: string } | { type: "ERROR"; stack: string }; @@ -105,6 +110,7 @@ export interface PlaygroundSettings { quoteProperties: QuoteProperties; trailingComma: TrailingComma; semicolons: Semicolons; + arrowParentheses: ArrowParentheses; lintRules: LintRules; enabledLinting: boolean; importSortingEnabled: boolean; @@ -147,6 +153,7 @@ export const defaultPlaygroundState: PlaygroundState = { quoteProperties: QuoteProperties.AsNeeded, trailingComma: TrailingComma.All, semicolons: Semicolons.Always, + arrowParentheses: ArrowParentheses.Always, lintRules: LintRules.Recommended, enabledLinting: true, importSortingEnabled: true, diff --git a/website/src/playground/workers/prettierWorker.ts b/website/src/playground/workers/prettierWorker.ts index 271b224360d..3e1ba1fdca0 100644 --- a/website/src/playground/workers/prettierWorker.ts +++ b/website/src/playground/workers/prettierWorker.ts @@ -1,4 +1,5 @@ import { + ArrowParentheses, IndentStyle, PlaygroundSettings, PrettierOutput, @@ -32,6 +33,7 @@ self.addEventListener("message", (e) => { quoteProperties, trailingComma, semicolons, + arrowParentheses, } = settings; const code = e.data.code as string; const filename = e.data.filename as string; @@ -46,6 +48,7 @@ self.addEventListener("message", (e) => { quoteProperties, trailingComma, semicolons, + arrowParentheses, }); self.postMessage({ @@ -74,6 +77,7 @@ function formatWithPrettier( quoteProperties: QuoteProperties; trailingComma: TrailingComma; semicolons: Semicolons; + arrowParentheses: ArrowParentheses; }, ): PrettierOutput { try { @@ -89,6 +93,7 @@ function formatWithPrettier( quoteProps: options.quoteProperties, trailingComma: options.trailingComma, semi: options.semicolons === Semicolons.Always, + arrowParens: options.arrowParentheses === ArrowParentheses.Always ? "always" : "avoid", }; // @ts-expect-error diff --git a/website/src/playground/workers/romeWorker.ts b/website/src/playground/workers/romeWorker.ts index 5ef33abc0df..aeef0cd0142 100644 --- a/website/src/playground/workers/romeWorker.ts +++ b/website/src/playground/workers/romeWorker.ts @@ -1,4 +1,5 @@ import { + ArrowParentheses, IndentStyle, LintRules, LoadingState, @@ -71,6 +72,7 @@ self.addEventListener("message", async (e) => { enabledLinting, trailingComma, semicolons, + arrowParentheses, importSortingEnabled, unsafeParameterDecoratorsEnabled, } = e.data.settings as PlaygroundSettings; @@ -104,6 +106,8 @@ self.addEventListener("message", async (e) => { trailingComma, semicolons: semicolons === Semicolons.Always ? "always" : "asNeeded", + arrowParentheses: + arrowParentheses === ArrowParentheses.Always ? "always" : "asNeeded", }, parser: { unsafeParameterDecoratorsEnabled, From 6fc6e9bbeb62f359a2d3ba0aaff1c1d546584581 Mon Sep 17 00:00:00 2001 From: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Date: Sun, 16 Jul 2023 12:33:11 +0000 Subject: [PATCH 5/7] chore: run rome formatter --- website/src/playground/tabs/SettingsTab.tsx | 4 +++- website/src/playground/workers/prettierWorker.ts | 5 ++++- website/src/playground/workers/romeWorker.ts | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/website/src/playground/tabs/SettingsTab.tsx b/website/src/playground/tabs/SettingsTab.tsx index 1540ae442fd..79f7c49afd5 100644 --- a/website/src/playground/tabs/SettingsTab.tsx +++ b/website/src/playground/tabs/SettingsTab.tsx @@ -688,7 +688,9 @@ function FormatterSettings({ id="arrowParentheses" name="arrowParentheses" value={arrowParentheses ?? "always"} - onChange={(e) => setArrowParentheses(e.target.value as ArrowParentheses)} + onChange={(e) => + setArrowParentheses(e.target.value as ArrowParentheses) + } > diff --git a/website/src/playground/workers/prettierWorker.ts b/website/src/playground/workers/prettierWorker.ts index 3e1ba1fdca0..439217dafb4 100644 --- a/website/src/playground/workers/prettierWorker.ts +++ b/website/src/playground/workers/prettierWorker.ts @@ -93,7 +93,10 @@ function formatWithPrettier( quoteProps: options.quoteProperties, trailingComma: options.trailingComma, semi: options.semicolons === Semicolons.Always, - arrowParens: options.arrowParentheses === ArrowParentheses.Always ? "always" : "avoid", + arrowParens: + options.arrowParentheses === ArrowParentheses.Always + ? "always" + : "avoid", }; // @ts-expect-error diff --git a/website/src/playground/workers/romeWorker.ts b/website/src/playground/workers/romeWorker.ts index aeef0cd0142..f083f296520 100644 --- a/website/src/playground/workers/romeWorker.ts +++ b/website/src/playground/workers/romeWorker.ts @@ -107,7 +107,9 @@ self.addEventListener("message", async (e) => { semicolons: semicolons === Semicolons.Always ? "always" : "asNeeded", arrowParentheses: - arrowParentheses === ArrowParentheses.Always ? "always" : "asNeeded", + arrowParentheses === ArrowParentheses.Always + ? "always" + : "asNeeded", }, parser: { unsafeParameterDecoratorsEnabled, From 280eabce86939d436b568f604375dbe8279e499a Mon Sep 17 00:00:00 2001 From: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Date: Sun, 16 Jul 2023 12:52:37 +0000 Subject: [PATCH 6/7] chore: update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 287fa011f57..4be3000a4f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,8 @@ multiple files: - Added a new option called `--jsx-quote-style` to the formatter. This option allows you to choose between single and double quotes for JSX attributes. [#4486](https://github.com/rome/tools/issues/4486) +- Added a new option called `--arrow-parentheses` to the formatter. This option allows you to set the parentheses style for arrow functions. [#4666](https://github.com/rome/tools/issues/4666) + ### Linter - [`noDuplicateParameters`](https://docs.rome.tools/lint/rules/noduplicateparameters/): enhanced rule to manage constructor parameters. From aa140cb97ed572a3fea663fd409272b3aa377e3e Mon Sep 17 00:00:00 2001 From: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Date: Mon, 17 Jul 2023 09:04:18 +0000 Subject: [PATCH 7/7] chore: implement requested changes --- crates/rome_cli/tests/commands/format.rs | 62 +++++++++++++++++++ .../applies_custom_arrow_parentheses.snap | 23 +++++++ .../src/js/bindings/parameters.rs | 7 +-- .../expressions/arrow_function_expression.rs | 29 ++++----- website/src/pages/configuration.mdx | 6 -- website/src/pages/formatter/index.mdx | 2 - website/src/pages/linter/index.mdx | 2 - 7 files changed, 101 insertions(+), 30 deletions(-) create mode 100644 crates/rome_cli/tests/snapshots/main_commands_format/applies_custom_arrow_parentheses.snap diff --git a/crates/rome_cli/tests/commands/format.rs b/crates/rome_cli/tests/commands/format.rs index d05b95b80ca..95dd216c216 100644 --- a/crates/rome_cli/tests/commands/format.rs +++ b/crates/rome_cli/tests/commands/format.rs @@ -52,6 +52,23 @@ const APPLY_TRAILING_COMMA_AFTER: &str = r#"const a = [ ]; "#; +const APPLY_ARROW_PARENTHESES_BEFORE: &str = r#" +action => {} +(action) => {} +({ action }) => {} +([ action ]) => {} +(...action) => {} +(action = 1) => {} +"#; + +const APPLY_ARROW_PARENTHESES_AFTER: &str = r#"action => {}; +action => {}; +({ action }) => {}; +([action]) => {}; +(...action) => {}; +(action = 1) => {}; +"#; + const DEFAULT_CONFIGURATION_BEFORE: &str = r#"function f() { return { a, b } }"#; @@ -707,6 +724,51 @@ fn applies_custom_trailing_comma() { )); } +#[test] +fn applies_custom_arrow_parentheses() { + let mut fs = MemoryFileSystem::default(); + let mut console = BufferConsole::default(); + + let file_path = Path::new("file.js"); + fs.insert(file_path.into(), APPLY_ARROW_PARENTHESES_BEFORE.as_bytes()); + + let result = run_cli( + DynRef::Borrowed(&mut fs), + &mut console, + Args::from( + [ + ("format"), + ("--arrow-parentheses"), + ("as-needed"), + ("--write"), + file_path.as_os_str().to_str().unwrap(), + ] + .as_slice(), + ), + ); + + assert!(result.is_ok(), "run_cli returned {result:?}"); + + let mut file = fs + .open(file_path) + .expect("formatting target file was removed by the CLI"); + + let mut content = String::new(); + file.read_to_string(&mut content) + .expect("failed to read file from memory FS"); + + assert_eq!(content, APPLY_ARROW_PARENTHESES_AFTER); + + drop(file); + assert_cli_snapshot(SnapshotPayload::new( + module_path!(), + "applies_custom_arrow_parentheses", + fs, + console, + result, + )); +} + #[test] fn trailing_comma_parse_errors() { let mut console = BufferConsole::default(); diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/applies_custom_arrow_parentheses.snap b/crates/rome_cli/tests/snapshots/main_commands_format/applies_custom_arrow_parentheses.snap new file mode 100644 index 00000000000..da06e0ae047 --- /dev/null +++ b/crates/rome_cli/tests/snapshots/main_commands_format/applies_custom_arrow_parentheses.snap @@ -0,0 +1,23 @@ +--- +source: crates/rome_cli/tests/snap_test.rs +expression: content +--- +## `file.js` + +```js +action => {}; +action => {}; +({ action }) => {}; +([action]) => {}; +(...action) => {}; +(action = 1) => {}; + +``` + +# Emitted Messages + +```block +Formatted 1 file(s) in