From bea304a2f0d0bd8e1fcc53fb489e0bd57884c855 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Fri, 25 Oct 2024 14:16:11 +0100 Subject: [PATCH] tests: use `insta` for JS parser --- Cargo.lock | 6 + .../biome_configuration/src/javascript/mod.rs | 5 + crates/biome_js_analyze/src/utils/tests.rs | 4 +- crates/biome_js_parser/Cargo.toml | 15 +- crates/biome_js_parser/src/lib.rs | 10 +- crates/biome_js_parser/src/test_utils.rs | 67 --- crates/biome_js_parser/src/tests.rs | 424 ----------------- .../test_data/inline/err/import_call.rast | 40 -- .../inline/err/import_call_no_arg.rast | 95 ---- .../inline/err/spread_attribute_error.rast | 292 ------------ .../err/switch_stmt_double_default.rast | 85 ---- .../err/ts_decorator_object.options.json | 1 - ...decorator_on_ambient_function.options.json | 1 - ...s_decorator_on_arrow_function.options.json | 1 - ...decorator_on_constructor_type.options.json | 1 - ...rator_on_function_declaration.options.json | 1 - ...orator_on_function_expression.options.json | 1 - ...ts_decorator_on_function_type.options.json | 1 - ...decorator_on_signature_member.options.json | 1 - .../ts_decorator_this_parameter.options.json | 1 - ...corator_this_parameter_option.options.json | 1 - ...ts_formal_parameter_decorator.options.json | 1 - .../test_data/inline/ok/metavar.options.json | 1 - .../inline/ok/object_expr_getter.rast | 98 ---- .../inline/ok/object_expr_setter.rast | 108 ----- .../ok/ts_decorator_constructor.options.json | 1 - .../ts_decorator_on_class_method.options.json | 1 - .../ts_decorator_on_class_setter.options.json | 1 - ...ts_formal_parameter_decorator.options.json | 1 - .../error}/abstract_class_in_js.js | 0 .../error/abstract_class_in_js.js.snap} | 29 +- .../error}/array_assignment_target_err.js | 0 .../array_assignment_target_err.js.snap} | 44 +- .../array_assignment_target_rest_err.js | 0 .../array_assignment_target_rest_err.js.snap} | 35 +- .../js_test_suite/error}/array_binding_err.js | 0 .../error/array_binding_err.js.snap} | 40 +- .../error}/array_binding_rest_err.js | 0 .../error/array_binding_rest_err.js.snap} | 35 +- .../error}/array_expr_incomplete.js | 0 .../error/array_expr_incomplete.js.snap} | 29 +- .../error}/arrow_escaped_async.js | 0 .../error/arrow_escaped_async.js.snap} | 29 +- .../arrow_rest_in_expr_in_initializer.js | 0 ...arrow_rest_in_expr_in_initializer.js.snap} | 29 +- .../error}/assign_eval_or_arguments.js | 0 .../error/assign_eval_or_arguments.js.snap} | 47 +- .../js_test_suite/error}/assign_expr_left.js | 0 .../error/assign_expr_left.js.snap} | 30 +- .../js_test_suite/error}/assign_expr_right.js | 0 .../error/assign_expr_right.js.snap} | 29 +- .../async_arrow_expr_await_parameter.js | 0 .../async_arrow_expr_await_parameter.js.snap} | 35 +- ...r_generator_in_single_statement_context.js | 0 ...rator_in_single_statement_context.js.snap} | 32 +- .../js_test_suite/error}/await_in_module.js | 0 .../error/await_in_module.js.snap} | 32 +- .../error}/await_in_non_async_function.js | 0 .../await_in_non_async_function.js.snap} | 29 +- .../error}/await_in_parameter_initializer.js | 0 .../await_in_parameter_initializer.js.snap} | 32 +- ...in_static_initialization_block_member.cjs} | 0 ...tatic_initialization_block_member.cjs.snap | 175 +++++++ ...tatic_initialization_block_member.js.snap} | 42 +- ...n_only_allowed_inside_an_async_function.js | 0 ..._allowed_inside_an_async_function.js.snap} | 35 +- .../error}/binary_expressions_err.js | 0 .../error/binary_expressions_err.js.snap} | 34 +- .../error}/binding_identifier_invalid.js | 0 .../error/binding_identifier_invalid.js.snap} | 48 +- .../binding_identifier_invalid_script.cjs} | 0 ...binding_identifier_invalid_script.cjs.snap | 141 ++++++ ...binding_identifier_invalid_script.js.snap} | 50 +- .../error}/block_stmt_in_class.js | 0 .../error/block_stmt_in_class.js.snap} | 30 +- .../js_test_suite/error}/bracket_expr_err.js | 0 .../error/bracket_expr_err.js.snap} | 35 +- .../error}/break_in_nested_function.js | 0 .../error/break_in_nested_function.js.snap} | 37 +- .../js_test_suite/error}/break_stmt.js | 0 .../js_test_suite/error/break_stmt.js.snap} | 36 +- .../error}/class_constructor_parameter.js | 0 .../class_constructor_parameter.js.snap} | 29 +- .../class_constructor_parameter_readonly.js | 0 ...ss_constructor_parameter_readonly.js.snap} | 29 +- .../js_test_suite/error}/class_decl_err.js | 0 .../error/class_decl_err.js.snap} | 41 +- .../js_test_suite/error}/class_decl_no_id.ts | 0 .../error/class_decl_no_id.ts.snap} | 32 +- .../error}/class_declare_member.js | 0 .../error/class_declare_member.js.snap} | 29 +- .../error}/class_declare_method.js | 0 .../error/class_declare_method.js.snap} | 29 +- .../js_test_suite/error}/class_extends_err.js | 0 .../error/class_extends_err.js.snap} | 35 +- .../js_test_suite/error}/class_implements.js | 0 .../error/class_implements.js.snap} | 29 +- .../class_in_single_statement_context.js | 0 ...class_in_single_statement_context.js.snap} | 29 +- .../error}/class_invalid_modifiers.js | 0 .../error/class_invalid_modifiers.js.snap} | 35 +- .../error}/class_member_method_parameters.js | 0 .../class_member_method_parameters.js.snap} | 31 +- .../error}/class_member_modifier.js | 0 .../error/class_member_modifier.js.snap} | 29 +- ...class_member_static_accessor_precedence.js | 0 ...member_static_accessor_precedence.js.snap} | 33 +- .../error}/class_property_initializer.js | 0 .../error/class_property_initializer.js.snap} | 29 +- .../class_yield_property_initializer.cjs} | 0 .../class_yield_property_initializer.cjs.snap | 154 ++++++ .../class_yield_property_initializer.js.snap} | 47 +- .../error}/conditional_expr_err.js | 0 .../error/conditional_expr_err.js.snap} | 35 +- .../js_test_suite/error}/continue_stmt.js | 0 .../error/continue_stmt.js.snap} | 43 +- .../js_test_suite/error}/debugger_stmt.js | 0 .../error/debugger_stmt.js.snap} | 37 +- .../js_test_suite/error}/decorator.ts | 0 .../js_test_suite/error/decorator.ts.snap} | 108 ++--- ...ction_export_default_declaration_clause.ts | 0 ...export_default_declaration_clause.ts.snap} | 31 +- .../error}/decorator_class_declaration.js | 0 .../decorator_class_declaration.js.snap} | 40 +- .../decorator_class_declaration_top_level.js | 0 ...rator_class_declaration_top_level.js.snap} | 36 +- .../error}/decorator_class_member.ts | 0 .../error/decorator_class_member.ts.snap} | 69 +-- ..._enum_export_default_declaration_clause.ts | 0 ...export_default_declaration_clause.ts.snap} | 32 +- .../js_test_suite/error}/decorator_export.js | 0 .../error/decorator_export.js.snap} | 40 +- .../error}/decorator_export_class_clause.js | 0 .../decorator_export_class_clause.js.snap} | 36 +- ...orator_export_default_expression_clause.ts | 0 ..._export_default_expression_clause.ts.snap} | 31 +- .../error}/decorator_expression_class.js | 0 .../error/decorator_expression_class.js.snap} | 37 +- ...ction_export_default_declaration_clause.ts | 0 ...export_default_declaration_clause.ts.snap} | 31 +- ...rface_export_default_declaration_clause.ts | 0 ...export_default_declaration_clause.ts.snap} | 31 +- .../error}/decorator_precede_class_member.ts | 0 .../decorator_precede_class_member.ts.snap} | 67 +-- .../error}/do_while_no_continue_break.js | 0 .../error/do_while_no_continue_break.js.snap} | 44 +- .../js_test_suite/error}/do_while_stmt_err.js | 0 .../error/do_while_stmt_err.js.snap} | 35 +- .../js_test_suite/error}/double_label.js | 0 .../js_test_suite/error/double_label.js.snap} | 37 +- .../error}/empty_parenthesized_expression.js | 0 .../empty_parenthesized_expression.js.snap} | 29 +- .../js_test_suite/error}/enum_decl_no_id.ts | 0 .../error/enum_decl_no_id.ts.snap} | 32 +- .../js_test_suite/error}/enum_in_js.js | 0 .../js_test_suite/error/enum_in_js.js.snap} | 29 +- .../js_test_suite/error}/enum_no_l_curly.ts | 0 .../error/enum_no_l_curly.ts.snap} | 33 +- .../js_test_suite/error}/enum_no_r_curly.ts | 0 .../error/enum_no_r_curly.ts.snap} | 33 +- .../js_test_suite/error}/escaped_from.js | 0 .../js_test_suite/error/escaped_from.js.snap} | 29 +- .../error}/eval_arguments_assignment.js | 0 .../error/eval_arguments_assignment.js.snap} | 32 +- .../error}/exponent_unary_unparenthesized.js | 0 .../exponent_unary_unparenthesized.js.snap} | 47 +- .../error}/export_as_identifier_err.js | 0 .../error/export_as_identifier_err.js.snap} | 29 +- .../error}/export_decl_not_top_level.js | 0 .../error/export_decl_not_top_level.js.snap} | 33 +- .../export_default_expression_broken.js | 0 .../export_default_expression_broken.js.snap} | 40 +- .../export_default_expression_clause_err.js | 0 ...ort_default_expression_clause_err.js.snap} | 29 +- .../js_test_suite/error}/export_err.js | 0 .../js_test_suite/error/export_err.js.snap} | 29 +- .../error}/export_from_clause_err.js | 0 .../error/export_from_clause_err.js.snap} | 51 +- .../error/export_huge_function_in_script.cjs} | 0 .../export_huge_function_in_script.cjs.snap} | 33 +- .../error}/export_named_clause_err.js | 0 .../error/export_named_clause_err.js.snap} | 42 +- .../error}/export_named_from_clause_err.js | 0 .../export_named_from_clause_err.js.snap} | 39 +- .../error}/export_variable_clause_error.js | 0 .../export_variable_clause_error.js.snap} | 34 +- .../for_in_and_of_initializer_loose_mode.cjs} | 0 ..._in_and_of_initializer_loose_mode.cjs.snap | 385 +++++++++++++++ ..._in_and_of_initializer_loose_mode.js.snap} | 51 +- .../for_in_and_of_initializer_strict_mode.js | 0 ...in_and_of_initializer_strict_mode.js.snap} | 56 ++- .../error}/for_of_async_identifier.js | 0 .../error/for_of_async_identifier.js.snap} | 31 +- .../js_test_suite/error}/for_stmt_err.js | 0 .../js_test_suite/error/for_stmt_err.js.snap} | 52 ++- .../error}/formal_params_invalid.js | 0 .../error/formal_params_invalid.js.snap} | 30 +- .../formal_params_no_binding_element.js | 0 .../formal_params_no_binding_element.js.snap} | 29 +- .../js_test_suite/error}/function_broken.js | 0 .../error/function_broken.js.snap} | 30 +- .../js_test_suite/error}/function_decl_err.js | 0 .../error/function_decl_err.js.snap} | 58 ++- .../error}/function_escaped_async.js | 0 .../error/function_escaped_async.js.snap} | 29 +- .../error}/function_expression_id_err.js | 0 .../error/function_expression_id_err.js.snap} | 35 +- .../js_test_suite/error}/function_id_err.js | 0 .../error/function_id_err.js.snap} | 33 +- ...tion_in_single_statement_context_strict.js | 0 ...n_single_statement_context_strict.js.snap} | 35 +- .../error}/getter_class_no_body.js | 0 .../error/getter_class_no_body.js.snap} | 33 +- .../js_test_suite/error}/identifier.js | 0 .../js_test_suite/error/identifier.js.snap} | 32 +- .../js_test_suite/error}/identifier_err.js | 0 .../error/identifier_err.js.snap} | 47 +- .../js_test_suite/error}/if_stmt_err.js | 0 .../js_test_suite/error/if_stmt_err.js.snap} | 41 +- .../error}/import_as_identifier_err.js | 0 .../error/import_as_identifier_err.js.snap} | 29 +- .../error}/import_assertion_err.js | 0 .../error/import_assertion_err.js.snap} | 55 ++- .../error}/import_attribute_err.js | 0 .../error/import_attribute_err.js.snap} | 52 ++- .../error}/import_decl_not_top_level.js | 0 .../error/import_decl_not_top_level.js.snap} | 33 +- .../js_test_suite/error}/import_err.js | 0 .../js_test_suite/error/import_err.js.snap} | 58 ++- .../error}/import_invalid_args.js | 0 .../error/import_invalid_args.js.snap} | 38 +- .../import_keyword_in_expression_position.js | 0 ...rt_keyword_in_expression_position.js.snap} | 30 +- .../js_test_suite/error}/import_no_meta.js | 0 .../error/import_no_meta.js.snap} | 32 +- ...plete_parenthesized_sequence_expression.js | 0 ...parenthesized_sequence_expression.js.snap} | 32 +- .../index_signature_class_member_in_js.js | 0 ...ndex_signature_class_member_in_js.js.snap} | 33 +- .../interface_cannot_be_reserved_world.ts | 0 ...nterface_cannot_be_reserved_world.ts.snap} | 32 +- .../js_test_suite/error}/invalid_arg_list.js | 0 .../error/invalid_arg_list.js.snap} | 44 +- .../error}/invalid_assignment_target.js | 0 .../error/invalid_assignment_target.js.snap} | 45 +- .../error}/invalid_method_recover.js | 0 .../error/invalid_method_recover.js.snap} | 38 +- ...lid_optional_chain_from_new_expressions.ts | 0 ...tional_chain_from_new_expressions.ts.snap} | 43 +- ...using_declarations_inside_for_statement.js | 0 ...declarations_inside_for_statement.js.snap} | 37 +- .../js_class_property_with_ts_annotation.js | 0 ...class_property_with_ts_annotation.js.snap} | 39 +- ..._constructor_parameter_reserved_names.cjs} | 0 ...structor_parameter_reserved_names.cjs.snap | 203 ++++++++ ...structor_parameter_reserved_names.js.snap} | 41 +- .../error}/js_formal_parameter_error.js | 0 .../error/js_formal_parameter_error.js.snap} | 32 +- .../error}/js_invalid_assignment.js | 0 .../error/js_invalid_assignment.js.snap} | 36 +- .../error}/js_regex_assignment.js | 0 .../error/js_regex_assignment.js.snap} | 30 +- .../error}/js_rewind_at_eof_token.js | 0 .../error/js_rewind_at_eof_token.js.snap} | 33 +- .../error}/js_right_shift_comments.js | 0 .../error/js_right_shift_comments.js.snap} | 29 +- .../error}/js_type_variable_annotation.js | 0 .../js_type_variable_annotation.js.snap} | 30 +- .../jsx_child_expression_missing_r_curly.jsx | 0 ...child_expression_missing_r_curly.jsx.snap} | 29 +- ...sx_children_expression_missing_r_curly.jsx | 0 ...ldren_expression_missing_r_curly.jsx.snap} | 35 +- .../jsx_children_expressions_not_accepted.jsx | 0 ...hildren_expressions_not_accepted.jsx.snap} | 42 +- .../error}/jsx_closing_element_mismatch.jsx | 0 .../jsx_closing_element_mismatch.jsx.snap} | 39 +- .../error}/jsx_closing_missing_r_angle.jsx | 0 .../jsx_closing_missing_r_angle.jsx.snap} | 29 +- ...jsx_element_attribute_expression_error.jsx | 0 ...ement_attribute_expression_error.jsx.snap} | 29 +- .../jsx_element_attribute_missing_value.jsx | 0 ..._element_attribute_missing_value.jsx.snap} | 33 +- .../jsx_fragment_closing_missing_r_angle.jsx | 0 ...fragment_closing_missing_r_angle.jsx.snap} | 29 +- .../js_test_suite/error}/jsx_invalid_text.jsx | 0 .../error/jsx_invalid_text.jsx.snap} | 32 +- .../error}/jsx_missing_closing_fragment.jsx | 0 .../jsx_missing_closing_fragment.jsx.snap} | 32 +- .../jsx_namespace_member_element_name.jsx | 0 ...sx_namespace_member_element_name.jsx.snap} | 32 +- .../jsx_opening_element_missing_r_angle.jsx | 0 ..._opening_element_missing_r_angle.jsx.snap} | 29 +- .../error/jsx_or_type_assertion.cjs} | 0 .../error/jsx_or_type_assertion.cjs.snap} | 57 ++- .../error/jsx_or_type_assertion.js.snap | 437 ++++++++++++++++++ ...x_self_closing_element_missing_r_angle.jsx | 0 ..._closing_element_missing_r_angle.jsx.snap} | 29 +- .../error}/jsx_spread_attribute_error.jsx | 0 .../jsx_spread_attribute_error.jsx.snap} | 48 +- .../error}/jsx_spread_no_expression.jsx | 0 .../error/jsx_spread_no_expression.jsx.snap} | 29 +- ...nction_decl_in_single_statement_context.js | 0 ..._decl_in_single_statement_context.js.snap} | 29 +- ...belled_function_declaration_strict_mode.js | 0 ..._function_declaration_strict_mode.js.snap} | 29 +- .../error/let_array_with_new_line.cjs} | 0 .../error/let_array_with_new_line.cjs.snap | 118 +++++ .../error/let_array_with_new_line.js.snap} | 41 +- .../error}/let_newline_in_async_function.js | 0 .../let_newline_in_async_function.js.snap} | 36 +- ...declaration_in_single_statement_context.js | 0 ...ation_in_single_statement_context.js.snap} | 32 +- .../js_test_suite/error}/literals.js | 0 .../js_test_suite/error/literals.js.snap} | 44 +- .../error}/logical_expressions_err.js | 0 .../error/logical_expressions_err.js.snap} | 34 +- .../js_test_suite/error}/method_getter_err.js | 0 .../error/method_getter_err.js.snap} | 35 +- .../error}/module_closing_curly.ts | 0 .../error/module_closing_curly.ts.snap} | 37 +- .../error}/multiple_default_exports_err.js | 0 .../multiple_default_exports_err.js.snap} | 34 +- .../js_test_suite/error}/new_exprs.js | 0 .../js_test_suite/error/new_exprs.js.snap} | 29 +- .../error/no_top_level_await_in_scripts.cjs} | 0 .../no_top_level_await_in_scripts.cjs.snap} | 35 +- .../error}/object_binding_pattern.js | 0 .../error/object_binding_pattern.js.snap} | 42 +- .../js_test_suite/error}/object_expr_err.js | 0 .../error/object_expr_err.js.snap} | 34 +- .../error}/object_expr_error_prop_name.js | 0 .../object_expr_error_prop_name.js.snap} | 34 +- .../error}/object_expr_method.js | 0 .../error/object_expr_method.js.snap} | 29 +- .../object_expr_non_ident_literal_prop.js | 0 ...bject_expr_non_ident_literal_prop.js.snap} | 29 +- .../error}/object_expr_setter.js | 0 .../error/object_expr_setter.js.snap} | 37 +- .../error}/object_property_binding_err.js | 0 .../object_property_binding_err.js.snap} | 35 +- .../error}/object_shorthand_property_err.js | 0 .../object_shorthand_property_err.js.snap} | 35 +- .../object_shorthand_with_initializer.js | 0 ...object_shorthand_with_initializer.js.snap} | 29 +- .../optional_chain_call_without_arguments.ts | 0 ...onal_chain_call_without_arguments.ts.snap} | 34 +- .../js_test_suite/error}/optional_member.js | 0 .../error/optional_member.js.snap} | 29 +- .../paren_or_arrow_expr_invalid_params.js | 0 ...aren_or_arrow_expr_invalid_params.js.snap} | 44 +- .../error}/primary_expr_invalid_recovery.js | 0 .../primary_expr_invalid_recovery.js.snap} | 29 +- .../private_name_presence_check_recursive.js | 0 ...ate_name_presence_check_recursive.js.snap} | 48 +- .../error}/private_name_with_space.js | 0 .../error/private_name_with_space.js.snap} | 34 +- .../error}/property_assignment_target_err.js | 0 .../property_assignment_target_err.js.snap} | 44 +- .../js_test_suite/error}/regex.js | 0 .../js_test_suite/error/regex.js.snap} | 32 +- .../rest_property_assignment_target_err.js | 0 ...st_property_assignment_target_err.js.snap} | 41 +- .../error}/rest_property_binding_err.js | 0 .../error/rest_property_binding_err.js.snap} | 48 +- .../js_test_suite/error}/return_stmt_err.js | 0 .../error/return_stmt_err.js.snap} | 32 +- .../js_test_suite/error}/semicolons_err.js | 0 .../error/semicolons_err.js.snap} | 29 +- .../js_test_suite/error}/sequence_expr.js | 0 .../error/sequence_expr.js.snap} | 29 +- .../error}/setter_class_member.js | 0 .../error/setter_class_member.js.snap} | 33 +- .../error}/setter_class_no_body.js | 0 .../error/setter_class_no_body.js.snap} | 33 +- .../js_test_suite/error}/spread.js | 0 .../js_test_suite/error/spread.js.snap} | 29 +- .../error}/statements_closing_curly.js | 0 .../error/statements_closing_curly.js.snap} | 37 +- .../js_test_suite/error}/subscripts_err.js | 0 .../error/subscripts_err.js.snap} | 33 +- .../error}/super_expression_err.js | 0 .../error/super_expression_err.js.snap} | 43 +- ...xpression_in_constructor_parameter_list.js | 0 ...ion_in_constructor_parameter_list.js.snap} | 31 +- .../js_test_suite/error}/switch_stmt_err.js | 0 .../error/switch_stmt_err.js.snap} | 53 ++- .../error}/template_after_optional_chain.js | 0 .../template_after_optional_chain.js.snap} | 35 +- .../js_test_suite/error}/template_literal.js | 0 .../error/template_literal.js.snap} | 32 +- .../error}/template_literal_unterminated.js | 0 .../template_literal_unterminated.js.snap} | 29 +- .../js_test_suite/error}/throw_stmt_err.js | 0 .../error/throw_stmt_err.js.snap} | 34 +- .../error}/ts_abstract_member_ansi.ts | 0 .../error/ts_abstract_member_ansi.ts.snap} | 33 +- ...ts_abstract_property_cannot_be_definite.ts | 0 ...tract_property_cannot_be_definite.ts.snap} | 33 +- ...tract_property_cannot_have_initiliazers.ts | 0 ...property_cannot_have_initiliazers.ts.snap} | 33 +- .../error}/ts_ambient_async_method.ts | 0 .../error/ts_ambient_async_method.ts.snap} | 29 +- .../error}/ts_ambient_context_semi.ts | 0 .../error/ts_ambient_context_semi.ts.snap} | 30 +- ...ed_property_initializer_ambient_context.ts | 0 ...perty_initializer_ambient_context.ts.snap} | 32 +- .../ts_arrow_function_this_parameter.ts | 0 .../ts_arrow_function_this_parameter.ts.snap} | 29 +- .../ts_as_assignment_no_parenthesize.ts | 0 .../ts_as_assignment_no_parenthesize.ts.snap} | 36 +- .../ts_broken_class_member_modifiers.ts | 0 .../ts_broken_class_member_modifiers.ts.snap} | 50 +- ...aration_non_any_unknown_type_annotation.ts | 0 ...n_non_any_unknown_type_annotation.ts.snap} | 29 +- .../error}/ts_class_declare_modifier_error.ts | 0 .../ts_class_declare_modifier_error.ts.snap} | 49 +- .../error}/ts_class_heritage_clause_errors.ts | 0 .../ts_class_heritage_clause_errors.ts.snap} | 45 +- .../ts_class_initializer_with_modifiers.ts | 0 ..._class_initializer_with_modifiers.ts.snap} | 33 +- .../ts_class_invalid_modifier_combinations.ts | 0 ...ass_invalid_modifier_combinations.ts.snap} | 87 ++-- ...ass_member_accessor_readonly_precedence.ts | 0 ...mber_accessor_readonly_precedence.ts.snap} | 33 +- .../error}/ts_class_modifier_precedence.ts | 0 .../ts_class_modifier_precedence.ts.snap} | 75 +-- .../error}/ts_class_name_reserved_as_type.ts | 0 .../ts_class_name_reserved_as_type.ts.snap} | 35 +- .../error}/ts_class_type_parameters_errors.ts | 0 .../ts_class_type_parameters_errors.ts.snap} | 29 +- ...ts_concrete_class_with_abstract_members.ts | 0 ...crete_class_with_abstract_members.ts.snap} | 42 +- .../ts_construct_signature_member_err.ts | 0 ...ts_construct_signature_member_err.ts.snap} | 29 +- .../error}/ts_constructor_this_parameter.ts | 0 .../ts_constructor_this_parameter.ts.snap} | 29 +- .../error}/ts_constructor_type_err.ts | 0 .../error/ts_constructor_type_err.ts.snap} | 32 +- .../error}/ts_constructor_type_parameters.ts | 0 .../ts_constructor_type_parameters.ts.snap} | 33 +- .../error}/ts_declare_async_function.ts | 0 .../error/ts_declare_async_function.ts.snap} | 29 +- .../error}/ts_declare_const_initializer.ts | 0 .../ts_declare_const_initializer.ts.snap} | 32 +- ..._function_export_declaration_missing_id.ts | 0 ...ion_export_declaration_missing_id.ts.snap} | 33 +- .../error}/ts_declare_function_with_body.ts | 0 .../ts_declare_function_with_body.ts.snap} | 29 +- .../error}/ts_declare_generator_function.ts | 0 .../ts_declare_generator_function.ts.snap} | 36 +- .../ts_declare_property_private_name.ts | 0 .../ts_declare_property_private_name.ts.snap} | 29 +- .../js_test_suite/error}/ts_declare_using.ts | 0 .../error/ts_declare_using.ts.snap} | 34 +- .../error}/ts_decorator_constructor.ts | 0 .../error/ts_decorator_constructor.ts.snap} | 54 ++- .../error/ts_decorator_object.options.json | 7 + .../error}/ts_decorator_object.ts | 0 .../error/ts_decorator_object.ts.snap} | 56 ++- ...decorator_on_ambient_function.options.json | 7 + .../ts_decorator_on_ambient_function.ts | 0 .../ts_decorator_on_ambient_function.ts.snap} | 57 ++- ...s_decorator_on_arrow_function.options.json | 7 + .../error}/ts_decorator_on_arrow_function.ts | 0 .../ts_decorator_on_arrow_function.ts.snap} | 38 +- .../error}/ts_decorator_on_class_method.ts | 0 .../ts_decorator_on_class_method.ts.snap} | 54 ++- .../error}/ts_decorator_on_class_setter.ts | 0 .../ts_decorator_on_class_setter.ts.snap} | 39 +- ...decorator_on_constructor_type.options.json | 7 + .../ts_decorator_on_constructor_type.ts | 0 .../ts_decorator_on_constructor_type.ts.snap} | 38 +- ...rator_on_function_declaration.options.json | 7 + .../ts_decorator_on_function_declaration.ts | 0 ...decorator_on_function_declaration.ts.snap} | 38 +- ...orator_on_function_expression.options.json | 7 + .../ts_decorator_on_function_expression.ts | 0 ..._decorator_on_function_expression.ts.snap} | 38 +- ...ts_decorator_on_function_type.options.json | 7 + .../error}/ts_decorator_on_function_type.ts | 0 .../ts_decorator_on_function_type.ts.snap} | 41 +- ...decorator_on_signature_member.options.json | 7 + .../ts_decorator_on_signature_member.ts | 0 .../ts_decorator_on_signature_member.ts.snap} | 41 +- .../error}/ts_decorator_setter_signature.ts | 0 .../ts_decorator_setter_signature.ts.snap} | 38 +- .../ts_decorator_this_parameter.options.json | 7 + .../error}/ts_decorator_this_parameter.ts | 0 .../ts_decorator_this_parameter.ts.snap} | 39 +- ...corator_this_parameter_option.options.json | 7 + .../ts_decorator_this_parameter_option.ts | 0 ...s_decorator_this_parameter_option.ts.snap} | 39 +- ..._definite_assignment_in_ambient_context.ts | 0 ...ite_assignment_in_ambient_context.ts.snap} | 32 +- .../ts_definite_variable_with_initializer.ts | 0 ...efinite_variable_with_initializer.ts.snap} | 29 +- .../js_test_suite/error}/ts_export_declare.ts | 0 .../error/ts_export_declare.ts.snap} | 32 +- .../error}/ts_export_default_enum.ts | 0 .../error/ts_export_default_enum.ts.snap} | 29 +- .../error}/ts_export_syntax_in_js.js | 0 .../error/ts_export_syntax_in_js.js.snap} | 46 +- .../js_test_suite/error}/ts_export_type.ts | 0 .../error/ts_export_type.ts.snap} | 29 +- .../error}/ts_extends_trailing_comma.ts | 0 .../error/ts_extends_trailing_comma.ts.snap} | 31 +- ...ts_formal_parameter_decorator.options.json | 7 + .../error}/ts_formal_parameter_decorator.ts | 0 .../ts_formal_parameter_decorator.ts.snap} | 29 +- .../ts_formal_parameter_decorator_option.ts | 0 ...formal_parameter_decorator_option.ts.snap} | 36 +- .../error}/ts_formal_parameter_error.ts | 0 .../error/ts_formal_parameter_error.ts.snap} | 35 +- .../error}/ts_function_overload_generator.ts | 0 .../ts_function_overload_generator.ts.snap} | 31 +- .../error}/ts_function_type_err.ts | 0 .../error/ts_function_type_err.ts.snap} | 29 +- .../ts_getter_setter_type_parameters.ts | 0 .../ts_getter_setter_type_parameters.ts.snap} | 36 +- ...ts_getter_setter_type_parameters_errors.ts | 0 ...ter_setter_type_parameters_errors.ts.snap} | 38 +- ...gnature_class_member_cannot_be_abstract.ts | 0 ...e_class_member_cannot_be_abstract.ts.snap} | 33 +- ...gnature_class_member_cannot_be_accessor.ts | 0 ...e_class_member_cannot_be_accessor.ts.snap} | 33 +- ...member_cannot_have_visibility_modifiers.ts | 0 ..._cannot_have_visibility_modifiers.ts.snap} | 47 +- ...class_member_static_readonly_precedence.ts | 0 ...member_static_readonly_precedence.ts.snap} | 33 +- ...ature_interface_member_cannot_be_static.ts | 0 ...interface_member_cannot_be_static.ts.snap} | 47 +- ...member_cannot_have_visibility_modifiers.ts | 0 ..._cannot_have_visibility_modifiers.ts.snap} | 47 +- .../error}/ts_infer_type_not_allowed.ts | 0 .../error/ts_infer_type_not_allowed.ts.snap} | 65 +-- ...nstantiation_expression_property_access.ts | 0 ...iation_expression_property_access.ts.snap} | 38 +- .../error}/ts_instantiation_expressions_1.ts | 0 .../ts_instantiation_expressions_1.ts.snap} | 96 ++-- .../ts_interface_heritage_clause_error.ts | 0 ...s_interface_heritage_clause_error.ts.snap} | 40 +- .../ts_invalid_decorated_class_members.ts | 0 ...s_invalid_decorated_class_members.ts.snap} | 50 +- .../ts_method_members_with_missing_body.ts | 0 ..._method_members_with_missing_body.ts.snap} | 38 +- .../ts_method_object_member_body_error.ts | 0 ...s_method_object_member_body_error.ts.snap} | 36 +- .../error}/ts_method_signature_generator.ts | 0 .../ts_method_signature_generator.ts.snap} | 41 +- .../js_test_suite/error}/ts_module_err.ts | 0 .../error/ts_module_err.ts.snap} | 32 +- .../error}/ts_named_import_specifier_error.ts | 0 .../ts_named_import_specifier_error.ts.snap} | 41 +- .../js_test_suite/error}/ts_new_operator.ts | 0 .../error/ts_new_operator.ts.snap} | 29 +- .../ts_object_getter_type_parameters.ts | 0 .../ts_object_getter_type_parameters.ts.snap} | 33 +- .../error}/ts_object_setter_return_type.ts | 0 .../ts_object_setter_return_type.ts.snap} | 29 +- .../ts_object_setter_type_parameters.ts | 0 .../ts_object_setter_type_parameters.ts.snap} | 33 +- ...ts_property_initializer_ambient_context.ts | 0 ...perty_initializer_ambient_context.ts.snap} | 32 +- .../error}/ts_property_parameter_pattern.ts | 0 .../ts_property_parameter_pattern.ts.snap} | 30 +- ..._readonly_modifier_non_class_or_indexer.ts | 0 ...nly_modifier_non_class_or_indexer.ts.snap} | 42 +- ...ts_satisfies_assignment_no_parenthesize.ts | 0 ...isfies_assignment_no_parenthesize.ts.snap} | 33 +- .../error}/ts_satisfies_expression.js | 0 .../error/ts_satisfies_expression.js.snap} | 29 +- .../ts_setter_return_type_annotation.ts | 0 .../ts_setter_return_type_annotation.ts.snap} | 33 +- ...ialization_block_member_with_decorators.ts | 0 ...tion_block_member_with_decorators.ts.snap} | 37 +- .../error}/ts_template_literal_error.ts | 0 .../error/ts_template_literal_error.ts.snap} | 36 +- ..._tuple_type_cannot_be_optional_and_rest.ts | 0 ..._type_cannot_be_optional_and_rest.ts.snap} | 29 +- .../error}/ts_tuple_type_incomplete.ts | 0 .../error/ts_tuple_type_incomplete.ts.snap} | 29 +- .../ts_type_alias_cannot_be_reserved_word.ts | 0 ...ype_alias_cannot_be_reserved_word.ts.snap} | 35 +- ...s_type_assertions_not_valid_at_new_expr.ts | 0 ..._assertions_not_valid_at_new_expr.ts.snap} | 29 +- .../error}/ts_type_parameters_incomplete.ts | 0 .../ts_type_parameters_incomplete.ts.snap} | 29 +- .../ts_typed_default_import_with_named.ts | 0 ...s_typed_default_import_with_named.ts.snap} | 29 +- .../error}/ts_variable_annotation_err.ts | 0 .../error/ts_variable_annotation_err.ts.snap} | 29 +- .../error}/type_arguments_incomplete.ts | 0 .../error/type_arguments_incomplete.ts.snap} | 29 +- .../error}/type_parameter_modifier.ts | 0 .../error/type_parameter_modifier.ts.snap} | 155 +++---- ...tract_class_member_should_not_have_body.ts | 0 ...class_member_should_not_have_body.ts.snap} | 46 +- ...ct_classes_abstract_accessor_precedence.ts | 0 ...sses_abstract_accessor_precedence.ts.snap} | 29 +- .../typescript_abstract_classes_incomplete.ts | 0 ...cript_abstract_classes_incomplete.ts.snap} | 29 +- ...t_classes_invalid_abstract_async_member.ts | 0 ...ses_invalid_abstract_async_member.ts.snap} | 29 +- ...ct_classes_invalid_abstract_constructor.ts | 0 ...sses_invalid_abstract_constructor.ts.snap} | 29 +- ...classes_invalid_abstract_private_member.ts | 0 ...s_invalid_abstract_private_member.ts.snap} | 29 +- ..._classes_invalid_static_abstract_member.ts | 0 ...es_invalid_static_abstract_member.ts.snap} | 32 +- ...d_accessibility_modifier_private_member.ts | 0 ...ssibility_modifier_private_member.ts.snap} | 31 +- .../error}/typescript_enum_incomplete.ts | 0 .../error/typescript_enum_incomplete.ts.snap} | 29 +- ...with_body_in_ambient_context_should_err.ts | 0 ...ody_in_ambient_context_should_err.ts.snap} | 62 ++- .../js_test_suite/error}/unary_delete.js | 0 .../js_test_suite/error/unary_delete.js.snap} | 41 +- .../error}/unary_delete_parenthesized.js | 0 .../error/unary_delete_parenthesized.js.snap} | 50 +- .../js_test_suite/error}/unary_expr.js | 0 .../js_test_suite/error/unary_expr.js.snap} | 34 +- .../error}/unterminated_string.jsx | 0 .../error/unterminated_string.jsx.snap} | 38 +- .../error}/unterminated_unicode_codepoint.js | 0 .../unterminated_unicode_codepoint.js.snap} | 29 +- ...aration_not_allowed_in_for_in_statement.js | 0 ...n_not_allowed_in_for_in_statement.js.snap} | 32 +- .../error}/using_declaration_statement_err.js | 0 .../using_declaration_statement_err.js.snap} | 57 ++- .../js_test_suite/error}/var_decl_err.js | 0 .../js_test_suite/error/var_decl_err.js.snap} | 32 +- .../variable_declaration_statement_err.js | 0 ...ariable_declaration_statement_err.js.snap} | 39 +- .../error}/variable_declarator_list_empty.js | 0 .../variable_declarator_list_empty.js.snap} | 32 +- .../variable_declarator_list_incomplete.js | 0 ...riable_declarator_list_incomplete.js.snap} | 29 +- .../js_test_suite/error}/while_stmt_err.js | 0 .../error/while_stmt_err.js.snap} | 40 +- .../error}/yield_at_top_level_module.js | 0 .../error/yield_at_top_level_module.js.snap} | 29 +- .../error/yield_at_top_level_script.cjs} | 0 .../error/yield_at_top_level_script.cjs.snap | 73 +++ .../error/yield_at_top_level_script.js.snap} | 39 +- .../yield_expr_in_parameter_initializer.js | 0 ...eld_expr_in_parameter_initializer.js.snap} | 32 +- .../error}/yield_in_non_generator_function.js | 0 .../yield_in_non_generator_function.js.snap} | 32 +- .../yield_in_non_generator_function_module.js | 0 ..._in_non_generator_function_module.js.snap} | 35 +- ...ield_in_non_generator_function_script.cjs} | 0 ..._in_non_generator_function_script.cjs.snap | 188 ++++++++ ..._in_non_generator_function_script.js.snap} | 42 +- .../ok/arguments_in_definition_file.d.ts | 0 .../arguments_in_definition_file.d.ts.snap} | 21 + .../ok/array_assignment_target.js | 0 .../ok/array_assignment_target.js.snap} | 24 + .../ok/array_assignment_target_rest.js | 0 .../ok/array_assignment_target_rest.js.snap} | 27 ++ .../js_test_suite}/ok/array_binding.js | 0 .../js_test_suite/ok/array_binding.js.snap} | 26 ++ .../js_test_suite}/ok/array_binding_rest.js | 0 .../ok/array_binding_rest.js.snap} | 23 + .../ok/array_element_in_expr.js | 0 .../ok/array_element_in_expr.js.snap} | 21 + .../js_test_suite}/ok/array_expr.js | 0 .../js_test_suite/ok/array_expr.js.snap} | 26 ++ .../ok/array_or_object_member_assignment.js | 0 ...array_or_object_member_assignment.js.snap} | 36 ++ .../ok/arrow_expr_in_alternate.js | 0 .../ok/arrow_expr_in_alternate.js.snap} | 21 + .../ok/arrow_expr_single_param.cjs} | 0 .../ok/arrow_expr_single_param.cjs.snap} | 26 ++ .../js_test_suite}/ok/arrow_in_constructor.js | 0 .../ok/arrow_in_constructor.js.snap} | 26 ++ .../ok/assign_eval_member_or_computed_expr.js | 0 ...sign_eval_member_or_computed_expr.js.snap} | 23 + .../js_test_suite}/ok/assign_expr.js | 0 .../js_test_suite/ok/assign_expr.js.snap} | 28 ++ ...ignment_shorthand_prop_with_initializer.js | 0 ...t_shorthand_prop_with_initializer.js.snap} | 21 + .../js_test_suite}/ok/assignment_target.js | 0 .../ok/assignment_target.js.snap} | 28 ++ .../js_test_suite}/ok/async_arrow_expr.js | 0 .../ok/async_arrow_expr.js.snap} | 23 + .../js_test_suite}/ok/async_continue_stmt.js | 0 .../ok/async_continue_stmt.js.snap} | 21 + .../js_test_suite}/ok/async_function_expr.js | 0 .../ok/async_function_expr.js.snap} | 22 + .../js_test_suite}/ok/async_ident.js | 0 .../js_test_suite/ok/async_ident.js.snap} | 21 + .../js_test_suite}/ok/async_method.js | 0 .../js_test_suite/ok/async_method.js.snap} | 24 + .../js_test_suite}/ok/await_expression.js | 0 .../ok/await_expression.js.snap} | 28 ++ .../ok/await_in_ambient_context.ts | 0 .../ok/await_in_ambient_context.ts.snap} | 21 + .../js_test_suite}/ok/binary_expressions.js | 0 .../ok/binary_expressions.js.snap} | 33 ++ .../js_test_suite}/ok/block_stmt.js | 0 .../js_test_suite/ok/block_stmt.js.snap} | 23 + .../js_test_suite}/ok/bom_character.js | 0 .../js_test_suite/ok/bom_character.js.snap} | 20 + .../js_test_suite}/ok/break_stmt.js | 0 .../js_test_suite/ok/break_stmt.js.snap} | 29 ++ .../js_test_suite}/ok/built_in_module_name.ts | 0 .../ok/built_in_module_name.ts.snap} | 24 + .../js_test_suite}/ok/call_arguments.js | 0 .../js_test_suite/ok/call_arguments.js.snap} | 26 ++ .../ok/class_await_property_initializer.cjs} | 0 ...class_await_property_initializer.cjs.snap} | 26 ++ .../class_constructor_parameter_modifiers.ts | 0 ...s_constructor_parameter_modifiers.ts.snap} | 26 ++ .../js_test_suite}/ok/class_declaration.js | 0 .../ok/class_declaration.js.snap} | 23 + .../js_test_suite}/ok/class_declare.js | 0 .../js_test_suite/ok/class_declare.js.snap} | 22 + .../js_test_suite}/ok/class_decorator.js | 0 .../js_test_suite/ok/class_decorator.js.snap} | 22 + .../js_test_suite}/ok/class_empty_element.js | 0 .../ok/class_empty_element.js.snap} | 21 + .../js_test_suite}/ok/class_expr.js | 0 .../js_test_suite/ok/class_expr.js.snap} | 25 + .../ok/class_member_modifiers.js | 0 .../ok/class_member_modifiers.js.snap} | 23 + .../ok/class_member_modifiers_no_asi.js | 0 .../ok/class_member_modifiers_no_asi.js.snap} | 24 + .../ok/class_named_abstract_is_valid_in_js.js | 0 ...ass_named_abstract_is_valid_in_js.js.snap} | 21 + .../ok/class_static_constructor_method.js | 0 .../class_static_constructor_method.js.snap} | 21 + .../ok/computed_member_expression.js | 0 .../ok/computed_member_expression.js.snap} | 25 + .../js_test_suite}/ok/computed_member_in.js | 0 .../ok/computed_member_in.js.snap} | 21 + .../ok/computed_member_name_in.js | 0 .../ok/computed_member_name_in.js.snap} | 21 + .../js_test_suite}/ok/conditional_expr.js | 0 .../ok/conditional_expr.js.snap} | 22 + .../ok/constructor_class_member.js | 0 .../ok/constructor_class_member.js.snap} | 30 ++ .../js_test_suite}/ok/continue_stmt.js | 0 .../js_test_suite/ok/continue_stmt.js.snap} | 27 ++ .../js_test_suite}/ok/debugger_stmt.js | 0 .../js_test_suite/ok/debugger_stmt.js.snap} | 21 + .../js_test_suite}/ok/decorator.ts | 0 .../js_test_suite/ok/decorator.ts.snap} | 44 ++ .../decorator_abstract_class_declaration.ts | 0 ...orator_abstract_class_declaration.ts.snap} | 25 + ...or_abstract_class_declaration_top_level.ts | 0 ...tract_class_declaration_top_level.ts.snap} | 23 + ...class_export_default_declaration_clause.ts | 0 ...export_default_declaration_clause.ts.snap} | 22 + .../ok/decorator_class_declaration.js | 0 .../ok/decorator_class_declaration.js.snap} | 26 ++ .../decorator_class_declaration_top_level.js | 0 ...rator_class_declaration_top_level.js.snap} | 24 + ...class_export_default_declaration_clause.ts | 0 ...export_default_declaration_clause.ts.snap} | 22 + .../ok/decorator_class_member.ts | 0 .../ok/decorator_class_member.ts.snap} | 62 +++ .../ok/decorator_class_member_in_ts.ts | 0 .../ok/decorator_class_member_in_ts.ts.snap} | 26 ++ .../ok/decorator_class_not_top_level.ts | 0 .../ok/decorator_class_not_top_level.ts.snap} | 26 ++ .../ok/decorator_export_class_clause.js | 0 .../ok/decorator_export_class_clause.js.snap} | 24 + ...ator_export_default_class_and_interface.ts | 0 ...xport_default_class_and_interface.ts.snap} | 25 + ..._default_function_and_function_overload.ts | 0 ...lt_function_and_function_overload.ts.snap} | 24 + ...r_export_default_function_and_interface.ts | 0 ...rt_default_function_and_interface.ts.snap} | 25 + .../decorator_export_default_top_level_1.ts | 0 ...orator_export_default_top_level_1.ts.snap} | 22 + .../decorator_export_default_top_level_2.ts | 0 ...orator_export_default_top_level_2.ts.snap} | 22 + .../decorator_export_default_top_level_3.ts | 0 ...orator_export_default_top_level_3.ts.snap} | 22 + .../decorator_export_default_top_level_4.ts | 0 ...orator_export_default_top_level_4.ts.snap} | 22 + .../decorator_export_default_top_level_5.ts | 0 ...orator_export_default_top_level_5.ts.snap} | 22 + .../ok/decorator_export_top_level.js | 0 .../ok/decorator_export_top_level.js.snap} | 30 ++ .../ok/decorator_expression_class.js | 0 .../ok/decorator_expression_class.js.snap} | 24 + .../ok/destructuring_initializer_binding.js | 0 ...destructuring_initializer_binding.js.snap} | 21 + .../js_test_suite/ok/directives.cjs} | 0 .../js_test_suite/ok/directives.cjs.snap} | 44 ++ .../ok/directives_redundant.cjs} | 0 .../ok/directives_redundant.cjs.snap} | 32 ++ .../js_test_suite}/ok/do-while-asi.js | 0 .../js_test_suite/ok/do-while-asi.js.snap} | 22 + .../js_test_suite}/ok/do_while_statement.js | 0 .../ok/do_while_statement.js.snap} | 30 ++ .../js_test_suite}/ok/do_while_stmt.js | 0 .../js_test_suite/ok/do_while_stmt.js.snap} | 23 + .../js_test_suite}/ok/empty_stmt.js | 0 .../js_test_suite/ok/empty_stmt.js.snap} | 21 + .../ok/exponent_unary_parenthesized.js | 0 .../ok/exponent_unary_parenthesized.js.snap} | 27 ++ .../js_test_suite}/ok/export_as_identifier.js | 0 .../ok/export_as_identifier.js.snap} | 22 + .../js_test_suite}/ok/export_class_clause.js | 0 .../ok/export_class_clause.js.snap} | 22 + .../ok/export_default_class_clause.js | 0 .../ok/export_default_class_clause.js.snap} | 21 + .../ok/export_default_expression_clause.js | 0 .../export_default_expression_clause.js.snap} | 21 + .../ok/export_default_function_clause.js | 0 .../export_default_function_clause.js.snap} | 21 + .../js_test_suite}/ok/export_from_clause.js | 0 .../ok/export_from_clause.js.snap} | 29 ++ .../ok/export_function_clause.js | 0 .../ok/export_function_clause.js.snap} | 23 + .../js_test_suite}/ok/export_named_clause.js | 0 .../ok/export_named_clause.js.snap} | 23 + .../ok/export_named_from_clause.js | 0 .../ok/export_named_from_clause.js.snap} | 30 ++ .../ok/export_variable_clause.js | 0 .../ok/export_variable_clause.js.snap} | 23 + .../ok/for_await_async_identifier.js | 0 .../ok/for_await_async_identifier.js.snap} | 24 + .../ok/for_in_initializer_loose_mode.cjs} | 0 .../for_in_initializer_loose_mode.cjs.snap} | 22 + .../js_test_suite}/ok/for_stmt.js | 0 .../js_test_suite/ok/for_stmt.js.snap} | 27 ++ ...for_with_in_in_parenthesized_expression.js | 0 ...th_in_in_parenthesized_expression.js.snap} | 21 + .../js_test_suite}/ok/function_decl.js | 0 .../js_test_suite/ok/function_decl.js.snap} | 27 ++ .../ok/function_declaration_script.cjs} | 0 .../ok/function_declaration_script.cjs.snap} | 22 + .../js_test_suite}/ok/function_expr.js | 0 .../js_test_suite/ok/function_expr.js.snap} | 22 + .../ok/function_expression_id.cjs} | 0 .../ok/function_expression_id.cjs.snap} | 25 + .../js_test_suite/ok/function_id.cjs} | 0 .../js_test_suite/ok/function_id.cjs.snap} | 26 ++ ...ion_in_if_or_labelled_stmt_loose_mode.cjs} | 0 ...n_if_or_labelled_stmt_loose_mode.cjs.snap} | 25 + .../js_test_suite}/ok/getter_class_member.js | 0 .../ok/getter_class_member.js.snap} | 34 ++ .../js_test_suite}/ok/getter_object_member.js | 0 .../ok/getter_object_member.js.snap} | 37 ++ .../js_test_suite}/ok/grouping_expr.js | 0 .../js_test_suite/ok/grouping_expr.js.snap} | 22 + ...declaration_in_single_statement_context.js | 0 ...ation_in_single_statement_context.js.snap} | 21 + .../js_test_suite}/ok/identifier.js | 0 .../js_test_suite/ok/identifier.js.snap} | 22 + .../ok/identifier_loose_mode.cjs} | 0 .../ok/identifier_loose_mode.cjs.snap} | 24 + .../ok/identifier_reference.cjs} | 0 .../ok/identifier_reference.cjs.snap} | 24 + .../js_test_suite}/ok/if_stmt.js | 0 .../js_test_suite/ok/if_stmt.js.snap} | 24 + .../ok/import_as_as_as_identifier.js | 0 .../ok/import_as_as_as_identifier.js.snap} | 21 + .../js_test_suite}/ok/import_as_identifier.js | 0 .../ok/import_as_identifier.js.snap} | 21 + .../js_test_suite}/ok/import_assertion.js | 0 .../ok/import_assertion.js.snap} | 27 ++ .../js_test_suite}/ok/import_attribute.js | 0 .../ok/import_attribute.js.snap} | 27 ++ .../js_test_suite}/ok/import_bare_clause.js | 0 .../ok/import_bare_clause.js.snap} | 22 + .../js_test_suite}/ok/import_call.js | 0 .../js_test_suite/ok/import_call.js.snap} | 23 + .../js_test_suite}/ok/import_decl.js | 0 .../js_test_suite/ok/import_decl.js.snap} | 21 + .../ok/import_default_clause.js | 0 .../ok/import_default_clause.js.snap} | 21 + .../ok/import_default_clauses.js | 0 .../ok/import_default_clauses.js.snap} | 21 + .../js_test_suite}/ok/import_meta.js | 0 .../js_test_suite/ok/import_meta.js.snap} | 21 + .../js_test_suite}/ok/import_named_clause.js | 0 .../ok/import_named_clause.js.snap} | 23 + .../js_test_suite}/ok/in_expr_in_arguments.js | 0 .../ok/in_expr_in_arguments.js.snap} | 22 + .../js_test_suite}/ok/issue_2790.ts | 0 .../js_test_suite/ok/issue_2790.ts.snap} | 23 + .../ok/js_class_property_member_modifiers.js | 0 ...s_class_property_member_modifiers.js.snap} | 29 ++ .../ok/js_parenthesized_expression.js | 0 .../ok/js_parenthesized_expression.js.snap} | 22 + .../js_test_suite}/ok/js_unary_expressions.js | 0 .../ok/js_unary_expressions.js.snap} | 28 ++ .../js_test_suite}/ok/jsx_any_name.jsx | 0 .../js_test_suite/ok/jsx_any_name.jsx.snap} | 25 + .../ok/jsx_arrow_exrp_in_alternate.jsx | 0 .../ok/jsx_arrow_exrp_in_alternate.jsx.snap} | 21 + .../ok/jsx_children_expression.jsx | 0 .../ok/jsx_children_expression.jsx.snap} | 76 +++ .../ok/jsx_children_expression_then_text.jsx | 0 ...sx_children_expression_then_text.jsx.snap} | 25 + .../js_test_suite}/ok/jsx_children_spread.jsx | 0 .../ok/jsx_children_spread.jsx.snap} | 22 + .../ok/jsx_closing_token_trivia.jsx | 0 .../ok/jsx_closing_token_trivia.jsx.snap} | 23 + .../ok/jsx_element_as_statements.jsx | 0 .../ok/jsx_element_as_statements.jsx.snap} | 21 + .../ok/jsx_element_attribute_element.jsx | 0 .../jsx_element_attribute_element.jsx.snap} | 21 + .../ok/jsx_element_attribute_expression.jsx | 0 ...jsx_element_attribute_expression.jsx.snap} | 22 + .../jsx_element_attribute_string_literal.jsx | 0 ...element_attribute_string_literal.jsx.snap} | 21 + .../ok/jsx_element_attributes.jsx | 0 .../ok/jsx_element_attributes.jsx.snap} | 28 ++ .../ok/jsx_element_children.jsx | 0 .../ok/jsx_element_children.jsx.snap} | 27 ++ .../ok/jsx_element_on_arrow_function.jsx | 0 .../jsx_element_on_arrow_function.jsx.snap} | 22 + .../ok/jsx_element_on_return.jsx | 0 .../ok/jsx_element_on_return.jsx.snap} | 23 + .../ok/jsx_element_open_close.jsx | 0 .../ok/jsx_element_open_close.jsx.snap} | 23 + .../ok/jsx_element_self_close.jsx | 0 .../ok/jsx_element_self_close.jsx.snap} | 23 + .../js_test_suite}/ok/jsx_equal_content.jsx | 0 .../ok/jsx_equal_content.jsx.snap} | 22 + .../js_test_suite}/ok/jsx_fragments.jsx | 0 .../js_test_suite/ok/jsx_fragments.jsx.snap} | 30 ++ .../ok/jsx_member_element_name.jsx | 0 .../ok/jsx_member_element_name.jsx.snap} | 23 + .../ok/jsx_primary_expression.jsx | 0 .../ok/jsx_primary_expression.jsx.snap} | 21 + .../ok/jsx_spread_attribute.jsx | 0 .../ok/jsx_spread_attribute.jsx.snap} | 22 + .../js_test_suite}/ok/jsx_text.jsx | 0 .../js_test_suite/ok/jsx_text.jsx.snap} | 27 ++ .../js_test_suite}/ok/jsx_type_arguments.jsx | 0 .../ok/jsx_type_arguments.jsx.snap} | 27 ++ .../js_test_suite}/ok/labeled_statement.js | 0 .../ok/labeled_statement.js.snap} | 23 + .../ok/labelled_function_declaration.cjs} | 0 .../labelled_function_declaration.cjs.snap} | 22 + ...d_statement_in_single_statement_context.js | 0 ...ement_in_single_statement_context.js.snap} | 21 + .../js_test_suite/ok/let_asi_rule.cjs} | 0 .../js_test_suite/ok/let_asi_rule.cjs.snap} | 25 + .../js_test_suite}/ok/literals.js | 0 .../js_test_suite/ok/literals.js.snap} | 33 ++ .../js_test_suite}/ok/logical_expressions.js | 0 .../ok/logical_expressions.js.snap} | 23 + .../js_test_suite/ok/metavar.options.json | 7 + .../js_test_suite}/ok/metavar.ts | 0 .../js_test_suite/ok/metavar.ts.snap} | 39 ++ .../js_test_suite}/ok/method_class_member.js | 0 .../ok/method_class_member.js.snap} | 50 ++ .../js_test_suite}/ok/module.js | 0 .../js_test_suite/ok/module.js.snap} | 24 + .../js_test_suite}/ok/new_exprs.js | 0 .../js_test_suite/ok/new_exprs.js.snap} | 25 + .../ok/object_assignment_target.js | 0 .../ok/object_assignment_target.js.snap} | 23 + .../js_test_suite}/ok/object_expr.js | 0 .../js_test_suite/ok/object_expr.js.snap} | 22 + .../ok/object_expr_async_method.js | 0 .../ok/object_expr_async_method.js.snap} | 24 + .../ok/object_expr_generator_method.js | 0 .../ok/object_expr_generator_method.js.snap} | 21 + .../ok/object_expr_ident_literal_prop.js | 0 .../object_expr_ident_literal_prop.js.snap} | 21 + .../ok/object_expr_ident_prop.js | 0 .../ok/object_expr_ident_prop.js.snap} | 21 + .../js_test_suite}/ok/object_expr_method.js | 0 .../ok/object_expr_method.js.snap} | 26 ++ .../ok/object_expr_spread_prop.js | 0 .../ok/object_expr_spread_prop.js.snap} | 21 + .../js_test_suite}/ok/object_member_name.js | 0 .../ok/object_member_name.js.snap} | 21 + .../js_test_suite}/ok/object_prop_in_rhs.js | 0 .../ok/object_prop_in_rhs.js.snap} | 21 + .../js_test_suite}/ok/object_prop_name.js | 0 .../ok/object_prop_name.js.snap} | 21 + .../ok/object_property_binding.js | 0 .../ok/object_property_binding.js.snap} | 22 + .../ok/object_shorthand_property.js | 0 .../ok/object_shorthand_property.js.snap} | 22 + .../ok/optional_chain_call_less_than.ts | 0 .../ok/optional_chain_call_less_than.ts.snap} | 22 + .../js_test_suite}/ok/parameter_list.js | 0 .../js_test_suite/ok/parameter_list.js.snap} | 21 + .../js_test_suite}/ok/paren_or_arrow_expr.js | 0 .../ok/paren_or_arrow_expr.js.snap} | 25 + .../ok/parenthesized_sequence_expression.js | 0 ...parenthesized_sequence_expression.js.snap} | 25 + .../ok/pattern_with_default_in_keyword.js | 0 .../pattern_with_default_in_keyword.js.snap} | 21 + .../js_test_suite}/ok/post_update_expr.js | 0 .../ok/post_update_expr.js.snap} | 22 + .../js_test_suite}/ok/postfix_expr.js | 0 .../js_test_suite/ok/postfix_expr.js.snap} | 22 + .../js_test_suite}/ok/pre_update_expr.js | 0 .../js_test_suite/ok/pre_update_expr.js.snap} | 22 + .../ok/private_name_presence_check.js | 0 .../ok/private_name_presence_check.js.snap} | 26 ++ .../ok/property_assignment_target.js | 0 .../ok/property_assignment_target.js.snap} | 28 ++ .../ok/property_class_member.js | 0 .../ok/property_class_member.js.snap} | 34 ++ .../ok/reparse_await_as_identifier.cjs} | 0 .../ok/reparse_await_as_identifier.cjs.snap} | 23 + .../ok/reparse_yield_as_identifier.cjs} | 0 .../ok/reparse_yield_as_identifier.cjs.snap} | 24 + .../ok/rest_property_assignment_target.js | 0 .../rest_property_assignment_target.js.snap} | 26 ++ .../ok/rest_property_binding.js | 0 .../ok/rest_property_binding.js.snap} | 22 + .../js_test_suite}/ok/return_stmt.js | 0 .../js_test_suite/ok/return_stmt.js.snap} | 25 + .../js_test_suite}/ok/scoped_declarations.js | 0 .../ok/scoped_declarations.js.snap} | 25 + .../js_test_suite}/ok/semicolons.js | 0 .../js_test_suite/ok/semicolons.js.snap} | 26 ++ .../js_test_suite}/ok/sequence_expr.js | 0 .../js_test_suite/ok/sequence_expr.js.snap} | 21 + .../js_test_suite}/ok/setter_class_member.js | 0 .../ok/setter_class_member.js.snap} | 37 ++ .../js_test_suite}/ok/setter_object_member.js | 0 .../ok/setter_object_member.js.snap} | 35 ++ ...row_function_with_parameter_named_async.js | 0 ...nction_with_parameter_named_async.js.snap} | 21 + .../ok/static_generator_constructor_method.js | 0 ...atic_generator_constructor_method.js.snap} | 24 + .../ok/static_initialization_block_member.js | 0 ...tatic_initialization_block_member.js.snap} | 26 ++ .../ok/static_member_expression.js | 0 .../ok/static_member_expression.js.snap} | 35 ++ .../js_test_suite}/ok/static_method.js | 0 .../js_test_suite/ok/static_method.js.snap} | 26 ++ .../js_test_suite}/ok/subscripts.js | 0 .../js_test_suite/ok/subscripts.js.snap} | 22 + .../js_test_suite}/ok/super_expression.js | 0 .../ok/super_expression.js.snap} | 29 ++ ...xpression_in_constructor_parameter_list.js | 0 ...ion_in_constructor_parameter_list.js.snap} | 21 + .../js_test_suite}/ok/switch_stmt.js | 0 .../js_test_suite/ok/switch_stmt.js.snap} | 24 + .../js_test_suite}/ok/template_literal.js | 0 .../ok/template_literal.js.snap} | 25 + .../js_test_suite}/ok/this_expr.js | 0 .../js_test_suite/ok/this_expr.js.snap} | 22 + .../js_test_suite}/ok/throw_stmt.js | 0 .../js_test_suite/ok/throw_stmt.js.snap} | 22 + .../js_test_suite}/ok/try_stmt.js | 0 .../js_test_suite/ok/try_stmt.js.snap} | 25 + .../js_test_suite}/ok/ts_abstract_classes.ts | 0 .../ok/ts_abstract_classes.ts.snap} | 36 ++ .../ts_abstract_property_can_be_optional.ts | 0 ...abstract_property_can_be_optional.ts.snap} | 23 + .../ok/ts_ambient_const_variable_statement.ts | 0 ..._ambient_const_variable_statement.ts.snap} | 21 + .../ok/ts_ambient_enum_statement.ts | 0 .../ok/ts_ambient_enum_statement.ts.snap} | 22 + .../js_test_suite}/ok/ts_ambient_function.ts | 0 .../ok/ts_ambient_function.ts.snap} | 23 + .../js_test_suite}/ok/ts_ambient_interface.ts | 0 .../ok/ts_ambient_interface.ts.snap} | 21 + .../ok/ts_ambient_let_variable_statement.ts | 0 ...ts_ambient_let_variable_statement.ts.snap} | 21 + .../ok/ts_ambient_var_statement.ts | 0 .../ok/ts_ambient_var_statement.ts.snap} | 21 + .../js_test_suite}/ok/ts_array_type.ts | 0 .../js_test_suite/ok/ts_array_type.ts.snap} | 22 + .../ok/ts_arrow_exrp_in_alternate.ts | 0 .../ok/ts_arrow_exrp_in_alternate.ts.snap} | 21 + .../ok/ts_arrow_function_type_parameters.ts | 0 ...ts_arrow_function_type_parameters.ts.snap} | 22 + .../js_test_suite}/ok/ts_as_assignment.ts | 0 .../ok/ts_as_assignment.ts.snap} | 29 ++ .../js_test_suite}/ok/ts_as_expression.ts | 0 .../ok/ts_as_expression.ts.snap} | 26 ++ .../ok/ts_call_expr_with_type_arguments.ts | 0 .../ts_call_expr_with_type_arguments.ts.snap} | 26 ++ .../ok/ts_call_signature_member.ts | 0 .../ok/ts_call_signature_member.ts.snap} | 24 + .../js_test_suite}/ok/ts_catch_declaration.ts | 0 .../ok/ts_catch_declaration.ts.snap} | 22 + .../ts_class_named_abstract_is_valid_in_ts.ts | 0 ...ass_named_abstract_is_valid_in_ts.ts.snap} | 21 + .../ok/ts_class_property_annotation.ts | 0 .../ok/ts_class_property_annotation.ts.snap} | 25 + .../ok/ts_class_property_member_modifiers.ts | 0 ...s_class_property_member_modifiers.ts.snap} | 37 ++ .../ok/ts_class_type_parameters.ts | 0 .../ok/ts_class_type_parameters.ts.snap} | 21 + .../js_test_suite}/ok/ts_conditional_type.ts | 0 .../ok/ts_conditional_type.ts.snap} | 39 ++ .../ts_conditional_type_call_signature_lhs.ts | 0 ...nditional_type_call_signature_lhs.ts.snap} | 21 + .../ok/ts_construct_signature_member.ts | 0 .../ok/ts_construct_signature_member.ts.snap} | 24 + .../js_test_suite}/ok/ts_constructor_type.ts | 0 .../ok/ts_constructor_type.ts.snap} | 24 + .../ok/ts_declare_const_initializer.ts | 0 .../ok/ts_declare_const_initializer.ts.snap} | 21 + .../js_test_suite}/ok/ts_declare_function.ts | 0 .../ok/ts_declare_function.ts.snap} | 24 + .../ts_declare_function_export_declaration.ts | 0 ...clare_function_export_declaration.ts.snap} | 23 + ...are_function_export_default_declaration.ts | 0 ...nction_export_default_declaration.ts.snap} | 26 ++ .../ok/ts_declare_type_alias.ts | 0 .../ok/ts_declare_type_alias.ts.snap} | 22 + .../ok/ts_decorate_computed_member.ts | 0 .../ok/ts_decorate_computed_member.ts.snap} | 24 + .../ok/ts_decorated_class_members.ts | 0 .../ok/ts_decorated_class_members.ts.snap} | 26 ++ .../ok/ts_decorator_assignment.ts | 0 .../ok/ts_decorator_assignment.ts.snap} | 22 + ...ts_decorator_call_expression_with_arrow.ts | 0 ...orator_call_expression_with_arrow.ts.snap} | 24 + .../ok/ts_decorator_constructor.options.json | 7 + .../ok/ts_decorator_constructor.ts | 0 .../ok/ts_decorator_constructor.ts.snap} | 32 ++ .../ts_decorator_on_class_method.options.json | 7 + .../ok/ts_decorator_on_class_method.ts | 0 .../ok/ts_decorator_on_class_method.ts.snap} | 28 ++ .../ts_decorator_on_class_setter.options.json | 7 + .../ok/ts_decorator_on_class_setter.ts | 0 .../ok/ts_decorator_on_class_setter.ts.snap} | 25 + .../ok/ts_default_type_clause.ts | 0 .../ok/ts_default_type_clause.ts.snap} | 22 + .../ok/ts_export_assignment_identifier.ts | 0 .../ts_export_assignment_identifier.ts.snap} | 25 + .../ok/ts_export_assignment_qualified_name.ts | 0 ..._export_assignment_qualified_name.ts.snap} | 22 + .../js_test_suite}/ok/ts_export_declare.ts | 0 .../ok/ts_export_declare.ts.snap} | 26 ++ .../ok/ts_export_default_function_overload.ts | 0 ..._export_default_function_overload.ts.snap} | 22 + .../ok/ts_export_default_interface.ts | 0 .../ok/ts_export_default_interface.ts.snap} | 21 + .../ts_export_default_multiple_interfaces.ts | 0 ...xport_default_multiple_interfaces.ts.snap} | 23 + .../ok/ts_export_enum_declaration.ts | 0 .../ok/ts_export_enum_declaration.ts.snap} | 22 + .../ok/ts_export_function_overload.ts | 0 .../ok/ts_export_function_overload.ts.snap} | 22 + .../ok/ts_export_interface_declaration.ts | 0 .../ts_export_interface_declaration.ts.snap} | 21 + ...s_export_named_from_specifier_with_type.ts | 0 ...rt_named_from_specifier_with_type.ts.snap} | 22 + .../ok/ts_export_named_type_specifier.ts | 0 .../ts_export_named_type_specifier.ts.snap} | 23 + .../ok/ts_export_namespace_clause.ts | 0 .../ok/ts_export_namespace_clause.ts.snap} | 22 + .../js_test_suite}/ok/ts_export_type_named.ts | 0 .../ok/ts_export_type_named.ts.snap} | 22 + .../ok/ts_export_type_named_from.ts | 0 .../ok/ts_export_type_named_from.ts.snap} | 21 + .../ok/ts_export_type_specifier.ts | 0 .../ok/ts_export_type_specifier.ts.snap} | 30 ++ .../ok/ts_extends_generic_type.ts | 0 .../ok/ts_extends_generic_type.ts.snap} | 24 + .../ok/ts_external_module_declaration.ts | 0 .../ts_external_module_declaration.ts.snap} | 23 + .../js_test_suite}/ok/ts_formal_parameter.ts | 0 .../ok/ts_formal_parameter.ts.snap} | 23 + ...ts_formal_parameter_decorator.options.json | 7 + .../ok/ts_formal_parameter_decorator.ts | 0 .../ok/ts_formal_parameter_decorator.ts.snap} | 24 + .../js_test_suite}/ok/ts_function_overload.ts | 0 .../ok/ts_function_overload.ts.snap} | 26 ++ .../ok/ts_function_statement.ts | 0 .../ok/ts_function_statement.ts.snap} | 22 + .../js_test_suite}/ok/ts_function_type.ts | 0 .../ok/ts_function_type.ts.snap} | 29 ++ .../ok/ts_getter_signature_member.ts | 0 .../ok/ts_getter_signature_member.ts.snap} | 26 ++ .../ok/ts_global_declaration.ts | 0 .../ok/ts_global_declaration.ts.snap} | 32 ++ .../js_test_suite}/ok/ts_global_variable.ts | 0 .../ok/ts_global_variable.ts.snap} | 23 + .../ok/ts_import_clause_types.ts | 0 .../ok/ts_import_clause_types.ts.snap} | 25 + .../ok/ts_import_equals_declaration.ts | 0 .../ok/ts_import_equals_declaration.ts.snap} | 26 ++ .../js_test_suite}/ok/ts_import_type.ts | 0 .../js_test_suite/ok/ts_import_type.ts.snap} | 30 ++ .../ok/ts_index_signature_class_member.ts | 0 .../ts_index_signature_class_member.ts.snap} | 26 ++ ...ex_signature_class_member_can_be_static.ts | 0 ...nature_class_member_can_be_static.ts.snap} | 26 ++ .../ok/ts_index_signature_interface_member.ts | 0 ..._index_signature_interface_member.ts.snap} | 29 ++ .../ok/ts_index_signature_member.ts | 0 .../ok/ts_index_signature_member.ts.snap} | 25 + .../ok/ts_indexed_access_type.ts | 0 .../ok/ts_indexed_access_type.ts.snap} | 22 + .../ok/ts_infer_type_allowed.ts | 0 .../ok/ts_infer_type_allowed.ts.snap} | 71 +++ .../js_test_suite}/ok/ts_inferred_type.ts | 0 .../ok/ts_inferred_type.ts.snap} | 22 + ...nstantiation_expression_property_access.ts | 0 ...iation_expression_property_access.ts.snap} | 25 + .../ok/ts_instantiation_expressions.ts | 0 .../ok/ts_instantiation_expressions.ts.snap} | 46 ++ .../ok/ts_instantiation_expressions_1.ts | 0 .../ts_instantiation_expressions_1.ts.snap} | 74 +++ .../ok/ts_instantiation_expressions_asi.ts | 0 .../ts_instantiation_expressions_asi.ts.snap} | 56 +++ .../ts_instantiation_expressions_new_line.ts | 0 ...nstantiation_expressions_new_line.ts.snap} | 114 +++++ .../js_test_suite}/ok/ts_interface.ts | 0 .../js_test_suite/ok/ts_interface.ts.snap} | 22 + .../ok/ts_interface_extends_clause.ts | 0 .../ok/ts_interface_extends_clause.ts.snap} | 23 + .../js_test_suite}/ok/ts_intersection_type.ts | 0 .../ok/ts_intersection_type.ts.snap} | 22 + .../ok/ts_keyword_assignments.js | 0 .../ok/ts_keyword_assignments.js.snap} | 26 ++ .../ok/ts_keywords_assignments_script.cjs} | 0 .../ts_keywords_assignments_script.cjs.snap} | 26 ++ .../js_test_suite}/ok/ts_literal_type.ts | 0 .../js_test_suite/ok/ts_literal_type.ts.snap} | 28 ++ .../js_test_suite}/ok/ts_mapped_type.ts | 0 .../js_test_suite/ok/ts_mapped_type.ts.snap} | 33 ++ .../ok/ts_method_and_constructor_overload.ts | 0 ...s_method_and_constructor_overload.ts.snap} | 28 ++ .../ok/ts_method_class_member.ts | 0 .../ok/ts_method_class_member.ts.snap} | 23 + .../ok/ts_method_object_member_body.ts | 0 .../ok/ts_method_object_member_body.ts.snap} | 25 + .../ok/ts_module_declaration.ts | 0 .../ok/ts_module_declaration.ts.snap} | 24 + .../ok/ts_named_import_specifier_with_type.ts | 0 ..._named_import_specifier_with_type.ts.snap} | 25 + .../ok/ts_namespace_declaration.ts | 0 .../ok/ts_namespace_declaration.ts.snap} | 24 + .../js_test_suite}/ok/ts_new_operator.ts | 0 .../js_test_suite/ok/ts_new_operator.ts.snap} | 24 + .../ok/ts_new_with_type_arguments.ts | 0 .../ok/ts_new_with_type_arguments.ts.snap} | 22 + .../ok/ts_non_null_assertion_expression.ts | 0 .../ts_non_null_assertion_expression.ts.snap} | 26 ++ .../ok/ts_non_null_assignment.ts | 0 .../ok/ts_non_null_assignment.ts.snap} | 24 + .../js_test_suite}/ok/ts_object_type.ts | 0 .../js_test_suite/ok/ts_object_type.ts.snap} | 27 ++ .../ok/ts_optional_chain_call.ts | 0 .../ok/ts_optional_chain_call.ts.snap} | 21 + .../ok/ts_optional_method_class_member.ts | 0 .../ts_optional_method_class_member.ts.snap} | 21 + .../ok/ts_parameter_option_binding_pattern.ts | 0 ..._parameter_option_binding_pattern.ts.snap} | 25 + .../ok/ts_parenthesized_type.ts | 0 .../ok/ts_parenthesized_type.ts.snap} | 21 + .../js_test_suite}/ok/ts_predefined_type.ts | 0 .../ok/ts_predefined_type.ts.snap} | 31 ++ ...ty_class_member_can_be_named_set_or_get.ts | 0 ...ss_member_can_be_named_set_or_get.ts.snap} | 21 + .../ts_property_or_method_signature_member.ts | 0 ...operty_or_method_signature_member.ts.snap} | 26 ++ .../ok/ts_property_parameter.ts | 0 .../ok/ts_property_parameter.ts.snap} | 23 + ...ly_property_initializer_ambient_context.ts | 0 ...perty_initializer_ambient_context.ts.snap} | 26 ++ .../js_test_suite}/ok/ts_reference_type.ts | 0 .../ok/ts_reference_type.ts.snap} | 25 + .../ok/ts_return_type_annotation.ts | 0 .../ok/ts_return_type_annotation.ts.snap} | 25 + .../js_test_suite}/ok/ts_return_type_asi.ts | 0 .../ok/ts_return_type_asi.ts.snap} | 26 ++ .../ok/ts_satisfies_assignment.ts | 0 .../ok/ts_satisfies_assignment.ts.snap} | 28 ++ .../ok/ts_satisfies_expression.ts | 0 .../ok/ts_satisfies_expression.ts.snap} | 29 ++ .../ok/ts_setter_signature_member.ts | 0 .../ok/ts_setter_signature_member.ts.snap} | 29 ++ .../ok/ts_tagged_template_literal.ts | 0 .../ok/ts_tagged_template_literal.ts.snap} | 22 + .../ok/ts_template_literal_type.ts | 0 .../ok/ts_template_literal_type.ts.snap} | 23 + .../js_test_suite}/ok/ts_this_parameter.ts | 0 .../ok/ts_this_parameter.ts.snap} | 22 + .../js_test_suite}/ok/ts_this_type.ts | 0 .../js_test_suite/ok/ts_this_type.ts.snap} | 28 ++ .../js_test_suite}/ok/ts_tuple_type.ts | 0 .../js_test_suite/ok/ts_tuple_type.ts.snap} | 26 ++ .../ok/ts_type_arguments_left_shift.ts | 0 .../ok/ts_type_arguments_left_shift.ts.snap} | 22 + .../ok/ts_type_arguments_like_expression.ts | 0 ...ts_type_arguments_like_expression.ts.snap} | 21 + .../js_test_suite}/ok/ts_type_assertion.ts | 0 .../ok/ts_type_assertion.ts.snap} | 21 + .../ok/ts_type_assertion_expression.ts | 0 .../ok/ts_type_assertion_expression.ts.snap} | 23 + .../ok/ts_type_constraint_clause.ts | 0 .../ok/ts_type_constraint_clause.ts.snap} | 22 + .../ok/ts_type_instantiation_expression.ts | 0 .../ts_type_instantiation_expression.ts.snap} | 21 + .../js_test_suite}/ok/ts_type_operator.ts | 0 .../ok/ts_type_operator.ts.snap} | 24 + .../js_test_suite}/ok/ts_type_parameters.ts | 0 .../ok/ts_type_parameters.ts.snap} | 23 + .../js_test_suite}/ok/ts_type_predicate.ts | 0 .../ok/ts_type_predicate.ts.snap} | 25 + .../js_test_suite}/ok/ts_type_variable.ts | 0 .../ok/ts_type_variable.ts.snap} | 22 + .../ok/ts_type_variable_annotation.ts | 0 .../ok/ts_type_variable_annotation.ts.snap} | 23 + .../js_test_suite}/ok/ts_typeof_type.ts | 0 .../js_test_suite/ok/ts_typeof_type.ts.snap} | 24 + .../js_test_suite}/ok/ts_typeof_type2.tsx | 0 .../ok/ts_typeof_type2.tsx.snap} | 22 + .../js_test_suite}/ok/ts_union_type.ts | 0 .../js_test_suite/ok/ts_union_type.ts.snap} | 23 + .../ok/tsx_element_generics_type.tsx | 0 .../ok/tsx_element_generics_type.tsx.snap} | 23 + .../js_test_suite}/ok/tsx_type_arguments.tsx | 0 .../ok/tsx_type_arguments.tsx.snap} | 27 ++ .../ok/type_arguments_like_expression.js | 0 .../type_arguments_like_expression.js.snap} | 21 + .../ok/type_arguments_no_recovery.ts | 0 .../ok/type_arguments_no_recovery.ts.snap} | 29 ++ .../ok/type_assertion_primary_expression.ts | 0 ...type_assertion_primary_expression.ts.snap} | 21 + .../ok/type_parameter_modifier.ts | 0 .../ok/type_parameter_modifier.ts.snap} | 70 +++ .../ok/type_parameter_modifier_tsx.tsx | 0 .../ok/type_parameter_modifier_tsx.tsx.snap} | 28 ++ .../js_test_suite}/ok/typescript_enum.ts | 0 .../js_test_suite/ok/typescript_enum.ts.snap} | 23 + ...ript_export_default_abstract_class_case.ts | 0 ...xport_default_abstract_class_case.ts.snap} | 21 + ...ers_can_have_no_body_in_ambient_context.ts | 0 ...n_have_no_body_in_ambient_context.ts.snap} | 34 ++ .../js_test_suite}/ok/unary_delete.js | 0 .../js_test_suite/ok/unary_delete.js.snap} | 45 ++ .../js_test_suite}/ok/unary_delete_nested.js | 0 .../ok/unary_delete_nested.js.snap} | 26 ++ .../ok/using_declaration_statement.js | 0 .../ok/using_declaration_statement.js.snap} | 35 ++ ...using_declarations_inside_for_statement.js | 0 ...declarations_inside_for_statement.js.snap} | 24 + .../js_test_suite}/ok/var_decl.js | 0 .../js_test_suite/ok/var_decl.js.snap} | 27 ++ .../js_test_suite}/ok/while_stmt.js | 0 .../js_test_suite/ok/while_stmt.js.snap} | 22 + .../js_test_suite/ok/with_statement.cjs} | 0 .../js_test_suite/ok/with_statement.cjs.snap} | 26 ++ .../js_test_suite}/ok/yield_expr.js | 0 .../js_test_suite/ok/yield_expr.js.snap} | 27 ++ .../ok/yield_in_generator_function.js | 0 .../ok/yield_in_generator_function.js.snap} | 23 + crates/biome_js_parser/tests/spec_test.rs | 189 ++++++++ crates/biome_js_parser/tests/spec_tests.rs | 10 + .../src/file_handlers/javascript.rs | 1 + crates/biome_service/src/settings.rs | 1 + 1356 files changed, 19828 insertions(+), 3731 deletions(-) delete mode 100644 crates/biome_js_parser/src/test_utils.rs delete mode 100644 crates/biome_js_parser/src/tests.rs delete mode 100644 crates/biome_js_parser/test_data/inline/err/import_call.rast delete mode 100644 crates/biome_js_parser/test_data/inline/err/import_call_no_arg.rast delete mode 100644 crates/biome_js_parser/test_data/inline/err/spread_attribute_error.rast delete mode 100644 crates/biome_js_parser/test_data/inline/err/switch_stmt_double_default.rast delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_decorator_object.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/ok/metavar.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/ok/object_expr_getter.rast delete mode 100644 crates/biome_js_parser/test_data/inline/ok/object_expr_setter.rast delete mode 100644 crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.options.json delete mode 100644 crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/abstract_class_in_js.js (100%) rename crates/biome_js_parser/{test_data/inline/err/abstract_class_in_js.rast => tests/js_test_suite/error/abstract_class_in_js.js.snap} (91%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/array_assignment_target_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/array_assignment_target_err.rast => tests/js_test_suite/error/array_assignment_target_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/array_assignment_target_rest_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/array_assignment_target_rest_err.rast => tests/js_test_suite/error/array_assignment_target_rest_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/array_binding_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/array_binding_err.rast => tests/js_test_suite/error/array_binding_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/array_binding_rest_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/array_binding_rest_err.rast => tests/js_test_suite/error/array_binding_rest_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/array_expr_incomplete.js (100%) rename crates/biome_js_parser/{test_data/inline/err/array_expr_incomplete.rast => tests/js_test_suite/error/array_expr_incomplete.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/arrow_escaped_async.js (100%) rename crates/biome_js_parser/{test_data/inline/err/arrow_escaped_async.rast => tests/js_test_suite/error/arrow_escaped_async.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/arrow_rest_in_expr_in_initializer.js (100%) rename crates/biome_js_parser/{test_data/inline/err/arrow_rest_in_expr_in_initializer.rast => tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/assign_eval_or_arguments.js (100%) rename crates/biome_js_parser/{test_data/inline/err/assign_eval_or_arguments.rast => tests/js_test_suite/error/assign_eval_or_arguments.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/assign_expr_left.js (100%) rename crates/biome_js_parser/{test_data/inline/err/assign_expr_left.rast => tests/js_test_suite/error/assign_expr_left.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/assign_expr_right.js (100%) rename crates/biome_js_parser/{test_data/inline/err/assign_expr_right.rast => tests/js_test_suite/error/assign_expr_right.js.snap} (91%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/async_arrow_expr_await_parameter.js (100%) rename crates/biome_js_parser/{test_data/inline/err/async_arrow_expr_await_parameter.rast => tests/js_test_suite/error/async_arrow_expr_await_parameter.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/async_or_generator_in_single_statement_context.js (100%) rename crates/biome_js_parser/{test_data/inline/err/async_or_generator_in_single_statement_context.rast => tests/js_test_suite/error/async_or_generator_in_single_statement_context.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/await_in_module.js (100%) rename crates/biome_js_parser/{test_data/inline/err/await_in_module.rast => tests/js_test_suite/error/await_in_module.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/await_in_non_async_function.js (100%) rename crates/biome_js_parser/{test_data/inline/err/await_in_non_async_function.rast => tests/js_test_suite/error/await_in_non_async_function.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/await_in_parameter_initializer.js (100%) rename crates/biome_js_parser/{test_data/inline/err/await_in_parameter_initializer.rast => tests/js_test_suite/error/await_in_parameter_initializer.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err/await_in_static_initialization_block_member.js => tests/js_test_suite/error/await_in_static_initialization_block_member.cjs} (100%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs.snap rename crates/biome_js_parser/{test_data/inline/err/await_in_static_initialization_block_member.rast => tests/js_test_suite/error/await_in_static_initialization_block_member.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/await_using_declaration_only_allowed_inside_an_async_function.js (100%) rename crates/biome_js_parser/{test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.rast => tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/binary_expressions_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/binary_expressions_err.rast => tests/js_test_suite/error/binary_expressions_err.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/binding_identifier_invalid.js (100%) rename crates/biome_js_parser/{test_data/inline/err/binding_identifier_invalid.rast => tests/js_test_suite/error/binding_identifier_invalid.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err/binding_identifier_invalid_script.js => tests/js_test_suite/error/binding_identifier_invalid_script.cjs} (100%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs.snap rename crates/biome_js_parser/{test_data/inline/err/binding_identifier_invalid_script.rast => tests/js_test_suite/error/binding_identifier_invalid_script.js.snap} (91%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/block_stmt_in_class.js (100%) rename crates/biome_js_parser/{test_data/inline/err/block_stmt_in_class.rast => tests/js_test_suite/error/block_stmt_in_class.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/bracket_expr_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/bracket_expr_err.rast => tests/js_test_suite/error/bracket_expr_err.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/break_in_nested_function.js (100%) rename crates/biome_js_parser/{test_data/inline/err/break_in_nested_function.rast => tests/js_test_suite/error/break_in_nested_function.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/break_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/err/break_stmt.rast => tests/js_test_suite/error/break_stmt.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_constructor_parameter.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_constructor_parameter.rast => tests/js_test_suite/error/class_constructor_parameter.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_constructor_parameter_readonly.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_constructor_parameter_readonly.rast => tests/js_test_suite/error/class_constructor_parameter_readonly.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_decl_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_decl_err.rast => tests/js_test_suite/error/class_decl_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_decl_no_id.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/class_decl_no_id.rast => tests/js_test_suite/error/class_decl_no_id.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_declare_member.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_declare_member.rast => tests/js_test_suite/error/class_declare_member.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_declare_method.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_declare_method.rast => tests/js_test_suite/error/class_declare_method.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_extends_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_extends_err.rast => tests/js_test_suite/error/class_extends_err.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_implements.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_implements.rast => tests/js_test_suite/error/class_implements.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_in_single_statement_context.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_in_single_statement_context.rast => tests/js_test_suite/error/class_in_single_statement_context.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_invalid_modifiers.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_invalid_modifiers.rast => tests/js_test_suite/error/class_invalid_modifiers.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_member_method_parameters.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_member_method_parameters.rast => tests/js_test_suite/error/class_member_method_parameters.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_member_modifier.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_member_modifier.rast => tests/js_test_suite/error/class_member_modifier.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_member_static_accessor_precedence.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_member_static_accessor_precedence.rast => tests/js_test_suite/error/class_member_static_accessor_precedence.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/class_property_initializer.js (100%) rename crates/biome_js_parser/{test_data/inline/err/class_property_initializer.rast => tests/js_test_suite/error/class_property_initializer.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err/class_yield_property_initializer.js => tests/js_test_suite/error/class_yield_property_initializer.cjs} (100%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs.snap rename crates/biome_js_parser/{test_data/inline/err/class_yield_property_initializer.rast => tests/js_test_suite/error/class_yield_property_initializer.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/conditional_expr_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/conditional_expr_err.rast => tests/js_test_suite/error/conditional_expr_err.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/continue_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/err/continue_stmt.rast => tests/js_test_suite/error/continue_stmt.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/debugger_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/err/debugger_stmt.rast => tests/js_test_suite/error/debugger_stmt.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator.rast => tests/js_test_suite/error/decorator.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_async_function_export_default_declaration_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_async_function_export_default_declaration_clause.rast => tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_class_declaration.js (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_class_declaration.rast => tests/js_test_suite/error/decorator_class_declaration.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_class_declaration_top_level.js (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_class_declaration_top_level.rast => tests/js_test_suite/error/decorator_class_declaration_top_level.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_class_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_class_member.rast => tests/js_test_suite/error/decorator_class_member.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_enum_export_default_declaration_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_enum_export_default_declaration_clause.rast => tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_export.js (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_export.rast => tests/js_test_suite/error/decorator_export.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_export_class_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_export_class_clause.rast => tests/js_test_suite/error/decorator_export_class_clause.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_export_default_expression_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_export_default_expression_clause.rast => tests/js_test_suite/error/decorator_export_default_expression_clause.ts.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_expression_class.js (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_expression_class.rast => tests/js_test_suite/error/decorator_expression_class.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_function_export_default_declaration_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_function_export_default_declaration_clause.rast => tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_interface_export_default_declaration_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_interface_export_default_declaration_clause.rast => tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/decorator_precede_class_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/decorator_precede_class_member.rast => tests/js_test_suite/error/decorator_precede_class_member.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/do_while_no_continue_break.js (100%) rename crates/biome_js_parser/{test_data/inline/err/do_while_no_continue_break.rast => tests/js_test_suite/error/do_while_no_continue_break.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/do_while_stmt_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/do_while_stmt_err.rast => tests/js_test_suite/error/do_while_stmt_err.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/double_label.js (100%) rename crates/biome_js_parser/{test_data/inline/err/double_label.rast => tests/js_test_suite/error/double_label.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/empty_parenthesized_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/err/empty_parenthesized_expression.rast => tests/js_test_suite/error/empty_parenthesized_expression.js.snap} (88%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/enum_decl_no_id.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/enum_decl_no_id.rast => tests/js_test_suite/error/enum_decl_no_id.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/enum_in_js.js (100%) rename crates/biome_js_parser/{test_data/inline/err/enum_in_js.rast => tests/js_test_suite/error/enum_in_js.js.snap} (89%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/enum_no_l_curly.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/enum_no_l_curly.rast => tests/js_test_suite/error/enum_no_l_curly.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/enum_no_r_curly.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/enum_no_r_curly.rast => tests/js_test_suite/error/enum_no_r_curly.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/escaped_from.js (100%) rename crates/biome_js_parser/{test_data/inline/err/escaped_from.rast => tests/js_test_suite/error/escaped_from.js.snap} (92%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/eval_arguments_assignment.js (100%) rename crates/biome_js_parser/{test_data/inline/err/eval_arguments_assignment.rast => tests/js_test_suite/error/eval_arguments_assignment.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/exponent_unary_unparenthesized.js (100%) rename crates/biome_js_parser/{test_data/inline/err/exponent_unary_unparenthesized.rast => tests/js_test_suite/error/exponent_unary_unparenthesized.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/export_as_identifier_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/export_as_identifier_err.rast => tests/js_test_suite/error/export_as_identifier_err.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/export_decl_not_top_level.js (100%) rename crates/biome_js_parser/{test_data/inline/err/export_decl_not_top_level.rast => tests/js_test_suite/error/export_decl_not_top_level.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/export_default_expression_broken.js (100%) rename crates/biome_js_parser/{test_data/inline/err/export_default_expression_broken.rast => tests/js_test_suite/error/export_default_expression_broken.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/export_default_expression_clause_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/export_default_expression_clause_err.rast => tests/js_test_suite/error/export_default_expression_clause_err.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/export_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/export_err.rast => tests/js_test_suite/error/export_err.js.snap} (87%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/export_from_clause_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/export_from_clause_err.rast => tests/js_test_suite/error/export_from_clause_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err/export_huge_function_in_script.js => tests/js_test_suite/error/export_huge_function_in_script.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/err/export_huge_function_in_script.rast => tests/js_test_suite/error/export_huge_function_in_script.cjs.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/export_named_clause_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/export_named_clause_err.rast => tests/js_test_suite/error/export_named_clause_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/export_named_from_clause_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/export_named_from_clause_err.rast => tests/js_test_suite/error/export_named_from_clause_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/export_variable_clause_error.js (100%) rename crates/biome_js_parser/{test_data/inline/err/export_variable_clause_error.rast => tests/js_test_suite/error/export_variable_clause_error.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err/for_in_and_of_initializer_loose_mode.js => tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs} (100%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs.snap rename crates/biome_js_parser/{test_data/inline/err/for_in_and_of_initializer_loose_mode.rast => tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/for_in_and_of_initializer_strict_mode.js (100%) rename crates/biome_js_parser/{test_data/inline/err/for_in_and_of_initializer_strict_mode.rast => tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/for_of_async_identifier.js (100%) rename crates/biome_js_parser/{test_data/inline/err/for_of_async_identifier.rast => tests/js_test_suite/error/for_of_async_identifier.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/for_stmt_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/for_stmt_err.rast => tests/js_test_suite/error/for_stmt_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/formal_params_invalid.js (100%) rename crates/biome_js_parser/{test_data/inline/err/formal_params_invalid.rast => tests/js_test_suite/error/formal_params_invalid.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/formal_params_no_binding_element.js (100%) rename crates/biome_js_parser/{test_data/inline/err/formal_params_no_binding_element.rast => tests/js_test_suite/error/formal_params_no_binding_element.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/function_broken.js (100%) rename crates/biome_js_parser/{test_data/inline/err/function_broken.rast => tests/js_test_suite/error/function_broken.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/function_decl_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/function_decl_err.rast => tests/js_test_suite/error/function_decl_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/function_escaped_async.js (100%) rename crates/biome_js_parser/{test_data/inline/err/function_escaped_async.rast => tests/js_test_suite/error/function_escaped_async.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/function_expression_id_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/function_expression_id_err.rast => tests/js_test_suite/error/function_expression_id_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/function_id_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/function_id_err.rast => tests/js_test_suite/error/function_id_err.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/function_in_single_statement_context_strict.js (100%) rename crates/biome_js_parser/{test_data/inline/err/function_in_single_statement_context_strict.rast => tests/js_test_suite/error/function_in_single_statement_context_strict.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/getter_class_no_body.js (100%) rename crates/biome_js_parser/{test_data/inline/err/getter_class_no_body.rast => tests/js_test_suite/error/getter_class_no_body.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/identifier.js (100%) rename crates/biome_js_parser/{test_data/inline/err/identifier.rast => tests/js_test_suite/error/identifier.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/identifier_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/identifier_err.rast => tests/js_test_suite/error/identifier_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/if_stmt_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/if_stmt_err.rast => tests/js_test_suite/error/if_stmt_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/import_as_identifier_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/import_as_identifier_err.rast => tests/js_test_suite/error/import_as_identifier_err.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/import_assertion_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/import_assertion_err.rast => tests/js_test_suite/error/import_assertion_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/import_attribute_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/import_attribute_err.rast => tests/js_test_suite/error/import_attribute_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/import_decl_not_top_level.js (100%) rename crates/biome_js_parser/{test_data/inline/err/import_decl_not_top_level.rast => tests/js_test_suite/error/import_decl_not_top_level.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/import_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/import_err.rast => tests/js_test_suite/error/import_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/import_invalid_args.js (100%) rename crates/biome_js_parser/{test_data/inline/err/import_invalid_args.rast => tests/js_test_suite/error/import_invalid_args.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/import_keyword_in_expression_position.js (100%) rename crates/biome_js_parser/{test_data/inline/err/import_keyword_in_expression_position.rast => tests/js_test_suite/error/import_keyword_in_expression_position.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/import_no_meta.js (100%) rename crates/biome_js_parser/{test_data/inline/err/import_no_meta.rast => tests/js_test_suite/error/import_no_meta.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/incomplete_parenthesized_sequence_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/err/incomplete_parenthesized_sequence_expression.rast => tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/index_signature_class_member_in_js.js (100%) rename crates/biome_js_parser/{test_data/inline/err/index_signature_class_member_in_js.rast => tests/js_test_suite/error/index_signature_class_member_in_js.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/interface_cannot_be_reserved_world.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/interface_cannot_be_reserved_world.rast => tests/js_test_suite/error/interface_cannot_be_reserved_world.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/invalid_arg_list.js (100%) rename crates/biome_js_parser/{test_data/inline/err/invalid_arg_list.rast => tests/js_test_suite/error/invalid_arg_list.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/invalid_assignment_target.js (100%) rename crates/biome_js_parser/{test_data/inline/err/invalid_assignment_target.rast => tests/js_test_suite/error/invalid_assignment_target.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/invalid_method_recover.js (100%) rename crates/biome_js_parser/{test_data/inline/err/invalid_method_recover.rast => tests/js_test_suite/error/invalid_method_recover.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/invalid_optional_chain_from_new_expressions.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/invalid_optional_chain_from_new_expressions.rast => tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/invalid_using_declarations_inside_for_statement.js (100%) rename crates/biome_js_parser/{test_data/inline/err/invalid_using_declarations_inside_for_statement.rast => tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/js_class_property_with_ts_annotation.js (100%) rename crates/biome_js_parser/{test_data/inline/err/js_class_property_with_ts_annotation.rast => tests/js_test_suite/error/js_class_property_with_ts_annotation.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err/js_constructor_parameter_reserved_names.js => tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs} (100%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs.snap rename crates/biome_js_parser/{test_data/inline/err/js_constructor_parameter_reserved_names.rast => tests/js_test_suite/error/js_constructor_parameter_reserved_names.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/js_formal_parameter_error.js (100%) rename crates/biome_js_parser/{test_data/inline/err/js_formal_parameter_error.rast => tests/js_test_suite/error/js_formal_parameter_error.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/js_invalid_assignment.js (100%) rename crates/biome_js_parser/{test_data/inline/err/js_invalid_assignment.rast => tests/js_test_suite/error/js_invalid_assignment.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/js_regex_assignment.js (100%) rename crates/biome_js_parser/{test_data/inline/err/js_regex_assignment.rast => tests/js_test_suite/error/js_regex_assignment.js.snap} (92%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/js_rewind_at_eof_token.js (100%) rename crates/biome_js_parser/{test_data/inline/err/js_rewind_at_eof_token.rast => tests/js_test_suite/error/js_rewind_at_eof_token.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/js_right_shift_comments.js (100%) rename crates/biome_js_parser/{test_data/inline/err/js_right_shift_comments.rast => tests/js_test_suite/error/js_right_shift_comments.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/js_type_variable_annotation.js (100%) rename crates/biome_js_parser/{test_data/inline/err/js_type_variable_annotation.rast => tests/js_test_suite/error/js_type_variable_annotation.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_child_expression_missing_r_curly.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_child_expression_missing_r_curly.rast => tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_children_expression_missing_r_curly.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_children_expression_missing_r_curly.rast => tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_children_expressions_not_accepted.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_children_expressions_not_accepted.rast => tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_closing_element_mismatch.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_closing_element_mismatch.rast => tests/js_test_suite/error/jsx_closing_element_mismatch.jsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_closing_missing_r_angle.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_closing_missing_r_angle.rast => tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_element_attribute_expression_error.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_element_attribute_expression_error.rast => tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_element_attribute_missing_value.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_element_attribute_missing_value.rast => tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_fragment_closing_missing_r_angle.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast => tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_invalid_text.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_invalid_text.rast => tests/js_test_suite/error/jsx_invalid_text.jsx.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_missing_closing_fragment.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_missing_closing_fragment.rast => tests/js_test_suite/error/jsx_missing_closing_fragment.jsx.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_namespace_member_element_name.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_namespace_member_element_name.rast => tests/js_test_suite/error/jsx_namespace_member_element_name.jsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_opening_element_missing_r_angle.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_opening_element_missing_r_angle.rast => tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err/jsx_or_type_assertion.js => tests/js_test_suite/error/jsx_or_type_assertion.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_or_type_assertion.rast => tests/js_test_suite/error/jsx_or_type_assertion.cjs.snap} (96%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.js.snap rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_self_closing_element_missing_r_angle.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast => tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_spread_attribute_error.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_spread_attribute_error.rast => tests/js_test_suite/error/jsx_spread_attribute_error.jsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/jsx_spread_no_expression.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/jsx_spread_no_expression.rast => tests/js_test_suite/error/jsx_spread_no_expression.jsx.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/labelled_function_decl_in_single_statement_context.js (100%) rename crates/biome_js_parser/{test_data/inline/err/labelled_function_decl_in_single_statement_context.rast => tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/labelled_function_declaration_strict_mode.js (100%) rename crates/biome_js_parser/{test_data/inline/err/labelled_function_declaration_strict_mode.rast => tests/js_test_suite/error/labelled_function_declaration_strict_mode.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err/let_array_with_new_line.js => tests/js_test_suite/error/let_array_with_new_line.cjs} (100%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs.snap rename crates/biome_js_parser/{test_data/inline/err/let_array_with_new_line.rast => tests/js_test_suite/error/let_array_with_new_line.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/let_newline_in_async_function.js (100%) rename crates/biome_js_parser/{test_data/inline/err/let_newline_in_async_function.rast => tests/js_test_suite/error/let_newline_in_async_function.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/lexical_declaration_in_single_statement_context.js (100%) rename crates/biome_js_parser/{test_data/inline/err/lexical_declaration_in_single_statement_context.rast => tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/literals.js (100%) rename crates/biome_js_parser/{test_data/inline/err/literals.rast => tests/js_test_suite/error/literals.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/logical_expressions_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/logical_expressions_err.rast => tests/js_test_suite/error/logical_expressions_err.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/method_getter_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/method_getter_err.rast => tests/js_test_suite/error/method_getter_err.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/module_closing_curly.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/module_closing_curly.rast => tests/js_test_suite/error/module_closing_curly.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/multiple_default_exports_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/multiple_default_exports_err.rast => tests/js_test_suite/error/multiple_default_exports_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/new_exprs.js (100%) rename crates/biome_js_parser/{test_data/inline/err/new_exprs.rast => tests/js_test_suite/error/new_exprs.js.snap} (89%) rename crates/biome_js_parser/{test_data/inline/err/no_top_level_await_in_scripts.js => tests/js_test_suite/error/no_top_level_await_in_scripts.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/err/no_top_level_await_in_scripts.rast => tests/js_test_suite/error/no_top_level_await_in_scripts.cjs.snap} (92%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/object_binding_pattern.js (100%) rename crates/biome_js_parser/{test_data/inline/err/object_binding_pattern.rast => tests/js_test_suite/error/object_binding_pattern.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/object_expr_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/object_expr_err.rast => tests/js_test_suite/error/object_expr_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/object_expr_error_prop_name.js (100%) rename crates/biome_js_parser/{test_data/inline/err/object_expr_error_prop_name.rast => tests/js_test_suite/error/object_expr_error_prop_name.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/object_expr_method.js (100%) rename crates/biome_js_parser/{test_data/inline/err/object_expr_method.rast => tests/js_test_suite/error/object_expr_method.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/object_expr_non_ident_literal_prop.js (100%) rename crates/biome_js_parser/{test_data/inline/err/object_expr_non_ident_literal_prop.rast => tests/js_test_suite/error/object_expr_non_ident_literal_prop.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/object_expr_setter.js (100%) rename crates/biome_js_parser/{test_data/inline/err/object_expr_setter.rast => tests/js_test_suite/error/object_expr_setter.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/object_property_binding_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/object_property_binding_err.rast => tests/js_test_suite/error/object_property_binding_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/object_shorthand_property_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/object_shorthand_property_err.rast => tests/js_test_suite/error/object_shorthand_property_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/object_shorthand_with_initializer.js (100%) rename crates/biome_js_parser/{test_data/inline/err/object_shorthand_with_initializer.rast => tests/js_test_suite/error/object_shorthand_with_initializer.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/optional_chain_call_without_arguments.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/optional_chain_call_without_arguments.rast => tests/js_test_suite/error/optional_chain_call_without_arguments.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/optional_member.js (100%) rename crates/biome_js_parser/{test_data/inline/err/optional_member.rast => tests/js_test_suite/error/optional_member.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/paren_or_arrow_expr_invalid_params.js (100%) rename crates/biome_js_parser/{test_data/inline/err/paren_or_arrow_expr_invalid_params.rast => tests/js_test_suite/error/paren_or_arrow_expr_invalid_params.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/primary_expr_invalid_recovery.js (100%) rename crates/biome_js_parser/{test_data/inline/err/primary_expr_invalid_recovery.rast => tests/js_test_suite/error/primary_expr_invalid_recovery.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/private_name_presence_check_recursive.js (100%) rename crates/biome_js_parser/{test_data/inline/err/private_name_presence_check_recursive.rast => tests/js_test_suite/error/private_name_presence_check_recursive.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/private_name_with_space.js (100%) rename crates/biome_js_parser/{test_data/inline/err/private_name_with_space.rast => tests/js_test_suite/error/private_name_with_space.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/property_assignment_target_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/property_assignment_target_err.rast => tests/js_test_suite/error/property_assignment_target_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/regex.js (100%) rename crates/biome_js_parser/{test_data/inline/err/regex.rast => tests/js_test_suite/error/regex.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/rest_property_assignment_target_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/rest_property_assignment_target_err.rast => tests/js_test_suite/error/rest_property_assignment_target_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/rest_property_binding_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/rest_property_binding_err.rast => tests/js_test_suite/error/rest_property_binding_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/return_stmt_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/return_stmt_err.rast => tests/js_test_suite/error/return_stmt_err.js.snap} (92%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/semicolons_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/semicolons_err.rast => tests/js_test_suite/error/semicolons_err.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/sequence_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/err/sequence_expr.rast => tests/js_test_suite/error/sequence_expr.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/setter_class_member.js (100%) rename crates/biome_js_parser/{test_data/inline/err/setter_class_member.rast => tests/js_test_suite/error/setter_class_member.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/setter_class_no_body.js (100%) rename crates/biome_js_parser/{test_data/inline/err/setter_class_no_body.rast => tests/js_test_suite/error/setter_class_no_body.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/spread.js (100%) rename crates/biome_js_parser/{test_data/inline/err/spread.rast => tests/js_test_suite/error/spread.js.snap} (90%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/statements_closing_curly.js (100%) rename crates/biome_js_parser/{test_data/inline/err/statements_closing_curly.rast => tests/js_test_suite/error/statements_closing_curly.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/subscripts_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/subscripts_err.rast => tests/js_test_suite/error/subscripts_err.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/super_expression_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/super_expression_err.rast => tests/js_test_suite/error/super_expression_err.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/super_expression_in_constructor_parameter_list.js (100%) rename crates/biome_js_parser/{test_data/inline/err/super_expression_in_constructor_parameter_list.rast => tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/switch_stmt_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/switch_stmt_err.rast => tests/js_test_suite/error/switch_stmt_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/template_after_optional_chain.js (100%) rename crates/biome_js_parser/{test_data/inline/err/template_after_optional_chain.rast => tests/js_test_suite/error/template_after_optional_chain.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/template_literal.js (100%) rename crates/biome_js_parser/{test_data/inline/err/template_literal.rast => tests/js_test_suite/error/template_literal.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/template_literal_unterminated.js (100%) rename crates/biome_js_parser/{test_data/inline/err/template_literal_unterminated.rast => tests/js_test_suite/error/template_literal_unterminated.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/throw_stmt_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/throw_stmt_err.rast => tests/js_test_suite/error/throw_stmt_err.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_abstract_member_ansi.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_abstract_member_ansi.rast => tests/js_test_suite/error/ts_abstract_member_ansi.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_abstract_property_cannot_be_definite.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_abstract_property_cannot_be_definite.rast => tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_abstract_property_cannot_have_initiliazers.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast => tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_ambient_async_method.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_ambient_async_method.rast => tests/js_test_suite/error/ts_ambient_async_method.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_ambient_context_semi.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_ambient_context_semi.rast => tests/js_test_suite/error/ts_ambient_context_semi.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_annotated_property_initializer_ambient_context.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_annotated_property_initializer_ambient_context.rast => tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_arrow_function_this_parameter.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_arrow_function_this_parameter.rast => tests/js_test_suite/error/ts_arrow_function_this_parameter.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_as_assignment_no_parenthesize.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_as_assignment_no_parenthesize.rast => tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_broken_class_member_modifiers.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_broken_class_member_modifiers.rast => tests/js_test_suite/error/ts_broken_class_member_modifiers.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_catch_declaration_non_any_unknown_type_annotation.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast => tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_class_declare_modifier_error.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_class_declare_modifier_error.rast => tests/js_test_suite/error/ts_class_declare_modifier_error.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_class_heritage_clause_errors.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_class_heritage_clause_errors.rast => tests/js_test_suite/error/ts_class_heritage_clause_errors.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_class_initializer_with_modifiers.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_class_initializer_with_modifiers.rast => tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_class_invalid_modifier_combinations.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_class_invalid_modifier_combinations.rast => tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_class_member_accessor_readonly_precedence.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_class_member_accessor_readonly_precedence.rast => tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_class_modifier_precedence.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_class_modifier_precedence.rast => tests/js_test_suite/error/ts_class_modifier_precedence.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_class_name_reserved_as_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_class_name_reserved_as_type.rast => tests/js_test_suite/error/ts_class_name_reserved_as_type.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_class_type_parameters_errors.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_class_type_parameters_errors.rast => tests/js_test_suite/error/ts_class_type_parameters_errors.ts.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_concrete_class_with_abstract_members.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_concrete_class_with_abstract_members.rast => tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_construct_signature_member_err.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_construct_signature_member_err.rast => tests/js_test_suite/error/ts_construct_signature_member_err.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_constructor_this_parameter.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_constructor_this_parameter.rast => tests/js_test_suite/error/ts_constructor_this_parameter.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_constructor_type_err.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_constructor_type_err.rast => tests/js_test_suite/error/ts_constructor_type_err.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_constructor_type_parameters.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_constructor_type_parameters.rast => tests/js_test_suite/error/ts_constructor_type_parameters.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_declare_async_function.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_declare_async_function.rast => tests/js_test_suite/error/ts_declare_async_function.ts.snap} (92%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_declare_const_initializer.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_declare_const_initializer.rast => tests/js_test_suite/error/ts_declare_const_initializer.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_declare_function_export_declaration_missing_id.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_declare_function_export_declaration_missing_id.rast => tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_declare_function_with_body.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_declare_function_with_body.rast => tests/js_test_suite/error/ts_declare_function_with_body.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_declare_generator_function.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_declare_generator_function.rast => tests/js_test_suite/error/ts_declare_generator_function.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_declare_property_private_name.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_declare_property_private_name.rast => tests/js_test_suite/error/ts_declare_property_private_name.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_declare_using.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_declare_using.rast => tests/js_test_suite/error/ts_declare_using.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_constructor.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_constructor.rast => tests/js_test_suite/error/ts_decorator_constructor.ts.snap} (99%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_object.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_object.rast => tests/js_test_suite/error/ts_decorator_object.ts.snap} (99%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_on_ambient_function.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_on_ambient_function.rast => tests/js_test_suite/error/ts_decorator_on_ambient_function.ts.snap} (99%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_on_arrow_function.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_on_arrow_function.rast => tests/js_test_suite/error/ts_decorator_on_arrow_function.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_on_class_method.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_on_class_method.rast => tests/js_test_suite/error/ts_decorator_on_class_method.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_on_class_setter.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_on_class_setter.rast => tests/js_test_suite/error/ts_decorator_on_class_setter.ts.snap} (98%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_on_constructor_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_on_constructor_type.rast => tests/js_test_suite/error/ts_decorator_on_constructor_type.ts.snap} (99%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_on_function_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_on_function_declaration.rast => tests/js_test_suite/error/ts_decorator_on_function_declaration.ts.snap} (99%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_on_function_expression.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_on_function_expression.rast => tests/js_test_suite/error/ts_decorator_on_function_expression.ts.snap} (99%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_on_function_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_on_function_type.rast => tests/js_test_suite/error/ts_decorator_on_function_type.ts.snap} (99%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_on_signature_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_on_signature_member.rast => tests/js_test_suite/error/ts_decorator_on_signature_member.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_setter_signature.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_setter_signature.rast => tests/js_test_suite/error/ts_decorator_setter_signature.ts.snap} (99%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_this_parameter.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_this_parameter.rast => tests/js_test_suite/error/ts_decorator_this_parameter.ts.snap} (99%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_decorator_this_parameter_option.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_decorator_this_parameter_option.rast => tests/js_test_suite/error/ts_decorator_this_parameter_option.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_definite_assignment_in_ambient_context.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_definite_assignment_in_ambient_context.rast => tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_definite_variable_with_initializer.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_definite_variable_with_initializer.rast => tests/js_test_suite/error/ts_definite_variable_with_initializer.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_export_declare.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_export_declare.rast => tests/js_test_suite/error/ts_export_declare.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_export_default_enum.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_export_default_enum.rast => tests/js_test_suite/error/ts_export_default_enum.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_export_syntax_in_js.js (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_export_syntax_in_js.rast => tests/js_test_suite/error/ts_export_syntax_in_js.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_export_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_export_type.rast => tests/js_test_suite/error/ts_export_type.ts.snap} (91%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_extends_trailing_comma.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_extends_trailing_comma.rast => tests/js_test_suite/error/ts_extends_trailing_comma.ts.snap} (95%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.options.json rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_formal_parameter_decorator.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_formal_parameter_decorator.rast => tests/js_test_suite/error/ts_formal_parameter_decorator.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_formal_parameter_decorator_option.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_formal_parameter_decorator_option.rast => tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_formal_parameter_error.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_formal_parameter_error.rast => tests/js_test_suite/error/ts_formal_parameter_error.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_function_overload_generator.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_function_overload_generator.rast => tests/js_test_suite/error/ts_function_overload_generator.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_function_type_err.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_function_type_err.rast => tests/js_test_suite/error/ts_function_type_err.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_getter_setter_type_parameters.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_getter_setter_type_parameters.rast => tests/js_test_suite/error/ts_getter_setter_type_parameters.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_getter_setter_type_parameters_errors.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_getter_setter_type_parameters_errors.rast => tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_index_signature_class_member_cannot_be_abstract.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast => tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_index_signature_class_member_cannot_be_accessor.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.rast => tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast => tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_index_signature_class_member_static_readonly_precedence.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast => tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_index_signature_interface_member_cannot_be_static.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast => tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast => tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_infer_type_not_allowed.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_infer_type_not_allowed.rast => tests/js_test_suite/error/ts_infer_type_not_allowed.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_instantiation_expression_property_access.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_instantiation_expression_property_access.rast => tests/js_test_suite/error/ts_instantiation_expression_property_access.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_instantiation_expressions_1.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_instantiation_expressions_1.rast => tests/js_test_suite/error/ts_instantiation_expressions_1.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_interface_heritage_clause_error.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_interface_heritage_clause_error.rast => tests/js_test_suite/error/ts_interface_heritage_clause_error.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_invalid_decorated_class_members.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_invalid_decorated_class_members.rast => tests/js_test_suite/error/ts_invalid_decorated_class_members.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_method_members_with_missing_body.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_method_members_with_missing_body.rast => tests/js_test_suite/error/ts_method_members_with_missing_body.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_method_object_member_body_error.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_method_object_member_body_error.rast => tests/js_test_suite/error/ts_method_object_member_body_error.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_method_signature_generator.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_method_signature_generator.rast => tests/js_test_suite/error/ts_method_signature_generator.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_module_err.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_module_err.rast => tests/js_test_suite/error/ts_module_err.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_named_import_specifier_error.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_named_import_specifier_error.rast => tests/js_test_suite/error/ts_named_import_specifier_error.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_new_operator.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_new_operator.rast => tests/js_test_suite/error/ts_new_operator.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_object_getter_type_parameters.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_object_getter_type_parameters.rast => tests/js_test_suite/error/ts_object_getter_type_parameters.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_object_setter_return_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_object_setter_return_type.rast => tests/js_test_suite/error/ts_object_setter_return_type.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_object_setter_type_parameters.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_object_setter_type_parameters.rast => tests/js_test_suite/error/ts_object_setter_type_parameters.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_property_initializer_ambient_context.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_property_initializer_ambient_context.rast => tests/js_test_suite/error/ts_property_initializer_ambient_context.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_property_parameter_pattern.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_property_parameter_pattern.rast => tests/js_test_suite/error/ts_property_parameter_pattern.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_readonly_modifier_non_class_or_indexer.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast => tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_satisfies_assignment_no_parenthesize.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast => tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_satisfies_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_satisfies_expression.rast => tests/js_test_suite/error/ts_satisfies_expression.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_setter_return_type_annotation.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_setter_return_type_annotation.rast => tests/js_test_suite/error/ts_setter_return_type_annotation.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_static_initialization_block_member_with_decorators.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_static_initialization_block_member_with_decorators.rast => tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_template_literal_error.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_template_literal_error.rast => tests/js_test_suite/error/ts_template_literal_error.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_tuple_type_cannot_be_optional_and_rest.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast => tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_tuple_type_incomplete.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_tuple_type_incomplete.rast => tests/js_test_suite/error/ts_tuple_type_incomplete.ts.snap} (92%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_type_alias_cannot_be_reserved_word.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_type_alias_cannot_be_reserved_word.rast => tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_type_assertions_not_valid_at_new_expr.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast => tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_type_parameters_incomplete.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_type_parameters_incomplete.rast => tests/js_test_suite/error/ts_type_parameters_incomplete.ts.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_typed_default_import_with_named.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_typed_default_import_with_named.rast => tests/js_test_suite/error/ts_typed_default_import_with_named.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/ts_variable_annotation_err.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/ts_variable_annotation_err.rast => tests/js_test_suite/error/ts_variable_annotation_err.ts.snap} (92%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/type_arguments_incomplete.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/type_arguments_incomplete.rast => tests/js_test_suite/error/type_arguments_incomplete.ts.snap} (92%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/type_parameter_modifier.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/type_parameter_modifier.rast => tests/js_test_suite/error/type_parameter_modifier.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/typescript_abstract_class_member_should_not_have_body.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/typescript_abstract_class_member_should_not_have_body.rast => tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/typescript_abstract_classes_abstract_accessor_precedence.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.rast => tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/typescript_abstract_classes_incomplete.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/typescript_abstract_classes_incomplete.rast => tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts.snap} (91%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/typescript_abstract_classes_invalid_abstract_async_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast => tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/typescript_abstract_classes_invalid_abstract_constructor.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast => tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/typescript_abstract_classes_invalid_abstract_private_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast => tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/typescript_abstract_classes_invalid_static_abstract_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast => tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/typescript_classes_invalid_accessibility_modifier_private_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast => tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/typescript_enum_incomplete.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/typescript_enum_incomplete.rast => tests/js_test_suite/error/typescript_enum_incomplete.ts.snap} (89%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/typescript_members_with_body_in_ambient_context_should_err.ts (100%) rename crates/biome_js_parser/{test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast => tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/unary_delete.js (100%) rename crates/biome_js_parser/{test_data/inline/err/unary_delete.rast => tests/js_test_suite/error/unary_delete.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/unary_delete_parenthesized.js (100%) rename crates/biome_js_parser/{test_data/inline/err/unary_delete_parenthesized.rast => tests/js_test_suite/error/unary_delete_parenthesized.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/unary_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/err/unary_expr.rast => tests/js_test_suite/error/unary_expr.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/unterminated_string.jsx (100%) rename crates/biome_js_parser/{test_data/inline/err/unterminated_string.rast => tests/js_test_suite/error/unterminated_string.jsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/unterminated_unicode_codepoint.js (100%) rename crates/biome_js_parser/{test_data/inline/err/unterminated_unicode_codepoint.rast => tests/js_test_suite/error/unterminated_unicode_codepoint.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/using_declaration_not_allowed_in_for_in_statement.js (100%) rename crates/biome_js_parser/{test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.rast => tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/using_declaration_statement_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/using_declaration_statement_err.rast => tests/js_test_suite/error/using_declaration_statement_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/var_decl_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/var_decl_err.rast => tests/js_test_suite/error/var_decl_err.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/variable_declaration_statement_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/variable_declaration_statement_err.rast => tests/js_test_suite/error/variable_declaration_statement_err.js.snap} (99%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/variable_declarator_list_empty.js (100%) rename crates/biome_js_parser/{test_data/inline/err/variable_declarator_list_empty.rast => tests/js_test_suite/error/variable_declarator_list_empty.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/variable_declarator_list_incomplete.js (100%) rename crates/biome_js_parser/{test_data/inline/err/variable_declarator_list_incomplete.rast => tests/js_test_suite/error/variable_declarator_list_incomplete.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/while_stmt_err.js (100%) rename crates/biome_js_parser/{test_data/inline/err/while_stmt_err.rast => tests/js_test_suite/error/while_stmt_err.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/yield_at_top_level_module.js (100%) rename crates/biome_js_parser/{test_data/inline/err/yield_at_top_level_module.rast => tests/js_test_suite/error/yield_at_top_level_module.js.snap} (90%) rename crates/biome_js_parser/{test_data/inline/err/yield_at_top_level_script.js => tests/js_test_suite/error/yield_at_top_level_script.cjs} (100%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs.snap rename crates/biome_js_parser/{test_data/inline/err/yield_at_top_level_script.rast => tests/js_test_suite/error/yield_at_top_level_script.js.snap} (86%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/yield_expr_in_parameter_initializer.js (100%) rename crates/biome_js_parser/{test_data/inline/err/yield_expr_in_parameter_initializer.rast => tests/js_test_suite/error/yield_expr_in_parameter_initializer.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/yield_in_non_generator_function.js (100%) rename crates/biome_js_parser/{test_data/inline/err/yield_in_non_generator_function.rast => tests/js_test_suite/error/yield_in_non_generator_function.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/err => tests/js_test_suite/error}/yield_in_non_generator_function_module.js (100%) rename crates/biome_js_parser/{test_data/inline/err/yield_in_non_generator_function_module.rast => tests/js_test_suite/error/yield_in_non_generator_function_module.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/err/yield_in_non_generator_function_script.js => tests/js_test_suite/error/yield_in_non_generator_function_script.cjs} (100%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs.snap rename crates/biome_js_parser/{test_data/inline/err/yield_in_non_generator_function_script.rast => tests/js_test_suite/error/yield_in_non_generator_function_script.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/arguments_in_definition_file.d.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/arguments_in_definition_file.d.rast => tests/js_test_suite/ok/arguments_in_definition_file.d.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/array_assignment_target.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/array_assignment_target.rast => tests/js_test_suite/ok/array_assignment_target.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/array_assignment_target_rest.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/array_assignment_target_rest.rast => tests/js_test_suite/ok/array_assignment_target_rest.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/array_binding.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/array_binding.rast => tests/js_test_suite/ok/array_binding.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/array_binding_rest.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/array_binding_rest.rast => tests/js_test_suite/ok/array_binding_rest.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/array_element_in_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/array_element_in_expr.rast => tests/js_test_suite/ok/array_element_in_expr.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/array_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/array_expr.rast => tests/js_test_suite/ok/array_expr.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/array_or_object_member_assignment.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/array_or_object_member_assignment.rast => tests/js_test_suite/ok/array_or_object_member_assignment.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/arrow_expr_in_alternate.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_arrow_exrp_in_alternate.rast => tests/js_test_suite/ok/arrow_expr_in_alternate.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/ok/arrow_expr_single_param.js => tests/js_test_suite/ok/arrow_expr_single_param.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/arrow_expr_single_param.rast => tests/js_test_suite/ok/arrow_expr_single_param.cjs.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/arrow_in_constructor.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/arrow_in_constructor.rast => tests/js_test_suite/ok/arrow_in_constructor.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/assign_eval_member_or_computed_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/assign_eval_member_or_computed_expr.rast => tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/assign_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/assign_expr.rast => tests/js_test_suite/ok/assign_expr.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/assignment_shorthand_prop_with_initializer.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/assignment_shorthand_prop_with_initializer.rast => tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/assignment_target.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/assignment_target.rast => tests/js_test_suite/ok/assignment_target.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/async_arrow_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/async_arrow_expr.rast => tests/js_test_suite/ok/async_arrow_expr.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/async_continue_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/async_continue_stmt.rast => tests/js_test_suite/ok/async_continue_stmt.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/async_function_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/async_function_expr.rast => tests/js_test_suite/ok/async_function_expr.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/async_ident.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/async_ident.rast => tests/js_test_suite/ok/async_ident.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/async_method.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/async_method.rast => tests/js_test_suite/ok/async_method.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/await_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/await_expression.rast => tests/js_test_suite/ok/await_expression.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/await_in_ambient_context.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/await_in_ambient_context.rast => tests/js_test_suite/ok/await_in_ambient_context.ts.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/binary_expressions.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/binary_expressions.rast => tests/js_test_suite/ok/binary_expressions.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/block_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/block_stmt.rast => tests/js_test_suite/ok/block_stmt.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/bom_character.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/bom_character.rast => tests/js_test_suite/ok/bom_character.js.snap} (92%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/break_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/break_stmt.rast => tests/js_test_suite/ok/break_stmt.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/built_in_module_name.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/built_in_module_name.rast => tests/js_test_suite/ok/built_in_module_name.ts.snap} (92%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/call_arguments.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/call_arguments.rast => tests/js_test_suite/ok/call_arguments.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline/ok/class_await_property_initializer.js => tests/js_test_suite/ok/class_await_property_initializer.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_await_property_initializer.rast => tests/js_test_suite/ok/class_await_property_initializer.cjs.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/class_constructor_parameter_modifiers.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_constructor_parameter_modifiers.rast => tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/class_declaration.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_declaration.rast => tests/js_test_suite/ok/class_declaration.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/class_declare.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_declare.rast => tests/js_test_suite/ok/class_declare.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/class_decorator.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_decorator.rast => tests/js_test_suite/ok/class_decorator.js.snap} (92%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/class_empty_element.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_empty_element.rast => tests/js_test_suite/ok/class_empty_element.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/class_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_expr.rast => tests/js_test_suite/ok/class_expr.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/class_member_modifiers.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_member_modifiers.rast => tests/js_test_suite/ok/class_member_modifiers.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/class_member_modifiers_no_asi.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_member_modifiers_no_asi.rast => tests/js_test_suite/ok/class_member_modifiers_no_asi.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/class_named_abstract_is_valid_in_js.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_named_abstract_is_valid_in_js.rast => tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js.snap} (89%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/class_static_constructor_method.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/class_static_constructor_method.rast => tests/js_test_suite/ok/class_static_constructor_method.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/computed_member_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/computed_member_expression.rast => tests/js_test_suite/ok/computed_member_expression.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/computed_member_in.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/computed_member_in.rast => tests/js_test_suite/ok/computed_member_in.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/computed_member_name_in.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/computed_member_name_in.rast => tests/js_test_suite/ok/computed_member_name_in.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/conditional_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/conditional_expr.rast => tests/js_test_suite/ok/conditional_expr.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/constructor_class_member.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/constructor_class_member.rast => tests/js_test_suite/ok/constructor_class_member.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/continue_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/continue_stmt.rast => tests/js_test_suite/ok/continue_stmt.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/debugger_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/debugger_stmt.rast => tests/js_test_suite/ok/debugger_stmt.js.snap} (81%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator.rast => tests/js_test_suite/ok/decorator.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_abstract_class_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_abstract_class_declaration.rast => tests/js_test_suite/ok/decorator_abstract_class_declaration.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_abstract_class_declaration_top_level.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_abstract_class_declaration_top_level.rast => tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_abstract_class_export_default_declaration_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.rast => tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_class_declaration.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_class_declaration.rast => tests/js_test_suite/ok/decorator_class_declaration.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_class_declaration_top_level.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_class_declaration_top_level.rast => tests/js_test_suite/ok/decorator_class_declaration_top_level.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_class_export_default_declaration_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_class_export_default_declaration_clause.rast => tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_class_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_class_member.rast => tests/js_test_suite/ok/decorator_class_member.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_class_member_in_ts.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_class_member_in_ts.rast => tests/js_test_suite/ok/decorator_class_member_in_ts.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_class_not_top_level.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_class_not_top_level.rast => tests/js_test_suite/ok/decorator_class_not_top_level.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_export_class_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_export_class_clause.rast => tests/js_test_suite/ok/decorator_export_class_clause.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_export_default_class_and_interface.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_export_default_class_and_interface.rast => tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_export_default_function_and_function_overload.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_export_default_function_and_function_overload.rast => tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_export_default_function_and_interface.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_export_default_function_and_interface.rast => tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_export_default_top_level_1.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_export_default_top_level_1.rast => tests/js_test_suite/ok/decorator_export_default_top_level_1.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_export_default_top_level_2.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_export_default_top_level_2.rast => tests/js_test_suite/ok/decorator_export_default_top_level_2.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_export_default_top_level_3.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_export_default_top_level_3.rast => tests/js_test_suite/ok/decorator_export_default_top_level_3.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_export_default_top_level_4.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_export_default_top_level_4.rast => tests/js_test_suite/ok/decorator_export_default_top_level_4.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_export_default_top_level_5.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_export_default_top_level_5.rast => tests/js_test_suite/ok/decorator_export_default_top_level_5.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_export_top_level.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_export_top_level.rast => tests/js_test_suite/ok/decorator_export_top_level.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/decorator_expression_class.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/decorator_expression_class.rast => tests/js_test_suite/ok/decorator_expression_class.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/destructuring_initializer_binding.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/destructuring_initializer_binding.rast => tests/js_test_suite/ok/destructuring_initializer_binding.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/ok/directives.js => tests/js_test_suite/ok/directives.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/directives.rast => tests/js_test_suite/ok/directives.cjs.snap} (97%) rename crates/biome_js_parser/{test_data/inline/ok/directives_redundant.js => tests/js_test_suite/ok/directives_redundant.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/directives_redundant.rast => tests/js_test_suite/ok/directives_redundant.cjs.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/do-while-asi.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/do-while-asi.rast => tests/js_test_suite/ok/do-while-asi.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/do_while_statement.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/do_while_statement.rast => tests/js_test_suite/ok/do_while_statement.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/do_while_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/do_while_stmt.rast => tests/js_test_suite/ok/do_while_stmt.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/empty_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/empty_stmt.rast => tests/js_test_suite/ok/empty_stmt.js.snap} (78%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/exponent_unary_parenthesized.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/exponent_unary_parenthesized.rast => tests/js_test_suite/ok/exponent_unary_parenthesized.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/export_as_identifier.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/export_as_identifier.rast => tests/js_test_suite/ok/export_as_identifier.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/export_class_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/export_class_clause.rast => tests/js_test_suite/ok/export_class_clause.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/export_default_class_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/export_default_class_clause.rast => tests/js_test_suite/ok/export_default_class_clause.js.snap} (92%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/export_default_expression_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/export_default_expression_clause.rast => tests/js_test_suite/ok/export_default_expression_clause.js.snap} (89%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/export_default_function_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/export_default_function_clause.rast => tests/js_test_suite/ok/export_default_function_clause.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/export_from_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/export_from_clause.rast => tests/js_test_suite/ok/export_from_clause.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/export_function_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/export_function_clause.rast => tests/js_test_suite/ok/export_function_clause.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/export_named_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/export_named_clause.rast => tests/js_test_suite/ok/export_named_clause.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/export_named_from_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/export_named_from_clause.rast => tests/js_test_suite/ok/export_named_from_clause.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/export_variable_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/export_variable_clause.rast => tests/js_test_suite/ok/export_variable_clause.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/for_await_async_identifier.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/for_await_async_identifier.rast => tests/js_test_suite/ok/for_await_async_identifier.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/ok/for_in_initializer_loose_mode.js => tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/for_in_initializer_loose_mode.rast => tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/for_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/for_stmt.rast => tests/js_test_suite/ok/for_stmt.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/for_with_in_in_parenthesized_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/for_with_in_in_parenthesized_expression.rast => tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/function_decl.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/function_decl.rast => tests/js_test_suite/ok/function_decl.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/ok/function_declaration_script.js => tests/js_test_suite/ok/function_declaration_script.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/function_declaration_script.rast => tests/js_test_suite/ok/function_declaration_script.cjs.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/function_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/function_expr.rast => tests/js_test_suite/ok/function_expr.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/ok/function_expression_id.js => tests/js_test_suite/ok/function_expression_id.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/function_expression_id.rast => tests/js_test_suite/ok/function_expression_id.cjs.snap} (97%) rename crates/biome_js_parser/{test_data/inline/ok/function_id.js => tests/js_test_suite/ok/function_id.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/function_id.rast => tests/js_test_suite/ok/function_id.cjs.snap} (97%) rename crates/biome_js_parser/{test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.js => tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.rast => tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/getter_class_member.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/getter_class_member.rast => tests/js_test_suite/ok/getter_class_member.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/getter_object_member.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/getter_object_member.rast => tests/js_test_suite/ok/getter_object_member.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/grouping_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/grouping_expr.rast => tests/js_test_suite/ok/grouping_expr.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/hoisted_declaration_in_single_statement_context.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast => tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/identifier.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/identifier.rast => tests/js_test_suite/ok/identifier.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/ok/identifier_loose_mode.js => tests/js_test_suite/ok/identifier_loose_mode.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/identifier_loose_mode.rast => tests/js_test_suite/ok/identifier_loose_mode.cjs.snap} (92%) rename crates/biome_js_parser/{test_data/inline/ok/identifier_reference.js => tests/js_test_suite/ok/identifier_reference.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/identifier_reference.rast => tests/js_test_suite/ok/identifier_reference.cjs.snap} (92%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/if_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/if_stmt.rast => tests/js_test_suite/ok/if_stmt.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_as_as_as_identifier.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_as_as_as_identifier.rast => tests/js_test_suite/ok/import_as_as_as_identifier.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_as_identifier.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_as_identifier.rast => tests/js_test_suite/ok/import_as_identifier.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_assertion.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_assertion.rast => tests/js_test_suite/ok/import_assertion.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_attribute.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_attribute.rast => tests/js_test_suite/ok/import_attribute.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_bare_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_bare_clause.rast => tests/js_test_suite/ok/import_bare_clause.js.snap} (90%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_call.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_call.rast => tests/js_test_suite/ok/import_call.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_decl.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_decl.rast => tests/js_test_suite/ok/import_decl.js.snap} (91%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_default_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_default_clause.rast => tests/js_test_suite/ok/import_default_clause.js.snap} (90%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_default_clauses.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_default_clauses.rast => tests/js_test_suite/ok/import_default_clauses.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_meta.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_meta.rast => tests/js_test_suite/ok/import_meta.js.snap} (85%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/import_named_clause.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/import_named_clause.rast => tests/js_test_suite/ok/import_named_clause.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/in_expr_in_arguments.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/in_expr_in_arguments.rast => tests/js_test_suite/ok/in_expr_in_arguments.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/issue_2790.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/issue_2790.rast => tests/js_test_suite/ok/issue_2790.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/js_class_property_member_modifiers.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/js_class_property_member_modifiers.rast => tests/js_test_suite/ok/js_class_property_member_modifiers.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/js_parenthesized_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/js_parenthesized_expression.rast => tests/js_test_suite/ok/js_parenthesized_expression.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/js_unary_expressions.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/js_unary_expressions.rast => tests/js_test_suite/ok/js_unary_expressions.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_any_name.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_any_name.rast => tests/js_test_suite/ok/jsx_any_name.jsx.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_arrow_exrp_in_alternate.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_arrow_exrp_in_alternate.rast => tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_children_expression.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_children_expression.rast => tests/js_test_suite/ok/jsx_children_expression.jsx.snap} (99%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_children_expression_then_text.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_children_expression_then_text.rast => tests/js_test_suite/ok/jsx_children_expression_then_text.jsx.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_children_spread.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_children_spread.rast => tests/js_test_suite/ok/jsx_children_spread.jsx.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_closing_token_trivia.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_closing_token_trivia.rast => tests/js_test_suite/ok/jsx_closing_token_trivia.jsx.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_element_as_statements.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_element_as_statements.rast => tests/js_test_suite/ok/jsx_element_as_statements.jsx.snap} (90%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_element_attribute_element.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_element_attribute_element.rast => tests/js_test_suite/ok/jsx_element_attribute_element.jsx.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_element_attribute_expression.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_element_attribute_expression.rast => tests/js_test_suite/ok/jsx_element_attribute_expression.jsx.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_element_attribute_string_literal.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_element_attribute_string_literal.rast => tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_element_attributes.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_element_attributes.rast => tests/js_test_suite/ok/jsx_element_attributes.jsx.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_element_children.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_element_children.rast => tests/js_test_suite/ok/jsx_element_children.jsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_element_on_arrow_function.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_element_on_arrow_function.rast => tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_element_on_return.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_element_open_close.rast => tests/js_test_suite/ok/jsx_element_on_return.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_element_open_close.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_element_on_return.rast => tests/js_test_suite/ok/jsx_element_open_close.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_element_self_close.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_element_self_close.rast => tests/js_test_suite/ok/jsx_element_self_close.jsx.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_equal_content.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_equal_content.rast => tests/js_test_suite/ok/jsx_equal_content.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_fragments.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_fragments.rast => tests/js_test_suite/ok/jsx_fragments.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_member_element_name.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_member_element_name.rast => tests/js_test_suite/ok/jsx_member_element_name.jsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_primary_expression.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_primary_expression.rast => tests/js_test_suite/ok/jsx_primary_expression.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_spread_attribute.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_spread_attribute.rast => tests/js_test_suite/ok/jsx_spread_attribute.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_text.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_text.rast => tests/js_test_suite/ok/jsx_text.jsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/jsx_type_arguments.jsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/jsx_type_arguments.rast => tests/js_test_suite/ok/jsx_type_arguments.jsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/labeled_statement.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/labeled_statement.rast => tests/js_test_suite/ok/labeled_statement.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline/ok/labelled_function_declaration.js => tests/js_test_suite/ok/labelled_function_declaration.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/labelled_function_declaration.rast => tests/js_test_suite/ok/labelled_function_declaration.cjs.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/labelled_statement_in_single_statement_context.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/labelled_statement_in_single_statement_context.rast => tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline/ok/let_asi_rule.js => tests/js_test_suite/ok/let_asi_rule.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/let_asi_rule.rast => tests/js_test_suite/ok/let_asi_rule.cjs.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/literals.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/literals.rast => tests/js_test_suite/ok/literals.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/logical_expressions.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/logical_expressions.rast => tests/js_test_suite/ok/logical_expressions.js.snap} (95%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/ok/metavar.options.json rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/metavar.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/metavar.rast => tests/js_test_suite/ok/metavar.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/method_class_member.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/method_class_member.rast => tests/js_test_suite/ok/method_class_member.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/module.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/module.rast => tests/js_test_suite/ok/module.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/new_exprs.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/new_exprs.rast => tests/js_test_suite/ok/new_exprs.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_assignment_target.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_assignment_target.rast => tests/js_test_suite/ok/object_assignment_target.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_expr.rast => tests/js_test_suite/ok/object_expr.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_expr_async_method.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_expr_async_method.rast => tests/js_test_suite/ok/object_expr_async_method.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_expr_generator_method.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_expr_generator_method.rast => tests/js_test_suite/ok/object_expr_generator_method.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_expr_ident_literal_prop.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_expr_ident_literal_prop.rast => tests/js_test_suite/ok/object_expr_ident_literal_prop.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_expr_ident_prop.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_expr_ident_prop.rast => tests/js_test_suite/ok/object_expr_ident_prop.js.snap} (91%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_expr_method.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_expr_method.rast => tests/js_test_suite/ok/object_expr_method.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_expr_spread_prop.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_expr_spread_prop.rast => tests/js_test_suite/ok/object_expr_spread_prop.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_member_name.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_prop_name.rast => tests/js_test_suite/ok/object_member_name.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_prop_in_rhs.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_prop_in_rhs.rast => tests/js_test_suite/ok/object_prop_in_rhs.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_prop_name.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_member_name.rast => tests/js_test_suite/ok/object_prop_name.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_property_binding.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_property_binding.rast => tests/js_test_suite/ok/object_property_binding.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/object_shorthand_property.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/object_shorthand_property.rast => tests/js_test_suite/ok/object_shorthand_property.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/optional_chain_call_less_than.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/optional_chain_call_less_than.rast => tests/js_test_suite/ok/optional_chain_call_less_than.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/parameter_list.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/parameter_list.rast => tests/js_test_suite/ok/parameter_list.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/paren_or_arrow_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/paren_or_arrow_expr.rast => tests/js_test_suite/ok/paren_or_arrow_expr.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/parenthesized_sequence_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/parenthesized_sequence_expression.rast => tests/js_test_suite/ok/parenthesized_sequence_expression.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/pattern_with_default_in_keyword.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/pattern_with_default_in_keyword.rast => tests/js_test_suite/ok/pattern_with_default_in_keyword.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/post_update_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/post_update_expr.rast => tests/js_test_suite/ok/post_update_expr.js.snap} (90%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/postfix_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/postfix_expr.rast => tests/js_test_suite/ok/postfix_expr.js.snap} (90%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/pre_update_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/pre_update_expr.rast => tests/js_test_suite/ok/pre_update_expr.js.snap} (90%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/private_name_presence_check.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/private_name_presence_check.rast => tests/js_test_suite/ok/private_name_presence_check.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/property_assignment_target.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/property_assignment_target.rast => tests/js_test_suite/ok/property_assignment_target.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/property_class_member.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/property_class_member.rast => tests/js_test_suite/ok/property_class_member.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline/ok/reparse_await_as_identifier.js => tests/js_test_suite/ok/reparse_await_as_identifier.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/reparse_await_as_identifier.rast => tests/js_test_suite/ok/reparse_await_as_identifier.cjs.snap} (96%) rename crates/biome_js_parser/{test_data/inline/ok/reparse_yield_as_identifier.js => tests/js_test_suite/ok/reparse_yield_as_identifier.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/reparse_yield_as_identifier.rast => tests/js_test_suite/ok/reparse_yield_as_identifier.cjs.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/rest_property_assignment_target.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/rest_property_assignment_target.rast => tests/js_test_suite/ok/rest_property_assignment_target.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/rest_property_binding.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/rest_property_binding.rast => tests/js_test_suite/ok/rest_property_binding.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/return_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/return_stmt.rast => tests/js_test_suite/ok/return_stmt.js.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/scoped_declarations.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/scoped_declarations.rast => tests/js_test_suite/ok/scoped_declarations.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/semicolons.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/semicolons.rast => tests/js_test_suite/ok/semicolons.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/sequence_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/sequence_expr.rast => tests/js_test_suite/ok/sequence_expr.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/setter_class_member.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/setter_class_member.rast => tests/js_test_suite/ok/setter_class_member.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/setter_object_member.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/setter_object_member.rast => tests/js_test_suite/ok/setter_object_member.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/single_parameter_arrow_function_with_parameter_named_async.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast => tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/static_generator_constructor_method.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/static_generator_constructor_method.rast => tests/js_test_suite/ok/static_generator_constructor_method.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/static_initialization_block_member.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/static_initialization_block_member.rast => tests/js_test_suite/ok/static_initialization_block_member.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/static_member_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/static_member_expression.rast => tests/js_test_suite/ok/static_member_expression.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/static_method.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/static_method.rast => tests/js_test_suite/ok/static_method.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/subscripts.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/subscripts.rast => tests/js_test_suite/ok/subscripts.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/super_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/super_expression.rast => tests/js_test_suite/ok/super_expression.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/super_expression_in_constructor_parameter_list.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/super_expression_in_constructor_parameter_list.rast => tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/switch_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/switch_stmt.rast => tests/js_test_suite/ok/switch_stmt.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/template_literal.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/template_literal.rast => tests/js_test_suite/ok/template_literal.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/this_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/this_expr.rast => tests/js_test_suite/ok/this_expr.js.snap} (90%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/throw_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/throw_stmt.rast => tests/js_test_suite/ok/throw_stmt.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/try_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/try_stmt.rast => tests/js_test_suite/ok/try_stmt.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_abstract_classes.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_abstract_classes.rast => tests/js_test_suite/ok/ts_abstract_classes.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_abstract_property_can_be_optional.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_abstract_property_can_be_optional.rast => tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_ambient_const_variable_statement.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_ambient_const_variable_statement.rast => tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_ambient_enum_statement.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_ambient_enum_statement.rast => tests/js_test_suite/ok/ts_ambient_enum_statement.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_ambient_function.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_ambient_function.rast => tests/js_test_suite/ok/ts_ambient_function.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_ambient_interface.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_ambient_interface.rast => tests/js_test_suite/ok/ts_ambient_interface.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_ambient_let_variable_statement.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_ambient_let_variable_statement.rast => tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_ambient_var_statement.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_ambient_var_statement.rast => tests/js_test_suite/ok/ts_ambient_var_statement.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_array_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_array_type.rast => tests/js_test_suite/ok/ts_array_type.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_arrow_exrp_in_alternate.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/arrow_expr_in_alternate.rast => tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_arrow_function_type_parameters.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_arrow_function_type_parameters.rast => tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_as_assignment.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_as_assignment.rast => tests/js_test_suite/ok/ts_as_assignment.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_as_expression.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_as_expression.rast => tests/js_test_suite/ok/ts_as_expression.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_call_expr_with_type_arguments.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_call_expr_with_type_arguments.rast => tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_call_signature_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_call_signature_member.rast => tests/js_test_suite/ok/ts_call_signature_member.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_catch_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_catch_declaration.rast => tests/js_test_suite/ok/ts_catch_declaration.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_class_named_abstract_is_valid_in_ts.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.rast => tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts.snap} (89%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_class_property_annotation.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_class_property_annotation.rast => tests/js_test_suite/ok/ts_class_property_annotation.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_class_property_member_modifiers.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_class_property_member_modifiers.rast => tests/js_test_suite/ok/ts_class_property_member_modifiers.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_class_type_parameters.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_class_type_parameters.rast => tests/js_test_suite/ok/ts_class_type_parameters.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_conditional_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_conditional_type.rast => tests/js_test_suite/ok/ts_conditional_type.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_conditional_type_call_signature_lhs.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast => tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_construct_signature_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_construct_signature_member.rast => tests/js_test_suite/ok/ts_construct_signature_member.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_constructor_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_constructor_type.rast => tests/js_test_suite/ok/ts_constructor_type.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_declare_const_initializer.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_declare_const_initializer.rast => tests/js_test_suite/ok/ts_declare_const_initializer.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_declare_function.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_declare_function.rast => tests/js_test_suite/ok/ts_declare_function.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_declare_function_export_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_declare_function_export_declaration.rast => tests/js_test_suite/ok/ts_declare_function_export_declaration.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_declare_function_export_default_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_declare_function_export_default_declaration.rast => tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_declare_type_alias.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_declare_type_alias.rast => tests/js_test_suite/ok/ts_declare_type_alias.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_decorate_computed_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_decorate_computed_member.rast => tests/js_test_suite/ok/ts_decorate_computed_member.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_decorated_class_members.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_decorated_class_members.rast => tests/js_test_suite/ok/ts_decorated_class_members.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_decorator_assignment.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_decorator_assignment.rast => tests/js_test_suite/ok/ts_decorator_assignment.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_decorator_call_expression_with_arrow.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_decorator_call_expression_with_arrow.rast => tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts.snap} (97%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.options.json rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_decorator_constructor.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_decorator_constructor.rast => tests/js_test_suite/ok/ts_decorator_constructor.ts.snap} (98%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.options.json rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_decorator_on_class_method.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_decorator_on_class_method.rast => tests/js_test_suite/ok/ts_decorator_on_class_method.ts.snap} (99%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.options.json rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_decorator_on_class_setter.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_decorator_on_class_setter.rast => tests/js_test_suite/ok/ts_decorator_on_class_setter.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_default_type_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_default_type_clause.rast => tests/js_test_suite/ok/ts_default_type_clause.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_assignment_identifier.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_assignment_identifier.rast => tests/js_test_suite/ok/ts_export_assignment_identifier.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_assignment_qualified_name.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_assignment_qualified_name.rast => tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_declare.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_declare.rast => tests/js_test_suite/ok/ts_export_declare.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_default_function_overload.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_default_function_overload.rast => tests/js_test_suite/ok/ts_export_default_function_overload.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_default_interface.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_default_interface.rast => tests/js_test_suite/ok/ts_export_default_interface.ts.snap} (92%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_default_multiple_interfaces.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_default_multiple_interfaces.rast => tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_enum_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_enum_declaration.rast => tests/js_test_suite/ok/ts_export_enum_declaration.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_function_overload.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_function_overload.rast => tests/js_test_suite/ok/ts_export_function_overload.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_interface_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_interface_declaration.rast => tests/js_test_suite/ok/ts_export_interface_declaration.ts.snap} (90%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_named_from_specifier_with_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_named_from_specifier_with_type.rast => tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_named_type_specifier.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_named_type_specifier.rast => tests/js_test_suite/ok/ts_export_named_type_specifier.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_namespace_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_namespace_clause.rast => tests/js_test_suite/ok/ts_export_namespace_clause.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_type_named.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_type_named.rast => tests/js_test_suite/ok/ts_export_type_named.ts.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_type_named_from.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_type_named_from.rast => tests/js_test_suite/ok/ts_export_type_named_from.ts.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_export_type_specifier.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_export_type_specifier.rast => tests/js_test_suite/ok/ts_export_type_specifier.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_extends_generic_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_extends_generic_type.rast => tests/js_test_suite/ok/ts_extends_generic_type.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_external_module_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_external_module_declaration.rast => tests/js_test_suite/ok/ts_external_module_declaration.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_formal_parameter.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_formal_parameter.rast => tests/js_test_suite/ok/ts_formal_parameter.ts.snap} (98%) create mode 100644 crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.options.json rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_formal_parameter_decorator.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_formal_parameter_decorator.rast => tests/js_test_suite/ok/ts_formal_parameter_decorator.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_function_overload.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_function_overload.rast => tests/js_test_suite/ok/ts_function_overload.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_function_statement.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_function_statement.rast => tests/js_test_suite/ok/ts_function_statement.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_function_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_function_type.rast => tests/js_test_suite/ok/ts_function_type.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_getter_signature_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_getter_signature_member.rast => tests/js_test_suite/ok/ts_getter_signature_member.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_global_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_global_declaration.rast => tests/js_test_suite/ok/ts_global_declaration.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_global_variable.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_global_variable.rast => tests/js_test_suite/ok/ts_global_variable.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_import_clause_types.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_import_clause_types.rast => tests/js_test_suite/ok/ts_import_clause_types.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_import_equals_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_import_equals_declaration.rast => tests/js_test_suite/ok/ts_import_equals_declaration.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_import_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_import_type.rast => tests/js_test_suite/ok/ts_import_type.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_index_signature_class_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_index_signature_class_member.rast => tests/js_test_suite/ok/ts_index_signature_class_member.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_index_signature_class_member_can_be_static.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_index_signature_class_member_can_be_static.rast => tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_index_signature_interface_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_index_signature_interface_member.rast => tests/js_test_suite/ok/ts_index_signature_interface_member.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_index_signature_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_index_signature_member.rast => tests/js_test_suite/ok/ts_index_signature_member.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_indexed_access_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_indexed_access_type.rast => tests/js_test_suite/ok/ts_indexed_access_type.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_infer_type_allowed.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_infer_type_allowed.rast => tests/js_test_suite/ok/ts_infer_type_allowed.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_inferred_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_inferred_type.rast => tests/js_test_suite/ok/ts_inferred_type.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_instantiation_expression_property_access.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_instantiation_expression_property_access.rast => tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_instantiation_expressions.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_instantiation_expressions.rast => tests/js_test_suite/ok/ts_instantiation_expressions.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_instantiation_expressions_1.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_instantiation_expressions_1.rast => tests/js_test_suite/ok/ts_instantiation_expressions_1.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_instantiation_expressions_asi.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_instantiation_expressions_asi.rast => tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_instantiation_expressions_new_line.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_instantiation_expressions_new_line.rast => tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_interface.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_interface.rast => tests/js_test_suite/ok/ts_interface.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_interface_extends_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_interface_extends_clause.rast => tests/js_test_suite/ok/ts_interface_extends_clause.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_intersection_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_intersection_type.rast => tests/js_test_suite/ok/ts_intersection_type.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_keyword_assignments.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_keyword_assignments.rast => tests/js_test_suite/ok/ts_keyword_assignments.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline/ok/ts_keywords_assignments_script.js => tests/js_test_suite/ok/ts_keywords_assignments_script.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_keywords_assignments_script.rast => tests/js_test_suite/ok/ts_keywords_assignments_script.cjs.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_literal_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_literal_type.rast => tests/js_test_suite/ok/ts_literal_type.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_mapped_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_mapped_type.rast => tests/js_test_suite/ok/ts_mapped_type.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_method_and_constructor_overload.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_method_and_constructor_overload.rast => tests/js_test_suite/ok/ts_method_and_constructor_overload.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_method_class_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_method_class_member.rast => tests/js_test_suite/ok/ts_method_class_member.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_method_object_member_body.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_method_object_member_body.rast => tests/js_test_suite/ok/ts_method_object_member_body.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_module_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_module_declaration.rast => tests/js_test_suite/ok/ts_module_declaration.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_named_import_specifier_with_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_named_import_specifier_with_type.rast => tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_namespace_declaration.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_namespace_declaration.rast => tests/js_test_suite/ok/ts_namespace_declaration.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_new_operator.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_new_operator.rast => tests/js_test_suite/ok/ts_new_operator.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_new_with_type_arguments.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_new_with_type_arguments.rast => tests/js_test_suite/ok/ts_new_with_type_arguments.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_non_null_assertion_expression.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_non_null_assertion_expression.rast => tests/js_test_suite/ok/ts_non_null_assertion_expression.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_non_null_assignment.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_non_null_assignment.rast => tests/js_test_suite/ok/ts_non_null_assignment.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_object_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_object_type.rast => tests/js_test_suite/ok/ts_object_type.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_optional_chain_call.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_optional_chain_call.rast => tests/js_test_suite/ok/ts_optional_chain_call.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_optional_method_class_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_optional_method_class_member.rast => tests/js_test_suite/ok/ts_optional_method_class_member.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_parameter_option_binding_pattern.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_parameter_option_binding_pattern.rast => tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_parenthesized_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_parenthesized_type.rast => tests/js_test_suite/ok/ts_parenthesized_type.ts.snap} (90%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_predefined_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_predefined_type.rast => tests/js_test_suite/ok/ts_predefined_type.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_property_class_member_can_be_named_set_or_get.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.rast => tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_property_or_method_signature_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_property_or_method_signature_member.rast => tests/js_test_suite/ok/ts_property_or_method_signature_member.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_property_parameter.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_property_parameter.rast => tests/js_test_suite/ok/ts_property_parameter.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_readonly_property_initializer_ambient_context.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_readonly_property_initializer_ambient_context.rast => tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_reference_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_reference_type.rast => tests/js_test_suite/ok/ts_reference_type.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_return_type_annotation.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_return_type_annotation.rast => tests/js_test_suite/ok/ts_return_type_annotation.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_return_type_asi.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_return_type_asi.rast => tests/js_test_suite/ok/ts_return_type_asi.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_satisfies_assignment.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_satisfies_assignment.rast => tests/js_test_suite/ok/ts_satisfies_assignment.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_satisfies_expression.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_satisfies_expression.rast => tests/js_test_suite/ok/ts_satisfies_expression.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_setter_signature_member.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_setter_signature_member.rast => tests/js_test_suite/ok/ts_setter_signature_member.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_tagged_template_literal.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_tagged_template_literal.rast => tests/js_test_suite/ok/ts_tagged_template_literal.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_template_literal_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_template_literal_type.rast => tests/js_test_suite/ok/ts_template_literal_type.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_this_parameter.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_this_parameter.rast => tests/js_test_suite/ok/ts_this_parameter.ts.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_this_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_this_type.rast => tests/js_test_suite/ok/ts_this_type.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_tuple_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_tuple_type.rast => tests/js_test_suite/ok/ts_tuple_type.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_arguments_left_shift.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_arguments_left_shift.rast => tests/js_test_suite/ok/ts_type_arguments_left_shift.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_arguments_like_expression.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_arguments_like_expression.rast => tests/js_test_suite/ok/ts_type_arguments_like_expression.ts.snap} (93%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_assertion.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_assertion.rast => tests/js_test_suite/ok/ts_type_assertion.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_assertion_expression.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_assertion_expression.rast => tests/js_test_suite/ok/ts_type_assertion_expression.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_constraint_clause.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_constraint_clause.rast => tests/js_test_suite/ok/ts_type_constraint_clause.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_instantiation_expression.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_instantiation_expression.rast => tests/js_test_suite/ok/ts_type_instantiation_expression.ts.snap} (92%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_operator.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_operator.rast => tests/js_test_suite/ok/ts_type_operator.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_parameters.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_parameters.rast => tests/js_test_suite/ok/ts_type_parameters.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_predicate.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_predicate.rast => tests/js_test_suite/ok/ts_type_predicate.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_variable.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_variable.rast => tests/js_test_suite/ok/ts_type_variable.ts.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_type_variable_annotation.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_type_variable_annotation.rast => tests/js_test_suite/ok/ts_type_variable_annotation.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_typeof_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_typeof_type.rast => tests/js_test_suite/ok/ts_typeof_type.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_typeof_type2.tsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_typeof_type2.rast => tests/js_test_suite/ok/ts_typeof_type2.tsx.snap} (95%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/ts_union_type.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/ts_union_type.rast => tests/js_test_suite/ok/ts_union_type.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/tsx_element_generics_type.tsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/tsx_element_generics_type.rast => tests/js_test_suite/ok/tsx_element_generics_type.tsx.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/tsx_type_arguments.tsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/tsx_type_arguments.rast => tests/js_test_suite/ok/tsx_type_arguments.tsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/type_arguments_like_expression.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/type_arguments_like_expression.rast => tests/js_test_suite/ok/type_arguments_like_expression.js.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/type_arguments_no_recovery.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/type_arguments_no_recovery.rast => tests/js_test_suite/ok/type_arguments_no_recovery.ts.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/type_assertion_primary_expression.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/type_assertion_primary_expression.rast => tests/js_test_suite/ok/type_assertion_primary_expression.ts.snap} (94%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/type_parameter_modifier.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/type_parameter_modifier.rast => tests/js_test_suite/ok/type_parameter_modifier.ts.snap} (99%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/type_parameter_modifier_tsx.tsx (100%) rename crates/biome_js_parser/{test_data/inline/ok/type_parameter_modifier_tsx.rast => tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/typescript_enum.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/typescript_enum.rast => tests/js_test_suite/ok/typescript_enum.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/typescript_export_default_abstract_class_case.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/typescript_export_default_abstract_class_case.rast => tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts.snap} (92%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/typescript_members_can_have_no_body_in_ambient_context.ts (100%) rename crates/biome_js_parser/{test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.rast => tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/unary_delete.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/unary_delete.rast => tests/js_test_suite/ok/unary_delete.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/unary_delete_nested.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/unary_delete_nested.rast => tests/js_test_suite/ok/unary_delete_nested.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/using_declaration_statement.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/using_declaration_statement.rast => tests/js_test_suite/ok/using_declaration_statement.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/using_declarations_inside_for_statement.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/using_declarations_inside_for_statement.rast => tests/js_test_suite/ok/using_declarations_inside_for_statement.js.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/var_decl.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/var_decl.rast => tests/js_test_suite/ok/var_decl.js.snap} (98%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/while_stmt.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/while_stmt.rast => tests/js_test_suite/ok/while_stmt.js.snap} (93%) rename crates/biome_js_parser/{test_data/inline/ok/with_statement.js => tests/js_test_suite/ok/with_statement.cjs} (100%) rename crates/biome_js_parser/{test_data/inline/ok/with_statement.rast => tests/js_test_suite/ok/with_statement.cjs.snap} (97%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/yield_expr.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/yield_expr.rast => tests/js_test_suite/ok/yield_expr.js.snap} (96%) rename crates/biome_js_parser/{test_data/inline => tests/js_test_suite}/ok/yield_in_generator_function.js (100%) rename crates/biome_js_parser/{test_data/inline/ok/yield_in_generator_function.rast => tests/js_test_suite/ok/yield_in_generator_function.js.snap} (97%) create mode 100644 crates/biome_js_parser/tests/spec_test.rs create mode 100644 crates/biome_js_parser/tests/spec_tests.rs diff --git a/Cargo.lock b/Cargo.lock index 05b99955c80f..321aec179a1f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -804,17 +804,23 @@ dependencies = [ name = "biome_js_parser" version = "0.5.7" dependencies = [ + "biome_configuration", "biome_console", + "biome_deserialize", "biome_diagnostics", + "biome_fs", "biome_js_factory", "biome_js_syntax", "biome_parser", "biome_rowan", + "biome_service", + "biome_test_utils", "biome_unicode_table", "drop_bomb", "enumflags2", "expect-test", "indexmap 2.6.0", + "insta", "quickcheck", "quickcheck_macros", "rustc-hash 1.1.0", diff --git a/crates/biome_configuration/src/javascript/mod.rs b/crates/biome_configuration/src/javascript/mod.rs index 9ac646202d41..7c1e131205aa 100644 --- a/crates/biome_configuration/src/javascript/mod.rs +++ b/crates/biome_configuration/src/javascript/mod.rs @@ -63,6 +63,11 @@ pub struct JavascriptParser { /// These decorators belong to an old proposal, and they are subject to change. #[partial(bpaf(hide))] pub unsafe_parameter_decorators_enabled: bool, + + /// Enables parsing of Grit metavariables. + /// Defaults to `false`. + #[partial(bpaf(hide))] + pub grit_metavariables: bool, } /// Indicates the type of runtime or transformation used for interpreting JSX. diff --git a/crates/biome_js_analyze/src/utils/tests.rs b/crates/biome_js_analyze/src/utils/tests.rs index 89ccdc61f459..444c13110e9d 100644 --- a/crates/biome_js_analyze/src/utils/tests.rs +++ b/crates/biome_js_analyze/src/utils/tests.rs @@ -42,7 +42,7 @@ pub fn assert_rename_binding_a_to_b_ok(before: &str, expected: &str) { let after = root.to_string(); assert_eq!(expected, after.as_str()); - assert!(!biome_js_parser::test_utils::has_bogus_nodes_or_empty_slots(&root)); + assert!(!biome_test_utils::has_bogus_nodes_or_empty_slots(&root)); } pub fn assert_rename_ts_binding_a_to_b_ok(before: &str, expected: &str) { @@ -71,7 +71,7 @@ pub fn assert_rename_ts_binding_a_to_b_ok(before: &str, expected: &str) { let after = root.to_string(); assert_eq!(expected, after.as_str()); - assert!(!biome_js_parser::test_utils::has_bogus_nodes_or_empty_slots(&root)); + assert!(!biome_test_utils::has_bogus_nodes_or_empty_slots(&root)); } /// Search and renames one binding named "a" to "b". diff --git a/crates/biome_js_parser/Cargo.toml b/crates/biome_js_parser/Cargo.toml index 00b5283e61ad..45ad9600d903 100644 --- a/crates/biome_js_parser/Cargo.toml +++ b/crates/biome_js_parser/Cargo.toml @@ -29,10 +29,17 @@ smallvec = { workspace = true } tracing = { workspace = true } [dev-dependencies] -expect-test = "1.5.0" -quickcheck = { workspace = true } -quickcheck_macros = { workspace = true } -tests_macros = { workspace = true } +biome_configuration = { workspace = true } +biome_deserialize = { workspace = true } +biome_fs = { workspace = true } +biome_service = { workspace = true } +biome_test_utils = { workspace = true } +expect-test = "1.5.0" +insta = { workspace = true } +quickcheck = { workspace = true } +quickcheck_macros = { workspace = true } +tests_macros = { path = "../tests_macros" } + [features] schemars = ["dep:schemars"] diff --git a/crates/biome_js_parser/src/lib.rs b/crates/biome_js_parser/src/lib.rs index 8773b6022521..9f035d1815c9 100644 --- a/crates/biome_js_parser/src/lib.rs +++ b/crates/biome_js_parser/src/lib.rs @@ -113,18 +113,12 @@ mod parser; #[macro_use] mod lexer; +pub mod options; mod parse; +mod prelude; mod rewrite; mod span; mod state; - -#[cfg(any(test, feature = "tests"))] -pub mod test_utils; -#[cfg(test)] -mod tests; - -pub mod options; -mod prelude; pub mod syntax; mod token_source; diff --git a/crates/biome_js_parser/src/test_utils.rs b/crates/biome_js_parser/src/test_utils.rs deleted file mode 100644 index 4bd56556cb2b..000000000000 --- a/crates/biome_js_parser/src/test_utils.rs +++ /dev/null @@ -1,67 +0,0 @@ -use crate::Parse; -use biome_console::fmt::{Formatter, Termcolor}; -use biome_console::markup; -use biome_diagnostics::DiagnosticExt; -use biome_diagnostics::{termcolor::Buffer, PrintDiagnostic}; -use biome_js_syntax::{JsLanguage, JsSyntaxNode}; -use biome_rowan::{AstNode, SyntaxKind, SyntaxSlot}; -use std::{fmt::Debug, path::Path}; - -/// This check is used in the parser test to ensure it doesn't emit -/// bogus nodes without diagnostics, and in the analyzer tests to -/// check the syntax trees resulting from code actions are correct -pub fn has_bogus_nodes_or_empty_slots(node: &JsSyntaxNode) -> bool { - node.descendants().any(|descendant| { - let kind = descendant.kind(); - if kind.is_bogus() { - return true; - } - - if kind.is_list() { - return descendant - .slots() - .any(|slot| matches!(slot, SyntaxSlot::Empty { .. })); - } - - false - }) -} - -/// This function analyzes the parsing result of a file and panic with a -/// detailed message if it contains any error-level diagnostic, bogus nodes, -/// empty list slots or missing required children -pub fn assert_errors_are_absent(program: &Parse, path: &Path) -where - T: AstNode + Debug, -{ - let syntax = program.syntax(); - let debug_tree = format!("{:?}", program.tree()); - let has_missing_children = debug_tree.contains("missing (required)"); - - if has_bogus_nodes_or_empty_slots(&syntax) { - panic!("modified tree has bogus nodes or empty slots:\n{syntax:#?} \n\n {syntax}") - } - - if !program.has_errors() && !has_missing_children { - return; - } - - let mut buffer = Buffer::no_color(); - for diagnostic in program.diagnostics() { - let error = diagnostic - .clone() - .with_file_path(path.to_str().unwrap()) - .with_file_source_code(syntax.to_string()); - Formatter::new(&mut Termcolor(&mut buffer)) - .write_markup(markup! { - {PrintDiagnostic::verbose(&error)} - }) - .unwrap(); - } - - panic!("There should be no errors in the file {:?} but the following errors where present:\n{}\n\nParsed tree:\n{:#?}", - path.display(), - std::str::from_utf8(buffer.as_slice()).unwrap(), - &syntax - ); -} diff --git a/crates/biome_js_parser/src/tests.rs b/crates/biome_js_parser/src/tests.rs deleted file mode 100644 index 5df6860aef3b..000000000000 --- a/crates/biome_js_parser/src/tests.rs +++ /dev/null @@ -1,424 +0,0 @@ -use crate::test_utils::has_bogus_nodes_or_empty_slots; -use crate::{parse, parse_module, test_utils::assert_errors_are_absent, JsParserOptions, Parse}; -use biome_console::fmt::{Formatter, Termcolor}; -use biome_console::markup; -use biome_diagnostics::DiagnosticExt; -use biome_diagnostics::PrintDiagnostic; -use biome_js_syntax::{AnyJsRoot, JsFileSource, JsSyntaxKind}; -use biome_js_syntax::{JsCallArguments, JsLogicalExpression, JsSyntaxToken}; -use biome_rowan::{AstNode, Direction, TextSize}; -use expect_test::expect_file; -use std::fmt::Write; -use std::panic::catch_unwind; -use std::path::{Path, PathBuf}; - -#[test] -fn parser_smoke_test() { - let src = r#" -import "x" with { type: "json" } -"#; - - let module = parse(src, JsFileSource::tsx(), JsParserOptions::default()); - assert_errors_are_absent(&module, Path::new("parser_smoke_test")); -} - -#[test] -fn parser_missing_smoke_test() { - let src = r#" - console.log("Hello world"; - "#; - - let module = parse_module(src, JsParserOptions::default()); - - let arg_list = module - .syntax() - .descendants() - .find_map(JsCallArguments::cast) - .unwrap(); - - let opening = arg_list.syntax().element_in_slot(0); - let list = arg_list.syntax().element_in_slot(1); - let closing = arg_list.syntax().element_in_slot(2); - - assert_eq!(opening.map(|o| o.to_string()), Some(String::from("("))); - assert_eq!( - list.map(|l| l.kind()), - Some(JsSyntaxKind::JS_CALL_ARGUMENT_LIST) - ); - assert_eq!(closing, None); -} - -fn try_parse(path: &str, text: &str, options: JsParserOptions) -> Parse { - let res = catch_unwind(|| { - let path = Path::new(path); - // Files containing a // SCRIPT comment are parsed as script and not as module - // This is needed to test features that are restricted in strict mode. - let source_type = if text.contains("// SCRIPT") { - JsFileSource::js_script() - } else { - path.try_into().unwrap() - }; - - let parse = parse(text, source_type, options); - - assert_eq!( - parse.syntax().to_string(), - text, - "Original source and re-printed tree differ\nParsed Tree: {:#?}", - parse.syntax(), - ); - - parse - }); - assert!(res.is_ok(), "Trying to parse `{path}` panicked"); - res.unwrap() -} - -fn try_parse_with_printed_ast( - path: &str, - text: &str, - options: JsParserOptions, -) -> (Parse, String) { - catch_unwind(|| { - let parse = try_parse(path, text, options.clone()); - let formatted = format!("{:#?}", &parse.tree()); - (parse, formatted) - }) - .unwrap_or_else(|err| { - // Re-parsing the source here seems silly. But the problem is, that `SyntaxNode`s aren't - // unwind safe. That's why the same `ParseResult` can't be reused here. - // This should be fine because this code is only executed for local tests. No checked-in - // test should ever hit this line. - let re_parsed = try_parse(path, text, options); - panic!( - "Printing the AST for `{}` panicked. That means it is malformed. Err: {:?}\n{:#?}", - path, - err, - re_parsed.syntax() - ); - }) -} - -#[cfg(test)] -fn run_and_expect_no_errors(path: &str, _: &str, _: &str, _: &str) { - let path = PathBuf::from(path); - let text = std::fs::read_to_string(&path).unwrap(); - - let options_path = path.with_extension("options.json"); - let options: JsParserOptions = std::fs::read_to_string(options_path) - .ok() - .and_then(|options| serde_json::from_str(&options).ok()) - .unwrap_or_default(); - - let (parse, ast) = try_parse_with_printed_ast(path.to_str().unwrap(), &text, options); - assert_errors_are_absent(&parse, &path); - let actual = format!("{}\n\n{:#?}", ast, parse.syntax()); - - let path = path.with_extension("rast"); - expect_file![path].assert_eq(&actual) -} - -#[cfg(test)] -fn run_and_expect_errors(path: &str, _: &str, _: &str, _: &str) { - let path = PathBuf::from(path); - let text = std::fs::read_to_string(&path).unwrap(); - - let options_path = path.with_extension("options.json"); - let options: JsParserOptions = std::fs::read_to_string(options_path) - .ok() - .and_then(|options| serde_json::from_str(&options).ok()) - .unwrap_or_default(); - - let (parse, ast) = try_parse_with_printed_ast(path.to_str().unwrap(), &text, options); - assert_errors_are_present(&parse, &path); - let mut actual = format!("{}\n\n{:#?}", ast, parse.syntax()); - for diag in parse.diagnostics() { - let mut write = biome_diagnostics::termcolor::Buffer::no_color(); - let error = diag - .clone() - .with_file_path(path.file_name().unwrap().to_string_lossy().to_string()) - .with_file_source_code(text.to_string()); - Formatter::new(&mut Termcolor(&mut write)) - .write_markup(markup! { - {PrintDiagnostic::verbose(&error)} - }) - .expect("failed to emit diagnostic"); - write!( - actual, - "--\n{}", - std::str::from_utf8(write.as_slice()).expect("non utf8 in error buffer") - ) - .unwrap(); - } - write!(actual, "--\n{text}").unwrap(); - - let path = path.with_extension("rast"); - expect_file![path].assert_eq(&actual) -} - -mod parser { - mod ok { - tests_macros::gen_tests! {"test_data/inline/ok/**/*.{js,ts,jsx,tsx}", crate::tests::run_and_expect_no_errors, ""} - } - mod err { - tests_macros::gen_tests! {"test_data/inline/err/**/*.{js,ts,jsx,tsx}", crate::tests::run_and_expect_errors, ""} - } -} - -fn assert_errors_are_present(program: &Parse, path: &Path) { - assert!( - !program.diagnostics().is_empty(), - "There should be errors in the file {:?}\nSyntax Tree: {:#?}", - path.display(), - program.syntax() - ); -} - -#[test] -pub fn test_trivia_attached_to_tokens() { - let text = "/**/let a = 1; // nice variable \n /*hey*/ let \t b = 2; // another nice variable"; - let m = parse_module(text, JsParserOptions::default()); - let mut tokens = m.syntax().descendants_tokens(Direction::Next); - - let is_let = |x: &JsSyntaxToken| x.text_trimmed() == "let"; - let first_let = tokens.find(is_let).unwrap(); - - // first let leading trivia asserts - let pieces: Vec<_> = first_let.leading_trivia().pieces().collect(); - assert!(matches!(pieces.first().map(|x| x.text()), Some("/**/"))); - assert!(pieces.get(1).is_none()); - - // first let trailing trivia asserts - let pieces: Vec<_> = first_let.trailing_trivia().pieces().collect(); - assert!(matches!(pieces.first().map(|x| x.text()), Some(" "))); - assert!(pieces.get(1).is_none()); - - // second let leading trivia asserts - let second_let = tokens.find(is_let).unwrap(); - let pieces: Vec<_> = second_let.leading_trivia().pieces().collect(); - assert_eq!(4, pieces.len()); - assert!(matches!(pieces.first().map(|x| x.text()), Some("\n"))); - assert!(matches!(pieces.get(1).map(|x| x.text()), Some(" "))); - assert!(matches!(pieces.get(2).map(|x| x.text()), Some("/*hey*/"))); - assert!(matches!(pieces.get(3).map(|x| x.text()), Some(" "))); - - // second let trailing trivia asserts - let pieces: Vec<_> = second_let.trailing_trivia().pieces().collect(); - assert_eq!(1, pieces.len()); - assert!(matches!(pieces.first().map(|x| x.text()), Some(" \t "))); -} - -#[test] -pub fn jsroot_display_text_and_trimmed() { - let code = " let a = 1; \n "; - let root = parse_module(code, JsParserOptions::default()); - let syntax = root.syntax(); - - assert_eq!(format!("{syntax}"), code); - - let syntax_text = syntax.text(); - assert_eq!(format!("{syntax_text}"), code); - - let syntax_text = syntax.text_trimmed(); - assert_eq!(format!("{syntax_text}"), code.trim()); -} - -#[test] -pub fn jsroot_ranges() { - // 0123456789A - let code = " let a = 1;"; - let root = parse_module(code, JsParserOptions::default()); - let syntax = root.syntax(); - - let first_let = syntax.first_token().unwrap(); - let range = first_let.text_range(); - assert_eq!(0usize, usize::from(range.start())); - assert_eq!(5usize, usize::from(range.end())); - - let range = first_let.text_trimmed_range(); - assert_eq!(1usize, usize::from(range.start())); - assert_eq!(4usize, usize::from(range.end())); - - let eq = syntax - .descendants_tokens(Direction::Next) - .find(|x| x.text_trimmed() == "=") - .unwrap(); - let range = eq.text_range(); - assert_eq!(7usize, usize::from(range.start())); - assert_eq!(9usize, usize::from(range.end())); - - let range = eq.text_trimmed_range(); - assert_eq!(7usize, usize::from(range.start())); - assert_eq!(8usize, usize::from(range.end())); -} - -#[test] -pub fn node_range_must_be_correct() { - // 0123456789A123456789B123456789 - let text = " function foo() { let a = 1; }"; - let root = parse_module(text, JsParserOptions::default()); - - let var_decl = root - .syntax() - .descendants() - .find(|x| x.kind() == JsSyntaxKind::JS_VARIABLE_STATEMENT) - .unwrap(); - - let range = var_decl.text_range(); - assert_eq!(18usize, usize::from(range.start())); - assert_eq!(29usize, usize::from(range.end())); - - let range = var_decl.text_trimmed_range(); - assert_eq!(18usize, usize::from(range.start())); - assert_eq!(28usize, usize::from(range.end())); -} - -#[test] -pub fn last_trivia_must_be_appended_to_eof() { - // 0123456789A123456789B123456789CC - let text = " function foo() { let a = 1; }\n"; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - - let range = syntax.text_range(); - let start = range.start(); - let end = range.end(); - - assert_eq!(TextSize::from(0), start); - assert_eq!(TextSize::from(31), end); -} - -#[test] -pub fn just_trivia_must_be_appended_to_eof() { - // 0123456789A123456789B123456789C123 - let text = "// just trivia... nothing else...."; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - - let range = syntax.text_range(); - let start = range.start(); - let end = range.end(); - - assert_eq!(TextSize::from(0), start); - assert_eq!(TextSize::from(34), end); -} - -#[test] -pub fn node_contains_comments() { - let text = "true && true // comment"; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - - assert!(syntax.has_comments_descendants()); -} - -#[test] -fn parser_regexp_after_operator() { - fn assert_no_errors(src: &str) { - let module = parse(src, JsFileSource::js_script(), JsParserOptions::default()); - assert_errors_are_absent(&module, Path::new("parser_regexp_after_operator")); - } - assert_no_errors(r#"a=/a/"#); - assert_no_errors(r#"a==/a/"#); - assert_no_errors(r#"a===/a/"#); - assert_no_errors(r#"a!=/a/"#); - assert_no_errors(r#"a!==/a/"#); -} - -#[test] -pub fn node_contains_trailing_comments() { - let text = "true && (3 - 2 == 0) // comment"; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - let node = syntax - .descendants() - .find(|n| n.kind() == JsSyntaxKind::JS_LOGICAL_EXPRESSION) - .unwrap(); - - let logical_expression = JsLogicalExpression::cast(node).unwrap(); - let right = logical_expression.right().unwrap(); - - assert!(right.syntax().has_trailing_comments()); - assert!(!right.syntax().has_leading_comments()); -} - -#[test] -pub fn node_contains_leading_comments() { - let text = r"true && -// comment -(3 - 2 == 0)"; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - let node = syntax - .descendants() - .find(|n| n.kind() == JsSyntaxKind::JS_LOGICAL_EXPRESSION) - .unwrap(); - - let logical_expression = JsLogicalExpression::cast(node).unwrap(); - let right = logical_expression.right().unwrap(); - - assert!(right.syntax().has_leading_comments()); - assert!(!right.syntax().has_trailing_comments()); -} - -#[test] -pub fn node_has_comments() { - let text = r"true && -// comment -(3 - 2 == 0)"; - let root = parse_module(text, JsParserOptions::default()); - let syntax = root.syntax(); - let node = syntax - .descendants() - .find(|n| n.kind() == JsSyntaxKind::JS_LOGICAL_EXPRESSION) - .unwrap(); - - let logical_expression = JsLogicalExpression::cast(node).unwrap(); - let right = logical_expression.right().unwrap(); - - assert!(right.syntax().has_comments_direct()); -} - -#[test] -fn diagnostics_print_correctly() { - let text = r"const a"; - - let root = parse_module(text, JsParserOptions::default()); - for diagnostic in root.diagnostics() { - let mut write = biome_diagnostics::termcolor::Buffer::no_color(); - let error = diagnostic - .clone() - .with_file_path("example.js") - .with_file_source_code(text.to_string()); - - Formatter::new(&mut Termcolor(&mut write)) - .write_markup(markup! { - {PrintDiagnostic::verbose(&error)} - }) - .expect("failed to emit diagnostic"); - - eprintln!( - "{}", - std::str::from_utf8(write.as_slice()).expect("non utf8 in error buffer") - ); - } -} - -#[ignore] -#[test] -pub fn quick_test() { - let code = r#" - type Equals = A extends (x: B extends C ? D : E) => 0 ? F : G; - "#; - let root = parse( - code, - JsFileSource::ts(), - JsParserOptions::default().with_parse_class_parameter_decorators(), - ); - let syntax = root.syntax(); - dbg!(&syntax, root.diagnostics(), root.has_errors()); - - if has_bogus_nodes_or_empty_slots(&syntax) { - panic!("modified tree has bogus nodes or empty slots:\n{syntax:#?} \n\n {syntax}") - } -} diff --git a/crates/biome_js_parser/test_data/inline/err/import_call.rast b/crates/biome_js_parser/test_data/inline/err/import_call.rast deleted file mode 100644 index a11e682a4a69..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_call.rast +++ /dev/null @@ -1,40 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsExpressionStatement { - expression: JsImportCallExpression { - import_token: IMPORT_KW@0..6 "import" [] [], - l_paren_token: L_PAREN@6..7 "(" [] [], - argument: missing (required), - r_paren_token: R_PAREN@7..8 ")" [] [], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@8..9 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..9 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..8 - 0: JS_EXPRESSION_STATEMENT@0..8 - 0: JS_IMPORT_CALL_EXPRESSION@0..8 - 0: IMPORT_KW@0..6 "import" [] [] - 1: L_PAREN@6..7 "(" [] [] - 2: (empty) - 3: R_PAREN@7..8 ")" [] [] - 1: (empty) - 4: EOF@8..9 "" [Newline("\n")] [] --- -error[SyntaxError]: expected an expression, or an assignment but instead found ')' - ┌─ import_call.js:1:8 - │ -1 │ import() - │ ^ Expected an expression, or an assignment here - --- -import() diff --git a/crates/biome_js_parser/test_data/inline/err/import_call_no_arg.rast b/crates/biome_js_parser/test_data/inline/err/import_call_no_arg.rast deleted file mode 100644 index 64c6c99be711..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/import_call_no_arg.rast +++ /dev/null @@ -1,95 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declarations: JsVariableDeclarations { - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - items: JsVariableDeclarationList [ - JsVariableDeclaration { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - excl_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsImportCallExpression { - import_token: IMPORT_KW@8..14 "import" [] [], - l_paren_token: L_PAREN@14..15 "(" [] [], - argument: missing (required), - r_paren_token: R_PAREN@15..16 ")" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@16..17 ";" [] [], - }, - JsExpressionStatement { - expression: JsCallExpression { - callee: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@17..21 "foo" [Newline("\n")] [], - }, - }, - optional_chain_token_token: missing (optional), - type_args: missing (optional), - arguments: JsCallArguments { - l_paren_token: L_PAREN@21..22 "(" [] [], - args: JsCallArgumentList [], - r_paren_token: R_PAREN@22..23 ")" [] [], - }, - }, - semicolon_token: SEMICOLON@23..24 ";" [] [], - }, - ], - eof_token: EOF@24..25 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..25 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..24 - 0: JS_VARIABLE_STATEMENT@0..17 - 0: JS_VARIABLE_DECLARATIONS@0..16 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_LIST@4..16 - 0: JS_VARIABLE_DECLARATION@4..16 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@6..16 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_IMPORT_CALL_EXPRESSION@8..16 - 0: IMPORT_KW@8..14 "import" [] [] - 1: L_PAREN@14..15 "(" [] [] - 2: (empty) - 3: R_PAREN@15..16 ")" [] [] - 1: SEMICOLON@16..17 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@17..24 - 0: JS_CALL_EXPRESSION@17..23 - 0: JS_IDENTIFIER_EXPRESSION@17..21 - 0: JS_REFERENCE_IDENTIFIER@17..21 - 0: IDENT@17..21 "foo" [Newline("\n")] [] - 1: (empty) - 2: (empty) - 3: JS_CALL_ARGUMENTS@21..23 - 0: L_PAREN@21..22 "(" [] [] - 1: JS_CALL_ARGUMENT_LIST@22..22 - 2: R_PAREN@22..23 ")" [] [] - 1: SEMICOLON@23..24 ";" [] [] - 4: EOF@24..25 "" [Newline("\n")] [] --- -error[SyntaxError]: expected an expression, or an assignment but instead found ')' - ┌─ import_call_no_arg.js:1:16 - │ -1 │ let a = import(); - │ ^ Expected an expression, or an assignment here - --- -let a = import(); -foo(); diff --git a/crates/biome_js_parser/test_data/inline/err/spread_attribute_error.rast b/crates/biome_js_parser/test_data/inline/err/spread_attribute_error.rast deleted file mode 100644 index 207af3df864d..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/spread_attribute_error.rast +++ /dev/null @@ -1,292 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declaration: JsVariableDeclaration { - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - declarators: JsVariableDeclaratorList [ - JsVariableDeclarator { - id: JsIdentifierBinding { - name_token: IDENT@4..8 "obj" [] [Whitespace(" ")], - }, - variable_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@8..10 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@10..11 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@11..12 "}" [] [], - }, - }, - }, - ], - }, - semicolon_token: SEMICOLON@12..13 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@13..15 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@15..17 "a" [] [Whitespace(" ")], - }, - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: L_CURLY@17..18 "{" [] [], - dotdotdot_token: DOT3@18..21 "..." [] [], - argument: JsUnknownExpression { - items: [ - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@21..24 "obj" [] [], - }, - }, - COMMA@24..26 "," [] [Whitespace(" ")], - JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@26..31 "other" [] [], - }, - }, - ], - }, - r_curly_token: R_CURLY@31..33 "}" [] [Whitespace(" ")], - }, - ], - slash_token: SLASH@33..34 "/" [] [], - r_angle_token: R_ANGLE@34..35 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@35..36 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@36..38 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@38..40 "a" [] [Whitespace(" ")], - }, - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: missing (required), - dotdotdot_token: DOT3@40..43 "..." [] [], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@43..46 "obj" [] [], - }, - }, - r_curly_token: R_CURLY@46..48 "}" [] [Whitespace(" ")], - }, - ], - slash_token: SLASH@48..49 "/" [] [], - r_angle_token: R_ANGLE@49..50 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@50..51 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@51..53 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@53..55 "a" [] [Whitespace(" ")], - }, - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: L_CURLY@55..56 "{" [] [], - dotdotdot_token: missing (required), - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@56..59 "obj" [] [], - }, - }, - r_curly_token: R_CURLY@59..61 "}" [] [Whitespace(" ")], - }, - ], - slash_token: SLASH@61..62 "/" [] [], - r_angle_token: R_ANGLE@62..63 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@63..64 ";" [] [], - }, - JsExpressionStatement { - expression: JsxTagExpression { - tag: JsxSelfClosingElement { - l_angle_token: L_ANGLE@64..66 "<" [Newline("\n")] [], - name: JsxName { - value_token: JSX_IDENT@66..69 "div" [] [], - }, - attributes: JsxAttributeList [ - JsxSpreadAttribute { - l_curly_token: L_CURLY@69..77 "{" [Newline("\n"), Whitespace(" ")] [], - dotdotdot_token: DOT3@77..80 "..." [] [], - argument: JsObjectExpression { - l_curly_token: L_CURLY@80..81 "{" [] [], - members: JsObjectMemberList [], - r_curly_token: R_CURLY@81..130 "}" [] [Whitespace(" "), Comments("/*\n // @ts-ignor ..."), Whitespace(" "), Comments("/* prettier-ignore */")], - }, - r_curly_token: missing (required), - }, - JsxAttribute { - name: JsxName { - value_token: JSX_IDENT@130..148 "invalidProp" [Newline("\n"), Whitespace(" ")] [], - }, - initializer: JsxAttributeInitializerClause { - eq_token: EQ@148..149 "=" [] [], - value: JsxString { - value_token: JSX_STRING_LITERAL@149..161 "\"HelloWorld\"" [] [], - }, - }, - }, - ], - slash_token: SLASH@161..167 "/" [Newline("\n"), Whitespace(" ")] [], - r_angle_token: R_ANGLE@167..168 ">" [] [], - }, - }, - semicolon_token: SEMICOLON@168..169 ";" [] [], - }, - ], - eof_token: EOF@169..170 "" [Newline("\n")] [], -} - -0: JS_MODULE@0..170 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..169 - 0: JS_VARIABLE_STATEMENT@0..13 - 0: JS_VARIABLE_DECLARATION@0..12 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATOR_LIST@4..12 - 0: JS_VARIABLE_DECLARATOR@4..12 - 0: JS_IDENTIFIER_BINDING@4..8 - 0: IDENT@4..8 "obj" [] [Whitespace(" ")] - 1: (empty) - 2: JS_INITIALIZER_CLAUSE@8..12 - 0: EQ@8..10 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@10..12 - 0: L_CURLY@10..11 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@11..11 - 2: R_CURLY@11..12 "}" [] [] - 1: SEMICOLON@12..13 ";" [] [] - 1: JS_EXPRESSION_STATEMENT@13..36 - 0: JSX_TAG_EXPRESSION@13..35 - 0: JSX_SELF_CLOSING_ELEMENT@13..35 - 0: L_ANGLE@13..15 "<" [Newline("\n")] [] - 1: JSX_NAME@15..17 - 0: JSX_IDENT@15..17 "a" [] [Whitespace(" ")] - 2: JSX_ATTRIBUTE_LIST@17..33 - 0: JSX_SPREAD_ATTRIBUTE@17..33 - 0: L_CURLY@17..18 "{" [] [] - 1: DOT3@18..21 "..." [] [] - 2: JS_UNKNOWN_EXPRESSION@21..31 - 0: JS_IDENTIFIER_EXPRESSION@21..24 - 0: JS_REFERENCE_IDENTIFIER@21..24 - 0: IDENT@21..24 "obj" [] [] - 1: COMMA@24..26 "," [] [Whitespace(" ")] - 2: JS_IDENTIFIER_EXPRESSION@26..31 - 0: JS_REFERENCE_IDENTIFIER@26..31 - 0: IDENT@26..31 "other" [] [] - 3: R_CURLY@31..33 "}" [] [Whitespace(" ")] - 3: SLASH@33..34 "/" [] [] - 4: R_ANGLE@34..35 ">" [] [] - 1: SEMICOLON@35..36 ";" [] [] - 2: JS_EXPRESSION_STATEMENT@36..51 - 0: JSX_TAG_EXPRESSION@36..50 - 0: JSX_SELF_CLOSING_ELEMENT@36..50 - 0: L_ANGLE@36..38 "<" [Newline("\n")] [] - 1: JSX_NAME@38..40 - 0: JSX_IDENT@38..40 "a" [] [Whitespace(" ")] - 2: JSX_ATTRIBUTE_LIST@40..48 - 0: JSX_SPREAD_ATTRIBUTE@40..48 - 0: (empty) - 1: DOT3@40..43 "..." [] [] - 2: JS_IDENTIFIER_EXPRESSION@43..46 - 0: JS_REFERENCE_IDENTIFIER@43..46 - 0: IDENT@43..46 "obj" [] [] - 3: R_CURLY@46..48 "}" [] [Whitespace(" ")] - 3: SLASH@48..49 "/" [] [] - 4: R_ANGLE@49..50 ">" [] [] - 1: SEMICOLON@50..51 ";" [] [] - 3: JS_EXPRESSION_STATEMENT@51..64 - 0: JSX_TAG_EXPRESSION@51..63 - 0: JSX_SELF_CLOSING_ELEMENT@51..63 - 0: L_ANGLE@51..53 "<" [Newline("\n")] [] - 1: JSX_NAME@53..55 - 0: JSX_IDENT@53..55 "a" [] [Whitespace(" ")] - 2: JSX_ATTRIBUTE_LIST@55..61 - 0: JSX_SPREAD_ATTRIBUTE@55..61 - 0: L_CURLY@55..56 "{" [] [] - 1: (empty) - 2: JS_IDENTIFIER_EXPRESSION@56..59 - 0: JS_REFERENCE_IDENTIFIER@56..59 - 0: IDENT@56..59 "obj" [] [] - 3: R_CURLY@59..61 "}" [] [Whitespace(" ")] - 3: SLASH@61..62 "/" [] [] - 4: R_ANGLE@62..63 ">" [] [] - 1: SEMICOLON@63..64 ";" [] [] - 4: JS_EXPRESSION_STATEMENT@64..169 - 0: JSX_TAG_EXPRESSION@64..168 - 0: JSX_SELF_CLOSING_ELEMENT@64..168 - 0: L_ANGLE@64..66 "<" [Newline("\n")] [] - 1: JSX_NAME@66..69 - 0: JSX_IDENT@66..69 "div" [] [] - 2: JSX_ATTRIBUTE_LIST@69..161 - 0: JSX_SPREAD_ATTRIBUTE@69..130 - 0: L_CURLY@69..77 "{" [Newline("\n"), Whitespace(" ")] [] - 1: DOT3@77..80 "..." [] [] - 2: JS_OBJECT_EXPRESSION@80..130 - 0: L_CURLY@80..81 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@81..81 - 2: R_CURLY@81..130 "}" [] [Whitespace(" "), Comments("/*\n // @ts-ignor ..."), Whitespace(" "), Comments("/* prettier-ignore */")] - 3: (empty) - 1: JSX_ATTRIBUTE@130..161 - 0: JSX_NAME@130..148 - 0: JSX_IDENT@130..148 "invalidProp" [Newline("\n"), Whitespace(" ")] [] - 1: JSX_ATTRIBUTE_INITIALIZER_CLAUSE@148..161 - 0: EQ@148..149 "=" [] [] - 1: JSX_STRING@149..161 - 0: JSX_STRING_LITERAL@149..161 "\"HelloWorld\"" [] [] - 3: SLASH@161..167 "/" [Newline("\n"), Whitespace(" ")] [] - 4: R_ANGLE@167..168 ">" [] [] - 1: SEMICOLON@168..169 ";" [] [] - 4: EOF@169..170 "" [Newline("\n")] [] --- -error[SyntaxError]: Comma operator isn't a valid value for a JSX spread argument. - ┌─ spread_attribute_error.jsx:2:8 - │ -2 │ ; - │ ^^^^^^^^^^ - --- -error[SyntaxError]: expected `'{'` but instead found `...` - ┌─ spread_attribute_error.jsx:3:4 - │ -3 │ ; - │ ^^^ unexpected - --- -error[SyntaxError]: expected `...` but instead found `obj` - ┌─ spread_attribute_error.jsx:4:5 - │ -4 │ ; - │ ^^^ unexpected - --- -error[SyntaxError]: expected `'}'` but instead found `invalidProp` - ┌─ spread_attribute_error.jsx:8:7 - │ -8 │ invalidProp="HelloWorld" - │ ^^^^^^^^^^^ unexpected - --- -let obj = {}; -; -; -; -
; diff --git a/crates/biome_js_parser/test_data/inline/err/switch_stmt_double_default.rast b/crates/biome_js_parser/test_data/inline/err/switch_stmt_double_default.rast deleted file mode 100644 index 5f0989672bc4..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/switch_stmt_double_default.rast +++ /dev/null @@ -1,85 +0,0 @@ -JsRoot { - interpreter_token: missing (optional), - directives: [], - statements: [ - JsSwitchStatement { - switch_token: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")], - l_paren_token: L_PAREN@7..8 "(" [] [], - discriminant: JsReferenceIdentifierExpression { - name_token: IDENT@8..11 "foo" [] [], - }, - r_paren_token: R_PAREN@11..13 ")" [] [Whitespace(" ")], - l_curly_token: L_CURLY@13..14 "{" [] [], - cases: [ - JsDefaultClause { - default_token: DEFAULT_KW@14..23 "default" [Whitespace("\n\t")] [], - colon_token: COLON@23..25 ":" [] [Whitespace(" ")], - consequent: [ - JsBlockStatement { - l_curly_token: L_CURLY@25..26 "{" [] [], - statements: [], - r_curly_token: R_CURLY@26..27 "}" [] [], - }, - ], - }, - JsDefaultClause { - default_token: DEFAULT_KW@27..36 "default" [Whitespace("\n\t")] [], - colon_token: COLON@36..38 ":" [] [Whitespace(" ")], - consequent: [ - JsBlockStatement { - l_curly_token: L_CURLY@38..39 "{" [] [], - statements: [], - r_curly_token: R_CURLY@39..40 "}" [] [], - }, - ], - }, - ], - r_curly_token: R_CURLY@40..42 "}" [Whitespace("\n")] [], - }, - ], -} - -0: JS_ROOT@0..43 - 0: (empty) - 1: LIST@0..0 - 2: LIST@0..42 - 0: JS_SWITCH_STATEMENT@0..42 - 0: SWITCH_KW@0..7 "switch" [] [Whitespace(" ")] - 1: L_PAREN@7..8 "(" [] [] - 2: JS_REFERENCE_IDENTIFIER_EXPRESSION@8..11 - 0: IDENT@8..11 "foo" [] [] - 3: R_PAREN@11..13 ")" [] [Whitespace(" ")] - 4: L_CURLY@13..14 "{" [] [] - 5: LIST@14..40 - 0: JS_DEFAULT_CLAUSE@14..27 - 0: DEFAULT_KW@14..23 "default" [Whitespace("\n\t")] [] - 1: COLON@23..25 ":" [] [Whitespace(" ")] - 2: LIST@25..27 - 0: JS_BLOCK_STATEMENT@25..27 - 0: L_CURLY@25..26 "{" [] [] - 1: LIST@26..26 - 2: R_CURLY@26..27 "}" [] [] - 1: JS_DEFAULT_CLAUSE@27..40 - 0: DEFAULT_KW@27..36 "default" [Whitespace("\n\t")] [] - 1: COLON@36..38 ":" [] [Whitespace(" ")] - 2: LIST@38..40 - 0: JS_BLOCK_STATEMENT@38..40 - 0: L_CURLY@38..39 "{" [] [] - 1: LIST@39..39 - 2: R_CURLY@39..40 "}" [] [] - 6: R_CURLY@40..42 "}" [Whitespace("\n")] [] - 3: EOF@42..43 "" [Whitespace("\n")] [] --- -error[SyntaxError]: Multiple default clauses inside of a switch statement are not allowed - ┌─ switch_stmt_double_default.js:3:2 - │ -2 │ default: {} - │ ---------- the first default clause is defined here -3 │ default: {} - │ ^^^^^^^^^^ a second clause here is not allowed - --- -switch (foo) { - default: {} - default: {} -} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.options.json deleted file mode 100644 index 435ed7fb84f9..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.options.json b/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.options.json b/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/ok/metavar.options.json b/crates/biome_js_parser/test_data/inline/ok/metavar.options.json deleted file mode 100644 index 5305a1b4a61b..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/metavar.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "grit_metavariables": true } diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_getter.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr_getter.rast deleted file mode 100644 index 1eaf6c557b03..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_getter.rast +++ /dev/null @@ -1,98 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declarations: JsVariableDeclarations { - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - items: JsVariableDeclarationList [ - JsVariableDeclaration { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "a" [] [Whitespace(" ")], - }, - excl_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsGetterObjectMember { - get_token: GET_KW@9..15 "get" [Whitespace("\n ")] [Whitespace(" ")], - name: JsLiteralMemberName { - value: IDENT@15..18 "foo" [] [], - }, - l_paren_token: L_PAREN@18..19 "(" [] [], - r_paren_token: R_PAREN@19..21 ")" [] [Whitespace(" ")], - return_type: missing (optional), - body: JsFunctionBody { - l_curly_token: L_CURLY@21..22 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@22..33 "return" [Whitespace("\n ")] [Whitespace(" ")], - argument: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@33..36 "foo" [] [], - }, - }, - semicolon_token: SEMICOLON@36..37 ";" [] [], - }, - ], - r_curly_token: R_CURLY@37..40 "}" [Whitespace("\n ")] [], - }, - }, - ], - r_curly_token: R_CURLY@40..42 "}" [Whitespace("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@42..43 "" [Whitespace("\n")] [], -} - -0: JS_MODULE@0..43 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..42 - 0: JS_VARIABLE_STATEMENT@0..42 - 0: JS_VARIABLE_DECLARATIONS@0..42 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_LIST@4..42 - 0: JS_VARIABLE_DECLARATION@4..42 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "a" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@6..42 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..42 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..40 - 0: JS_GETTER_OBJECT_MEMBER@9..40 - 0: GET_KW@9..15 "get" [Whitespace("\n ")] [Whitespace(" ")] - 1: JS_LITERAL_MEMBER_NAME@15..18 - 0: IDENT@15..18 "foo" [] [] - 2: L_PAREN@18..19 "(" [] [] - 3: R_PAREN@19..21 ")" [] [Whitespace(" ")] - 4: (empty) - 5: JS_FUNCTION_BODY@21..40 - 0: L_CURLY@21..22 "{" [] [] - 1: JS_DIRECTIVE_LIST@22..22 - 2: JS_STATEMENT_LIST@22..37 - 0: JS_RETURN_STATEMENT@22..37 - 0: RETURN_KW@22..33 "return" [Whitespace("\n ")] [Whitespace(" ")] - 1: JS_IDENTIFIER_EXPRESSION@33..36 - 0: JS_REFERENCE_IDENTIFIER@33..36 - 0: IDENT@33..36 "foo" [] [] - 2: SEMICOLON@36..37 ";" [] [] - 3: R_CURLY@37..40 "}" [Whitespace("\n ")] [] - 2: R_CURLY@40..42 "}" [Whitespace("\n")] [] - 1: (empty) - 4: EOF@42..43 "" [Whitespace("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_setter.rast b/crates/biome_js_parser/test_data/inline/ok/object_expr_setter.rast deleted file mode 100644 index 0d8f7af01daf..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_setter.rast +++ /dev/null @@ -1,108 +0,0 @@ -JsModule { - bom_token: missing (optional), - interpreter_token: missing (optional), - directives: JsDirectiveList [], - items: JsModuleItemList [ - JsVariableStatement { - declarations: JsVariableDeclarations { - kind: LET_KW@0..4 "let" [] [Whitespace(" ")], - items: JsVariableDeclarationList [ - JsVariableDeclaration { - id: JsIdentifierBinding { - name_token: IDENT@4..6 "b" [] [Whitespace(" ")], - }, - excl_token: missing (optional), - type_annotation: missing (optional), - initializer: JsInitializerClause { - eq_token: EQ@6..8 "=" [] [Whitespace(" ")], - expression: JsObjectExpression { - l_curly_token: L_CURLY@8..9 "{" [] [], - members: JsObjectMemberList [ - JsSetterObjectMember { - set_token: SET_KW@9..15 "set" [Whitespace("\n ")] [Whitespace(" ")], - name: JsComputedMemberName { - l_brack_token: L_BRACK@15..16 "[" [] [], - expression: JsIdentifierExpression { - name: JsReferenceIdentifier { - value_token: IDENT@16..19 "foo" [] [], - }, - }, - r_brack_token: R_BRACK@19..20 "]" [] [], - }, - l_paren_token: L_PAREN@20..21 "(" [] [], - parameter: JsIdentifierBinding { - name_token: IDENT@21..24 "bar" [] [], - }, - r_paren_token: R_PAREN@24..26 ")" [] [Whitespace(" ")], - body: JsFunctionBody { - l_curly_token: L_CURLY@26..27 "{" [] [], - directives: JsDirectiveList [], - statements: JsStatementList [ - JsReturnStatement { - return_token: RETURN_KW@27..39 "return" [Whitespace("\n ")] [Whitespace(" ")], - argument: JsNumberLiteralExpression { - value_token: JS_NUMBER_LITERAL@39..40 "5" [] [], - }, - semicolon_token: SEMICOLON@40..41 ";" [] [], - }, - ], - r_curly_token: R_CURLY@41..44 "}" [Whitespace("\n ")] [], - }, - }, - ], - r_curly_token: R_CURLY@44..46 "}" [Whitespace("\n")] [], - }, - }, - }, - ], - }, - semicolon_token: missing (optional), - }, - ], - eof_token: EOF@46..47 "" [Whitespace("\n")] [], -} - -0: JS_MODULE@0..47 - 0: (empty) - 1: (empty) - 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_MODULE_ITEM_LIST@0..46 - 0: JS_VARIABLE_STATEMENT@0..46 - 0: JS_VARIABLE_DECLARATIONS@0..46 - 0: LET_KW@0..4 "let" [] [Whitespace(" ")] - 1: JS_VARIABLE_DECLARATION_LIST@4..46 - 0: JS_VARIABLE_DECLARATION@4..46 - 0: JS_IDENTIFIER_BINDING@4..6 - 0: IDENT@4..6 "b" [] [Whitespace(" ")] - 1: (empty) - 2: (empty) - 3: JS_INITIALIZER_CLAUSE@6..46 - 0: EQ@6..8 "=" [] [Whitespace(" ")] - 1: JS_OBJECT_EXPRESSION@8..46 - 0: L_CURLY@8..9 "{" [] [] - 1: JS_OBJECT_MEMBER_LIST@9..44 - 0: JS_SETTER_OBJECT_MEMBER@9..44 - 0: SET_KW@9..15 "set" [Whitespace("\n ")] [Whitespace(" ")] - 1: JS_COMPUTED_MEMBER_NAME@15..20 - 0: L_BRACK@15..16 "[" [] [] - 1: JS_IDENTIFIER_EXPRESSION@16..19 - 0: JS_REFERENCE_IDENTIFIER@16..19 - 0: IDENT@16..19 "foo" [] [] - 2: R_BRACK@19..20 "]" [] [] - 2: L_PAREN@20..21 "(" [] [] - 3: JS_IDENTIFIER_BINDING@21..24 - 0: IDENT@21..24 "bar" [] [] - 4: R_PAREN@24..26 ")" [] [Whitespace(" ")] - 5: JS_FUNCTION_BODY@26..44 - 0: L_CURLY@26..27 "{" [] [] - 1: JS_DIRECTIVE_LIST@27..27 - 2: JS_STATEMENT_LIST@27..41 - 0: JS_RETURN_STATEMENT@27..41 - 0: RETURN_KW@27..39 "return" [Whitespace("\n ")] [Whitespace(" ")] - 1: JS_NUMBER_LITERAL_EXPRESSION@39..40 - 0: JS_NUMBER_LITERAL@39..40 "5" [] [] - 2: SEMICOLON@40..41 ";" [] [] - 3: R_CURLY@41..44 "}" [Whitespace("\n ")] [] - 2: R_CURLY@44..46 "}" [Whitespace("\n")] [] - 1: (empty) - 4: EOF@46..47 "" [Whitespace("\n")] [] diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.options.json b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.options.json b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.options.json b/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.options.json b/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.options.json deleted file mode 100644 index e58b2dfa5dd7..000000000000 --- a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.options.json +++ /dev/null @@ -1 +0,0 @@ -{ "parse_class_parameter_decorators": true } \ No newline at end of file diff --git a/crates/biome_js_parser/test_data/inline/err/abstract_class_in_js.js b/crates/biome_js_parser/tests/js_test_suite/error/abstract_class_in_js.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/abstract_class_in_js.js rename to crates/biome_js_parser/tests/js_test_suite/error/abstract_class_in_js.js diff --git a/crates/biome_js_parser/test_data/inline/err/abstract_class_in_js.rast b/crates/biome_js_parser/tests/js_test_suite/error/abstract_class_in_js.js.snap similarity index 91% rename from crates/biome_js_parser/test_data/inline/err/abstract_class_in_js.rast rename to crates/biome_js_parser/tests/js_test_suite/error/abstract_class_in_js.js.snap index 619d24c25332..eb4c1f7adb8d 100644 --- a/crates/biome_js_parser/test_data/inline/err/abstract_class_in_js.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/abstract_class_in_js.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +abstract class A {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -19,7 +34,11 @@ JsModule { ], eof_token: EOF@19..20 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..20 0: (empty) 1: (empty) @@ -35,7 +54,12 @@ JsModule { 5: JS_CLASS_MEMBER_LIST@18..18 6: R_CURLY@18..19 "}" [] [] 4: EOF@19..20 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` abstract_class_in_js.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × abstract classes are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -46,5 +70,4 @@ abstract_class_in_js.js:1:1 parse ━━━━━━━━━━━━━━━ i TypeScript only syntax --- -abstract class A {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_err.js b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/array_assignment_target_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/array_assignment_target_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_err.js.snap index c5be0277b406..e768396d12f1 100644 --- a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_err.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +[a a, ++b, ] = test; +[a, c, ...rest,] = test; +[a = , = "test"] = test; +[[a b] [c]]= test; +[a: b] = c + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -211,7 +230,11 @@ JsModule { ], eof_token: EOF@100..101 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..101 0: (empty) 1: (empty) @@ -343,7 +366,12 @@ JsModule { 0: IDENT@99..100 "c" [] [] 1: (empty) 4: EOF@100..101 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` array_assignment_target_err.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `a` @@ -355,7 +383,6 @@ array_assignment_target_err.js:1:4 parse ━━━━━━━━━━━━━ i Remove a --- array_assignment_target_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `++b` @@ -367,7 +394,6 @@ array_assignment_target_err.js:1:7 parse ━━━━━━━━━━━━━ i This expression cannot be assigned to --- array_assignment_target_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element may not have a trailing comma @@ -394,7 +420,6 @@ array_assignment_target_err.js:2:15 parse ━━━━━━━━━━━━ 3 │ [a = , = "test"] = test; 4 │ [[a b] [c]]= test; --- array_assignment_target_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found ','. @@ -415,7 +440,6 @@ array_assignment_target_err.js:3:6 parse ━━━━━━━━━━━━━ 4 │ [[a b] [c]]= test; 5 │ [a: b] = c --- array_assignment_target_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an assignment target, a rest element, or a comma but instead found '='. @@ -436,7 +460,6 @@ array_assignment_target_err.js:3:8 parse ━━━━━━━━━━━━━ 4 │ [[a b] [c]]= test; 5 │ [a: b] = c --- array_assignment_target_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -466,7 +489,6 @@ array_assignment_target_err.js:3:16 parse ━━━━━━━━━━━━ 4 │ [[a b] [c]]= test; 5 │ [a: b] = c --- array_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `b` @@ -480,7 +502,6 @@ array_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━━ i Remove b --- array_assignment_target_err.js:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `:` @@ -493,9 +514,4 @@ array_assignment_target_err.js:5:3 parse ━━━━━━━━━━━━━ i Remove : --- -[a a, ++b, ] = test; -[a, c, ...rest,] = test; -[a = , = "test"] = test; -[[a b] [c]]= test; -[a: b] = c +``` diff --git a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_rest_err.js b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_rest_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/array_assignment_target_rest_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_rest_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_rest_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_rest_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/array_assignment_target_rest_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_rest_err.js.snap index f1245a107dd7..3d496cc0c11a 100644 --- a/crates/biome_js_parser/test_data/inline/err/array_assignment_target_rest_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/array_assignment_target_rest_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +([ ... ] = a); +([ ...c = "default" ] = a); +([ ...rest, other_assignment ] = a); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -110,7 +127,11 @@ JsModule { ], eof_token: EOF@79..80 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..80 0: (empty) 1: (empty) @@ -177,7 +198,12 @@ JsModule { 2: R_PAREN@77..78 ")" [] [] 1: SEMICOLON@78..79 ";" [] [] 4: EOF@79..80 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` array_assignment_target_rest_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, or an assignment target but instead found ''. @@ -194,7 +220,6 @@ array_assignment_target_rest_err.js:1:7 parse ━━━━━━━━━━━ 2 │ ([ ...c = "default" ] = a); 3 │ ([ ...rest, other_assignment ] = a); --- array_assignment_target_rest_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element cannot have a default @@ -221,7 +246,6 @@ array_assignment_target_rest_err.js:2:9 parse ━━━━━━━━━━━ 3 │ ([ ...rest, other_assignment ] = a); 4 │ --- array_assignment_target_rest_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element must be the last element @@ -234,7 +258,4 @@ array_assignment_target_rest_err.js:3:4 parse ━━━━━━━━━━━ i Move the rest element to the end of the pattern, right before the closing ']' --- -([ ... ] = a); -([ ...c = "default" ] = a); -([ ...rest, other_assignment ] = a); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/array_binding_err.js b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/array_binding_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/array_binding_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/array_binding_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/array_binding_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/array_binding_err.js.snap index 6e342ec9d924..ec3dfab7e0d8 100644 --- a/crates/biome_js_parser/test_data/inline/err/array_binding_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_err.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let [a b] = [1, 2]; +let [="default"] = [1, 2]; +let ["default"] = [1, 2]; +let [[c ] = []; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -180,7 +198,11 @@ JsModule { ], eof_token: EOF@88..89 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..89 0: (empty) 1: (empty) @@ -296,7 +318,12 @@ JsModule { 2: (empty) 1: SEMICOLON@87..88 ";" [] [] 4: EOF@88..89 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` array_binding_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `b` @@ -308,7 +335,6 @@ array_binding_err.js:1:8 parse ━━━━━━━━━━━━━━━━ i Remove b --- array_binding_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, an object pattern, an array pattern, or a rest pattern but instead found '='. @@ -327,7 +353,6 @@ array_binding_err.js:2:6 parse ━━━━━━━━━━━━━━━━ 3 │ let ["default"] = [1, 2]; 4 │ let [[c ] = []; --- array_binding_err.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -354,7 +379,6 @@ array_binding_err.js:2:16 parse ━━━━━━━━━━━━━━━━ 3 │ let ["default"] = [1, 2]; 4 │ let [[c ] = []; --- array_binding_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, an object pattern, an array pattern, or a rest pattern but instead found '"default"'. @@ -375,7 +399,6 @@ array_binding_err.js:3:6 parse ━━━━━━━━━━━━━━━━ 4 │ let [[c ] = []; 5 │ --- array_binding_err.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `;` @@ -388,7 +411,6 @@ array_binding_err.js:4:15 parse ━━━━━━━━━━━━━━━━ i Remove ; --- array_binding_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Object and Array patterns require initializers. @@ -401,8 +423,4 @@ array_binding_err.js:4:5 parse ━━━━━━━━━━━━━━━━ i This pattern is declared, but it is not given an initialized value. --- -let [a b] = [1, 2]; -let [="default"] = [1, 2]; -let ["default"] = [1, 2]; -let [[c ] = []; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/array_binding_rest_err.js b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_rest_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/array_binding_rest_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/array_binding_rest_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/array_binding_rest_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_rest_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/array_binding_rest_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/array_binding_rest_err.js.snap index cd1b6de51a3e..a182cac234c8 100644 --- a/crates/biome_js_parser/test_data/inline/err/array_binding_rest_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/array_binding_rest_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let [ ... ] = a; +let [ ...c = "default" ] = a; +let [ ...rest, other_assignment ] = a; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -133,7 +150,11 @@ JsModule { ], eof_token: EOF@85..86 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..86 0: (empty) 1: (empty) @@ -205,7 +226,12 @@ JsModule { 0: IDENT@83..84 "a" [] [] 1: SEMICOLON@84..85 ";" [] [] 4: EOF@85..86 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` array_binding_rest_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern but instead found ''. @@ -222,7 +248,6 @@ array_binding_rest_err.js:1:10 parse ━━━━━━━━━━━━━━ 2 │ let [ ...c = "default" ] = a; 3 │ let [ ...rest, other_assignment ] = a; --- array_binding_rest_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element cannot have a default @@ -249,7 +274,6 @@ array_binding_rest_err.js:2:12 parse ━━━━━━━━━━━━━━ 3 │ let [ ...rest, other_assignment ] = a; 4 │ --- array_binding_rest_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element must be the last element @@ -262,7 +286,4 @@ array_binding_rest_err.js:3:7 parse ━━━━━━━━━━━━━━ i Move the rest element to the end of the pattern, right before the closing ']' --- -let [ ... ] = a; -let [ ...c = "default" ] = a; -let [ ...rest, other_assignment ] = a; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/array_expr_incomplete.js b/crates/biome_js_parser/tests/js_test_suite/error/array_expr_incomplete.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/array_expr_incomplete.js rename to crates/biome_js_parser/tests/js_test_suite/error/array_expr_incomplete.js diff --git a/crates/biome_js_parser/test_data/inline/err/array_expr_incomplete.rast b/crates/biome_js_parser/tests/js_test_suite/error/array_expr_incomplete.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/array_expr_incomplete.rast rename to crates/biome_js_parser/tests/js_test_suite/error/array_expr_incomplete.js.snap index b26eebaafc67..4d3d74438479 100644 --- a/crates/biome_js_parser/test_data/inline/err/array_expr_incomplete.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/array_expr_incomplete.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = [ + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -29,7 +44,11 @@ JsModule { ], eof_token: EOF@9..10 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..10 0: (empty) 1: (empty) @@ -52,7 +71,12 @@ JsModule { 2: (empty) 1: (empty) 4: EOF@9..10 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` array_expr_incomplete.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `]` but instead the file ends @@ -67,5 +91,4 @@ array_expr_incomplete.js:2:1 parse ━━━━━━━━━━━━━━━ > 2 │ │ --- -let a = [ +``` diff --git a/crates/biome_js_parser/test_data/inline/err/arrow_escaped_async.js b/crates/biome_js_parser/tests/js_test_suite/error/arrow_escaped_async.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/arrow_escaped_async.js rename to crates/biome_js_parser/tests/js_test_suite/error/arrow_escaped_async.js diff --git a/crates/biome_js_parser/test_data/inline/err/arrow_escaped_async.rast b/crates/biome_js_parser/tests/js_test_suite/error/arrow_escaped_async.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/arrow_escaped_async.rast rename to crates/biome_js_parser/tests/js_test_suite/error/arrow_escaped_async.js.snap index e3d23df97ae1..5d783ff75d4c 100644 --- a/crates/biome_js_parser/test_data/inline/err/arrow_escaped_async.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/arrow_escaped_async.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +\u0061sync () => {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -26,7 +41,11 @@ JsModule { ], eof_token: EOF@19..20 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..20 0: (empty) 1: (empty) @@ -47,7 +66,12 @@ JsModule { 3: R_CURLY@18..19 "}" [] [] 1: (empty) 4: EOF@19..20 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` arrow_escaped_async.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'async' keyword cannot contain escape character. @@ -56,5 +80,4 @@ arrow_escaped_async.js:1:1 parse ━━━━━━━━━━━━━━━ │ ^^^^^^^^^^ 2 │ --- -\u0061sync () => {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js diff --git a/crates/biome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js.snap index bf1ad90f0d24..c2a82af861c6 100644 --- a/crates/biome_js_parser/test_data/inline/err/arrow_rest_in_expr_in_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/arrow_rest_in_expr_in_initializer.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ((...a = "b" in {}) => {};;) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -61,7 +76,11 @@ JsModule { ], eof_token: EOF@35..36 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..36 0: (empty) 1: (empty) @@ -109,7 +128,12 @@ JsModule { 1: JS_STATEMENT_LIST@34..34 2: R_CURLY@34..35 "}" [] [] 4: EOF@35..36 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` arrow_rest_in_expr_in_initializer.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest elements may not have default initializers @@ -118,5 +142,4 @@ arrow_rest_in_expr_in_initializer.js:1:12 parse ━━━━━━━━━━ │ ^^^^^^^^^^^ 2 │ --- -for ((...a = "b" in {}) => {};;) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/assign_eval_or_arguments.js b/crates/biome_js_parser/tests/js_test_suite/error/assign_eval_or_arguments.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/assign_eval_or_arguments.js rename to crates/biome_js_parser/tests/js_test_suite/error/assign_eval_or_arguments.js diff --git a/crates/biome_js_parser/test_data/inline/err/assign_eval_or_arguments.rast b/crates/biome_js_parser/tests/js_test_suite/error/assign_eval_or_arguments.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/assign_eval_or_arguments.rast rename to crates/biome_js_parser/tests/js_test_suite/error/assign_eval_or_arguments.js.snap index 835ede934d37..9e868929b002 100644 --- a/crates/biome_js_parser/test_data/inline/err/assign_eval_or_arguments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/assign_eval_or_arguments.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +eval = 0 +eval ??= 2 +eval *= 4 +arguments = "foo" +arguments ||= "baz" +({ eval } = o) +({ foo: { eval }}) = o + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -156,7 +177,11 @@ JsModule { ], eof_token: EOF@105..106 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..106 0: (empty) 1: (empty) @@ -247,7 +272,12 @@ JsModule { 0: IDENT@104..105 "o" [] [] 1: (empty) 4: EOF@105..106 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` assign_eval_or_arguments.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode @@ -257,7 +287,6 @@ assign_eval_or_arguments.js:1:1 parse ━━━━━━━━━━━━━━ 2 │ eval ??= 2 3 │ eval *= 4 --- assign_eval_or_arguments.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode @@ -268,7 +297,6 @@ assign_eval_or_arguments.js:2:1 parse ━━━━━━━━━━━━━━ 3 │ eval *= 4 4 │ arguments = "foo" --- assign_eval_or_arguments.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode @@ -280,7 +308,6 @@ assign_eval_or_arguments.js:3:1 parse ━━━━━━━━━━━━━━ 4 │ arguments = "foo" 5 │ arguments ||= "baz" --- assign_eval_or_arguments.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `arguments` as an identifier in strict mode @@ -292,7 +319,6 @@ assign_eval_or_arguments.js:4:1 parse ━━━━━━━━━━━━━━ 5 │ arguments ||= "baz" 6 │ ({ eval } = o) --- assign_eval_or_arguments.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `arguments` as an identifier in strict mode @@ -304,7 +330,6 @@ assign_eval_or_arguments.js:5:1 parse ━━━━━━━━━━━━━━ 6 │ ({ eval } = o) 7 │ ({ foo: { eval }}) = o --- assign_eval_or_arguments.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode @@ -316,7 +341,6 @@ assign_eval_or_arguments.js:6:4 parse ━━━━━━━━━━━━━━ 7 │ ({ foo: { eval }}) = o 8 │ --- assign_eval_or_arguments.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `"baz" @@ -334,11 +358,4 @@ assign_eval_or_arguments.js:5:15 parse ━━━━━━━━━━━━━ i This expression cannot be assigned to --- -eval = 0 -eval ??= 2 -eval *= 4 -arguments = "foo" -arguments ||= "baz" -({ eval } = o) -({ foo: { eval }}) = o +``` diff --git a/crates/biome_js_parser/test_data/inline/err/assign_expr_left.js b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_left.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/assign_expr_left.js rename to crates/biome_js_parser/tests/js_test_suite/error/assign_expr_left.js diff --git a/crates/biome_js_parser/test_data/inline/err/assign_expr_left.rast b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_left.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/assign_expr_left.rast rename to crates/biome_js_parser/tests/js_test_suite/error/assign_expr_left.js.snap index 64551effcd87..3c26c5345da2 100644 --- a/crates/biome_js_parser/test_data/inline/err/assign_expr_left.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_left.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +( = foo); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -30,7 +45,11 @@ JsModule { ], eof_token: EOF@9..10 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..10 0: (empty) 1: (empty) @@ -52,7 +71,12 @@ JsModule { 2: JS_EMPTY_STATEMENT@8..9 0: SEMICOLON@8..9 ";" [] [] 4: EOF@9..10 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` assign_expr_left.js:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `=` @@ -63,7 +87,6 @@ assign_expr_left.js:1:3 parse ━━━━━━━━━━━━━━━━ i Remove = --- assign_expr_left.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -84,5 +107,4 @@ assign_expr_left.js:1:8 parse ━━━━━━━━━━━━━━━━ │ ^^^^^^^^ 2 │ --- -( = foo); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/assign_expr_right.js b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_right.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/assign_expr_right.js rename to crates/biome_js_parser/tests/js_test_suite/error/assign_expr_right.js diff --git a/crates/biome_js_parser/test_data/inline/err/assign_expr_right.rast b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_right.js.snap similarity index 91% rename from crates/biome_js_parser/test_data/inline/err/assign_expr_right.rast rename to crates/biome_js_parser/tests/js_test_suite/error/assign_expr_right.js.snap index 57700cc4ef04..6f76f0bc2b0a 100644 --- a/crates/biome_js_parser/test_data/inline/err/assign_expr_right.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/assign_expr_right.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(foo = ); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -20,7 +35,11 @@ JsModule { ], eof_token: EOF@9..10 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..10 0: (empty) 1: (empty) @@ -37,7 +56,12 @@ JsModule { 2: R_PAREN@7..8 ")" [] [] 1: SEMICOLON@8..9 ";" [] [] 4: EOF@9..10 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` assign_expr_right.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found ')'. @@ -52,5 +76,4 @@ assign_expr_right.js:1:8 parse ━━━━━━━━━━━━━━━━ │ ^ 2 │ --- -(foo = ); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.js b/crates/biome_js_parser/tests/js_test_suite/error/async_arrow_expr_await_parameter.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.js rename to crates/biome_js_parser/tests/js_test_suite/error/async_arrow_expr_await_parameter.js diff --git a/crates/biome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast b/crates/biome_js_parser/tests/js_test_suite/error/async_arrow_expr_await_parameter.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast rename to crates/biome_js_parser/tests/js_test_suite/error/async_arrow_expr_await_parameter.js.snap index cd9e84552237..a8b68953859c 100644 --- a/crates/biome_js_parser/test_data/inline/err/async_arrow_expr_await_parameter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/async_arrow_expr_await_parameter.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = async await => {} +async() => { (a = await) => {} }; +async() => { (a = await 10) => {} }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -164,7 +181,11 @@ JsModule { ], eof_token: EOF@96..97 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..97 0: (empty) 1: (empty) @@ -282,7 +303,12 @@ JsModule { 3: R_CURLY@94..95 "}" [] [] 1: SEMICOLON@95..96 ";" [] [] 4: EOF@96..97 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` async_arrow_expr_await_parameter.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context @@ -292,7 +318,6 @@ async_arrow_expr_await_parameter.js:1:15 parse ━━━━━━━━━━━ 2 │ async() => { (a = await) => {} }; 3 │ async() => { (a = await 10) => {} }; --- async_arrow_expr_await_parameter.js:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context @@ -303,7 +328,6 @@ async_arrow_expr_await_parameter.js:2:19 parse ━━━━━━━━━━━ 3 │ async() => { (a = await 10) => {} }; 4 │ --- async_arrow_expr_await_parameter.js:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `await` is only allowed within async functions and at the top levels of modules. @@ -314,7 +338,4 @@ async_arrow_expr_await_parameter.js:3:19 parse ━━━━━━━━━━━ │ ^^^^^ 4 │ --- -let a = async await => {} -async() => { (a = await) => {} }; -async() => { (a = await 10) => {} }; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/error/async_or_generator_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/error/async_or_generator_in_single_statement_context.js diff --git a/crates/biome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.rast b/crates/biome_js_parser/tests/js_test_suite/error/async_or_generator_in_single_statement_context.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.rast rename to crates/biome_js_parser/tests/js_test_suite/error/async_or_generator_in_single_statement_context.js.snap index ff89b061b838..b771047a62fb 100644 --- a/crates/biome_js_parser/test_data/inline/err/async_or_generator_in_single_statement_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/async_or_generator_in_single_statement_context.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) async function t() {} +if (true) function* t() {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -64,7 +80,11 @@ JsModule { ], eof_token: EOF@58..59 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..59 0: (empty) 1: (empty) @@ -113,7 +133,12 @@ JsModule { 3: R_CURLY@57..58 "}" [] [] 5: (empty) 4: EOF@58..59 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` async_or_generator_in_single_statement_context.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `async` and generator functions can only be declared at top level or inside a block @@ -123,7 +148,6 @@ async_or_generator_in_single_statement_context.js:1:11 parse ━━━━━━ 2 │ if (true) function* t() {} 3 │ --- async_or_generator_in_single_statement_context.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `async` and generator functions can only be declared at top level or inside a block @@ -133,6 +157,4 @@ async_or_generator_in_single_statement_context.js:2:11 parse ━━━━━━ │ ^^^^^^^^^^^^^^^^ 3 │ --- -if (true) async function t() {} -if (true) function* t() {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_module.js b/crates/biome_js_parser/tests/js_test_suite/error/await_in_module.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/await_in_module.js rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_module.js diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_module.rast b/crates/biome_js_parser/tests/js_test_suite/error/await_in_module.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/await_in_module.rast rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_module.js.snap index 8dd0dab58fbe..dc065b9c1bae 100644 --- a/crates/biome_js_parser/test_data/inline/err/await_in_module.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_in_module.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let await = 10; +console.log(await); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -57,7 +73,11 @@ JsModule { ], eof_token: EOF@35..36 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..36 0: (empty) 1: (empty) @@ -97,7 +117,12 @@ JsModule { 2: R_PAREN@33..34 ")" [] [] 1: SEMICOLON@34..35 ";" [] [] 4: EOF@35..36 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` await_in_module.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context @@ -107,7 +132,6 @@ await_in_module.js:1:5 parse ━━━━━━━━━━━━━━━━━ 2 │ console.log(await); 3 │ --- await_in_module.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an unary expression but instead found ')'. @@ -124,6 +148,4 @@ await_in_module.js:2:18 parse ━━━━━━━━━━━━━━━━ │ ^ 3 │ --- -let await = 10; -console.log(await); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_non_async_function.js b/crates/biome_js_parser/tests/js_test_suite/error/await_in_non_async_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/await_in_non_async_function.js rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_non_async_function.js diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_non_async_function.rast b/crates/biome_js_parser/tests/js_test_suite/error/await_in_non_async_function.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/await_in_non_async_function.rast rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_non_async_function.js.snap index b7e10f662f92..cf20525a1acf 100644 --- a/crates/biome_js_parser/test_data/inline/err/await_in_non_async_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_in_non_async_function.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function test() { await 10; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -39,7 +54,11 @@ JsModule { ], eof_token: EOF@29..30 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..30 0: (empty) 1: (empty) @@ -69,7 +88,12 @@ JsModule { 1: SEMICOLON@26..28 ";" [] [Whitespace(" ")] 3: R_CURLY@28..29 "}" [] [] 4: EOF@29..30 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` await_in_non_async_function.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `await` is only allowed within async functions and at the top levels of modules. @@ -78,5 +102,4 @@ await_in_non_async_function.js:1:19 parse ━━━━━━━━━━━━ │ ^^^^^ 2 │ --- -function test() { await 10; } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_parameter_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/await_in_parameter_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/await_in_parameter_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_parameter_initializer.js diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_parameter_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/error/await_in_parameter_initializer.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/await_in_parameter_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_parameter_initializer.js.snap index 92d3efd25fab..92c174c5facc 100644 --- a/crates/biome_js_parser/test_data/inline/err/await_in_parameter_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_in_parameter_initializer.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +async function test(a = await b()) {} +function test2(a = await b()) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -110,7 +126,11 @@ JsModule { ], eof_token: EOF@70..71 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..71 0: (empty) 1: (empty) @@ -191,7 +211,12 @@ JsModule { 2: JS_STATEMENT_LIST@69..69 3: R_CURLY@69..70 "}" [] [] 4: EOF@70..71 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` await_in_parameter_initializer.js:1:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `await` is only allowed within async functions and at the top levels of modules. @@ -201,7 +226,6 @@ await_in_parameter_initializer.js:1:25 parse ━━━━━━━━━━━ 2 │ function test2(a = await b()) {} 3 │ --- await_in_parameter_initializer.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `await` is only allowed within async functions and at the top levels of modules. @@ -211,6 +235,4 @@ await_in_parameter_initializer.js:2:20 parse ━━━━━━━━━━━ │ ^^^^^ 3 │ --- -async function test(a = await b()) {} -function test2(a = await b()) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.js b/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.js rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs.snap new file mode 100644 index 000000000000..ed52e738c20b --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.cjs.snap @@ -0,0 +1,175 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +class A { static { await; } } +class B { static { await 10; } } + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@16..18 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsStaticInitializationBlockClassMember { + static_token: STATIC_KW@20..27 "static" [] [Whitespace(" ")], + l_curly_token: L_CURLY@27..29 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@29..34 "await" [] [], + ], + }, + ], + }, + semicolon_token: SEMICOLON@34..36 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@36..38 "}" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@39..46 "class" [Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@46..48 "B" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@48..50 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsStaticInitializationBlockClassMember { + static_token: STATIC_KW@50..57 "static" [] [Whitespace(" ")], + l_curly_token: L_CURLY@57..59 "{" [] [Whitespace(" ")], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + AWAIT_KW@59..65 "await" [] [Whitespace(" ")], + JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@65..67 "10" [] [], + }, + ], + }, + semicolon_token: SEMICOLON@67..69 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@69..71 "}" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@71..72 "}" [] [], + }, + ], + eof_token: EOF@72..73 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..73 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..72 + 0: JS_CLASS_DECLARATION@0..39 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@16..18 + 0: IDENT@16..18 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@20..38 + 0: JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER@20..38 + 0: STATIC_KW@20..27 "static" [] [Whitespace(" ")] + 1: L_CURLY@27..29 "{" [] [Whitespace(" ")] + 2: JS_STATEMENT_LIST@29..36 + 0: JS_EXPRESSION_STATEMENT@29..36 + 0: JS_BOGUS_EXPRESSION@29..34 + 0: JS_BOGUS@29..34 + 0: IDENT@29..34 "await" [] [] + 1: SEMICOLON@34..36 ";" [] [Whitespace(" ")] + 3: R_CURLY@36..38 "}" [] [Whitespace(" ")] + 9: R_CURLY@38..39 "}" [] [] + 1: JS_CLASS_DECLARATION@39..72 + 0: JS_DECORATOR_LIST@39..39 + 1: (empty) + 2: CLASS_KW@39..46 "class" [Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@46..48 + 0: IDENT@46..48 "B" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@48..50 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@50..71 + 0: JS_STATIC_INITIALIZATION_BLOCK_CLASS_MEMBER@50..71 + 0: STATIC_KW@50..57 "static" [] [Whitespace(" ")] + 1: L_CURLY@57..59 "{" [] [Whitespace(" ")] + 2: JS_STATEMENT_LIST@59..69 + 0: JS_EXPRESSION_STATEMENT@59..69 + 0: JS_BOGUS_EXPRESSION@59..67 + 0: AWAIT_KW@59..65 "await" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@65..67 + 0: JS_NUMBER_LITERAL@65..67 "10" [] [] + 1: SEMICOLON@67..69 ";" [] [Whitespace(" ")] + 3: R_CURLY@69..71 "}" [] [Whitespace(" ")] + 9: R_CURLY@71..72 "}" [] [] + 4: EOF@72..73 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +await_in_static_initialization_block_member.cjs:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of `await` as an identifier in an async context + + 1 │ // SCRIPT + > 2 │ class A { static { await; } } + │ ^^^^^ + 3 │ class B { static { await 10; } } + 4 │ + +await_in_static_initialization_block_member.cjs:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `await` is only allowed within async functions and at the top levels of modules. + + 1 │ // SCRIPT + 2 │ class A { static { await; } } + > 3 │ class B { static { await 10; } } + │ ^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.rast b/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.rast rename to crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.js.snap index 3480e024cd27..0c2dff862294 100644 --- a/crates/biome_js_parser/test_data/inline/err/await_in_static_initialization_block_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_in_static_initialization_block_member.js.snap @@ -1,8 +1,25 @@ -JsScript { +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +class A { static { await; } } +class B { static { await 10; } } + +``` + + +## AST + +``` +JsModule { bom_token: missing (optional), interpreter_token: missing (optional), directives: JsDirectiveList [], - statements: JsStatementList [ + items: JsModuleItemList [ JsClassDeclaration { decorators: JsDecoratorList [], abstract_token: missing (optional), @@ -73,12 +90,16 @@ JsScript { ], eof_token: EOF@72..73 "" [Newline("\n")] [], } +``` -0: JS_SCRIPT@0..73 +## CST + +``` +0: JS_MODULE@0..73 0: (empty) 1: (empty) 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..72 + 3: JS_MODULE_ITEM_LIST@0..72 0: JS_CLASS_DECLARATION@0..39 0: JS_DECORATOR_LIST@0..0 1: (empty) @@ -125,7 +146,12 @@ JsScript { 3: R_CURLY@69..71 "}" [] [Whitespace(" ")] 9: R_CURLY@71..72 "}" [] [] 4: EOF@72..73 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` await_in_static_initialization_block_member.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context @@ -136,7 +162,6 @@ await_in_static_initialization_block_member.js:2:20 parse ━━━━━━━ 3 │ class B { static { await 10; } } 4 │ --- await_in_static_initialization_block_member.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `await` is only allowed within async functions and at the top levels of modules. @@ -147,7 +172,4 @@ await_in_static_initialization_block_member.js:3:20 parse ━━━━━━━ │ ^^^^^ 4 │ --- -// SCRIPT -class A { static { await; } } -class B { static { await 10; } } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.js b/crates/biome_js_parser/tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.js rename to crates/biome_js_parser/tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js diff --git a/crates/biome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.rast b/crates/biome_js_parser/tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.rast rename to crates/biome_js_parser/tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js.snap index 0c568352f0da..1275f8ea23bf 100644 --- a/crates/biome_js_parser/test_data/inline/err/await_using_declaration_only_allowed_inside_an_async_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/await_using_declaration_only_allowed_inside_an_async_function.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { await using x = y }; +foo = function() { await using x = y }; +foo = () => { await using x = y }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -159,7 +176,11 @@ JsModule { ], eof_token: EOF@112..113 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..113 0: (empty) 1: (empty) @@ -269,7 +290,12 @@ JsModule { 3: R_CURLY@110..111 "}" [] [] 1: SEMICOLON@111..112 ";" [] [] 4: EOF@112..113 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` await_using_declaration_only_allowed_inside_an_async_function.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━ × `await using` declarations are only allowed at top-level or inside an async function @@ -281,7 +307,6 @@ await_using_declaration_only_allowed_inside_an_async_function.js:1:18 parse ━ i Wrap this declaration in an async function --- await_using_declaration_only_allowed_inside_an_async_function.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━ × `await using` declarations are only allowed at top-level or inside an async function @@ -294,7 +319,6 @@ await_using_declaration_only_allowed_inside_an_async_function.js:2:20 parse ━ i Wrap this declaration in an async function --- await_using_declaration_only_allowed_inside_an_async_function.js:3:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━ × `await using` declarations are only allowed at top-level or inside an async function @@ -307,7 +331,4 @@ await_using_declaration_only_allowed_inside_an_async_function.js:3:15 parse ━ i Wrap this declaration in an async function --- -function foo() { await using x = y }; -foo = function() { await using x = y }; -foo = () => { await using x = y }; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/binary_expressions_err.js b/crates/biome_js_parser/tests/js_test_suite/error/binary_expressions_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/binary_expressions_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/binary_expressions_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/binary_expressions_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/binary_expressions_err.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/binary_expressions_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/binary_expressions_err.js.snap index 0ce8a30d5c8a..5901c245a3f4 100644 --- a/crates/biome_js_parser/test_data/inline/err/binary_expressions_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/binary_expressions_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo(foo +); +foo + * 2; +!foo * bar; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -70,7 +87,11 @@ JsModule { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..35 0: (empty) 1: (empty) @@ -119,7 +140,12 @@ JsModule { 0: IDENT@30..33 "bar" [] [] 1: SEMICOLON@33..34 ";" [] [] 4: EOF@34..35 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` binary_expressions_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ')'. @@ -136,7 +162,6 @@ binary_expressions_err.js:1:10 parse ━━━━━━━━━━━━━━ 2 │ foo + * 2; 3 │ !foo * bar; --- binary_expressions_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `*` operator. @@ -149,7 +174,4 @@ binary_expressions_err.js:2:7 parse ━━━━━━━━━━━━━━ i This operator requires a left hand side value --- -foo(foo +); -foo + * 2; -!foo * bar; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid.js b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid.js rename to crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid.js diff --git a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid.rast b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid.rast rename to crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid.js.snap index 3c11ac1244da..3e82aa0c49ce 100644 --- a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +async () => { let await = 5; } +function *foo() { + let yield = 5; +} +let eval = 5; +let let = 5; +const let = 5; +let a, a; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -190,7 +212,11 @@ JsModule { ], eof_token: EOF@120..121 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..121 0: (empty) 1: (empty) @@ -317,7 +343,12 @@ JsModule { 2: (empty) 1: SEMICOLON@119..120 ";" [] [] 4: EOF@120..121 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` binding_identifier_invalid.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context @@ -327,7 +358,6 @@ binding_identifier_invalid.js:1:19 parse ━━━━━━━━━━━━━ 2 │ function *foo() { 3 │ let yield = 5; --- binding_identifier_invalid.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `yield` as an identifier in generator function @@ -339,7 +369,6 @@ binding_identifier_invalid.js:3:8 parse ━━━━━━━━━━━━━ 4 │ } 5 │ let eval = 5; --- binding_identifier_invalid.js:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode @@ -351,7 +380,6 @@ binding_identifier_invalid.js:5:5 parse ━━━━━━━━━━━━━ 6 │ let let = 5; 7 │ const let = 5; --- binding_identifier_invalid.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `let` as an identifier in strict mode @@ -363,7 +391,6 @@ binding_identifier_invalid.js:6:5 parse ━━━━━━━━━━━━━ 7 │ const let = 5; 8 │ let a, a; --- binding_identifier_invalid.js:7:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `let` as an identifier in strict mode @@ -375,7 +402,6 @@ binding_identifier_invalid.js:7:7 parse ━━━━━━━━━━━━━ 8 │ let a, a; 9 │ --- binding_identifier_invalid.js:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Declarations inside of a `let` declaration may not have duplicates @@ -402,12 +428,4 @@ binding_identifier_invalid.js:8:8 parse ━━━━━━━━━━━━━ │ ^ 9 │ --- -async () => { let await = 5; } -function *foo() { - let yield = 5; -} -let eval = 5; -let let = 5; -const let = 5; -let a, a; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid_script.js b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid_script.js rename to crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs.snap new file mode 100644 index 000000000000..3a5dbd7e798d --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.cjs.snap @@ -0,0 +1,141 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +let let = 5; +const let = 5; + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@0..14 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@14..18 "let" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@18..20 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@20..21 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@21..22 ";" [] [], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: CONST_KW@22..29 "const" [Newline("\n")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsBogusBinding { + items: [ + IDENT@29..33 "let" [] [Whitespace(" ")], + ], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@33..35 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@35..36 "5" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@36..37 ";" [] [], + }, + ], + eof_token: EOF@37..38 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..38 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..37 + 0: JS_VARIABLE_STATEMENT@0..22 + 0: JS_VARIABLE_DECLARATION@0..21 + 0: (empty) + 1: LET_KW@0..14 "let" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@14..21 + 0: JS_VARIABLE_DECLARATOR@14..21 + 0: JS_BOGUS_BINDING@14..18 + 0: IDENT@14..18 "let" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@18..21 + 0: EQ@18..20 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@20..21 + 0: JS_NUMBER_LITERAL@20..21 "5" [] [] + 1: SEMICOLON@21..22 ";" [] [] + 1: JS_VARIABLE_STATEMENT@22..37 + 0: JS_VARIABLE_DECLARATION@22..36 + 0: (empty) + 1: CONST_KW@22..29 "const" [Newline("\n")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@29..36 + 0: JS_VARIABLE_DECLARATOR@29..36 + 0: JS_BOGUS_BINDING@29..33 + 0: IDENT@29..33 "let" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@33..36 + 0: EQ@33..35 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@35..36 + 0: JS_NUMBER_LITERAL@35..36 "5" [] [] + 1: SEMICOLON@36..37 ";" [] [] + 4: EOF@37..38 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +binding_identifier_invalid_script.cjs:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `let` cannot be declared as a variable name inside of a `let` declaration + + 1 │ // SCRIPT + > 2 │ let let = 5; + │ ^^^ + 3 │ const let = 5; + 4 │ + + i Rename the let identifier here + +binding_identifier_invalid_script.cjs:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `let` cannot be declared as a variable name inside of a `const` declaration + + 1 │ // SCRIPT + 2 │ let let = 5; + > 3 │ const let = 5; + │ ^^^ + 4 │ + + i Rename the let identifier here + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.js.snap similarity index 91% rename from crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast rename to crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.js.snap index c275ed466148..1f068c847c8c 100644 --- a/crates/biome_js_parser/test_data/inline/err/binding_identifier_invalid_script.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/binding_identifier_invalid_script.js.snap @@ -1,8 +1,25 @@ -JsScript { +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +let let = 5; +const let = 5; + +``` + + +## AST + +``` +JsModule { bom_token: missing (optional), interpreter_token: missing (optional), directives: JsDirectiveList [], - statements: JsStatementList [ + items: JsModuleItemList [ JsVariableStatement { declaration: JsVariableDeclaration { await_token: missing (optional), @@ -52,12 +69,16 @@ JsScript { ], eof_token: EOF@37..38 "" [Newline("\n")] [], } +``` + +## CST -0: JS_SCRIPT@0..38 +``` +0: JS_MODULE@0..38 0: (empty) 1: (empty) 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..37 + 3: JS_MODULE_ITEM_LIST@0..37 0: JS_VARIABLE_STATEMENT@0..22 0: JS_VARIABLE_DECLARATION@0..21 0: (empty) @@ -87,10 +108,15 @@ JsScript { 0: JS_NUMBER_LITERAL@35..36 "5" [] [] 1: SEMICOLON@36..37 ";" [] [] 4: EOF@37..38 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` binding_identifier_invalid_script.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - × `let` cannot be declared as a variable name inside of a `let` declaration + × Illegal use of reserved keyword `let` as an identifier in strict mode 1 │ // SCRIPT > 2 │ let let = 5; @@ -98,12 +124,9 @@ binding_identifier_invalid_script.js:2:5 parse ━━━━━━━━━━━ 3 │ const let = 5; 4 │ - i Rename the let identifier here - --- binding_identifier_invalid_script.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - × `let` cannot be declared as a variable name inside of a `const` declaration + × Illegal use of reserved keyword `let` as an identifier in strict mode 1 │ // SCRIPT 2 │ let let = 5; @@ -111,9 +134,4 @@ binding_identifier_invalid_script.js:3:7 parse ━━━━━━━━━━━ │ ^^^ 4 │ - i Rename the let identifier here - --- -// SCRIPT -let let = 5; -const let = 5; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/block_stmt_in_class.js b/crates/biome_js_parser/tests/js_test_suite/error/block_stmt_in_class.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/block_stmt_in_class.js rename to crates/biome_js_parser/tests/js_test_suite/error/block_stmt_in_class.js diff --git a/crates/biome_js_parser/test_data/inline/err/block_stmt_in_class.rast b/crates/biome_js_parser/tests/js_test_suite/error/block_stmt_in_class.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/block_stmt_in_class.rast rename to crates/biome_js_parser/tests/js_test_suite/error/block_stmt_in_class.js.snap index 62bdeed83327..50e7f3def405 100644 --- a/crates/biome_js_parser/test_data/inline/err/block_stmt_in_class.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/block_stmt_in_class.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class S{{}} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -31,7 +46,11 @@ JsModule { ], eof_token: EOF@11..12 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..12 0: (empty) 1: (empty) @@ -54,7 +73,12 @@ JsModule { 1: JS_BOGUS_STATEMENT@10..11 0: R_CURLY@10..11 "}" [] [] 4: EOF@11..12 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` block_stmt_in_class.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '{'. @@ -69,7 +93,6 @@ block_stmt_in_class.js:1:9 parse ━━━━━━━━━━━━━━━ │ ^ 2 │ --- block_stmt_in_class.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '}'. @@ -84,5 +107,4 @@ block_stmt_in_class.js:1:11 parse ━━━━━━━━━━━━━━━ │ ^ 2 │ --- -class S{{}} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/bracket_expr_err.js b/crates/biome_js_parser/tests/js_test_suite/error/bracket_expr_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/bracket_expr_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/bracket_expr_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/bracket_expr_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/bracket_expr_err.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/bracket_expr_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/bracket_expr_err.js.snap index 5579ddad82d0..5e5a32ac614a 100644 --- a/crates/biome_js_parser/test_data/inline/err/bracket_expr_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/bracket_expr_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo[] +foo?.[] +foo[ + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -48,7 +65,11 @@ JsModule { ], eof_token: EOF@18..19 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..19 0: (empty) 1: (empty) @@ -85,7 +106,12 @@ JsModule { 4: (empty) 1: (empty) 4: EOF@18..19 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` bracket_expr_err.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ']'. @@ -102,7 +128,6 @@ bracket_expr_err.js:1:5 parse ━━━━━━━━━━━━━━━━ 2 │ foo?.[] 3 │ foo[ --- bracket_expr_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ']'. @@ -121,7 +146,6 @@ bracket_expr_err.js:2:7 parse ━━━━━━━━━━━━━━━━ 3 │ foo[ 4 │ --- bracket_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found the end of the file. @@ -138,7 +162,4 @@ bracket_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━ > 4 │ │ --- -foo[] -foo?.[] -foo[ +``` diff --git a/crates/biome_js_parser/test_data/inline/err/break_in_nested_function.js b/crates/biome_js_parser/tests/js_test_suite/error/break_in_nested_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/break_in_nested_function.js rename to crates/biome_js_parser/tests/js_test_suite/error/break_in_nested_function.js diff --git a/crates/biome_js_parser/test_data/inline/err/break_in_nested_function.rast b/crates/biome_js_parser/tests/js_test_suite/error/break_in_nested_function.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/break_in_nested_function.rast rename to crates/biome_js_parser/tests/js_test_suite/error/break_in_nested_function.js.snap index e37439dd1d21..1fad5a672066 100644 --- a/crates/biome_js_parser/test_data/inline/err/break_in_nested_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/break_in_nested_function.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +while (true) { + function helper() { + break; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -48,7 +67,11 @@ JsModule { ], eof_token: EOF@53..54 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..54 0: (empty) 1: (empty) @@ -85,7 +108,12 @@ JsModule { 3: R_CURLY@47..51 "}" [Newline("\n"), Whitespace(" ")] [] 2: R_CURLY@51..53 "}" [Newline("\n")] [] 4: EOF@53..54 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` break_in_nested_function.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `break` statement can only be used within an enclosing iteration or switch statement. @@ -97,9 +125,4 @@ break_in_nested_function.js:3:5 parse ━━━━━━━━━━━━━━ 4 │ } 5 │ } --- -while (true) { - function helper() { - break; - } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/break_stmt.js b/crates/biome_js_parser/tests/js_test_suite/error/break_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/break_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/error/break_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/err/break_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/error/break_stmt.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/break_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/error/break_stmt.js.snap index 08f16c136c00..5872ded08c83 100644 --- a/crates/biome_js_parser/test_data/inline/err/break_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/break_stmt.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { break; } +while (true) { + break foo; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -57,7 +75,11 @@ JsModule { ], eof_token: EOF@55..56 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..56 0: (empty) 1: (empty) @@ -99,7 +121,12 @@ JsModule { 2: SEMICOLON@52..53 ";" [] [] 2: R_CURLY@53..55 "}" [Newline("\n")] [] 4: EOF@55..56 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` break_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `break` statement can only be used within an enclosing iteration or switch statement. @@ -109,7 +136,6 @@ break_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━━ 2 │ while (true) { 3 │ break foo; --- break_stmt.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Use of undefined statement label `foo` @@ -123,8 +149,4 @@ break_stmt.js:3:9 parse ━━━━━━━━━━━━━━━━━━ i This label is used, but it is never defined --- -function foo() { break; } -while (true) { - break foo; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter.js b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_constructor_parameter.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/class_constructor_parameter.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter.js.snap index 16f43765d6d4..04ce89d1e56d 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { constructor(protected b) {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -58,7 +73,11 @@ JsModule { ], eof_token: EOF@39..40 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..40 0: (empty) 1: (empty) @@ -102,7 +121,12 @@ JsModule { 3: R_CURLY@36..38 "}" [] [Whitespace(" ")] 9: R_CURLY@38..39 "}" [] [] 4: EOF@39..40 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_constructor_parameter.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'protected' modifier can only be used in TypeScript files @@ -111,5 +135,4 @@ class_constructor_parameter.js:1:23 parse ━━━━━━━━━━━━ │ ^^^^^^^^^ 2 │ --- -class B { constructor(protected b) {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.js b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter_readonly.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter_readonly.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter_readonly.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter_readonly.js.snap index 201f098e3031..e4369a0de631 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_constructor_parameter_readonly.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_constructor_parameter_readonly.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { constructor(readonly b) {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -58,7 +73,11 @@ JsModule { ], eof_token: EOF@38..39 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..39 0: (empty) 1: (empty) @@ -102,7 +121,12 @@ JsModule { 3: R_CURLY@35..37 "}" [] [Whitespace(" ")] 9: R_CURLY@37..38 "}" [] [] 4: EOF@38..39 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_constructor_parameter_readonly.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'readonly' modifier can only be used in TypeScript files @@ -111,5 +135,4 @@ class_constructor_parameter_readonly.js:1:23 parse ━━━━━━━━━ │ ^^^^^^^^ 2 │ --- -class B { constructor(readonly b) {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_decl_err.js b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_decl_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_decl_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_decl_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/class_decl_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_decl_err.js.snap index 58df185afcee..b068ab647aa0 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_decl_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_err.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class {} +class extends bar {} +class foo { set {} } +class extends {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -88,7 +106,11 @@ JsModule { ], eof_token: EOF@67..68 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..68 0: (empty) 1: (empty) @@ -159,7 +181,12 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@66..66 9: R_CURLY@66..67 "}" [] [] 4: EOF@67..68 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_decl_err.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name @@ -169,7 +196,6 @@ class_decl_err.js:1:1 parse ━━━━━━━━━━━━━━━━━ 2 │ class extends bar {} 3 │ class foo { set {} } --- class_decl_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name @@ -180,7 +206,6 @@ class_decl_err.js:2:1 parse ━━━━━━━━━━━━━━━━━ 3 │ class foo { set {} } 4 │ class extends {} --- class_decl_err.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none @@ -192,7 +217,6 @@ class_decl_err.js:3:13 parse ━━━━━━━━━━━━━━━━━ 4 │ class extends {} 5 │ --- class_decl_err.js:3:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '{'. @@ -213,7 +237,6 @@ class_decl_err.js:3:17 parse ━━━━━━━━━━━━━━━━━ 4 │ class extends {} 5 │ --- class_decl_err.js:3:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '}'. @@ -234,7 +257,6 @@ class_decl_err.js:3:20 parse ━━━━━━━━━━━━━━━━━ 4 │ class extends {} 5 │ --- class_decl_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name @@ -245,7 +267,6 @@ class_decl_err.js:4:1 parse ━━━━━━━━━━━━━━━━━ │ ^^^^^^ 5 │ --- class_decl_err.js:4:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'extends' list cannot be empty. @@ -256,8 +277,4 @@ class_decl_err.js:4:14 parse ━━━━━━━━━━━━━━━━━ │ 5 │ --- -class {} -class extends bar {} -class foo { set {} } -class extends {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_decl_no_id.ts b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_no_id.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_decl_no_id.ts rename to crates/biome_js_parser/tests/js_test_suite/error/class_decl_no_id.ts diff --git a/crates/biome_js_parser/test_data/inline/err/class_decl_no_id.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_no_id.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/class_decl_no_id.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_decl_no_id.ts.snap index 0f4d233a307a..461180bd526d 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_decl_no_id.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_decl_no_id.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class {} +class implements B {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -40,7 +56,11 @@ JsModule { ], eof_token: EOF@30..31 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..31 0: (empty) 1: (empty) @@ -75,7 +95,12 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@29..29 9: R_CURLY@29..30 "}" [] [] 4: EOF@30..31 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_decl_no_id.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name @@ -85,7 +110,6 @@ class_decl_no_id.ts:1:1 parse ━━━━━━━━━━━━━━━━ 2 │ class implements B {} 3 │ --- class_decl_no_id.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name @@ -95,6 +119,4 @@ class_decl_no_id.ts:2:1 parse ━━━━━━━━━━━━━━━━ │ ^^^^^^ 3 │ --- -class {} -class implements B {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_declare_member.js b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_declare_member.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_declare_member.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_declare_member.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_member.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/class_declare_member.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_declare_member.js.snap index 1a22e41b1124..2a5d60e57e64 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_declare_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_member.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { declare foo } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -33,7 +48,11 @@ JsModule { ], eof_token: EOF@23..24 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..24 0: (empty) 1: (empty) @@ -58,7 +77,12 @@ JsModule { 0: IDENT@18..22 "foo" [] [Whitespace(" ")] 9: R_CURLY@22..23 "}" [] [] 4: EOF@23..24 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_declare_member.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier can only be used in TypeScript files @@ -67,5 +91,4 @@ class_declare_member.js:1:11 parse ━━━━━━━━━━━━━━━ │ ^^^^^^^ 2 │ --- -class B { declare foo } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_declare_method.js b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_declare_method.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_declare_method.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_declare_method.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_method.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/class_declare_method.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_declare_method.js.snap index 63616c18b8d2..f4c20b0f99d1 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_declare_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_declare_method.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { declare fn() {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -46,7 +61,11 @@ JsModule { ], eof_token: EOF@27..28 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..28 0: (empty) 1: (empty) @@ -80,7 +99,12 @@ JsModule { 3: R_CURLY@24..26 "}" [] [Whitespace(" ")] 9: R_CURLY@26..27 "}" [] [] 4: EOF@27..28 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_declare_method.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier can only be used in TypeScript files @@ -89,5 +113,4 @@ class_declare_method.js:1:11 parse ━━━━━━━━━━━━━━━ │ ^^^^^^^ 2 │ --- -class B { declare fn() {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_extends_err.js b/crates/biome_js_parser/tests/js_test_suite/error/class_extends_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_extends_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_extends_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_extends_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_extends_err.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/class_extends_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_extends_err.js.snap index d5c5bc7b1eaa..a5a58ab15815 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_extends_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_extends_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A extends bar extends foo {} +class B extends bar, foo {} +class C implements B {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -93,7 +110,11 @@ JsModule { ], eof_token: EOF@86..87 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..87 0: (empty) 1: (empty) @@ -153,7 +174,12 @@ JsModule { 5: JS_CLASS_MEMBER_LIST@85..85 6: R_CURLY@85..86 "}" [] [] 4: EOF@86..87 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_extends_err.js:1:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'extends' clause already seen. @@ -170,7 +196,6 @@ class_extends_err.js:1:21 parse ━━━━━━━━━━━━━━━━ 2 │ class B extends bar, foo {} 3 │ class C implements B {} --- class_extends_err.js:2:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Classes can only extend a single class. @@ -181,7 +206,6 @@ class_extends_err.js:2:22 parse ━━━━━━━━━━━━━━━━ 3 │ class C implements B {} 4 │ --- class_extends_err.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × classes can only implement interfaces in TypeScript files @@ -192,7 +216,4 @@ class_extends_err.js:3:9 parse ━━━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^ 4 │ --- -class A extends bar extends foo {} -class B extends bar, foo {} -class C implements B {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_implements.js b/crates/biome_js_parser/tests/js_test_suite/error/class_implements.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_implements.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_implements.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_implements.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_implements.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/class_implements.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_implements.js.snap index 8ac9205ee7f1..2dc85e86ae3f 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_implements.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_implements.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B implements C {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -31,7 +46,11 @@ JsModule { ], eof_token: EOF@23..24 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..24 0: (empty) 1: (empty) @@ -53,7 +72,12 @@ JsModule { 5: JS_CLASS_MEMBER_LIST@22..22 6: R_CURLY@22..23 "}" [] [] 4: EOF@23..24 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_implements.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × classes can only implement interfaces in TypeScript files @@ -62,5 +86,4 @@ class_implements.js:1:9 parse ━━━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^ 2 │ --- -class B implements C {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/error/class_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_in_single_statement_context.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_in_single_statement_context.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_in_single_statement_context.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/class_in_single_statement_context.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_in_single_statement_context.js.snap index 503a525cb577..72c9de34feb4 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_in_single_statement_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_in_single_statement_context.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) class A {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -27,7 +42,11 @@ JsModule { ], eof_token: EOF@20..21 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..21 0: (empty) 1: (empty) @@ -49,7 +68,12 @@ JsModule { 5: R_CURLY@19..20 "}" [] [] 5: (empty) 4: EOF@20..21 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_in_single_statement_context.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Classes can only be declared at top level or inside a block @@ -60,5 +84,4 @@ class_in_single_statement_context.js:1:11 parse ━━━━━━━━━━ i wrap the class in a block statement --- -if (true) class A {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_invalid_modifiers.js b/crates/biome_js_parser/tests/js_test_suite/error/class_invalid_modifiers.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_invalid_modifiers.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_invalid_modifiers.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_invalid_modifiers.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_invalid_modifiers.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/class_invalid_modifiers.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_invalid_modifiers.js.snap index d255749d14f0..cb1f2f96e08c 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_invalid_modifiers.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_invalid_modifiers.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { public foo() {} } +class B { static static foo() {} } +class C { accessor foo() {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -125,7 +142,11 @@ JsModule { ], eof_token: EOF@92..93 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..93 0: (empty) 1: (empty) @@ -215,7 +236,12 @@ JsModule { 3: R_CURLY@89..91 "}" [] [Whitespace(" ")] 9: R_CURLY@91..92 "}" [] [] 4: EOF@92..93 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_invalid_modifiers.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'public' modifier can only be used in TypeScript files @@ -225,7 +251,6 @@ class_invalid_modifiers.js:1:11 parse ━━━━━━━━━━━━━━ 2 │ class B { static static foo() {} } 3 │ class C { accessor foo() {} } --- class_invalid_modifiers.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'static' already seen @@ -252,7 +277,6 @@ class_invalid_modifiers.js:2:18 parse ━━━━━━━━━━━━━━ 3 │ class C { accessor foo() {} } 4 │ --- class_invalid_modifiers.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'accessor' modifier is only allowed on properties. @@ -263,7 +287,4 @@ class_invalid_modifiers.js:3:11 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^ 4 │ --- -class A { public foo() {} } -class B { static static foo() {} } -class C { accessor foo() {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_method_parameters.js b/crates/biome_js_parser/tests/js_test_suite/error/class_member_method_parameters.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_member_method_parameters.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_member_method_parameters.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_method_parameters.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_member_method_parameters.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/class_member_method_parameters.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_member_method_parameters.js.snap index 62c4bd13cb1f..f600f934f330 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_member_method_parameters.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_member_method_parameters.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { foo(a {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -66,7 +81,11 @@ JsModule { ], eof_token: EOF@20..21 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..21 0: (empty) 1: (empty) @@ -119,7 +138,12 @@ JsModule { 8: (empty) 9: (empty) 4: EOF@20..21 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_member_method_parameters.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` @@ -130,7 +154,6 @@ class_member_method_parameters.js:1:17 parse ━━━━━━━━━━━ i Remove { --- class_member_method_parameters.js:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `}` @@ -141,7 +164,6 @@ class_member_method_parameters.js:1:20 parse ━━━━━━━━━━━ i Remove } --- class_member_method_parameters.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead the file ends @@ -156,5 +178,4 @@ class_member_method_parameters.js:2:1 parse ━━━━━━━━━━━━ > 2 │ │ --- -class B { foo(a {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_modifier.js b/crates/biome_js_parser/tests/js_test_suite/error/class_member_modifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_member_modifier.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_member_modifier.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_modifier.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_member_modifier.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/class_member_modifier.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_member_modifier.js.snap index 74dac9672196..f10cf2e947bd 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_member_modifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_member_modifier.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { abstract foo; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -34,7 +49,11 @@ JsModule { ], eof_token: EOF@25..26 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..26 0: (empty) 1: (empty) @@ -60,7 +79,12 @@ JsModule { 2: SEMICOLON@22..24 ";" [] [Whitespace(" ")] 9: R_CURLY@24..25 "}" [] [] 4: EOF@25..26 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_member_modifier.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Only abstract classes can have abstract members @@ -69,5 +93,4 @@ class_member_modifier.js:1:11 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^ 2 │ --- -class A { abstract foo; } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_static_accessor_precedence.js b/crates/biome_js_parser/tests/js_test_suite/error/class_member_static_accessor_precedence.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_member_static_accessor_precedence.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_member_static_accessor_precedence.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_member_static_accessor_precedence.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_member_static_accessor_precedence.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/class_member_static_accessor_precedence.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_member_static_accessor_precedence.js.snap index 37ca2d48307f..5c8c98a5cb07 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_member_static_accessor_precedence.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_member_static_accessor_precedence.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + accessor static foo = 1; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -43,7 +60,11 @@ JsModule { ], eof_token: EOF@40..41 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..41 0: (empty) 1: (empty) @@ -75,7 +96,12 @@ JsModule { 3: SEMICOLON@37..38 ";" [] [] 9: R_CURLY@38..40 "}" [Newline("\n")] [] 4: EOF@40..41 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_member_static_accessor_precedence.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'static' must precede 'accessor' @@ -102,7 +128,4 @@ class_member_static_accessor_precedence.js:2:14 parse ━━━━━━━━ 3 │ } 4 │ --- -class A { - accessor static foo = 1; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_property_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/class_property_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_property_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_property_initializer.js diff --git a/crates/biome_js_parser/test_data/inline/err/class_property_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_property_initializer.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/class_property_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_property_initializer.js.snap index 243086ce9b11..c073c469ac8c 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_property_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_property_initializer.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { lorem = ; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -33,7 +48,11 @@ JsModule { ], eof_token: EOF@21..22 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..22 0: (empty) 1: (empty) @@ -61,7 +80,12 @@ JsModule { 4: SEMICOLON@18..20 ";" [] [Whitespace(" ")] 9: R_CURLY@20..21 "}" [] [] 4: EOF@21..22 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_property_initializer.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found ';'. @@ -76,5 +100,4 @@ class_property_initializer.js:1:19 parse ━━━━━━━━━━━━━ │ ^ 2 │ --- -class B { lorem = ; } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_yield_property_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/class_yield_property_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs.snap new file mode 100644 index 000000000000..bc2bdd0e62ce --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.cjs.snap @@ -0,0 +1,154 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +async function* test() { + class A { + prop = yield; + } +} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + function_token: FUNCTION_KW@16..24 "function" [] [], + star_token: STAR@24..26 "*" [] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@26..30 "test" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@30..31 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@31..33 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@33..34 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@43..45 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@45..46 "{" [] [], + members: JsClassMemberList [ + JsPropertyClassMember { + modifiers: JsPropertyModifierList [], + name: JsLiteralMemberName { + value: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + }, + property_annotation: missing (optional), + value: JsInitializerClause { + eq_token: EQ@56..58 "=" [] [Whitespace(" ")], + expression: JsBogusExpression { + items: [ + JsBogus { + items: [ + IDENT@58..63 "yield" [] [], + ], + }, + ], + }, + }, + semicolon_token: SEMICOLON@63..64 ";" [] [], + }, + ], + r_curly_token: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [], + }, + ], + r_curly_token: R_CURLY@68..70 "}" [Newline("\n")] [], + }, + }, + ], + eof_token: EOF@70..71 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..71 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..70 + 0: JS_FUNCTION_DECLARATION@0..70 + 0: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: FUNCTION_KW@16..24 "function" [] [] + 2: STAR@24..26 "*" [] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@26..30 + 0: IDENT@26..30 "test" [] [] + 4: (empty) + 5: JS_PARAMETERS@30..33 + 0: L_PAREN@30..31 "(" [] [] + 1: JS_PARAMETER_LIST@31..31 + 2: R_PAREN@31..33 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@33..70 + 0: L_CURLY@33..34 "{" [] [] + 1: JS_DIRECTIVE_LIST@34..34 + 2: JS_STATEMENT_LIST@34..68 + 0: JS_CLASS_DECLARATION@34..68 + 0: JS_DECORATOR_LIST@34..34 + 1: (empty) + 2: CLASS_KW@34..43 "class" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@43..45 + 0: IDENT@43..45 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@45..46 "{" [] [] + 8: JS_CLASS_MEMBER_LIST@46..64 + 0: JS_PROPERTY_CLASS_MEMBER@46..64 + 0: JS_PROPERTY_MODIFIER_LIST@46..46 + 1: JS_LITERAL_MEMBER_NAME@46..56 + 0: IDENT@46..56 "prop" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: (empty) + 3: JS_INITIALIZER_CLAUSE@56..63 + 0: EQ@56..58 "=" [] [Whitespace(" ")] + 1: JS_BOGUS_EXPRESSION@58..63 + 0: JS_BOGUS@58..63 + 0: IDENT@58..63 "yield" [] [] + 4: SEMICOLON@63..64 ";" [] [] + 9: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [] + 3: R_CURLY@68..70 "}" [Newline("\n")] [] + 4: EOF@70..71 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +class_yield_property_initializer.cjs:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `yield` as an identifier in strict mode + + 2 │ async function* test() { + 3 │ class A { + > 4 │ prop = yield; + │ ^^^^^ + 5 │ } + 6 │ } + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/class_yield_property_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/class_yield_property_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.js.snap index 9c96d31cce4e..39a33722d1b7 100644 --- a/crates/biome_js_parser/test_data/inline/err/class_yield_property_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/class_yield_property_initializer.js.snap @@ -1,8 +1,28 @@ -JsScript { +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +async function* test() { + class A { + prop = yield; + } +} + +``` + + +## AST + +``` +JsModule { bom_token: missing (optional), interpreter_token: missing (optional), directives: JsDirectiveList [], - statements: JsStatementList [ + items: JsModuleItemList [ JsFunctionDeclaration { async_token: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], function_token: FUNCTION_KW@16..24 "function" [] [], @@ -63,12 +83,16 @@ JsScript { ], eof_token: EOF@70..71 "" [Newline("\n")] [], } +``` -0: JS_SCRIPT@0..71 +## CST + +``` +0: JS_MODULE@0..71 0: (empty) 1: (empty) 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..70 + 3: JS_MODULE_ITEM_LIST@0..70 0: JS_FUNCTION_DECLARATION@0..70 0: ASYNC_KW@0..16 "async" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] 1: FUNCTION_KW@16..24 "function" [] [] @@ -110,7 +134,12 @@ JsScript { 9: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [] 3: R_CURLY@68..70 "}" [Newline("\n")] [] 4: EOF@70..71 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` class_yield_property_initializer.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode @@ -122,10 +151,4 @@ class_yield_property_initializer.js:4:12 parse ━━━━━━━━━━━ 5 │ } 6 │ } --- -// SCRIPT -async function* test() { - class A { - prop = yield; - } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/conditional_expr_err.js b/crates/biome_js_parser/tests/js_test_suite/error/conditional_expr_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/conditional_expr_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/conditional_expr_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/conditional_expr_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/conditional_expr_err.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/conditional_expr_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/conditional_expr_err.js.snap index f6e903775346..24f9aa21f6a9 100644 --- a/crates/biome_js_parser/test_data/inline/err/conditional_expr_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/conditional_expr_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo ? bar baz +foo ? bar baz ? foo : bar +foo ? bar : + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -82,7 +99,11 @@ JsModule { ], eof_token: EOF@51..52 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..52 0: (empty) 1: (empty) @@ -138,7 +159,12 @@ JsModule { 4: (empty) 1: (empty) 4: EOF@51..52 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` conditional_expr_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `baz` @@ -150,7 +176,6 @@ conditional_expr_err.js:1:11 parse ━━━━━━━━━━━━━━━ i Remove baz --- conditional_expr_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `baz` @@ -163,7 +188,6 @@ conditional_expr_err.js:2:11 parse ━━━━━━━━━━━━━━━ i Remove baz --- conditional_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found the end of the file. @@ -180,7 +204,4 @@ conditional_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━ > 4 │ │ --- -foo ? bar baz -foo ? bar baz ? foo : bar -foo ? bar : +``` diff --git a/crates/biome_js_parser/test_data/inline/err/continue_stmt.js b/crates/biome_js_parser/tests/js_test_suite/error/continue_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/continue_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/error/continue_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/err/continue_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/error/continue_stmt.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/continue_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/error/continue_stmt.js.snap index 938333cd3e7b..ad4bca7c4e7f 100644 --- a/crates/biome_js_parser/test_data/inline/err/continue_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/continue_stmt.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { continue; } +while (true) { + continue foo; +} +foo: { + continue foo; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -78,7 +99,11 @@ JsModule { ], eof_token: EOF@86..87 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..87 0: (empty) 1: (empty) @@ -133,7 +158,12 @@ JsModule { 2: SEMICOLON@83..84 ";" [] [] 2: R_CURLY@84..86 "}" [Newline("\n")] [] 4: EOF@86..87 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` continue_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. @@ -143,7 +173,6 @@ continue_stmt.js:1:18 parse ━━━━━━━━━━━━━━━━━ 2 │ while (true) { 3 │ continue foo; --- continue_stmt.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Use of undefined statement label `foo` @@ -157,7 +186,6 @@ continue_stmt.js:3:12 parse ━━━━━━━━━━━━━━━━━ i This label is used, but it is never defined --- continue_stmt.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `continue` statement can only jump to a label of an enclosing `for`, `while` or `do while` statement. @@ -187,11 +215,4 @@ continue_stmt.js:6:12 parse ━━━━━━━━━━━━━━━━━ 6 │ continue foo; 7 │ } --- -function foo() { continue; } -while (true) { - continue foo; -} -foo: { - continue foo; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/debugger_stmt.js b/crates/biome_js_parser/tests/js_test_suite/error/debugger_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/debugger_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/error/debugger_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/err/debugger_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/error/debugger_stmt.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/debugger_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/error/debugger_stmt.js.snap index d02882d160aa..85f6fb3f5df0 100644 --- a/crates/biome_js_parser/test_data/inline/err/debugger_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/debugger_stmt.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { + debugger { + var something = "lorem"; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -59,7 +78,11 @@ JsModule { ], eof_token: EOF@64..65 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..65 0: (empty) 1: (empty) @@ -104,7 +127,12 @@ JsModule { 2: R_CURLY@58..62 "}" [Newline("\n"), Whitespace(" ")] [] 3: R_CURLY@62..64 "}" [Newline("\n")] [] 4: EOF@64..65 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` debugger_stmt.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -131,9 +159,4 @@ debugger_stmt.js:2:12 parse ━━━━━━━━━━━━━━━━━ 3 │ var something = "lorem"; 4 │ } --- -function foo() { - debugger { - var something = "lorem"; - } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator.ts diff --git a/crates/biome_js_parser/test_data/inline/err/decorator.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/decorator.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator.ts.snap index e91f20d188c7..a23af1fed64f 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator.ts.snap @@ -1,3 +1,37 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@'dsads' class MyClass {} +@1 class MyClass {} +@++1 class MyClass {} +@[] in 1 class MyClass {} +@[] class MyClass {} +@() => {} class MyClass {} +@1 == 2 ? true : false class MyClass {} +@await fn class MyClass {} +@function(){} class MyClass {} +@obj instanceof Object class MyClass {} +@1 === 2 class MyClass {} +@new Object() class MyClass {} +@{} class MyClass {} +@a++ class MyClass {} +@a,b class MyClass {} +@`${d}foo` class MyClass {} +@obj as MyType class MyClass {} +@obj class MyClass {} +@obj satisfies MyType class MyClass {} +@obj! class MyClass {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -662,7 +696,11 @@ JsModule { ], eof_token: EOF@553..554 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..554 0: (empty) 1: (empty) @@ -1110,7 +1148,12 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@552..552 9: R_CURLY@552..553 "}" [] [] 4: EOF@553..554 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator.ts:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `'dsads'` @@ -1120,7 +1163,6 @@ decorator.ts:1:2 parse ━━━━━━━━━━━━━━━━━━━ 2 │ @1 class MyClass {} 3 │ @++1 class MyClass {} --- decorator.ts:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `1` @@ -1131,7 +1173,6 @@ decorator.ts:2:2 parse ━━━━━━━━━━━━━━━━━━━ 3 │ @++1 class MyClass {} 4 │ @[] in 1 class MyClass {} --- decorator.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '++'. @@ -1152,7 +1193,6 @@ decorator.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━ 4 │ @[] in 1 class MyClass {} 5 │ @[] class MyClass {} --- decorator.ts:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1166,7 +1206,6 @@ decorator.ts:3:1 parse ━━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `1` @@ -1180,7 +1219,6 @@ decorator.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━ i This expression cannot be assigned to --- decorator.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -1210,7 +1248,6 @@ decorator.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━ 4 │ @[] in 1 class MyClass {} 5 │ @[] class MyClass {} --- decorator.ts:4:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `[]` @@ -1222,7 +1259,6 @@ decorator.ts:4:2 parse ━━━━━━━━━━━━━━━━━━━ 5 │ @[] class MyClass {} 6 │ @() => {} class MyClass {} --- decorator.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1236,7 +1272,6 @@ decorator.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found 'in 1'. @@ -1257,7 +1292,6 @@ decorator.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━ 5 │ @[] class MyClass {} 6 │ @() => {} class MyClass {} --- decorator.ts:5:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `[]` @@ -1269,7 +1303,6 @@ decorator.ts:5:2 parse ━━━━━━━━━━━━━━━━━━━ 6 │ @() => {} class MyClass {} 7 │ @1 == 2 ? true : false class MyClass {} --- decorator.ts:6:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Parenthesized expression didnt contain anything @@ -1283,7 +1316,6 @@ decorator.ts:6:3 parse ━━━━━━━━━━━━━━━━━━━ i Expected an expression here --- decorator.ts:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1297,7 +1329,6 @@ decorator.ts:6:1 parse ━━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '=>'. @@ -1318,7 +1349,6 @@ decorator.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━ 7 │ @1 == 2 ? true : false class MyClass {} 8 │ @await fn class MyClass {} --- decorator.ts:7:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `1` @@ -1330,7 +1360,6 @@ decorator.ts:7:2 parse ━━━━━━━━━━━━━━━━━━━ 8 │ @await fn class MyClass {} 9 │ @function(){} class MyClass {} --- decorator.ts:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1344,7 +1373,6 @@ decorator.ts:7:1 parse ━━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:7:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '== 2 ? true : false'. @@ -1365,7 +1393,6 @@ decorator.ts:7:4 parse ━━━━━━━━━━━━━━━━━━━ 8 │ @await fn class MyClass {} 9 │ @function(){} class MyClass {} --- decorator.ts:8:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context @@ -1377,7 +1404,6 @@ decorator.ts:8:2 parse ━━━━━━━━━━━━━━━━━━━ 9 │ @function(){} class MyClass {} 10 │ @obj instanceof Object class MyClass {} --- decorator.ts:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1391,7 +1417,6 @@ decorator.ts:8:1 parse ━━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:8:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -1421,7 +1446,6 @@ decorator.ts:8:11 parse ━━━━━━━━━━━━━━━━━━ 9 │ @function(){} class MyClass {} 10 │ @obj instanceof Object class MyClass {} --- decorator.ts:9:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `function(){}` @@ -1433,7 +1457,6 @@ decorator.ts:9:2 parse ━━━━━━━━━━━━━━━━━━━ 10 │ @obj instanceof Object class MyClass {} 11 │ @1 === 2 class MyClass {} --- decorator.ts:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1447,7 +1470,6 @@ decorator.ts:10:1 parse ━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:10:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found 'instanceof Object'. @@ -1468,7 +1490,6 @@ decorator.ts:10:6 parse ━━━━━━━━━━━━━━━━━━ 11 │ @1 === 2 class MyClass {} 12 │ @new Object() class MyClass {} --- decorator.ts:11:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `1` @@ -1480,7 +1501,6 @@ decorator.ts:11:2 parse ━━━━━━━━━━━━━━━━━━ 12 │ @new Object() class MyClass {} 13 │ @{} class MyClass {} --- decorator.ts:11:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1494,7 +1514,6 @@ decorator.ts:11:1 parse ━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:11:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '=== 2'. @@ -1515,7 +1534,6 @@ decorator.ts:11:4 parse ━━━━━━━━━━━━━━━━━━ 12 │ @new Object() class MyClass {} 13 │ @{} class MyClass {} --- decorator.ts:12:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `new Object()` @@ -1527,7 +1545,6 @@ decorator.ts:12:2 parse ━━━━━━━━━━━━━━━━━━ 13 │ @{} class MyClass {} 14 │ @a++ class MyClass {} --- decorator.ts:13:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `{}` @@ -1539,7 +1556,6 @@ decorator.ts:13:2 parse ━━━━━━━━━━━━━━━━━━ 14 │ @a++ class MyClass {} 15 │ @a,b class MyClass {} --- decorator.ts:14:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1553,7 +1569,6 @@ decorator.ts:14:1 parse ━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:14:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `class MyClass {}` @@ -1567,7 +1582,6 @@ decorator.ts:14:6 parse ━━━━━━━━━━━━━━━━━━ i This expression cannot be assigned to --- decorator.ts:15:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1581,7 +1595,6 @@ decorator.ts:15:1 parse ━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:15:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found ',b'. @@ -1602,7 +1615,6 @@ decorator.ts:15:3 parse ━━━━━━━━━━━━━━━━━━ 16 │ @`${d}foo` class MyClass {} 17 │ @obj as MyType class MyClass {} --- decorator.ts:16:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator ``${d}foo`` @@ -1614,7 +1626,6 @@ decorator.ts:16:2 parse ━━━━━━━━━━━━━━━━━━ 17 │ @obj as MyType class MyClass {} 18 │ @obj class MyClass {} --- decorator.ts:17:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1628,7 +1639,6 @@ decorator.ts:17:1 parse ━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:17:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -1658,7 +1668,6 @@ decorator.ts:17:9 parse ━━━━━━━━━━━━━━━━━━ 18 │ @obj class MyClass {} 19 │ @obj satisfies MyType class MyClass {} --- decorator.ts:17:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -1688,7 +1697,6 @@ decorator.ts:17:16 parse ━━━━━━━━━━━━━━━━━━ 18 │ @obj class MyClass {} 19 │ @obj satisfies MyType class MyClass {} --- decorator.ts:18:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '<'. @@ -1709,7 +1717,6 @@ decorator.ts:18:2 parse ━━━━━━━━━━━━━━━━━━ 19 │ @obj satisfies MyType class MyClass {} 20 │ @obj! class MyClass {} --- decorator.ts:18:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1723,7 +1730,6 @@ decorator.ts:18:1 parse ━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:18:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -1753,7 +1759,6 @@ decorator.ts:18:14 parse ━━━━━━━━━━━━━━━━━━ 19 │ @obj satisfies MyType class MyClass {} 20 │ @obj! class MyClass {} --- decorator.ts:19:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1767,7 +1772,6 @@ decorator.ts:19:1 parse ━━━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator.ts:19:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -1797,7 +1801,6 @@ decorator.ts:19:16 parse ━━━━━━━━━━━━━━━━━━ 20 │ @obj! class MyClass {} 21 │ --- decorator.ts:19:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -1827,7 +1830,6 @@ decorator.ts:19:23 parse ━━━━━━━━━━━━━━━━━━ 20 │ @obj! class MyClass {} 21 │ --- decorator.ts:20:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `obj!` @@ -1838,24 +1840,4 @@ decorator.ts:20:2 parse ━━━━━━━━━━━━━━━━━━ │ ^^^^ 21 │ --- -@'dsads' class MyClass {} -@1 class MyClass {} -@++1 class MyClass {} -@[] in 1 class MyClass {} -@[] class MyClass {} -@() => {} class MyClass {} -@1 == 2 ? true : false class MyClass {} -@await fn class MyClass {} -@function(){} class MyClass {} -@obj instanceof Object class MyClass {} -@1 === 2 class MyClass {} -@new Object() class MyClass {} -@{} class MyClass {} -@a++ class MyClass {} -@a,b class MyClass {} -@`${d}foo` class MyClass {} -@obj as MyType class MyClass {} -@obj class MyClass {} -@obj satisfies MyType class MyClass {} -@obj! class MyClass {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_async_function_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_async_function_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_async_function_export_default_declaration_clause.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/decorator_async_function_export_default_declaration_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts.snap index 0ae95764243e..f30b52205258 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_async_function_export_default_declaration_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_async_function_export_default_declaration_clause.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default async function foo() { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -47,7 +63,11 @@ JsModule { ], eof_token: EOF@50..51 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..51 0: (empty) 1: (empty) @@ -83,7 +103,12 @@ JsModule { 3: R_CURLY@49..50 "}" [] [] 2: (empty) 4: EOF@50..51 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_async_function_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -95,6 +120,4 @@ decorator_async_function_export_default_declaration_clause.ts:1:1 parse ━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -@decorator -export default async function foo() { } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration.js b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_class_declaration.js rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration.js diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/decorator_class_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration.js.snap index 547729bdc138..fb27e954c88b 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function bar() { + @decorator + let a; + @decorator @decorator2 + function Foo() { } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -97,7 +117,11 @@ JsModule { ], eof_token: EOF@98..99 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..99 0: (empty) 1: (empty) @@ -166,7 +190,12 @@ JsModule { 3: R_CURLY@95..96 "}" [] [] 3: R_CURLY@96..98 "}" [Newline("\n")] [] 4: EOF@98..99 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_class_declaration.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -179,7 +208,6 @@ decorator_class_declaration.js:2:6 parse ━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_class_declaration.js:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -193,10 +221,4 @@ decorator_class_declaration.js:4:6 parse ━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -function bar() { - @decorator - let a; - @decorator @decorator2 - function Foo() { } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.js b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration_top_level.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.js rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration_top_level.js diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration_top_level.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration_top_level.js.snap index 73e7709ed30f..62cae42dad7b 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_class_declaration_top_level.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_declaration_top_level.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +@decorator +let a; +@decorator1 @decorator2 +function Foo() { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -75,7 +93,11 @@ JsModule { ], eof_token: EOF@60..61 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..61 0: (empty) 1: (empty) @@ -127,7 +149,12 @@ JsModule { 2: JS_STATEMENT_LIST@59..59 3: R_CURLY@59..60 "}" [] [] 4: EOF@60..61 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_class_declaration_top_level.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -139,7 +166,6 @@ decorator_class_declaration_top_level.js:1:1 parse ━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_class_declaration_top_level.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -153,8 +179,4 @@ decorator_class_declaration_top_level.js:3:1 parse ━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -@decorator -let a; -@decorator1 @decorator2 -function Foo() { } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_class_member.ts diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_member.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/decorator_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_class_member.ts.snap index f3a4cfe74a61..a5c25de4eb4f 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_class_member.ts.snap @@ -1,3 +1,35 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Foo { + @dec constructor() {} + @dec [index: string]: { props: string } +} +class Quiz { + @dec public constructor() {} +} +class Bar extends Foo { + @dec + constructor(); + constructor(a: String) + constructor(a?: String) {} +} +declare class Baz { + @dec method(); + @dec get foo(); + @dec set foo(a); +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -356,7 +388,11 @@ JsModule { ], eof_token: EOF@312..313 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..313 0: (empty) 1: (empty) @@ -595,7 +631,12 @@ JsModule { 6: SEMICOLON@309..310 ";" [] [] 9: R_CURLY@310..312 "}" [Newline("\n")] [] 4: EOF@312..313 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_class_member.ts:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -608,7 +649,6 @@ decorator_class_member.ts:2:4 parse ━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_class_member.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -622,7 +662,6 @@ decorator_class_member.ts:3:4 parse ━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_class_member.ts:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -636,7 +675,6 @@ decorator_class_member.ts:6:4 parse ━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_class_member.ts:9:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -650,7 +688,6 @@ decorator_class_member.ts:9:4 parse ━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_class_member.ts:15:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -664,7 +701,6 @@ decorator_class_member.ts:15:3 parse ━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_class_member.ts:16:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -678,7 +714,6 @@ decorator_class_member.ts:16:3 parse ━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_class_member.ts:17:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -692,22 +727,4 @@ decorator_class_member.ts:17:3 parse ━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -class Foo { - @dec constructor() {} - @dec [index: string]: { props: string } -} -class Quiz { - @dec public constructor() {} -} -class Bar extends Foo { - @dec - constructor(); - constructor(a: String) - constructor(a?: String) {} -} -declare class Baz { - @dec method(); - @dec get foo(); - @dec set foo(a); -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_enum_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_enum_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_enum_export_default_declaration_clause.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/decorator_enum_export_default_declaration_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts.snap index df3c8f12704f..6c80e6f6ed3c 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_enum_export_default_declaration_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_enum_export_default_declaration_clause.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default enum A { X, Y, Z } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -60,7 +76,11 @@ JsModule { ], eof_token: EOF@44..45 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..45 0: (empty) 1: (empty) @@ -100,7 +120,12 @@ JsModule { 1: (empty) 5: R_CURLY@43..44 "}" [] [] 4: EOF@44..45 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_enum_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -112,7 +137,6 @@ decorator_enum_export_default_declaration_clause.ts:1:1 parse ━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_enum_export_default_declaration_clause.ts:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'export default' isn't allowed for 'enum's. Move the 'enum' declaration in its own statement and then export the enum's name. @@ -122,6 +146,4 @@ decorator_enum_export_default_declaration_clause.ts:2:16 parse ━━━━━ │ ^^^^^^^^^^^^^^^^^^ 3 │ --- -@decorator -export default enum A { X, Y, Z } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export.js b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_export.js rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_export.js diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/decorator_export.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_export.js.snap index bb34427fda85..c16adbb49f81 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_export.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { + @decorator + export class Foo { } + @first.field @second @(() => decorator)() + export class Bar {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -132,7 +152,11 @@ JsModule { ], eof_token: EOF@132..133 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..133 0: (empty) 1: (empty) @@ -229,7 +253,12 @@ JsModule { 9: R_CURLY@129..130 "}" [] [] 3: R_CURLY@130..132 "}" [Newline("\n")] [] 4: EOF@132..133 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_export.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of an export declaration not at the top level @@ -244,7 +273,6 @@ decorator_export.js:2:6 parse ━━━━━━━━━━━━━━━━ i move this declaration to the top level --- decorator_export.js:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of an export declaration not at the top level @@ -260,10 +288,4 @@ decorator_export.js:4:6 parse ━━━━━━━━━━━━━━━━ i move this declaration to the top level --- -function foo() { - @decorator - export class Foo { } - @first.field @second @(() => decorator)() - export class Bar {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export_class_clause.js b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_class_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_export_class_clause.js rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_export_class_clause.js diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export_class_clause.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_class_clause.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/decorator_export_class_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_export_class_clause.js.snap index cdb3c69ce745..35b1da2e4edf 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_export_class_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_class_clause.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +@decorator +export let a; +@decorator1 @decorator2 +export function Foo() { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -83,7 +101,11 @@ JsModule { ], eof_token: EOF@74..75 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..75 0: (empty) 1: (empty) @@ -141,7 +163,12 @@ JsModule { 2: JS_STATEMENT_LIST@73..73 3: R_CURLY@73..74 "}" [] [] 4: EOF@74..75 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_export_class_clause.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -153,7 +180,6 @@ decorator_export_class_clause.js:1:1 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_export_class_clause.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -167,8 +193,4 @@ decorator_export_class_clause.js:3:1 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -@decorator -export let a; -@decorator1 @decorator2 -export function Foo() { } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export_default_expression_clause.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_default_expression_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_export_default_expression_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_export_default_expression_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_export_default_expression_clause.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_default_expression_clause.ts.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/decorator_export_default_expression_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_export_default_expression_clause.ts.snap index 4c1bed0b5018..33239e876cb5 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_export_default_expression_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_export_default_expression_clause.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default a; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -31,7 +47,11 @@ JsModule { ], eof_token: EOF@28..29 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..29 0: (empty) 1: (empty) @@ -53,7 +73,12 @@ JsModule { 0: IDENT@26..27 "a" [] [] 2: SEMICOLON@27..28 ";" [] [] 4: EOF@28..29 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_export_default_expression_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -65,6 +90,4 @@ decorator_export_default_expression_clause.ts:1:1 parse ━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -@decorator -export default a; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_expression_class.js b/crates/biome_js_parser/tests/js_test_suite/error/decorator_expression_class.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_expression_class.js rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_expression_class.js diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_expression_class.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_expression_class.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/decorator_expression_class.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_expression_class.js.snap index 480e90d3b848..82d1e574e566 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_expression_class.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_expression_class.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = @decorator () => {}; +let b = @first @second function foo() {} +let a = @decorator ( () => {} ) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -189,7 +206,11 @@ JsModule { ], eof_token: EOF@101..102 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..102 0: (empty) 1: (empty) @@ -306,7 +327,12 @@ JsModule { 2: R_PAREN@100..101 ")" [] [] 1: (empty) 4: EOF@101..102 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_expression_class.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -318,7 +344,6 @@ decorator_expression_class.js:1:9 parse ━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_expression_class.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a parenthesis '(' but instead found '=>'. @@ -335,7 +360,6 @@ decorator_expression_class.js:1:23 parse ━━━━━━━━━━━━━ 2 │ let b = @first @second function foo() {} 3 │ let a = @decorator ( () => {} ) --- decorator_expression_class.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -348,7 +372,6 @@ decorator_expression_class.js:2:9 parse ━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_expression_class.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -361,7 +384,6 @@ decorator_expression_class.js:3:9 parse ━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- decorator_expression_class.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found the end of the file. @@ -378,7 +400,4 @@ decorator_expression_class.js:4:1 parse ━━━━━━━━━━━━━ > 4 │ │ --- -let a = @decorator () => {}; -let b = @first @second function foo() {} -let a = @decorator ( () => {} ) +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_function_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_function_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_function_export_default_declaration_clause.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/decorator_function_export_default_declaration_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts.snap index 63ea7b6447f0..65ce36bb9bd2 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_function_export_default_declaration_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_function_export_default_declaration_clause.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default function foo() { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -47,7 +63,11 @@ JsModule { ], eof_token: EOF@44..45 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..45 0: (empty) 1: (empty) @@ -83,7 +103,12 @@ JsModule { 3: R_CURLY@43..44 "}" [] [] 2: (empty) 4: EOF@44..45 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_function_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -95,6 +120,4 @@ decorator_function_export_default_declaration_clause.ts:1:1 parse ━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -@decorator -export default function foo() { } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_interface_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_interface_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_interface_export_default_declaration_clause.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/decorator_interface_export_default_declaration_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts.snap index 29a791cbb842..e22c9ccbc04e 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_interface_export_default_declaration_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_interface_export_default_declaration_clause.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default interface A { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +53,11 @@ JsModule { ], eof_token: EOF@41..42 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..42 0: (empty) 1: (empty) @@ -65,7 +85,12 @@ JsModule { 6: R_CURLY@40..41 "}" [] [] 2: (empty) 4: EOF@41..42 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_interface_export_default_declaration_clause.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -77,6 +102,4 @@ decorator_interface_export_default_declaration_clause.ts:1:1 parse ━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -@decorator -export default interface A { } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_precede_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/decorator_precede_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/decorator_precede_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_precede_class_member.ts diff --git a/crates/biome_js_parser/test_data/inline/err/decorator_precede_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/error/decorator_precede_class_member.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/decorator_precede_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/error/decorator_precede_class_member.ts.snap index 819618032276..e6a212836ee8 100644 --- a/crates/biome_js_parser/test_data/inline/err/decorator_precede_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/decorator_precede_class_member.ts.snap @@ -1,3 +1,31 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Bar { + public @dec get foo() {} + static @dec foo: string; + readonly @dec test() {} + private @dec test() {} + protected @dec test() {} +} +class Qux extends Bar { + public @dec get foo() {} + static @dec foo: string; + readonly @dec test() {} + private @dec test() {} + accessor @dec test() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -348,7 +376,11 @@ JsModule { ], eof_token: EOF@302..303 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..303 0: (empty) 1: (empty) @@ -574,7 +606,12 @@ JsModule { 3: R_CURLY@299..300 "}" [] [] 9: R_CURLY@300..302 "}" [Newline("\n")] [] 4: EOF@302..303 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` decorator_precede_class_member.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators must precede the name and all keywords of property declarations. @@ -585,7 +622,6 @@ decorator_precede_class_member.ts:2:10 parse ━━━━━━━━━━━ 3 │ static @dec foo: string; 4 │ readonly @dec test() {} --- decorator_precede_class_member.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators must precede the name and all keywords of property declarations. @@ -597,7 +633,6 @@ decorator_precede_class_member.ts:3:10 parse ━━━━━━━━━━━ 4 │ readonly @dec test() {} 5 │ private @dec test() {} --- decorator_precede_class_member.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Readonly can only appear on a property declaration or index signature. @@ -609,7 +644,6 @@ decorator_precede_class_member.ts:4:3 parse ━━━━━━━━━━━━ 5 │ private @dec test() {} 6 │ protected @dec test() {} --- decorator_precede_class_member.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators must precede the name and all keywords of property declarations. @@ -621,7 +655,6 @@ decorator_precede_class_member.ts:4:12 parse ━━━━━━━━━━━ 5 │ private @dec test() {} 6 │ protected @dec test() {} --- decorator_precede_class_member.ts:5:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators must precede the name and all keywords of property declarations. @@ -633,7 +666,6 @@ decorator_precede_class_member.ts:5:11 parse ━━━━━━━━━━━ 6 │ protected @dec test() {} 7 │ } --- decorator_precede_class_member.ts:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators must precede the name and all keywords of property declarations. @@ -645,7 +677,6 @@ decorator_precede_class_member.ts:6:13 parse ━━━━━━━━━━━ 7 │ } 8 │ class Qux extends Bar { --- decorator_precede_class_member.ts:9:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators must precede the name and all keywords of property declarations. @@ -657,7 +688,6 @@ decorator_precede_class_member.ts:9:10 parse ━━━━━━━━━━━ 10 │ static @dec foo: string; 11 │ readonly @dec test() {} --- decorator_precede_class_member.ts:10:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators must precede the name and all keywords of property declarations. @@ -669,7 +699,6 @@ decorator_precede_class_member.ts:10:10 parse ━━━━━━━━━━━ 11 │ readonly @dec test() {} 12 │ private @dec test() {} --- decorator_precede_class_member.ts:11:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Readonly can only appear on a property declaration or index signature. @@ -681,7 +710,6 @@ decorator_precede_class_member.ts:11:3 parse ━━━━━━━━━━━ 12 │ private @dec test() {} 13 │ accessor @dec test() {} --- decorator_precede_class_member.ts:11:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators must precede the name and all keywords of property declarations. @@ -693,7 +721,6 @@ decorator_precede_class_member.ts:11:12 parse ━━━━━━━━━━━ 12 │ private @dec test() {} 13 │ accessor @dec test() {} --- decorator_precede_class_member.ts:12:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators must precede the name and all keywords of property declarations. @@ -705,7 +732,6 @@ decorator_precede_class_member.ts:12:11 parse ━━━━━━━━━━━ 13 │ accessor @dec test() {} 14 │ } --- decorator_precede_class_member.ts:13:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'accessor' modifier is only allowed on properties. @@ -717,7 +743,6 @@ decorator_precede_class_member.ts:13:3 parse ━━━━━━━━━━━ 14 │ } 15 │ --- decorator_precede_class_member.ts:13:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators must precede the name and all keywords of property declarations. @@ -729,18 +754,4 @@ decorator_precede_class_member.ts:13:12 parse ━━━━━━━━━━━ 14 │ } 15 │ --- -class Bar { - public @dec get foo() {} - static @dec foo: string; - readonly @dec test() {} - private @dec test() {} - protected @dec test() {} -} -class Qux extends Bar { - public @dec get foo() {} - static @dec foo: string; - readonly @dec test() {} - private @dec test() {} - accessor @dec test() {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/do_while_no_continue_break.js b/crates/biome_js_parser/tests/js_test_suite/error/do_while_no_continue_break.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/do_while_no_continue_break.js rename to crates/biome_js_parser/tests/js_test_suite/error/do_while_no_continue_break.js diff --git a/crates/biome_js_parser/test_data/inline/err/do_while_no_continue_break.rast b/crates/biome_js_parser/tests/js_test_suite/error/do_while_no_continue_break.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/do_while_no_continue_break.rast rename to crates/biome_js_parser/tests/js_test_suite/error/do_while_no_continue_break.js.snap index 433a1ca4b7c8..5b6bc366a7a4 100644 --- a/crates/biome_js_parser/test_data/inline/err/do_while_no_continue_break.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/do_while_no_continue_break.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +do { } break (continue) +do { } continue (break) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -78,7 +94,11 @@ JsModule { ], eof_token: EOF@47..48 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -131,7 +151,12 @@ JsModule { 9: JS_BOGUS_STATEMENT@46..47 0: R_PAREN@46..47 ")" [] [] 4: EOF@47..48 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` do_while_no_continue_break.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `while` but instead found `break` @@ -143,7 +168,6 @@ do_while_no_continue_break.js:1:8 parse ━━━━━━━━━━━━━ i Remove break --- do_while_no_continue_break.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -167,7 +191,6 @@ do_while_no_continue_break.js:1:14 parse ━━━━━━━━━━━━━ 2 │ do { } continue (break) 3 │ --- do_while_no_continue_break.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `break` statement can only be used within an enclosing iteration or switch statement. @@ -177,7 +200,6 @@ do_while_no_continue_break.js:1:8 parse ━━━━━━━━━━━━━ 2 │ do { } continue (break) 3 │ --- do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `continue` @@ -189,7 +211,6 @@ do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━ i Remove continue --- do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -213,7 +234,6 @@ do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━ 2 │ do { } continue (break) 3 │ --- do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. @@ -223,7 +243,6 @@ do_while_no_continue_break.js:1:15 parse ━━━━━━━━━━━━━ 2 │ do { } continue (break) 3 │ --- do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found ')'. @@ -240,7 +259,6 @@ do_while_no_continue_break.js:1:23 parse ━━━━━━━━━━━━━ 2 │ do { } continue (break) 3 │ --- do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `while` but instead found `continue` @@ -252,7 +270,6 @@ do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━ i Remove continue --- do_while_no_continue_break.js:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -276,7 +293,6 @@ do_while_no_continue_break.js:2:17 parse ━━━━━━━━━━━━━ │ ^^^^^^^^^^ 3 │ --- do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `continue` statement can only be used within an enclosing `for`, `while` or `do while` statement. @@ -286,7 +302,6 @@ do_while_no_continue_break.js:2:8 parse ━━━━━━━━━━━━━ │ ^^^^^^^^ 3 │ --- do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `break` @@ -298,7 +313,6 @@ do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━ i Remove break --- do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -322,7 +336,6 @@ do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━ │ ^^^^^^ 3 │ --- do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A `break` statement can only be used within an enclosing iteration or switch statement. @@ -332,7 +345,6 @@ do_while_no_continue_break.js:2:18 parse ━━━━━━━━━━━━━ │ ^^^^^ 3 │ --- do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found ')'. @@ -349,6 +361,4 @@ do_while_no_continue_break.js:2:23 parse ━━━━━━━━━━━━━ │ ^ 3 │ --- -do { } break (continue) -do { } continue (break) +``` diff --git a/crates/biome_js_parser/test_data/inline/err/do_while_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/do_while_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/do_while_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/do_while_stmt_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/do_while_stmt_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/do_while_stmt_err.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/do_while_stmt_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/do_while_stmt_err.js.snap index 8fbf8c762c1f..5129218924ea 100644 --- a/crates/biome_js_parser/test_data/inline/err/do_while_stmt_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/do_while_stmt_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +do while (true) +do while () +do while true + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -53,7 +70,11 @@ JsModule { ], eof_token: EOF@41..42 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..42 0: (empty) 1: (empty) @@ -99,7 +120,12 @@ JsModule { 5: (empty) 6: (empty) 4: EOF@41..42 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` do_while_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ')'. @@ -118,7 +144,6 @@ do_while_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━ 3 │ do while true 4 │ --- do_while_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `true` @@ -131,7 +156,6 @@ do_while_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━ i Remove true --- do_while_stmt_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead the file ends @@ -148,7 +172,4 @@ do_while_stmt_err.js:4:1 parse ━━━━━━━━━━━━━━━━ > 4 │ │ --- -do while (true) -do while () -do while true +``` diff --git a/crates/biome_js_parser/test_data/inline/err/double_label.js b/crates/biome_js_parser/tests/js_test_suite/error/double_label.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/double_label.js rename to crates/biome_js_parser/tests/js_test_suite/error/double_label.js diff --git a/crates/biome_js_parser/test_data/inline/err/double_label.rast b/crates/biome_js_parser/tests/js_test_suite/error/double_label.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/double_label.rast rename to crates/biome_js_parser/tests/js_test_suite/error/double_label.js.snap index ec19e64223b4..91b1bfa9f8d4 100644 --- a/crates/biome_js_parser/test_data/inline/err/double_label.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/double_label.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +label1: { + label2: { + label1: {} + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -41,7 +60,11 @@ JsModule { ], eof_token: EOF@42..43 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..43 0: (empty) 1: (empty) @@ -72,7 +95,12 @@ JsModule { 2: R_CURLY@36..40 "}" [Newline("\n"), Whitespace(" ")] [] 2: R_CURLY@40..42 "}" [Newline("\n")] [] 4: EOF@42..43 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` double_label.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Duplicate statement labels are not allowed @@ -100,9 +128,4 @@ double_label.js:3:5 parse ━━━━━━━━━━━━━━━━━━ 2 │ label2: { 3 │ label1: {} --- -label1: { - label2: { - label1: {} - } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/empty_parenthesized_expression.js b/crates/biome_js_parser/tests/js_test_suite/error/empty_parenthesized_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/empty_parenthesized_expression.js rename to crates/biome_js_parser/tests/js_test_suite/error/empty_parenthesized_expression.js diff --git a/crates/biome_js_parser/test_data/inline/err/empty_parenthesized_expression.rast b/crates/biome_js_parser/tests/js_test_suite/error/empty_parenthesized_expression.js.snap similarity index 88% rename from crates/biome_js_parser/test_data/inline/err/empty_parenthesized_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/error/empty_parenthesized_expression.js.snap index 2070c3303a72..92f504a375f8 100644 --- a/crates/biome_js_parser/test_data/inline/err/empty_parenthesized_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/empty_parenthesized_expression.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -14,7 +29,11 @@ JsModule { ], eof_token: EOF@3..4 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..4 0: (empty) 1: (empty) @@ -27,7 +46,12 @@ JsModule { 2: R_PAREN@1..2 ")" [] [] 1: SEMICOLON@2..3 ";" [] [] 4: EOF@3..4 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` empty_parenthesized_expression.js:1:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Parenthesized expression didnt contain anything @@ -38,5 +62,4 @@ empty_parenthesized_expression.js:1:2 parse ━━━━━━━━━━━━ i Expected an expression here --- -(); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/enum_decl_no_id.ts b/crates/biome_js_parser/tests/js_test_suite/error/enum_decl_no_id.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/enum_decl_no_id.ts rename to crates/biome_js_parser/tests/js_test_suite/error/enum_decl_no_id.ts diff --git a/crates/biome_js_parser/test_data/inline/err/enum_decl_no_id.rast b/crates/biome_js_parser/tests/js_test_suite/error/enum_decl_no_id.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/enum_decl_no_id.rast rename to crates/biome_js_parser/tests/js_test_suite/error/enum_decl_no_id.ts.snap index 1d61665affad..165729de8259 100644 --- a/crates/biome_js_parser/test_data/inline/err/enum_decl_no_id.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/enum_decl_no_id.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +enum {A,B,C} +enum 1 {A,B,C} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -68,7 +84,11 @@ JsModule { ], eof_token: EOF@27..28 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..28 0: (empty) 1: (empty) @@ -118,7 +138,12 @@ JsModule { 1: (empty) 5: R_CURLY@26..27 "}" [] [] 4: EOF@27..28 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` enum_decl_no_id.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `enum` statements must have a name @@ -128,7 +153,6 @@ enum_decl_no_id.ts:1:1 parse ━━━━━━━━━━━━━━━━━ 2 │ enum 1 {A,B,C} 3 │ --- enum_decl_no_id.ts:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × invalid `enum` name @@ -138,6 +162,4 @@ enum_decl_no_id.ts:2:6 parse ━━━━━━━━━━━━━━━━━ │ ^ 3 │ --- -enum {A,B,C} -enum 1 {A,B,C} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/enum_in_js.js b/crates/biome_js_parser/tests/js_test_suite/error/enum_in_js.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/enum_in_js.js rename to crates/biome_js_parser/tests/js_test_suite/error/enum_in_js.js diff --git a/crates/biome_js_parser/test_data/inline/err/enum_in_js.rast b/crates/biome_js_parser/tests/js_test_suite/error/enum_in_js.js.snap similarity index 89% rename from crates/biome_js_parser/test_data/inline/err/enum_in_js.rast rename to crates/biome_js_parser/tests/js_test_suite/error/enum_in_js.js.snap index 733ac8c53f53..98ee6cc68eb6 100644 --- a/crates/biome_js_parser/test_data/inline/err/enum_in_js.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/enum_in_js.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +enum A {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -17,7 +32,11 @@ JsModule { ], eof_token: EOF@9..10 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..10 0: (empty) 1: (empty) @@ -31,7 +50,12 @@ JsModule { 3: TS_ENUM_MEMBER_LIST@8..8 4: R_CURLY@8..9 "}" [] [] 4: EOF@9..10 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` enum_in_js.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'enum's are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -42,5 +66,4 @@ enum_in_js.js:1:1 parse ━━━━━━━━━━━━━━━━━━ i TypeScript only syntax --- -enum A {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/enum_no_l_curly.ts b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_l_curly.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/enum_no_l_curly.ts rename to crates/biome_js_parser/tests/js_test_suite/error/enum_no_l_curly.ts diff --git a/crates/biome_js_parser/test_data/inline/err/enum_no_l_curly.rast b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_l_curly.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/enum_no_l_curly.rast rename to crates/biome_js_parser/tests/js_test_suite/error/enum_no_l_curly.ts.snap index c4220e3c3666..1f212591729f 100644 --- a/crates/biome_js_parser/test_data/inline/err/enum_no_l_curly.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_l_curly.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +enum; +enum A; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -30,7 +46,11 @@ JsModule { ], eof_token: EOF@13..14 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..14 0: (empty) 1: (empty) @@ -56,7 +76,12 @@ JsModule { 3: JS_EMPTY_STATEMENT@12..13 0: SEMICOLON@12..13 ";" [] [] 4: EOF@13..14 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` enum_no_l_curly.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `enum` statements must have a name @@ -66,7 +91,6 @@ enum_no_l_curly.ts:1:1 parse ━━━━━━━━━━━━━━━━━ 2 │ enum A; 3 │ --- enum_no_l_curly.ts:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `{` but instead found `;` @@ -78,7 +102,6 @@ enum_no_l_curly.ts:1:5 parse ━━━━━━━━━━━━━━━━━ i Remove ; --- enum_no_l_curly.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `{` but instead found `;` @@ -90,6 +113,4 @@ enum_no_l_curly.ts:2:7 parse ━━━━━━━━━━━━━━━━━ i Remove ; --- -enum; -enum A; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/enum_no_r_curly.ts b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_r_curly.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/enum_no_r_curly.ts rename to crates/biome_js_parser/tests/js_test_suite/error/enum_no_r_curly.ts diff --git a/crates/biome_js_parser/test_data/inline/err/enum_no_r_curly.rast b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_r_curly.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/enum_no_r_curly.rast rename to crates/biome_js_parser/tests/js_test_suite/error/enum_no_r_curly.ts.snap index 71724c217c18..50fae93f5411 100644 --- a/crates/biome_js_parser/test_data/inline/err/enum_no_r_curly.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/enum_no_r_curly.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +enum {; +enum A {; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -30,7 +46,11 @@ JsModule { ], eof_token: EOF@17..18 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..18 0: (empty) 1: (empty) @@ -56,7 +76,12 @@ JsModule { 3: JS_EMPTY_STATEMENT@16..17 0: SEMICOLON@16..17 ";" [] [] 4: EOF@17..18 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` enum_no_r_curly.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `enum` statements must have a name @@ -66,7 +91,6 @@ enum_no_r_curly.ts:1:1 parse ━━━━━━━━━━━━━━━━━ 2 │ enum A {; 3 │ --- enum_no_r_curly.ts:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, or a computed name but instead found ';'. @@ -83,7 +107,6 @@ enum_no_r_curly.ts:1:7 parse ━━━━━━━━━━━━━━━━━ 2 │ enum A {; 3 │ --- enum_no_r_curly.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, or a computed name but instead found ';'. @@ -100,6 +123,4 @@ enum_no_r_curly.ts:2:9 parse ━━━━━━━━━━━━━━━━━ │ ^ 3 │ --- -enum {; -enum A {; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/escaped_from.js b/crates/biome_js_parser/tests/js_test_suite/error/escaped_from.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/escaped_from.js rename to crates/biome_js_parser/tests/js_test_suite/error/escaped_from.js diff --git a/crates/biome_js_parser/test_data/inline/err/escaped_from.rast b/crates/biome_js_parser/tests/js_test_suite/error/escaped_from.js.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/err/escaped_from.rast rename to crates/biome_js_parser/tests/js_test_suite/error/escaped_from.js.snap index c79122fe67e3..922720f3f5d5 100644 --- a/crates/biome_js_parser/test_data/inline/err/escaped_from.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/escaped_from.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export {} \u0066rom "./escaped-from.js"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -24,7 +39,11 @@ JsModule { ], eof_token: EOF@40..41 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..41 0: (empty) 1: (empty) @@ -42,7 +61,12 @@ JsModule { 0: JS_STRING_LITERAL@20..39 "\"./escaped-from.js\"" [] [] 5: SEMICOLON@39..40 ";" [] [] 4: EOF@40..41 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` escaped_from.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'from' keyword cannot contain escape character. @@ -51,5 +75,4 @@ escaped_from.js:1:11 parse ━━━━━━━━━━━━━━━━━ │ ^^^^^^^^^ 2 │ --- -export {} \u0066rom "./escaped-from.js"; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/eval_arguments_assignment.js b/crates/biome_js_parser/tests/js_test_suite/error/eval_arguments_assignment.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/eval_arguments_assignment.js rename to crates/biome_js_parser/tests/js_test_suite/error/eval_arguments_assignment.js diff --git a/crates/biome_js_parser/test_data/inline/err/eval_arguments_assignment.rast b/crates/biome_js_parser/tests/js_test_suite/error/eval_arguments_assignment.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/eval_arguments_assignment.rast rename to crates/biome_js_parser/tests/js_test_suite/error/eval_arguments_assignment.js.snap index e5107e21a9ed..3721e4e50733 100644 --- a/crates/biome_js_parser/test_data/inline/err/eval_arguments_assignment.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/eval_arguments_assignment.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +eval = "test"; +arguments = "test"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -34,7 +50,11 @@ JsModule { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..35 0: (empty) 1: (empty) @@ -57,7 +77,12 @@ JsModule { 0: JS_STRING_LITERAL@27..33 "\"test\"" [] [] 1: SEMICOLON@33..34 ";" [] [] 4: EOF@34..35 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` eval_arguments_assignment.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode @@ -67,7 +92,6 @@ eval_arguments_assignment.js:1:1 parse ━━━━━━━━━━━━━ 2 │ arguments = "test"; 3 │ --- eval_arguments_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `arguments` as an identifier in strict mode @@ -77,6 +101,4 @@ eval_arguments_assignment.js:2:1 parse ━━━━━━━━━━━━━ │ ^^^^^^^^^ 3 │ --- -eval = "test"; -arguments = "test"; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.js b/crates/biome_js_parser/tests/js_test_suite/error/exponent_unary_unparenthesized.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.js rename to crates/biome_js_parser/tests/js_test_suite/error/exponent_unary_unparenthesized.js diff --git a/crates/biome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.rast b/crates/biome_js_parser/tests/js_test_suite/error/exponent_unary_unparenthesized.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.rast rename to crates/biome_js_parser/tests/js_test_suite/error/exponent_unary_unparenthesized.js.snap index 10b1d9f80a53..86f07880205c 100644 --- a/crates/biome_js_parser/test_data/inline/err/exponent_unary_unparenthesized.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/exponent_unary_unparenthesized.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +delete a.b ** 2; +void ident ** 2; +typeof ident ** 2; +-3 ** 2; ++3 ** 2; +~3 ** 2; +!true ** 2; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -137,7 +158,11 @@ JsModule { ], eof_token: EOF@91..92 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..92 0: (empty) 1: (empty) @@ -221,7 +246,12 @@ JsModule { 0: JS_NUMBER_LITERAL@89..90 "2" [] [] 1: SEMICOLON@90..91 ";" [] [] 4: EOF@91..92 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` exponent_unary_unparenthesized.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' @@ -245,7 +275,6 @@ exponent_unary_unparenthesized.js:1:1 parse ━━━━━━━━━━━━ 2 │ void ident ** 2; 3 │ typeof ident ** 2; --- exponent_unary_unparenthesized.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' @@ -272,7 +301,6 @@ exponent_unary_unparenthesized.js:2:1 parse ━━━━━━━━━━━━ 3 │ typeof ident ** 2; 4 │ -3 ** 2; --- exponent_unary_unparenthesized.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' @@ -302,7 +330,6 @@ exponent_unary_unparenthesized.js:3:1 parse ━━━━━━━━━━━━ 4 │ -3 ** 2; 5 │ +3 ** 2; --- exponent_unary_unparenthesized.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' @@ -332,7 +359,6 @@ exponent_unary_unparenthesized.js:4:1 parse ━━━━━━━━━━━━ 5 │ +3 ** 2; 6 │ ~3 ** 2; --- exponent_unary_unparenthesized.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' @@ -362,7 +388,6 @@ exponent_unary_unparenthesized.js:5:1 parse ━━━━━━━━━━━━ 6 │ ~3 ** 2; 7 │ !true ** 2; --- exponent_unary_unparenthesized.js:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' @@ -392,7 +417,6 @@ exponent_unary_unparenthesized.js:6:1 parse ━━━━━━━━━━━━ 7 │ !true ** 2; 8 │ --- exponent_unary_unparenthesized.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unparenthesized unary expression can't appear on the left-hand side of '**' @@ -419,11 +443,4 @@ exponent_unary_unparenthesized.js:7:1 parse ━━━━━━━━━━━━ │ ^^^^^ 8 │ --- -delete a.b ** 2; -void ident ** 2; -typeof ident ** 2; --3 ** 2; -+3 ** 2; -~3 ** 2; -!true ** 2; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_as_identifier_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_as_identifier_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_as_identifier_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_as_identifier_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/export_as_identifier_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/export_as_identifier_err.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/export_as_identifier_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/export_as_identifier_err.js.snap index 635d6cc7590c..53e4fc8bd2d1 100644 --- a/crates/biome_js_parser/test_data/inline/err/export_as_identifier_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_as_identifier_err.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { as c } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -26,7 +41,11 @@ JsModule { ], eof_token: EOF@15..16 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..16 0: (empty) 1: (empty) @@ -48,7 +67,12 @@ JsModule { 3: R_CURLY@14..15 "}" [] [] 4: (empty) 4: EOF@15..16 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` export_as_identifier_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier but instead found ''. @@ -63,5 +87,4 @@ export_as_identifier_err.js:1:10 parse ━━━━━━━━━━━━━ │ 2 │ --- -export { as c } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_decl_not_top_level.js b/crates/biome_js_parser/tests/js_test_suite/error/export_decl_not_top_level.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_decl_not_top_level.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_decl_not_top_level.js diff --git a/crates/biome_js_parser/test_data/inline/err/export_decl_not_top_level.rast b/crates/biome_js_parser/tests/js_test_suite/error/export_decl_not_top_level.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/export_decl_not_top_level.rast rename to crates/biome_js_parser/tests/js_test_suite/error/export_decl_not_top_level.js.snap index e8f26c1307e0..dabb12e885bc 100644 --- a/crates/biome_js_parser/test_data/inline/err/export_decl_not_top_level.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_decl_not_top_level.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{ + export { pain } from "life"; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -38,7 +55,11 @@ JsModule { ], eof_token: EOF@33..34 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..34 0: (empty) 1: (empty) @@ -67,7 +88,12 @@ JsModule { 7: SEMICOLON@30..31 ";" [] [] 2: R_CURLY@31..33 "}" [Newline("\n")] [] 4: EOF@33..34 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` export_decl_not_top_level.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of an export declaration not at the top level @@ -80,7 +106,4 @@ export_decl_not_top_level.js:2:2 parse ━━━━━━━━━━━━━ i move this declaration to the top level --- -{ - export { pain } from "life"; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_default_expression_broken.js b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_broken.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_default_expression_broken.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_broken.js diff --git a/crates/biome_js_parser/test_data/inline/err/export_default_expression_broken.rast b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_broken.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/export_default_expression_broken.rast rename to crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_broken.js.snap index 0cbd3646e754..852ef95df5d2 100644 --- a/crates/biome_js_parser/test_data/inline/err/export_default_expression_broken.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_broken.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default ; +export default @decorator +export default +export default @decorator + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -61,7 +79,11 @@ JsModule { ], eof_token: EOF@83..84 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..84 0: (empty) 1: (empty) @@ -98,7 +120,12 @@ JsModule { 0: JS_REFERENCE_IDENTIFIER@74..83 0: IDENT@74..83 "decorator" [] [] 4: EOF@83..84 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` export_default_expression_broken.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration but instead found ';'. @@ -115,7 +142,6 @@ export_default_expression_broken.js:1:16 parse ━━━━━━━━━━━ 2 │ export default @decorator 3 │ export default --- export_default_expression_broken.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -128,7 +154,6 @@ export_default_expression_broken.js:2:16 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- export_default_expression_broken.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration but instead found 'export'. @@ -149,7 +174,6 @@ export_default_expression_broken.js:3:1 parse ━━━━━━━━━━━ 4 │ export default @decorator 5 │ --- export_default_expression_broken.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration but instead found 'export'. @@ -168,7 +192,6 @@ export_default_expression_broken.js:4:1 parse ━━━━━━━━━━━ │ ^^^^^^ 5 │ --- export_default_expression_broken.js:4:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -181,7 +204,6 @@ export_default_expression_broken.js:4:16 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- export_default_expression_broken.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration but instead found the end of the file. @@ -198,8 +220,4 @@ export_default_expression_broken.js:5:1 parse ━━━━━━━━━━━ > 5 │ │ --- -export default ; -export default @decorator -export default -export default @decorator +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_default_expression_clause_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_clause_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_default_expression_clause_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_clause_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/export_default_expression_clause_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_clause_err.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/export_default_expression_clause_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_clause_err.js.snap index ddb66f648fbe..4ab6041e0d69 100644 --- a/crates/biome_js_parser/test_data/inline/err/export_default_expression_clause_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_default_expression_clause_err.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default a, b; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -28,7 +43,11 @@ JsModule { ], eof_token: EOF@20..21 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..21 0: (empty) 1: (empty) @@ -49,7 +68,12 @@ JsModule { 2: JS_EMPTY_STATEMENT@19..20 0: SEMICOLON@19..20 ";" [] [] 4: EOF@20..21 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` export_default_expression_clause_err.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -70,5 +94,4 @@ export_default_expression_clause_err.js:1:17 parse ━━━━━━━━━ │ ^^^^^^^^^ 2 │ --- -export default a, b; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/export_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/export_err.js.snap similarity index 87% rename from crates/biome_js_parser/test_data/inline/err/export_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/export_err.js.snap index ce465c6a69f2..5c1a4f6de652 100644 --- a/crates/biome_js_parser/test_data/inline/err/export_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_err.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -11,7 +26,11 @@ JsModule { ], eof_token: EOF@6..7 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..7 0: (empty) 1: (empty) @@ -22,7 +41,12 @@ JsModule { 1: EXPORT_KW@0..6 "export" [] [] 2: (empty) 4: EOF@6..7 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` export_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration but instead found the end of the file. @@ -37,5 +61,4 @@ export_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━ > 2 │ │ --- -export +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_from_clause_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_from_clause_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_from_clause_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_from_clause_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/export_from_clause_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/export_from_clause_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/export_from_clause_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/export_from_clause_err.js.snap index 4717e5773db4..bbf88455e063 100644 --- a/crates/biome_js_parser/test_data/inline/err/export_from_clause_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_from_clause_err.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export *; +export * from 5; +export as from "test"; +export from "test"; +export type *; +export type * from; +export type * as from; +export type * as ns from; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -135,7 +157,11 @@ JsModule { ], eof_token: EOF@153..154 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..154 0: (empty) 1: (empty) @@ -245,7 +271,12 @@ JsModule { 5: (empty) 6: SEMICOLON@152..153 ";" [] [] 4: EOF@153..154 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` export_from_clause_err.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `from` but instead found `;` @@ -257,7 +288,6 @@ export_from_clause_err.js:1:9 parse ━━━━━━━━━━━━━━ i Remove ; --- export_from_clause_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a string literal but instead found '5'. @@ -276,7 +306,6 @@ export_from_clause_err.js:2:15 parse ━━━━━━━━━━━━━━ 3 │ export as from "test"; 4 │ export from "test"; --- export_from_clause_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `*` but instead found `as` @@ -290,7 +319,6 @@ export_from_clause_err.js:3:8 parse ━━━━━━━━━━━━━━ i Remove as --- export_from_clause_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `from` but instead found `"test"` @@ -304,7 +332,6 @@ export_from_clause_err.js:3:16 parse ━━━━━━━━━━━━━━ i Remove "test" --- export_from_clause_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `*` but instead found `from` @@ -318,7 +345,6 @@ export_from_clause_err.js:4:8 parse ━━━━━━━━━━━━━━ i Remove from --- export_from_clause_err.js:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `from` but instead found `;` @@ -332,7 +358,6 @@ export_from_clause_err.js:5:14 parse ━━━━━━━━━━━━━━ i Remove ; --- export_from_clause_err.js:6:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a string literal but instead found ';'. @@ -353,7 +378,6 @@ export_from_clause_err.js:6:19 parse ━━━━━━━━━━━━━━ 7 │ export type * as from; 8 │ export type * as ns from; --- export_from_clause_err.js:7:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `from` but instead found `;` @@ -367,7 +391,6 @@ export_from_clause_err.js:7:22 parse ━━━━━━━━━━━━━━ i Remove ; --- export_from_clause_err.js:8:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a string literal but instead found ';'. @@ -386,12 +409,4 @@ export_from_clause_err.js:8:25 parse ━━━━━━━━━━━━━━ │ ^ 9 │ --- -export *; -export * from 5; -export as from "test"; -export from "test"; -export type *; -export type * from; -export type * as from; -export type * as ns from; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_huge_function_in_script.js b/crates/biome_js_parser/tests/js_test_suite/error/export_huge_function_in_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_huge_function_in_script.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_huge_function_in_script.cjs diff --git a/crates/biome_js_parser/test_data/inline/err/export_huge_function_in_script.rast b/crates/biome_js_parser/tests/js_test_suite/error/export_huge_function_in_script.cjs.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/export_huge_function_in_script.rast rename to crates/biome_js_parser/tests/js_test_suite/error/export_huge_function_in_script.cjs.snap index 6b8ab9058093..7f4c6d017c86 100644 --- a/crates/biome_js_parser/test_data/inline/err/export_huge_function_in_script.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_huge_function_in_script.cjs.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +export function A () { return "Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere."; } + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -41,7 +57,11 @@ JsScript { ], eof_token: EOF@1441..1442 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_SCRIPT@0..1442 0: (empty) 1: (empty) @@ -73,8 +93,13 @@ JsScript { 2: SEMICOLON@1438..1440 ";" [] [Whitespace(" ")] 3: R_CURLY@1440..1441 "}" [] [] 4: EOF@1441..1442 "" [Newline("\n")] [] --- -export_huge_function_in_script.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +``` + +## Diagnostics + +``` +export_huge_function_in_script.cjs:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of an export declaration outside of a module @@ -85,6 +110,4 @@ export_huge_function_in_script.js:2:1 parse ━━━━━━━━━━━━ i not allowed inside scripts --- -// SCRIPT -export function A () { return "Kinsmen hot Moria tea serves. Sticky camp spell covering forged they're Oakenshield vines. Admirable relatives march regained wheel Ere eternally on rest parts unhappy? Leave hundreds market's Argonath answered avail grieve doing goodness! Wrong miserable well-wishers wander stood immediately neither Agreed goat poison holes fire? Nobody tosses a Dwarf. Brigands Bilbo Baggins prisoner stinker birthday injuries. Kili's loosened shy spiders till. Gandalf's death was not in vain. Nor would he have you give up hope. Bread kindly ghost Beorn's jelly. Andûril two-faced bitterness biding seemed says drinking splendor feed light unnoticed one! Carven nearest Eärendil fireworks former. Mattress smelling wandering teaching appear taste wise Mithril uprooted winter forebearers wheel. Let's beside Proudfoots succumbed! Excuse Anárion stolen helpless nudge study shown holding form? Changes point Snowbourn material side outer highest eaves flash-flame relic descendant lurking. Thousand death Agreed oppose whole? Glóin head's hurts feasting fight shiny legacy. Thror's broken odds suffice believe well-protected? Rightfully manners begged Maggot's fairer. Unheard-of grog shields sad wondering gardener killed gone Galadriel! Pan Frodo fingers spreads magic parting amount interest idly naked. It's some form of Elvish. I can't read it. Silverwork Wraiths riddled enchantment apple anywhere."; } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_named_clause_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_named_clause_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_named_clause_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_named_clause_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/export_named_clause_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/export_named_clause_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/export_named_clause_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/export_named_clause_err.js.snap index 5d3c0db0ee6c..ced87e42134d 100644 --- a/crates/biome_js_parser/test_data/inline/err/export_named_clause_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_named_clause_err.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { default as "b" }; +export { "a" as b }; +export { as b }; +export { a as 5 }; +export { a b c }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -144,7 +163,11 @@ JsModule { ], eof_token: EOF@101..102 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..102 0: (empty) 1: (empty) @@ -233,7 +256,12 @@ JsModule { 3: R_CURLY@99..100 "}" [] [] 4: SEMICOLON@100..101 ";" [] [] 4: EOF@101..102 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` export_named_clause_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × "default" can only be used with "export ... from ..." @@ -243,7 +271,6 @@ export_named_clause_err.js:1:10 parse ━━━━━━━━━━━━━━ 2 │ export { "a" as b }; 3 │ export { as b }; --- export_named_clause_err.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A string literal cannot be used as an export binding without `from`. @@ -254,7 +281,6 @@ export_named_clause_err.js:2:10 parse ━━━━━━━━━━━━━━ 3 │ export { as b }; 4 │ export { a as 5 }; --- export_named_clause_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier but instead found ''. @@ -275,7 +301,6 @@ export_named_clause_err.js:3:10 parse ━━━━━━━━━━━━━━ 4 │ export { a as 5 }; 5 │ export { a b c }; --- export_named_clause_err.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a string literal, or an identifier but instead found '5'. @@ -296,7 +321,6 @@ export_named_clause_err.js:4:15 parse ━━━━━━━━━━━━━━ 5 │ export { a b c }; 6 │ --- export_named_clause_err.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `b` @@ -309,7 +333,6 @@ export_named_clause_err.js:5:12 parse ━━━━━━━━━━━━━━ i Remove b --- export_named_clause_err.js:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `c` @@ -322,9 +345,4 @@ export_named_clause_err.js:5:14 parse ━━━━━━━━━━━━━━ i Remove c --- -export { default as "b" }; -export { "a" as b }; -export { as b }; -export { a as 5 }; -export { a b c }; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_named_from_clause_err.js b/crates/biome_js_parser/tests/js_test_suite/error/export_named_from_clause_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_named_from_clause_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_named_from_clause_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/export_named_from_clause_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/export_named_from_clause_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/export_named_from_clause_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/export_named_from_clause_err.js.snap index 2038c35ee9b5..9510dc3d7fdc 100644 --- a/crates/biome_js_parser/test_data/inline/err/export_named_from_clause_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_named_from_clause_err.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { as b } from "mod"; +export { a as 5 } from "mod"; +export { a b c } from "mod"; +export { 5 as b } from "mod"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -137,7 +155,11 @@ JsModule { ], eof_token: EOF@116..117 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..117 0: (empty) 1: (empty) @@ -229,7 +251,12 @@ JsModule { 0: JS_STRING_LITERAL@110..115 "\"mod\"" [] [] 5: SEMICOLON@115..116 ";" [] [] 4: EOF@116..117 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` export_named_from_clause_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a string literal, or an identifier but instead found ''. @@ -246,7 +273,6 @@ export_named_from_clause_err.js:1:10 parse ━━━━━━━━━━━━ 2 │ export { a as 5 } from "mod"; 3 │ export { a b c } from "mod"; --- export_named_from_clause_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a string literal, or an identifier but instead found '5'. @@ -265,7 +291,6 @@ export_named_from_clause_err.js:2:15 parse ━━━━━━━━━━━━ 3 │ export { a b c } from "mod"; 4 │ export { 5 as b } from "mod"; --- export_named_from_clause_err.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `b` @@ -279,7 +304,6 @@ export_named_from_clause_err.js:3:12 parse ━━━━━━━━━━━━ i Remove b --- export_named_from_clause_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `c` @@ -293,7 +317,6 @@ export_named_from_clause_err.js:3:14 parse ━━━━━━━━━━━━ i Remove c --- export_named_from_clause_err.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a string literal, or an identifier but instead found '5 as b'. @@ -312,8 +335,4 @@ export_named_from_clause_err.js:4:10 parse ━━━━━━━━━━━━ │ ^^^^^^ 5 │ --- -export { as b } from "mod"; -export { a as 5 } from "mod"; -export { a b c } from "mod"; -export { 5 as b } from "mod"; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/export_variable_clause_error.js b/crates/biome_js_parser/tests/js_test_suite/error/export_variable_clause_error.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/export_variable_clause_error.js rename to crates/biome_js_parser/tests/js_test_suite/error/export_variable_clause_error.js diff --git a/crates/biome_js_parser/test_data/inline/err/export_variable_clause_error.rast b/crates/biome_js_parser/tests/js_test_suite/error/export_variable_clause_error.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/export_variable_clause_error.rast rename to crates/biome_js_parser/tests/js_test_suite/error/export_variable_clause_error.js.snap index 1459909572f4..37ad7690aa15 100644 --- a/crates/biome_js_parser/test_data/inline/err/export_variable_clause_error.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/export_variable_clause_error.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export let a = ; +export const b; +export let d, c; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -77,7 +94,11 @@ JsModule { ], eof_token: EOF@49..50 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..50 0: (empty) 1: (empty) @@ -134,7 +155,12 @@ JsModule { 2: (empty) 1: SEMICOLON@48..49 ";" [] [] 4: EOF@49..50 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` export_variable_clause_error.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found ';'. @@ -151,7 +177,6 @@ export_variable_clause_error.js:1:16 parse ━━━━━━━━━━━━ 2 │ export const b; 3 │ export let d, c; --- export_variable_clause_error.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Const declarations must have an initialized value. @@ -164,7 +189,4 @@ export_variable_clause_error.js:2:14 parse ━━━━━━━━━━━━ i This variable needs to be initialized. --- -export let a = ; -export const b; -export let d, c; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.js b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.js rename to crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs.snap new file mode 100644 index 000000000000..0928b8a836fb --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.cjs.snap @@ -0,0 +1,385 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +for (let i = 0 in []) {} +for (const i = 0 in []) {} +for (var i = 0 of []) {} +for (let i = 0 of []) {} +for (const i = 0 of []) {} + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsForInStatement { + for_token: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@14..15 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@15..19 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@19..21 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@21..23 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + in_token: IN_KW@25..28 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@28..29 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@29..30 "]" [] [], + }, + r_paren_token: R_PAREN@30..32 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@32..33 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@33..34 "}" [] [], + }, + }, + JsForInStatement { + for_token: FOR_KW@34..39 "for" [Newline("\n")] [Whitespace(" ")], + l_paren_token: L_PAREN@39..40 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: CONST_KW@40..46 "const" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@46..48 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@48..50 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@50..52 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + in_token: IN_KW@52..55 "in" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@55..56 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@56..57 "]" [] [], + }, + r_paren_token: R_PAREN@57..59 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@59..60 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@60..61 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@61..66 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@66..67 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: VAR_KW@67..71 "var" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@71..73 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@73..75 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@75..77 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@77..80 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@80..81 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@81..82 "]" [] [], + }, + r_paren_token: R_PAREN@82..84 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@84..85 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@85..86 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@86..91 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@91..92 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: LET_KW@92..96 "let" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@96..98 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@98..100 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@100..102 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@102..105 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@105..106 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@106..107 "]" [] [], + }, + r_paren_token: R_PAREN@107..109 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@109..110 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@110..111 "}" [] [], + }, + }, + JsForOfStatement { + for_token: FOR_KW@111..116 "for" [Newline("\n")] [Whitespace(" ")], + await_token: missing (optional), + l_paren_token: L_PAREN@116..117 "(" [] [], + initializer: JsForVariableDeclaration { + await_token: missing (optional), + kind_token: CONST_KW@117..123 "const" [] [Whitespace(" ")], + declarator: JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@123..125 "i" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@125..127 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@127..129 "0" [] [Whitespace(" ")], + }, + }, + }, + }, + of_token: OF_KW@129..132 "of" [] [Whitespace(" ")], + expression: JsArrayExpression { + l_brack_token: L_BRACK@132..133 "[" [] [], + elements: JsArrayElementList [], + r_brack_token: R_BRACK@133..134 "]" [] [], + }, + r_paren_token: R_PAREN@134..136 ")" [] [Whitespace(" ")], + body: JsBlockStatement { + l_curly_token: L_CURLY@136..137 "{" [] [], + statements: JsStatementList [], + r_curly_token: R_CURLY@137..138 "}" [] [], + }, + }, + ], + eof_token: EOF@138..139 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..139 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..138 + 0: JS_FOR_IN_STATEMENT@0..34 + 0: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@14..15 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@15..25 + 0: (empty) + 1: LET_KW@15..19 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@19..25 + 0: JS_IDENTIFIER_BINDING@19..21 + 0: IDENT@19..21 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@21..25 + 0: EQ@21..23 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@23..25 + 0: JS_NUMBER_LITERAL@23..25 "0" [] [Whitespace(" ")] + 3: IN_KW@25..28 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@28..30 + 0: L_BRACK@28..29 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@29..29 + 2: R_BRACK@29..30 "]" [] [] + 5: R_PAREN@30..32 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@32..34 + 0: L_CURLY@32..33 "{" [] [] + 1: JS_STATEMENT_LIST@33..33 + 2: R_CURLY@33..34 "}" [] [] + 1: JS_FOR_IN_STATEMENT@34..61 + 0: FOR_KW@34..39 "for" [Newline("\n")] [Whitespace(" ")] + 1: L_PAREN@39..40 "(" [] [] + 2: JS_FOR_VARIABLE_DECLARATION@40..52 + 0: (empty) + 1: CONST_KW@40..46 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@46..52 + 0: JS_IDENTIFIER_BINDING@46..48 + 0: IDENT@46..48 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@48..52 + 0: EQ@48..50 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@50..52 + 0: JS_NUMBER_LITERAL@50..52 "0" [] [Whitespace(" ")] + 3: IN_KW@52..55 "in" [] [Whitespace(" ")] + 4: JS_ARRAY_EXPRESSION@55..57 + 0: L_BRACK@55..56 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@56..56 + 2: R_BRACK@56..57 "]" [] [] + 5: R_PAREN@57..59 ")" [] [Whitespace(" ")] + 6: JS_BLOCK_STATEMENT@59..61 + 0: L_CURLY@59..60 "{" [] [] + 1: JS_STATEMENT_LIST@60..60 + 2: R_CURLY@60..61 "}" [] [] + 2: JS_FOR_OF_STATEMENT@61..86 + 0: FOR_KW@61..66 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@66..67 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@67..77 + 0: (empty) + 1: VAR_KW@67..71 "var" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@71..77 + 0: JS_IDENTIFIER_BINDING@71..73 + 0: IDENT@71..73 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@73..77 + 0: EQ@73..75 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@75..77 + 0: JS_NUMBER_LITERAL@75..77 "0" [] [Whitespace(" ")] + 4: OF_KW@77..80 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@80..82 + 0: L_BRACK@80..81 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@81..81 + 2: R_BRACK@81..82 "]" [] [] + 6: R_PAREN@82..84 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@84..86 + 0: L_CURLY@84..85 "{" [] [] + 1: JS_STATEMENT_LIST@85..85 + 2: R_CURLY@85..86 "}" [] [] + 3: JS_FOR_OF_STATEMENT@86..111 + 0: FOR_KW@86..91 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@91..92 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@92..102 + 0: (empty) + 1: LET_KW@92..96 "let" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@96..102 + 0: JS_IDENTIFIER_BINDING@96..98 + 0: IDENT@96..98 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@98..102 + 0: EQ@98..100 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@100..102 + 0: JS_NUMBER_LITERAL@100..102 "0" [] [Whitespace(" ")] + 4: OF_KW@102..105 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@105..107 + 0: L_BRACK@105..106 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@106..106 + 2: R_BRACK@106..107 "]" [] [] + 6: R_PAREN@107..109 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@109..111 + 0: L_CURLY@109..110 "{" [] [] + 1: JS_STATEMENT_LIST@110..110 + 2: R_CURLY@110..111 "}" [] [] + 4: JS_FOR_OF_STATEMENT@111..138 + 0: FOR_KW@111..116 "for" [Newline("\n")] [Whitespace(" ")] + 1: (empty) + 2: L_PAREN@116..117 "(" [] [] + 3: JS_FOR_VARIABLE_DECLARATION@117..129 + 0: (empty) + 1: CONST_KW@117..123 "const" [] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR@123..129 + 0: JS_IDENTIFIER_BINDING@123..125 + 0: IDENT@123..125 "i" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@125..129 + 0: EQ@125..127 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@127..129 + 0: JS_NUMBER_LITERAL@127..129 "0" [] [Whitespace(" ")] + 4: OF_KW@129..132 "of" [] [Whitespace(" ")] + 5: JS_ARRAY_EXPRESSION@132..134 + 0: L_BRACK@132..133 "[" [] [] + 1: JS_ARRAY_ELEMENT_LIST@133..133 + 2: R_BRACK@133..134 "]" [] [] + 6: R_PAREN@134..136 ")" [] [Whitespace(" ")] + 7: JS_BLOCK_STATEMENT@136..138 + 0: L_CURLY@136..137 "{" [] [] + 1: JS_STATEMENT_LIST@137..137 + 2: R_CURLY@137..138 "}" [] [] + 4: EOF@138..139 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +for_in_and_of_initializer_loose_mode.cjs:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..in` statement declarators cannot have an initializer expression + + 1 │ // SCRIPT + > 2 │ for (let i = 0 in []) {} + │ ^^^ + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} + +for_in_and_of_initializer_loose_mode.cjs:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..in` statement declarators cannot have an initializer expression + + 1 │ // SCRIPT + 2 │ for (let i = 0 in []) {} + > 3 │ for (const i = 0 in []) {} + │ ^^^ + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} + +for_in_and_of_initializer_loose_mode.cjs:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 2 │ for (let i = 0 in []) {} + 3 │ for (const i = 0 in []) {} + > 4 │ for (var i = 0 of []) {} + │ ^^^ + 5 │ for (let i = 0 of []) {} + 6 │ for (const i = 0 of []) {} + +for_in_and_of_initializer_loose_mode.cjs:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 3 │ for (const i = 0 in []) {} + 4 │ for (var i = 0 of []) {} + > 5 │ for (let i = 0 of []) {} + │ ^^^ + 6 │ for (const i = 0 of []) {} + 7 │ + +for_in_and_of_initializer_loose_mode.cjs:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `for..of` statement declarators cannot have an initializer expression + + 4 │ for (var i = 0 of []) {} + 5 │ for (let i = 0 of []) {} + > 6 │ for (const i = 0 of []) {} + │ ^^^ + 7 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast rename to crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.js.snap index 722387036be7..e2ae6045df98 100644 --- a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_loose_mode.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_loose_mode.js.snap @@ -1,8 +1,28 @@ -JsScript { +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +for (let i = 0 in []) {} +for (const i = 0 in []) {} +for (var i = 0 of []) {} +for (let i = 0 of []) {} +for (const i = 0 of []) {} + +``` + + +## AST + +``` +JsModule { bom_token: missing (optional), interpreter_token: missing (optional), directives: JsDirectiveList [], - statements: JsStatementList [ + items: JsModuleItemList [ JsForInStatement { for_token: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], l_paren_token: L_PAREN@14..15 "(" [] [], @@ -169,12 +189,16 @@ JsScript { ], eof_token: EOF@138..139 "" [Newline("\n")] [], } +``` -0: JS_SCRIPT@0..139 +## CST + +``` +0: JS_MODULE@0..139 0: (empty) 1: (empty) 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..138 + 3: JS_MODULE_ITEM_LIST@0..138 0: JS_FOR_IN_STATEMENT@0..34 0: FOR_KW@0..14 "for" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] 1: L_PAREN@14..15 "(" [] [] @@ -299,7 +323,12 @@ JsScript { 1: JS_STATEMENT_LIST@137..137 2: R_CURLY@137..138 "}" [] [] 4: EOF@138..139 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` for_in_and_of_initializer_loose_mode.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression @@ -310,7 +339,6 @@ for_in_and_of_initializer_loose_mode.js:2:12 parse ━━━━━━━━━ 3 │ for (const i = 0 in []) {} 4 │ for (var i = 0 of []) {} --- for_in_and_of_initializer_loose_mode.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression @@ -322,7 +350,6 @@ for_in_and_of_initializer_loose_mode.js:3:14 parse ━━━━━━━━━ 4 │ for (var i = 0 of []) {} 5 │ for (let i = 0 of []) {} --- for_in_and_of_initializer_loose_mode.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression @@ -334,7 +361,6 @@ for_in_and_of_initializer_loose_mode.js:4:12 parse ━━━━━━━━━ 5 │ for (let i = 0 of []) {} 6 │ for (const i = 0 of []) {} --- for_in_and_of_initializer_loose_mode.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression @@ -346,7 +372,6 @@ for_in_and_of_initializer_loose_mode.js:5:12 parse ━━━━━━━━━ 6 │ for (const i = 0 of []) {} 7 │ --- for_in_and_of_initializer_loose_mode.js:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression @@ -357,10 +382,4 @@ for_in_and_of_initializer_loose_mode.js:6:14 parse ━━━━━━━━━ │ ^^^ 7 │ --- -// SCRIPT -for (let i = 0 in []) {} -for (const i = 0 in []) {} -for (var i = 0 of []) {} -for (let i = 0 of []) {} -for (const i = 0 of []) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.js b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.js rename to crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js diff --git a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast rename to crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js.snap index 2f5bf06a8f0c..654e6003e7a2 100644 --- a/crates/biome_js_parser/test_data/inline/err/for_in_and_of_initializer_strict_mode.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/for_in_and_of_initializer_strict_mode.js.snap @@ -1,3 +1,27 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for (var i = 0 in []) {} +for (let i = 0 in []) {} +for (const i = 0 in []) {} +for (var i = 0 of []) {} +for (let i = 0 of []) {} +for (const i = 0 of []) {} +for (using x = y of z) {}; +for await (using x = y of z) {}; +for (await using x = y of z) {}; +for await (await using x = y of z) {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -353,7 +377,11 @@ JsModule { ], eof_token: EOF@285..286 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..286 0: (empty) 1: (empty) @@ -615,7 +643,12 @@ JsModule { 13: JS_EMPTY_STATEMENT@284..285 0: SEMICOLON@284..285 ";" [] [] 4: EOF@285..286 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` for_in_and_of_initializer_strict_mode.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression @@ -625,7 +658,6 @@ for_in_and_of_initializer_strict_mode.js:1:12 parse ━━━━━━━━━ 2 │ for (let i = 0 in []) {} 3 │ for (const i = 0 in []) {} --- for_in_and_of_initializer_strict_mode.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression @@ -636,7 +668,6 @@ for_in_and_of_initializer_strict_mode.js:2:12 parse ━━━━━━━━━ 3 │ for (const i = 0 in []) {} 4 │ for (var i = 0 of []) {} --- for_in_and_of_initializer_strict_mode.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression @@ -648,7 +679,6 @@ for_in_and_of_initializer_strict_mode.js:3:14 parse ━━━━━━━━━ 4 │ for (var i = 0 of []) {} 5 │ for (let i = 0 of []) {} --- for_in_and_of_initializer_strict_mode.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression @@ -660,7 +690,6 @@ for_in_and_of_initializer_strict_mode.js:4:12 parse ━━━━━━━━━ 5 │ for (let i = 0 of []) {} 6 │ for (const i = 0 of []) {} --- for_in_and_of_initializer_strict_mode.js:5:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression @@ -672,7 +701,6 @@ for_in_and_of_initializer_strict_mode.js:5:12 parse ━━━━━━━━━ 6 │ for (const i = 0 of []) {} 7 │ for (using x = y of z) {}; --- for_in_and_of_initializer_strict_mode.js:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression @@ -684,7 +712,6 @@ for_in_and_of_initializer_strict_mode.js:6:14 parse ━━━━━━━━━ 7 │ for (using x = y of z) {}; 8 │ for await (using x = y of z) {}; --- for_in_and_of_initializer_strict_mode.js:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression @@ -696,7 +723,6 @@ for_in_and_of_initializer_strict_mode.js:7:14 parse ━━━━━━━━━ 8 │ for await (using x = y of z) {}; 9 │ for (await using x = y of z) {}; --- for_in_and_of_initializer_strict_mode.js:8:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression @@ -708,7 +734,6 @@ for_in_and_of_initializer_strict_mode.js:8:20 parse ━━━━━━━━━ 9 │ for (await using x = y of z) {}; 10 │ for await (await using x = y of z) {}; --- for_in_and_of_initializer_strict_mode.js:9:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression @@ -720,7 +745,6 @@ for_in_and_of_initializer_strict_mode.js:9:20 parse ━━━━━━━━━ 10 │ for await (await using x = y of z) {}; 11 │ --- for_in_and_of_initializer_strict_mode.js:10:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..of` statement declarators cannot have an initializer expression @@ -731,14 +755,4 @@ for_in_and_of_initializer_strict_mode.js:10:26 parse ━━━━━━━━━ │ ^^^ 11 │ --- -for (var i = 0 in []) {} -for (let i = 0 in []) {} -for (const i = 0 in []) {} -for (var i = 0 of []) {} -for (let i = 0 of []) {} -for (const i = 0 of []) {} -for (using x = y of z) {}; -for await (using x = y of z) {}; -for (await using x = y of z) {}; -for await (await using x = y of z) {}; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/for_of_async_identifier.js b/crates/biome_js_parser/tests/js_test_suite/error/for_of_async_identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/for_of_async_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/error/for_of_async_identifier.js diff --git a/crates/biome_js_parser/test_data/inline/err/for_of_async_identifier.rast b/crates/biome_js_parser/tests/js_test_suite/error/for_of_async_identifier.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/for_of_async_identifier.rast rename to crates/biome_js_parser/tests/js_test_suite/error/for_of_async_identifier.js.snap index 765c84758d5e..3e9418762448 100644 --- a/crates/biome_js_parser/test_data/inline/err/for_of_async_identifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/for_of_async_identifier.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let async; +for (async of [1]) ; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -46,7 +62,11 @@ JsModule { ], eof_token: EOF@31..32 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..32 0: (empty) 1: (empty) @@ -80,7 +100,12 @@ JsModule { 7: JS_EMPTY_STATEMENT@30..31 0: SEMICOLON@30..31 ";" [] [] 4: EOF@31..32 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` for_of_async_identifier.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × The left-hand side of a `for...of` statement may not be `async` @@ -90,6 +115,4 @@ for_of_async_identifier.js:2:6 parse ━━━━━━━━━━━━━━ │ ^^^^^ 3 │ --- -let async; -for (async of [1]) ; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/for_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/for_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/for_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/for_stmt_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/for_stmt_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/for_stmt_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/for_stmt_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/for_stmt_err.js.snap index a99fb9ea9309..635950ad5ef4 100644 --- a/crates/biome_js_parser/test_data/inline/err/for_stmt_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/for_stmt_err.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ;; {} +for let i = 5; i < 10; i++ {} +for let i = 5; i < 10; ++i {} +for (in []) {} +for (let i, j = 6 of []) {} +for await (let a in []) {} +for await (let i = 0; i < 10; ++i) {} +for (let [a];;) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -290,7 +312,11 @@ JsModule { ], eof_token: EOF@196..197 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..197 0: (empty) 1: (empty) @@ -501,7 +527,12 @@ JsModule { 1: JS_STATEMENT_LIST@195..195 2: R_CURLY@195..196 "}" [] [] 4: EOF@196..197 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` for_stmt_err.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `;` @@ -513,7 +544,6 @@ for_stmt_err.js:1:5 parse ━━━━━━━━━━━━━━━━━━ i Remove ; --- for_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `for` @@ -526,7 +556,6 @@ for_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━ i Remove for --- for_stmt_err.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `let` @@ -539,7 +568,6 @@ for_stmt_err.js:2:5 parse ━━━━━━━━━━━━━━━━━━ i Remove let --- for_stmt_err.js:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `{` @@ -552,7 +580,6 @@ for_stmt_err.js:2:28 parse ━━━━━━━━━━━━━━━━━ i Remove { --- for_stmt_err.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `let` @@ -566,7 +593,6 @@ for_stmt_err.js:3:5 parse ━━━━━━━━━━━━━━━━━━ i Remove let --- for_stmt_err.js:3:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `{` @@ -580,7 +606,6 @@ for_stmt_err.js:3:28 parse ━━━━━━━━━━━━━━━━━ i Remove { --- for_stmt_err.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Only a single declaration is allowed in a `for...of` statement. @@ -594,7 +619,6 @@ for_stmt_err.js:5:13 parse ━━━━━━━━━━━━━━━━━ i additional declarations --- for_stmt_err.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × await can only be used in conjunction with `for...of` statements @@ -624,7 +648,6 @@ for_stmt_err.js:6:5 parse ━━━━━━━━━━━━━━━━━━ 7 │ for await (let i = 0; i < 10; ++i) {} 8 │ for (let [a];;) {} --- for_stmt_err.js:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × await can only be used in conjunction with `for...of` statements @@ -654,7 +677,6 @@ for_stmt_err.js:7:5 parse ━━━━━━━━━━━━━━━━━━ 8 │ for (let [a];;) {} 9 │ --- for_stmt_err.js:8:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Object and Array patterns require initializers. @@ -667,12 +689,4 @@ for_stmt_err.js:8:10 parse ━━━━━━━━━━━━━━━━━ i This pattern is declared, but it is not given an initialized value. --- -for ;; {} -for let i = 5; i < 10; i++ {} -for let i = 5; i < 10; ++i {} -for (in []) {} -for (let i, j = 6 of []) {} -for await (let a in []) {} -for await (let i = 0; i < 10; ++i) {} -for (let [a];;) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/formal_params_invalid.js b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_invalid.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/formal_params_invalid.js rename to crates/biome_js_parser/tests/js_test_suite/error/formal_params_invalid.js diff --git a/crates/biome_js_parser/test_data/inline/err/formal_params_invalid.rast b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_invalid.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/formal_params_invalid.rast rename to crates/biome_js_parser/tests/js_test_suite/error/formal_params_invalid.js.snap index 95d497a1fc8e..b183f5596b91 100644 --- a/crates/biome_js_parser/test_data/inline/err/formal_params_invalid.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_invalid.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function (a++, c) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -51,7 +66,11 @@ JsModule { ], eof_token: EOF@20..21 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..21 0: (empty) 1: (empty) @@ -92,7 +111,12 @@ JsModule { 2: JS_STATEMENT_LIST@19..19 3: R_CURLY@19..20 "}" [] [] 4: EOF@20..21 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` formal_params_invalid.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none @@ -101,7 +125,6 @@ formal_params_invalid.js:1:10 parse ━━━━━━━━━━━━━━ │ ^ 2 │ --- formal_params_invalid.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `++` @@ -112,5 +135,4 @@ formal_params_invalid.js:1:12 parse ━━━━━━━━━━━━━━ i Remove ++ --- -function (a++, c) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/formal_params_no_binding_element.js b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_no_binding_element.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/formal_params_no_binding_element.js rename to crates/biome_js_parser/tests/js_test_suite/error/formal_params_no_binding_element.js diff --git a/crates/biome_js_parser/test_data/inline/err/formal_params_no_binding_element.rast b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_no_binding_element.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/formal_params_no_binding_element.rast rename to crates/biome_js_parser/tests/js_test_suite/error/formal_params_no_binding_element.js.snap index 286166a21e2d..712dd104f5a3 100644 --- a/crates/biome_js_parser/test_data/inline/err/formal_params_no_binding_element.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/formal_params_no_binding_element.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo(true) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -33,7 +48,11 @@ JsModule { ], eof_token: EOF@21..22 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..22 0: (empty) 1: (empty) @@ -59,7 +78,12 @@ JsModule { 2: JS_STATEMENT_LIST@20..20 3: R_CURLY@20..21 "}" [] [] 4: EOF@21..22 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` formal_params_no_binding_element.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a parameter but instead found 'true'. @@ -74,5 +98,4 @@ formal_params_no_binding_element.js:1:14 parse ━━━━━━━━━━━ │ ^^^^ 2 │ --- -function foo(true) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_broken.js b/crates/biome_js_parser/tests/js_test_suite/error/function_broken.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_broken.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_broken.js diff --git a/crates/biome_js_parser/test_data/inline/err/function_broken.rast b/crates/biome_js_parser/tests/js_test_suite/error/function_broken.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/function_broken.rast rename to crates/biome_js_parser/tests/js_test_suite/error/function_broken.js.snap index 6338f2cbe682..ae14c0e66d94 100644 --- a/crates/biome_js_parser/test_data/inline/err/function_broken.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_broken.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo())})}{{{ {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -53,7 +68,11 @@ JsModule { ], eof_token: EOF@25..26 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..26 0: (empty) 1: (empty) @@ -94,7 +113,12 @@ JsModule { 2: (empty) 2: (empty) 4: EOF@25..26 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` function_broken.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a function body but instead found ')'. @@ -109,7 +133,6 @@ function_broken.js:1:15 parse ━━━━━━━━━━━━━━━━ │ ^ 2 │ --- function_broken.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead the file ends @@ -124,5 +147,4 @@ function_broken.js:2:1 parse ━━━━━━━━━━━━━━━━━ > 2 │ │ --- -function foo())})}{{{ {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_decl_err.js b/crates/biome_js_parser/tests/js_test_suite/error/function_decl_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_decl_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_decl_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/function_decl_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/function_decl_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/function_decl_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/function_decl_err.js.snap index 5759cdcb9509..9aabd1db14ab 100644 --- a/crates/biome_js_parser/test_data/inline/err/function_decl_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_decl_err.js.snap @@ -1,3 +1,28 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function() {} +function foo {} +function {} +function *() {} +async function() {} +async function *() {} +function *foo2() {} +yield foo3; +function test2(): number {} +function foo4(await) {} +function foo5(yield) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -244,7 +269,11 @@ JsModule { ], eof_token: EOF@207..208 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..208 0: (empty) 1: (empty) @@ -433,7 +462,12 @@ JsModule { 2: JS_STATEMENT_LIST@206..206 3: R_CURLY@206..207 "}" [] [] 4: EOF@207..208 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` function_decl_err.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none @@ -443,7 +477,6 @@ function_decl_err.js:1:9 parse ━━━━━━━━━━━━━━━━ 2 │ function foo {} 3 │ function {} --- function_decl_err.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a parenthesis '(' but instead found '{'. @@ -462,7 +495,6 @@ function_decl_err.js:2:14 parse ━━━━━━━━━━━━━━━━ 3 │ function {} 4 │ function *() {} --- function_decl_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none @@ -474,7 +506,6 @@ function_decl_err.js:3:10 parse ━━━━━━━━━━━━━━━━ 4 │ function *() {} 5 │ async function() {} --- function_decl_err.js:4:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none @@ -486,7 +517,6 @@ function_decl_err.js:4:11 parse ━━━━━━━━━━━━━━━━ 5 │ async function() {} 6 │ async function *() {} --- function_decl_err.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none @@ -498,7 +528,6 @@ function_decl_err.js:5:15 parse ━━━━━━━━━━━━━━━━ 6 │ async function *() {} 7 │ function *foo2() {} --- function_decl_err.js:6:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a name for the function in a function declaration, but found none @@ -510,7 +539,6 @@ function_decl_err.js:6:17 parse ━━━━━━━━━━━━━━━━ 7 │ function *foo2() {} 8 │ yield foo3; --- function_decl_err.js:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. @@ -522,7 +550,6 @@ function_decl_err.js:8:1 parse ━━━━━━━━━━━━━━━━ 9 │ function test2(): number {} 10 │ function foo4(await) {} --- function_decl_err.js:9:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × return types can only be used in TypeScript files @@ -534,7 +561,6 @@ function_decl_err.js:9:17 parse ━━━━━━━━━━━━━━━━ 10 │ function foo4(await) {} 11 │ function foo5(yield) {} --- function_decl_err.js:10:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier inside of a module @@ -546,7 +572,6 @@ function_decl_err.js:10:15 parse ━━━━━━━━━━━━━━━ 11 │ function foo5(yield) {} 12 │ --- function_decl_err.js:11:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode @@ -557,15 +582,4 @@ function_decl_err.js:11:15 parse ━━━━━━━━━━━━━━━ │ ^^^^^ 12 │ --- -function() {} -function foo {} -function {} -function *() {} -async function() {} -async function *() {} -function *foo2() {} -yield foo3; -function test2(): number {} -function foo4(await) {} -function foo5(yield) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_escaped_async.js b/crates/biome_js_parser/tests/js_test_suite/error/function_escaped_async.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_escaped_async.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_escaped_async.js diff --git a/crates/biome_js_parser/test_data/inline/err/function_escaped_async.rast b/crates/biome_js_parser/tests/js_test_suite/error/function_escaped_async.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/function_escaped_async.rast rename to crates/biome_js_parser/tests/js_test_suite/error/function_escaped_async.js.snap index 740e15007784..138a324b0c9d 100644 --- a/crates/biome_js_parser/test_data/inline/err/function_escaped_async.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_escaped_async.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +void \u0061sync function f(){} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -32,7 +47,11 @@ JsModule { ], eof_token: EOF@30..31 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..31 0: (empty) 1: (empty) @@ -57,7 +76,12 @@ JsModule { 3: R_CURLY@29..30 "}" [] [] 1: (empty) 4: EOF@30..31 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` function_escaped_async.js:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'async' keyword cannot contain escape character. @@ -66,5 +90,4 @@ function_escaped_async.js:1:6 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^^^ 2 │ --- -void \u0061sync function f(){} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_expression_id_err.js b/crates/biome_js_parser/tests/js_test_suite/error/function_expression_id_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_expression_id_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_expression_id_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/function_expression_id_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/function_expression_id_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/function_expression_id_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/function_expression_id_err.js.snap index ee09f09e9b36..22753a10d683 100644 --- a/crates/biome_js_parser/test_data/inline/err/function_expression_id_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_expression_id_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(async function await() {}); +(function* yield() {}); +function* test() { function yield() {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -111,7 +128,11 @@ JsModule { ], eof_token: EOF@93..94 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..94 0: (empty) 1: (empty) @@ -196,7 +217,12 @@ JsModule { 3: R_CURLY@90..92 "}" [] [Whitespace(" ")] 3: R_CURLY@92..93 "}" [] [] 4: EOF@93..94 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` function_expression_id_err.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context @@ -206,7 +232,6 @@ function_expression_id_err.js:1:17 parse ━━━━━━━━━━━━━ 2 │ (function* yield() {}); 3 │ function* test() { function yield() {} } --- function_expression_id_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `yield` as an identifier in generator function @@ -217,7 +242,6 @@ function_expression_id_err.js:2:12 parse ━━━━━━━━━━━━━ 3 │ function* test() { function yield() {} } 4 │ --- function_expression_id_err.js:3:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `yield` as an identifier in generator function @@ -228,7 +252,4 @@ function_expression_id_err.js:3:29 parse ━━━━━━━━━━━━━ │ ^^^^^ 4 │ --- -(async function await() {}); -(function* yield() {}); -function* test() { function yield() {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_id_err.js b/crates/biome_js_parser/tests/js_test_suite/error/function_id_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_id_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_id_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/function_id_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/function_id_err.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/function_id_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/function_id_err.js.snap index 22b552d00266..5233962ec75f 100644 --- a/crates/biome_js_parser/test_data/inline/err/function_id_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_id_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function* test() { + function yield(test) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -61,7 +78,11 @@ JsModule { ], eof_token: EOF@46..47 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..47 0: (empty) 1: (empty) @@ -109,7 +130,12 @@ JsModule { 3: R_CURLY@43..44 "}" [] [] 3: R_CURLY@44..46 "}" [Newline("\n")] [] 4: EOF@46..47 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` function_id_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `yield` as an identifier in generator function @@ -120,7 +146,4 @@ function_id_err.js:2:12 parse ━━━━━━━━━━━━━━━━ 3 │ } 4 │ --- -function* test() { - function yield(test) {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.js b/crates/biome_js_parser/tests/js_test_suite/error/function_in_single_statement_context_strict.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.js rename to crates/biome_js_parser/tests/js_test_suite/error/function_in_single_statement_context_strict.js diff --git a/crates/biome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.rast b/crates/biome_js_parser/tests/js_test_suite/error/function_in_single_statement_context_strict.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.rast rename to crates/biome_js_parser/tests/js_test_suite/error/function_in_single_statement_context_strict.js.snap index 41cfbe02fa55..d2ff546a3d74 100644 --- a/crates/biome_js_parser/test_data/inline/err/function_in_single_statement_context_strict.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/function_in_single_statement_context_strict.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) function a() {} +label1: function b() {} +while (true) function c() {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -86,7 +103,11 @@ JsModule { ], eof_token: EOF@78..79 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..79 0: (empty) 1: (empty) @@ -149,7 +170,12 @@ JsModule { 2: JS_STATEMENT_LIST@77..77 3: R_CURLY@77..78 "}" [] [] 4: EOF@78..79 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` function_in_single_statement_context_strict.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × In strict mode code, functions can only be declared at top level or inside a block @@ -161,7 +187,6 @@ function_in_single_statement_context_strict.js:1:11 parse ━━━━━━━ i wrap the function in a block statement --- function_in_single_statement_context_strict.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × In strict mode code, functions can only be declared at top level or inside a block @@ -174,7 +199,6 @@ function_in_single_statement_context_strict.js:2:9 parse ━━━━━━━ i wrap the function in a block statement --- function_in_single_statement_context_strict.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × In strict mode code, functions can only be declared at top level or inside a block @@ -187,7 +211,4 @@ function_in_single_statement_context_strict.js:3:14 parse ━━━━━━━ i wrap the function in a block statement --- -if (true) function a() {} -label1: function b() {} -while (true) function c() {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/getter_class_no_body.js b/crates/biome_js_parser/tests/js_test_suite/error/getter_class_no_body.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/getter_class_no_body.js rename to crates/biome_js_parser/tests/js_test_suite/error/getter_class_no_body.js diff --git a/crates/biome_js_parser/test_data/inline/err/getter_class_no_body.rast b/crates/biome_js_parser/tests/js_test_suite/error/getter_class_no_body.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/getter_class_no_body.rast rename to crates/biome_js_parser/tests/js_test_suite/error/getter_class_no_body.js.snap index 73e855011d20..a5a174886466 100644 --- a/crates/biome_js_parser/test_data/inline/err/getter_class_no_body.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/getter_class_no_body.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Getters { + get foo() +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -32,7 +49,11 @@ JsModule { ], eof_token: EOF@29..30 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..30 0: (empty) 1: (empty) @@ -60,7 +81,12 @@ JsModule { 6: (empty) 9: R_CURLY@27..29 "}" [Newline("\n")] [] 4: EOF@29..30 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` getter_class_no_body.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class method body but instead found '}'. @@ -79,7 +105,4 @@ getter_class_no_body.js:3:1 parse ━━━━━━━━━━━━━━━ │ ^ 4 │ --- -class Getters { - get foo() -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/identifier.js b/crates/biome_js_parser/tests/js_test_suite/error/identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/identifier.js rename to crates/biome_js_parser/tests/js_test_suite/error/identifier.js diff --git a/crates/biome_js_parser/test_data/inline/err/identifier.rast b/crates/biome_js_parser/tests/js_test_suite/error/identifier.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/identifier.rast rename to crates/biome_js_parser/tests/js_test_suite/error/identifier.js.snap index 8bdf6d8d91c5..5b443c153af7 100644 --- a/crates/biome_js_parser/test_data/inline/err/identifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/identifier.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +yield; +await; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -25,7 +41,11 @@ JsModule { ], eof_token: EOF@13..14 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..14 0: (empty) 1: (empty) @@ -42,7 +62,12 @@ JsModule { 1: (empty) 1: SEMICOLON@12..13 ";" [] [] 4: EOF@13..14 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` identifier.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode @@ -52,7 +77,6 @@ identifier.js:1:1 parse ━━━━━━━━━━━━━━━━━━ 2 │ await; 3 │ --- identifier.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an unary expression but instead found ';'. @@ -69,6 +93,4 @@ identifier.js:2:6 parse ━━━━━━━━━━━━━━━━━━ │ ^ 3 │ --- -yield; -await; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/identifier_err.js b/crates/biome_js_parser/tests/js_test_suite/error/identifier_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/identifier_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/identifier_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/identifier_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/identifier_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/identifier_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/identifier_err.js.snap index 3c26919695bb..3d5d09055c1c 100644 --- a/crates/biome_js_parser/test_data/inline/err/identifier_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/identifier_err.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +yield; +await; +async function test(await) {} +function* test(yield) {} +enum; +implements; +interface; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -124,7 +145,11 @@ JsModule { ], eof_token: EOF@97..98 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..98 0: (empty) 1: (empty) @@ -204,7 +229,12 @@ JsModule { 0: IDENT@86..96 "interface" [Newline("\n")] [] 1: SEMICOLON@96..97 ";" [] [] 4: EOF@97..98 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` identifier_err.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode @@ -214,7 +244,6 @@ identifier_err.js:1:1 parse ━━━━━━━━━━━━━━━━━ 2 │ await; 3 │ async function test(await) {} --- identifier_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an unary expression but instead found ';'. @@ -233,7 +262,6 @@ identifier_err.js:2:6 parse ━━━━━━━━━━━━━━━━━ 3 │ async function test(await) {} 4 │ function* test(yield) {} --- identifier_err.js:3:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context @@ -245,7 +273,6 @@ identifier_err.js:3:21 parse ━━━━━━━━━━━━━━━━━ 4 │ function* test(yield) {} 5 │ enum; --- identifier_err.js:4:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `yield` as an identifier in generator function @@ -257,7 +284,6 @@ identifier_err.js:4:16 parse ━━━━━━━━━━━━━━━━━ 5 │ enum; 6 │ implements; --- identifier_err.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'enum's are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -271,7 +297,6 @@ identifier_err.js:5:1 parse ━━━━━━━━━━━━━━━━━ i TypeScript only syntax --- identifier_err.js:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `implements` as an identifier in strict mode @@ -283,7 +308,6 @@ identifier_err.js:6:1 parse ━━━━━━━━━━━━━━━━━ 7 │ interface; 8 │ --- identifier_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `interface` as an identifier in strict mode @@ -294,11 +318,4 @@ identifier_err.js:7:1 parse ━━━━━━━━━━━━━━━━━ │ ^^^^^^^^^ 8 │ --- -yield; -await; -async function test(await) {} -function* test(yield) {} -enum; -implements; -interface; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/if_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/if_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/if_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/if_stmt_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/if_stmt_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/if_stmt_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/if_stmt_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/if_stmt_err.js.snap index ad06fce7d21b..3874a6acb134 100644 --- a/crates/biome_js_parser/test_data/inline/err/if_stmt_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/if_stmt_err.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) else {} +if (true) else +if else {} +if () {} else {} +if (true)}}}} {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -92,7 +111,11 @@ JsModule { ], eof_token: EOF@77..78 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..78 0: (empty) 1: (empty) @@ -165,7 +188,12 @@ JsModule { 1: JS_STATEMENT_LIST@76..76 2: R_CURLY@76..77 "}" [] [] 4: EOF@77..78 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` if_stmt_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found 'else'. @@ -182,7 +210,6 @@ if_stmt_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━ 2 │ if (true) else 3 │ if else {} --- if_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found 'else'. @@ -201,7 +228,6 @@ if_stmt_err.js:2:11 parse ━━━━━━━━━━━━━━━━━━ 3 │ if else {} 4 │ if () {} else {} --- if_stmt_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `else` @@ -215,7 +241,6 @@ if_stmt_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━ i Remove else --- if_stmt_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ')'. @@ -236,7 +261,6 @@ if_stmt_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━ 5 │ if (true)}}}} {} 6 │ --- if_stmt_err.js:5:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '}'. @@ -255,9 +279,4 @@ if_stmt_err.js:5:10 parse ━━━━━━━━━━━━━━━━━━ │ ^ 6 │ --- -if (true) else {} -if (true) else -if else {} -if () {} else {} -if (true)}}}} {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_as_identifier_err.js b/crates/biome_js_parser/tests/js_test_suite/error/import_as_identifier_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_as_identifier_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_as_identifier_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/import_as_identifier_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/import_as_identifier_err.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/import_as_identifier_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/import_as_identifier_err.js.snap index 7754de5f8b1e..ac36e1a22b8c 100644 --- a/crates/biome_js_parser/test_data/inline/err/import_as_identifier_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_as_identifier_err.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import { as c } from "test"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -32,7 +47,11 @@ JsModule { ], eof_token: EOF@28..29 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..29 0: (empty) 1: (empty) @@ -58,7 +77,12 @@ JsModule { 4: (empty) 2: SEMICOLON@27..28 ";" [] [] 4: EOF@28..29 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` import_as_identifier_err.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a string literal, or an identifier but instead found ''. @@ -73,5 +97,4 @@ import_as_identifier_err.js:1:10 parse ━━━━━━━━━━━━━ │ 2 │ --- -import { as c } from "test"; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_assertion_err.js b/crates/biome_js_parser/tests/js_test_suite/error/import_assertion_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_assertion_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_assertion_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/import_assertion_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/import_assertion_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/import_assertion_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/import_assertion_err.js.snap index 56e6ee81ee9f..8acf64dec176 100644 --- a/crates/biome_js_parser/test_data/inline/err/import_assertion_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_assertion_err.js.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import "foo" assert { type, "json" }; +import "bar" \u{61}ssert { type: "json" }; +import { foo } assert { type: "json" }; +import "lorem" +assert { type: "json" } +import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; +import "x" assert; +import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; +import { a } from "a.json" assert + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -269,7 +292,11 @@ JsModule { ], eof_token: EOF@379..380 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..380 0: (empty) 1: (empty) @@ -459,7 +486,12 @@ JsModule { 3: (empty) 2: (empty) 4: EOF@379..380 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` import_assertion_err.js:1:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `,` @@ -471,7 +503,6 @@ import_assertion_err.js:1:27 parse ━━━━━━━━━━━━━━━ i Remove , --- import_assertion_err.js:1:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `}` @@ -483,7 +514,6 @@ import_assertion_err.js:1:36 parse ━━━━━━━━━━━━━━━ i Remove } --- import_assertion_err.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'assert' keyword cannot contain escape character. @@ -494,7 +524,6 @@ import_assertion_err.js:2:14 parse ━━━━━━━━━━━━━━━ 3 │ import { foo } assert { type: "json" }; 4 │ import "lorem" --- import_assertion_err.js:3:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `from` but instead found `assert` @@ -508,7 +537,6 @@ import_assertion_err.js:3:16 parse ━━━━━━━━━━━━━━━ i Remove assert --- import_assertion_err.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -538,7 +566,6 @@ import_assertion_err.js:5:8 parse ━━━━━━━━━━━━━━━ 6 │ import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; 7 │ import "x" assert; --- import_assertion_err.js:6:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Duplicate assertion keys are not allowed @@ -568,7 +595,6 @@ import_assertion_err.js:6:38 parse ━━━━━━━━━━━━━━━ 7 │ import "x" assert; 8 │ import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; --- import_assertion_err.js:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `{` but instead found `;` @@ -582,7 +608,6 @@ import_assertion_err.js:7:18 parse ━━━━━━━━━━━━━━━ i Remove ; --- import_assertion_err.js:8:61 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `string literal` but instead found `true` @@ -596,7 +621,6 @@ import_assertion_err.js:8:61 parse ━━━━━━━━━━━━━━━ i Remove true --- import_assertion_err.js:8:65 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `,` @@ -610,7 +634,6 @@ import_assertion_err.js:8:65 parse ━━━━━━━━━━━━━━━ i Remove , --- import_assertion_err.js:8:80 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `string literal` but instead found `1` @@ -624,7 +647,6 @@ import_assertion_err.js:8:80 parse ━━━━━━━━━━━━━━━ i Remove 1 --- import_assertion_err.js:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `{` but instead the file ends @@ -641,13 +663,4 @@ import_assertion_err.js:10:1 parse ━━━━━━━━━━━━━━━ > 10 │ │ --- -import "foo" assert { type, "json" }; -import "bar" \u{61}ssert { type: "json" }; -import { foo } assert { type: "json" }; -import "lorem" -assert { type: "json" } -import foo2 from "foo.json" assert { "type": "json", type: "html", "type": "js" }; -import "x" assert; -import ipsum from "ipsum.json" assert { type: "json", lazy: true, startAtLine: 1 }; -import { a } from "a.json" assert +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_attribute_err.js b/crates/biome_js_parser/tests/js_test_suite/error/import_attribute_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_attribute_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_attribute_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/import_attribute_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/import_attribute_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/import_attribute_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/import_attribute_err.js.snap index d7b0cb42cca5..ec313da0511e 100644 --- a/crates/biome_js_parser/test_data/inline/err/import_attribute_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_attribute_err.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import "foo" with { type, "json" }; +import { foo } with { type: "json" }; +import "lorem" +assert { type: "json" } +import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; +import "x" with; +import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; +import { a } from "a.json" with + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -242,7 +264,11 @@ JsModule { ], eof_token: EOF@324..325 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..325 0: (empty) 1: (empty) @@ -417,7 +443,12 @@ JsModule { 3: (empty) 2: (empty) 4: EOF@324..325 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` import_attribute_err.js:1:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `,` @@ -429,7 +460,6 @@ import_attribute_err.js:1:25 parse ━━━━━━━━━━━━━━━ i Remove , --- import_attribute_err.js:1:34 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `}` @@ -441,7 +471,6 @@ import_attribute_err.js:1:34 parse ━━━━━━━━━━━━━━━ i Remove } --- import_attribute_err.js:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `from` but instead found `with` @@ -454,7 +483,6 @@ import_attribute_err.js:2:16 parse ━━━━━━━━━━━━━━━ i Remove with --- import_attribute_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -484,7 +512,6 @@ import_attribute_err.js:4:8 parse ━━━━━━━━━━━━━━━ 5 │ import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; 6 │ import "x" with; --- import_attribute_err.js:5:36 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Duplicate assertion keys are not allowed @@ -514,7 +541,6 @@ import_attribute_err.js:5:36 parse ━━━━━━━━━━━━━━━ 6 │ import "x" with; 7 │ import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; --- import_attribute_err.js:6:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `{` but instead found `;` @@ -528,7 +554,6 @@ import_attribute_err.js:6:16 parse ━━━━━━━━━━━━━━━ i Remove ; --- import_attribute_err.js:7:59 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `string literal` but instead found `true` @@ -542,7 +567,6 @@ import_attribute_err.js:7:59 parse ━━━━━━━━━━━━━━━ i Remove true --- import_attribute_err.js:7:63 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `,` @@ -556,7 +580,6 @@ import_attribute_err.js:7:63 parse ━━━━━━━━━━━━━━━ i Remove , --- import_attribute_err.js:7:78 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `string literal` but instead found `1` @@ -570,7 +593,6 @@ import_attribute_err.js:7:78 parse ━━━━━━━━━━━━━━━ i Remove 1 --- import_attribute_err.js:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `{` but instead the file ends @@ -587,12 +609,4 @@ import_attribute_err.js:9:1 parse ━━━━━━━━━━━━━━━ > 9 │ │ --- -import "foo" with { type, "json" }; -import { foo } with { type: "json" }; -import "lorem" -assert { type: "json" } -import foo2 from "foo.json" with { "type": "json", type: "html", "type": "js" }; -import "x" with; -import ipsum from "ipsum.json" with { type: "json", lazy: true, startAtLine: 1 }; -import { a } from "a.json" with +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_decl_not_top_level.js b/crates/biome_js_parser/tests/js_test_suite/error/import_decl_not_top_level.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_decl_not_top_level.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_decl_not_top_level.js diff --git a/crates/biome_js_parser/test_data/inline/err/import_decl_not_top_level.rast b/crates/biome_js_parser/tests/js_test_suite/error/import_decl_not_top_level.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/import_decl_not_top_level.rast rename to crates/biome_js_parser/tests/js_test_suite/error/import_decl_not_top_level.js.snap index 3db1686c5362..ec66375df36e 100644 --- a/crates/biome_js_parser/test_data/inline/err/import_decl_not_top_level.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_decl_not_top_level.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{ + import foo from "bar"; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -31,7 +48,11 @@ JsModule { ], eof_token: EOF@27..28 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..28 0: (empty) 1: (empty) @@ -54,7 +75,12 @@ JsModule { 2: SEMICOLON@24..25 ";" [] [] 2: R_CURLY@25..27 "}" [Newline("\n")] [] 4: EOF@27..28 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` import_decl_not_top_level.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of an import declaration not at the top level @@ -67,7 +93,4 @@ import_decl_not_top_level.js:2:2 parse ━━━━━━━━━━━━━ i move this declaration to the top level --- -{ - import foo from "bar"; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_err.js b/crates/biome_js_parser/tests/js_test_suite/error/import_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/import_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/import_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/import_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/import_err.js.snap index 33550b72d731..abf289abd68f 100644 --- a/crates/biome_js_parser/test_data/inline/err/import_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_err.js.snap @@ -1,3 +1,27 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import; +import *; +import * as c, { a, b } from "c"; +import { aa + bb, dd } from "c"; +import { ab, ac } from "c"; +import { default } from "c"; +import { "a" } from "c"; +import { as x } from "c"; +import 4 from "c"; +import y from 4; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -277,7 +301,11 @@ JsModule { ], eof_token: EOF@228..229 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..229 0: (empty) 1: (empty) @@ -475,7 +503,12 @@ JsModule { 0: JS_NUMBER_LITERAL@226..227 "4" [] [] 1: SEMICOLON@227..228 ";" [] [] 4: EOF@228..229 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` import_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a default import, a namespace import, or a named import but instead found ';'. @@ -492,7 +525,6 @@ import_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━ 2 │ import *; 3 │ import * as c, { a, b } from "c"; --- import_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `as` but instead found `;` @@ -505,7 +537,6 @@ import_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━ i Remove ; --- import_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `from` but instead found `,` @@ -519,7 +550,6 @@ import_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━ i Remove , --- import_err.js:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -549,7 +579,6 @@ import_err.js:3:30 parse ━━━━━━━━━━━━━━━━━━ 4 │ import { aa + bb, dd } from "c"; 5 │ import { ab, ac } from "c"; --- import_err.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `+` @@ -563,7 +592,6 @@ import_err.js:4:13 parse ━━━━━━━━━━━━━━━━━━ i Remove + --- import_err.js:6:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `as` but instead found `}` @@ -577,7 +605,6 @@ import_err.js:6:18 parse ━━━━━━━━━━━━━━━━━━ i Remove } --- import_err.js:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `as` but instead found `}` @@ -591,7 +618,6 @@ import_err.js:7:14 parse ━━━━━━━━━━━━━━━━━━ i Remove } --- import_err.js:8:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a string literal, or an identifier but instead found ''. @@ -612,7 +638,6 @@ import_err.js:8:10 parse ━━━━━━━━━━━━━━━━━━ 9 │ import 4 from "c"; 10 │ import y from 4; --- import_err.js:9:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a default import, a namespace import, or a named import but instead found '4'. @@ -633,7 +658,6 @@ import_err.js:9:8 parse ━━━━━━━━━━━━━━━━━━ 10 │ import y from 4; 11 │ --- import_err.js:9:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -663,7 +687,6 @@ import_err.js:9:10 parse ━━━━━━━━━━━━━━━━━━ 10 │ import y from 4; 11 │ --- import_err.js:9:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -693,7 +716,6 @@ import_err.js:9:15 parse ━━━━━━━━━━━━━━━━━━ 10 │ import y from 4; 11 │ --- import_err.js:10:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a string literal but instead found '4'. @@ -712,14 +734,4 @@ import_err.js:10:15 parse ━━━━━━━━━━━━━━━━━━ │ ^ 11 │ --- -import; -import *; -import * as c, { a, b } from "c"; -import { aa + bb, dd } from "c"; -import { ab, ac } from "c"; -import { default } from "c"; -import { "a" } from "c"; -import { as x } from "c"; -import 4 from "c"; -import y from 4; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_invalid_args.js b/crates/biome_js_parser/tests/js_test_suite/error/import_invalid_args.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_invalid_args.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_invalid_args.js diff --git a/crates/biome_js_parser/test_data/inline/err/import_invalid_args.rast b/crates/biome_js_parser/tests/js_test_suite/error/import_invalid_args.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/import_invalid_args.rast rename to crates/biome_js_parser/tests/js_test_suite/error/import_invalid_args.js.snap index f875058a6c77..3d0ff2a4fc49 100644 --- a/crates/biome_js_parser/test_data/inline/err/import_invalid_args.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_invalid_args.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import() +import(...["foo"]) +import("foo", { assert: { type: 'json' } }, "bar") +import("foo", { with: { type: 'json' } }, "bar") + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -143,7 +161,11 @@ JsModule { ], eof_token: EOF@127..128 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..128 0: (empty) 1: (empty) @@ -238,7 +260,12 @@ JsModule { 2: R_PAREN@126..127 ")" [] [] 1: (empty) 4: EOF@127..128 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` import_invalid_args.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `import()` requires exactly one or two arguments. @@ -248,7 +275,6 @@ import_invalid_args.js:1:8 parse ━━━━━━━━━━━━━━━ 2 │ import(...["foo"]) 3 │ import("foo", { assert: { type: 'json' } }, "bar") --- import_invalid_args.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `...` is not allowed in `import()` @@ -259,7 +285,6 @@ import_invalid_args.js:2:8 parse ━━━━━━━━━━━━━━━ 3 │ import("foo", { assert: { type: 'json' } }, "bar") 4 │ import("foo", { with: { type: 'json' } }, "bar") --- import_invalid_args.js:3:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `import()` requires exactly one or two arguments. @@ -271,7 +296,6 @@ import_invalid_args.js:3:45 parse ━━━━━━━━━━━━━━━ 4 │ import("foo", { with: { type: 'json' } }, "bar") 5 │ --- import_invalid_args.js:4:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `import()` requires exactly one or two arguments. @@ -282,8 +306,4 @@ import_invalid_args.js:4:43 parse ━━━━━━━━━━━━━━━ │ ^^^^^^ 5 │ --- -import() -import(...["foo"]) -import("foo", { assert: { type: 'json' } }, "bar") -import("foo", { with: { type: 'json' } }, "bar") +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_keyword_in_expression_position.js b/crates/biome_js_parser/tests/js_test_suite/error/import_keyword_in_expression_position.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_keyword_in_expression_position.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_keyword_in_expression_position.js diff --git a/crates/biome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast b/crates/biome_js_parser/tests/js_test_suite/error/import_keyword_in_expression_position.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast rename to crates/biome_js_parser/tests/js_test_suite/error/import_keyword_in_expression_position.js.snap index dd3def2a1b53..e37653e700a0 100644 --- a/crates/biome_js_parser/test_data/inline/err/import_keyword_in_expression_position.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_keyword_in_expression_position.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = import; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -30,7 +45,11 @@ JsModule { ], eof_token: EOF@15..16 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..16 0: (empty) 1: (empty) @@ -54,7 +73,12 @@ JsModule { 1: (empty) 2: SEMICOLON@14..15 ";" [] [] 4: EOF@15..16 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` import_keyword_in_expression_position.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found 'import'. @@ -69,7 +93,6 @@ import_keyword_in_expression_position.js:1:9 parse ━━━━━━━━━ │ ^^^^^^ 2 │ --- import_keyword_in_expression_position.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a default import, a namespace import, or a named import but instead found ';'. @@ -84,5 +107,4 @@ import_keyword_in_expression_position.js:1:15 parse ━━━━━━━━━ │ ^ 2 │ --- -let a = import; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/import_no_meta.js b/crates/biome_js_parser/tests/js_test_suite/error/import_no_meta.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/import_no_meta.js rename to crates/biome_js_parser/tests/js_test_suite/error/import_no_meta.js diff --git a/crates/biome_js_parser/test_data/inline/err/import_no_meta.rast b/crates/biome_js_parser/tests/js_test_suite/error/import_no_meta.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/import_no_meta.rast rename to crates/biome_js_parser/tests/js_test_suite/error/import_no_meta.js.snap index a2e0756d2632..9604f0591ab2 100644 --- a/crates/biome_js_parser/test_data/inline/err/import_no_meta.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/import_no_meta.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import.foo +import.metaa + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -34,7 +50,11 @@ JsModule { ], eof_token: EOF@23..24 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..24 0: (empty) 1: (empty) @@ -55,7 +75,12 @@ JsModule { 0: IDENT@18..23 "metaa" [] [] 1: (empty) 4: EOF@23..24 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` import_no_meta.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected `meta` following an import keyword, but found `foo` @@ -65,7 +90,6 @@ import_no_meta.js:1:8 parse ━━━━━━━━━━━━━━━━━ 2 │ import.metaa 3 │ --- import_no_meta.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected `meta` following an import keyword, but found `metaa` @@ -75,6 +99,4 @@ import_no_meta.js:2:8 parse ━━━━━━━━━━━━━━━━━ │ ^^^^^ 3 │ --- -import.foo -import.metaa +``` diff --git a/crates/biome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.js b/crates/biome_js_parser/tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.js rename to crates/biome_js_parser/tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js diff --git a/crates/biome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.rast b/crates/biome_js_parser/tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js.snap index 6bc653dae2d4..35a08e94ae55 100644 --- a/crates/biome_js_parser/test_data/inline/err/incomplete_parenthesized_sequence_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/incomplete_parenthesized_sequence_expression.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(a,; +(a, b, c; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -50,7 +66,11 @@ JsModule { ], eof_token: EOF@14..15 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..15 0: (empty) 1: (empty) @@ -86,7 +106,12 @@ JsModule { 2: (empty) 1: SEMICOLON@13..14 ";" [] [] 4: EOF@14..15 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` incomplete_parenthesized_sequence_expression.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ';'. @@ -103,7 +128,6 @@ incomplete_parenthesized_sequence_expression.js:1:4 parse ━━━━━━━ 2 │ (a, b, c; 3 │ --- incomplete_parenthesized_sequence_expression.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `;` @@ -115,6 +139,4 @@ incomplete_parenthesized_sequence_expression.js:2:9 parse ━━━━━━━ i Remove ; --- -(a,; -(a, b, c; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/index_signature_class_member_in_js.js b/crates/biome_js_parser/tests/js_test_suite/error/index_signature_class_member_in_js.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/index_signature_class_member_in_js.js rename to crates/biome_js_parser/tests/js_test_suite/error/index_signature_class_member_in_js.js diff --git a/crates/biome_js_parser/test_data/inline/err/index_signature_class_member_in_js.rast b/crates/biome_js_parser/tests/js_test_suite/error/index_signature_class_member_in_js.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/index_signature_class_member_in_js.rast rename to crates/biome_js_parser/tests/js_test_suite/error/index_signature_class_member_in_js.js.snap index 2c82e5e0d5d2..2cd556678682 100644 --- a/crates/biome_js_parser/test_data/inline/err/index_signature_class_member_in_js.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/index_signature_class_member_in_js.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + [a: number]: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -45,7 +62,11 @@ JsModule { ], eof_token: EOF@36..37 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..37 0: (empty) 1: (empty) @@ -79,7 +100,12 @@ JsModule { 4: SEMICOLON@33..34 ";" [] [] 9: R_CURLY@34..36 "}" [Newline("\n")] [] 4: EOF@36..37 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` index_signature_class_member_in_js.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Index signatures are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -92,7 +118,4 @@ index_signature_class_member_in_js.js:2:5 parse ━━━━━━━━━━ i TypeScript only syntax --- -class A { - [a: number]: string; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/interface_cannot_be_reserved_world.ts b/crates/biome_js_parser/tests/js_test_suite/error/interface_cannot_be_reserved_world.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/interface_cannot_be_reserved_world.ts rename to crates/biome_js_parser/tests/js_test_suite/error/interface_cannot_be_reserved_world.ts diff --git a/crates/biome_js_parser/test_data/inline/err/interface_cannot_be_reserved_world.rast b/crates/biome_js_parser/tests/js_test_suite/error/interface_cannot_be_reserved_world.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/interface_cannot_be_reserved_world.rast rename to crates/biome_js_parser/tests/js_test_suite/error/interface_cannot_be_reserved_world.ts.snap index b3804ad53b6b..c1c68cb997ec 100644 --- a/crates/biome_js_parser/test_data/inline/err/interface_cannot_be_reserved_world.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/interface_cannot_be_reserved_world.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface undefined {} +interface any {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -32,7 +48,11 @@ JsModule { ], eof_token: EOF@39..40 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..40 0: (empty) 1: (empty) @@ -53,7 +73,12 @@ JsModule { 3: TS_TYPE_MEMBER_LIST@38..38 4: R_CURLY@38..39 "}" [] [] 4: EOF@39..40 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` interface_cannot_be_reserved_world.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Type alias cannot be undefined @@ -63,7 +88,6 @@ interface_cannot_be_reserved_world.ts:1:11 parse ━━━━━━━━━━ 2 │ interface any {} 3 │ --- interface_cannot_be_reserved_world.ts:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Type alias cannot be any @@ -73,6 +97,4 @@ interface_cannot_be_reserved_world.ts:2:11 parse ━━━━━━━━━━ │ ^^^ 3 │ --- -interface undefined {} -interface any {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_arg_list.js b/crates/biome_js_parser/tests/js_test_suite/error/invalid_arg_list.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/invalid_arg_list.js rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_arg_list.js diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_arg_list.rast b/crates/biome_js_parser/tests/js_test_suite/error/invalid_arg_list.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/invalid_arg_list.rast rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_arg_list.js.snap index 97a07c34d0fc..dfd5968cd2cf 100644 --- a/crates/biome_js_parser/test_data/inline/err/invalid_arg_list.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/invalid_arg_list.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo(...args) {} +let a, b, c; +foo(a,b; +foo(a,b var; +foo (,,b); +foo (a, ...); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -194,7 +214,11 @@ JsModule { ], eof_token: EOF@84..85 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..85 0: (empty) 1: (empty) @@ -328,7 +352,12 @@ JsModule { 2: R_PAREN@82..83 ")" [] [] 1: SEMICOLON@83..84 ";" [] [] 4: EOF@84..85 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` invalid_arg_list.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `;` @@ -342,7 +371,6 @@ invalid_arg_list.js:3:8 parse ━━━━━━━━━━━━━━━━ i Remove ; --- invalid_arg_list.js:4:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `var` @@ -356,7 +384,6 @@ invalid_arg_list.js:4:9 parse ━━━━━━━━━━━━━━━━ i Remove var --- invalid_arg_list.js:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern but instead found ';'. @@ -377,7 +404,6 @@ invalid_arg_list.js:4:12 parse ━━━━━━━━━━━━━━━━ 5 │ foo (,,b); 6 │ foo (a, ...); --- invalid_arg_list.js:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ','. @@ -398,7 +424,6 @@ invalid_arg_list.js:5:6 parse ━━━━━━━━━━━━━━━━ 6 │ foo (a, ...); 7 │ --- invalid_arg_list.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ','. @@ -419,7 +444,6 @@ invalid_arg_list.js:5:7 parse ━━━━━━━━━━━━━━━━ 6 │ foo (a, ...); 7 │ --- invalid_arg_list.js:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found ')'. @@ -438,10 +462,4 @@ invalid_arg_list.js:6:12 parse ━━━━━━━━━━━━━━━━ │ ^ 7 │ --- -function foo(...args) {} -let a, b, c; -foo(a,b; -foo(a,b var; -foo (,,b); -foo (a, ...); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/error/invalid_assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/invalid_assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_assignment_target.js diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_assignment_target.rast b/crates/biome_js_parser/tests/js_test_suite/error/invalid_assignment_target.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/invalid_assignment_target.rast rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_assignment_target.js.snap index 49e039419406..aeb4cc6ee6c5 100644 --- a/crates/biome_js_parser/test_data/inline/err/invalid_assignment_target.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/invalid_assignment_target.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +++a = b; +(++a) = b; +(a = b; +a?.b = b; +a?.["b"] = b; +(a +) = b; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -141,7 +161,11 @@ JsModule { ], eof_token: EOF@62..63 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..63 0: (empty) 1: (empty) @@ -230,7 +254,12 @@ JsModule { 0: IDENT@60..61 "b" [] [] 1: SEMICOLON@61..62 ";" [] [] 4: EOF@62..63 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` invalid_assignment_target.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `++a` @@ -242,7 +271,6 @@ invalid_assignment_target.js:1:1 parse ━━━━━━━━━━━━━ i This expression cannot be assigned to --- invalid_assignment_target.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `++a` @@ -255,7 +283,6 @@ invalid_assignment_target.js:2:2 parse ━━━━━━━━━━━━━ i This expression cannot be assigned to --- invalid_assignment_target.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `;` @@ -269,7 +296,6 @@ invalid_assignment_target.js:3:7 parse ━━━━━━━━━━━━━ i Remove ; --- invalid_assignment_target.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `a?.b` @@ -283,7 +309,6 @@ invalid_assignment_target.js:4:1 parse ━━━━━━━━━━━━━ i This expression cannot be assigned to --- invalid_assignment_target.js:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `a?.["b"]` @@ -297,7 +322,6 @@ invalid_assignment_target.js:5:1 parse ━━━━━━━━━━━━━ i This expression cannot be assigned to --- invalid_assignment_target.js:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ')'. @@ -316,7 +340,6 @@ invalid_assignment_target.js:6:5 parse ━━━━━━━━━━━━━ │ ^ 7 │ --- invalid_assignment_target.js:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `a +` @@ -329,10 +352,4 @@ invalid_assignment_target.js:6:2 parse ━━━━━━━━━━━━━ i This expression cannot be assigned to --- -++a = b; -(++a) = b; -(a = b; -a?.b = b; -a?.["b"] = b; -(a +) = b; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_method_recover.js b/crates/biome_js_parser/tests/js_test_suite/error/invalid_method_recover.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/invalid_method_recover.js rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_method_recover.js diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_method_recover.rast b/crates/biome_js_parser/tests/js_test_suite/error/invalid_method_recover.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/invalid_method_recover.rast rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_method_recover.js.snap index c789bc1c6a54..4fc7d58f82a5 100644 --- a/crates/biome_js_parser/test_data/inline/err/invalid_method_recover.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/invalid_method_recover.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class { + [1 + 1] = () => { + let a=; + }; +}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -80,7 +99,11 @@ JsModule { ], eof_token: EOF@47..48 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -142,7 +165,12 @@ JsModule { 1: JS_EMPTY_STATEMENT@46..47 0: SEMICOLON@46..47 ";" [] [] 4: EOF@47..48 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` invalid_method_recover.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name @@ -152,7 +180,6 @@ invalid_method_recover.js:1:1 parse ━━━━━━━━━━━━━━ 2 │ [1 + 1] = () => { 3 │ let a=; --- invalid_method_recover.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found ';'. @@ -173,9 +200,4 @@ invalid_method_recover.js:3:11 parse ━━━━━━━━━━━━━━ 4 │ }; 5 │ }; --- -class { - [1 + 1] = () => { - let a=; - }; -}; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.ts b/crates/biome_js_parser/tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.ts rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.rast b/crates/biome_js_parser/tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.rast rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts.snap index f220de87158d..0cecae275198 100644 --- a/crates/biome_js_parser/test_data/inline/err/invalid_optional_chain_from_new_expressions.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/invalid_optional_chain_from_new_expressions.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +new Test?.test(); +new Test?.test(); +new A.b?.c() +new (A.b)?.c() +new (A.b?.()).c() +new A.b?.()() + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -221,7 +241,11 @@ JsModule { ], eof_token: EOF@103..104 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..104 0: (empty) 1: (empty) @@ -381,7 +405,12 @@ JsModule { 2: R_PAREN@102..103 ")" [] [] 1: (empty) 4: EOF@103..104 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` invalid_optional_chain_from_new_expressions.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid optional chain from new expression. @@ -393,7 +422,6 @@ invalid_optional_chain_from_new_expressions.ts:1:17 parse ━━━━━━━ i Did you mean to call 'Test()'? --- invalid_optional_chain_from_new_expressions.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid optional chain from new expression. @@ -406,7 +434,6 @@ invalid_optional_chain_from_new_expressions.ts:2:9 parse ━━━━━━━ i Did you mean to call 'Test()'? --- invalid_optional_chain_from_new_expressions.ts:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid optional chain from new expression. @@ -420,7 +447,6 @@ invalid_optional_chain_from_new_expressions.ts:3:8 parse ━━━━━━━ i Did you mean to call 'A.b()'? --- invalid_optional_chain_from_new_expressions.ts:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid optional chain from new expression. @@ -434,7 +460,6 @@ invalid_optional_chain_from_new_expressions.ts:4:10 parse ━━━━━━━ i Did you mean to call '(A.b)()'? --- invalid_optional_chain_from_new_expressions.ts:6:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid optional chain from new expression. @@ -447,10 +472,4 @@ invalid_optional_chain_from_new_expressions.ts:6:8 parse ━━━━━━━ i Did you mean to call 'A.b()'? --- -new Test?.test(); -new Test?.test(); -new A.b?.c() -new (A.b)?.c() -new (A.b?.()).c() -new A.b?.()() +``` diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.js b/crates/biome_js_parser/tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.js rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js diff --git a/crates/biome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.rast b/crates/biome_js_parser/tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js.snap index 8f5a5bc48d8d..f02e1000a79f 100644 --- a/crates/biome_js_parser/test_data/inline/err/invalid_using_declarations_inside_for_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/invalid_using_declarations_inside_for_statement.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for (await using of x) {}; +for await (await using of x) {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -74,7 +90,11 @@ JsModule { ], eof_token: EOF@59..60 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..60 0: (empty) 1: (empty) @@ -129,7 +149,12 @@ JsModule { 3: JS_EMPTY_STATEMENT@58..59 0: SEMICOLON@58..59 ";" [] [] 4: EOF@59..60 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` invalid_using_declarations_inside_for_statement.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Using declarations must have an initialized value. @@ -141,7 +166,6 @@ invalid_using_declarations_inside_for_statement.js:1:18 parse ━━━━━━ i This variable needs to be initialized. --- invalid_using_declarations_inside_for_statement.js:1:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `;` but instead found `x` @@ -153,7 +177,6 @@ invalid_using_declarations_inside_for_statement.js:1:21 parse ━━━━━━ i Remove x --- invalid_using_declarations_inside_for_statement.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `;` but instead found `)` @@ -165,7 +188,6 @@ invalid_using_declarations_inside_for_statement.js:1:22 parse ━━━━━━ i Remove ) --- invalid_using_declarations_inside_for_statement.js:2:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Using declarations must have an initialized value. @@ -177,7 +199,6 @@ invalid_using_declarations_inside_for_statement.js:2:24 parse ━━━━━━ i This variable needs to be initialized. --- invalid_using_declarations_inside_for_statement.js:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `;` but instead found `x` @@ -189,7 +210,6 @@ invalid_using_declarations_inside_for_statement.js:2:27 parse ━━━━━━ i Remove x --- invalid_using_declarations_inside_for_statement.js:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `;` but instead found `)` @@ -201,7 +221,6 @@ invalid_using_declarations_inside_for_statement.js:2:28 parse ━━━━━━ i Remove ) --- invalid_using_declarations_inside_for_statement.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × await can only be used in conjunction with `for...of` statements @@ -225,6 +244,4 @@ invalid_using_declarations_inside_for_statement.js:2:5 parse ━━━━━━ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 │ --- -for (await using of x) {}; -for await (await using of x) {}; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.js b/crates/biome_js_parser/tests/js_test_suite/error/js_class_property_with_ts_annotation.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_class_property_with_ts_annotation.js diff --git a/crates/biome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.rast b/crates/biome_js_parser/tests/js_test_suite/error/js_class_property_with_ts_annotation.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.rast rename to crates/biome_js_parser/tests/js_test_suite/error/js_class_property_with_ts_annotation.js.snap index e88d3b2d2d6d..af0fdfd76169 100644 --- a/crates/biome_js_parser/test_data/inline/err/js_class_property_with_ts_annotation.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_class_property_with_ts_annotation.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + a: string; + b?: string; + c!: string +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -77,7 +96,11 @@ JsModule { ], eof_token: EOF@48..49 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..49 0: (empty) 1: (empty) @@ -126,7 +149,12 @@ JsModule { 0: STRING_KW@40..46 "string" [] [] 9: R_CURLY@46..48 "}" [Newline("\n")] [] 4: EOF@48..49 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` js_class_property_with_ts_annotation.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × return types can only be used in TypeScript files @@ -139,7 +167,6 @@ js_class_property_with_ts_annotation.js:2:3 parse ━━━━━━━━━━ i remove this type annotation --- js_class_property_with_ts_annotation.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `?` modifiers can only be used in TypeScript files @@ -151,7 +178,6 @@ js_class_property_with_ts_annotation.js:3:3 parse ━━━━━━━━━━ 4 │ c!: string 5 │ } --- js_class_property_with_ts_annotation.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `!` modifiers can only be used in TypeScript files @@ -163,9 +189,4 @@ js_class_property_with_ts_annotation.js:4:3 parse ━━━━━━━━━━ 5 │ } 6 │ --- -class A { - a: string; - b?: string; - c!: string -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.js b/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs.snap new file mode 100644 index 000000000000..4b0562372263 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.cjs.snap @@ -0,0 +1,203 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +class A { constructor(readonly, private, protected, public) {} } + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsClassDeclaration { + decorators: JsDecoratorList [], + abstract_token: missing (optional), + class_token: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + id: JsIdentifierBinding { + name_token: IDENT@16..18 "A" [] [Whitespace(" ")], + }, + type_parameters: missing (optional), + extends_clause: missing (optional), + implements_clause: missing (optional), + l_curly_token: L_CURLY@18..20 "{" [] [Whitespace(" ")], + members: JsClassMemberList [ + JsConstructorClassMember { + modifiers: JsConstructorModifierList [], + name: JsLiteralMemberName { + value: IDENT@20..31 "constructor" [] [], + }, + parameters: JsConstructorParameters { + l_paren_token: L_PAREN@31..32 "(" [] [], + parameters: JsConstructorParameterList [ + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsIdentifierBinding { + name_token: IDENT@32..40 "readonly" [] [], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@40..42 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@42..49 "private" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@49..51 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@51..60 "protected" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + COMMA@60..62 "," [] [Whitespace(" ")], + JsFormalParameter { + decorators: JsDecoratorList [], + binding: JsBogusBinding { + items: [ + IDENT@62..68 "public" [] [], + ], + }, + question_mark_token: missing (optional), + type_annotation: missing (optional), + initializer: missing (optional), + }, + ], + r_paren_token: R_PAREN@68..70 ")" [] [Whitespace(" ")], + }, + body: JsFunctionBody { + l_curly_token: L_CURLY@70..71 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [], + r_curly_token: R_CURLY@71..73 "}" [] [Whitespace(" ")], + }, + }, + ], + r_curly_token: R_CURLY@73..74 "}" [] [], + }, + ], + eof_token: EOF@74..75 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..75 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..74 + 0: JS_CLASS_DECLARATION@0..74 + 0: JS_DECORATOR_LIST@0..0 + 1: (empty) + 2: CLASS_KW@0..16 "class" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 3: JS_IDENTIFIER_BINDING@16..18 + 0: IDENT@16..18 "A" [] [Whitespace(" ")] + 4: (empty) + 5: (empty) + 6: (empty) + 7: L_CURLY@18..20 "{" [] [Whitespace(" ")] + 8: JS_CLASS_MEMBER_LIST@20..73 + 0: JS_CONSTRUCTOR_CLASS_MEMBER@20..73 + 0: JS_CONSTRUCTOR_MODIFIER_LIST@20..20 + 1: JS_LITERAL_MEMBER_NAME@20..31 + 0: IDENT@20..31 "constructor" [] [] + 2: JS_CONSTRUCTOR_PARAMETERS@31..70 + 0: L_PAREN@31..32 "(" [] [] + 1: JS_CONSTRUCTOR_PARAMETER_LIST@32..68 + 0: JS_FORMAL_PARAMETER@32..40 + 0: JS_DECORATOR_LIST@32..32 + 1: JS_IDENTIFIER_BINDING@32..40 + 0: IDENT@32..40 "readonly" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 1: COMMA@40..42 "," [] [Whitespace(" ")] + 2: JS_FORMAL_PARAMETER@42..49 + 0: JS_DECORATOR_LIST@42..42 + 1: JS_BOGUS_BINDING@42..49 + 0: IDENT@42..49 "private" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 3: COMMA@49..51 "," [] [Whitespace(" ")] + 4: JS_FORMAL_PARAMETER@51..60 + 0: JS_DECORATOR_LIST@51..51 + 1: JS_BOGUS_BINDING@51..60 + 0: IDENT@51..60 "protected" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 5: COMMA@60..62 "," [] [Whitespace(" ")] + 6: JS_FORMAL_PARAMETER@62..68 + 0: JS_DECORATOR_LIST@62..62 + 1: JS_BOGUS_BINDING@62..68 + 0: IDENT@62..68 "public" [] [] + 2: (empty) + 3: (empty) + 4: (empty) + 2: R_PAREN@68..70 ")" [] [Whitespace(" ")] + 3: JS_FUNCTION_BODY@70..73 + 0: L_CURLY@70..71 "{" [] [] + 1: JS_DIRECTIVE_LIST@71..71 + 2: JS_STATEMENT_LIST@71..71 + 3: R_CURLY@71..73 "}" [] [Whitespace(" ")] + 9: R_CURLY@73..74 "}" [] [] + 4: EOF@74..75 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +js_constructor_parameter_reserved_names.cjs:2:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `private` as an identifier in strict mode + + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^^ + 3 │ + +js_constructor_parameter_reserved_names.cjs:2:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `protected` as an identifier in strict mode + + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^^^^ + 3 │ + +js_constructor_parameter_reserved_names.cjs:2:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `public` as an identifier in strict mode + + 1 │ // SCRIPT + > 2 │ class A { constructor(readonly, private, protected, public) {} } + │ ^^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.rast b/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.rast rename to crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.js.snap index 74ce8dfec427..e04b8bf95c47 100644 --- a/crates/biome_js_parser/test_data/inline/err/js_constructor_parameter_reserved_names.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_constructor_parameter_reserved_names.js.snap @@ -1,8 +1,24 @@ -JsScript { +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +class A { constructor(readonly, private, protected, public) {} } + +``` + + +## AST + +``` +JsModule { bom_token: missing (optional), interpreter_token: missing (optional), directives: JsDirectiveList [], - statements: JsStatementList [ + items: JsModuleItemList [ JsClassDeclaration { decorators: JsDecoratorList [], abstract_token: missing (optional), @@ -84,12 +100,16 @@ JsScript { ], eof_token: EOF@74..75 "" [Newline("\n")] [], } +``` -0: JS_SCRIPT@0..75 +## CST + +``` +0: JS_MODULE@0..75 0: (empty) 1: (empty) 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..74 + 3: JS_MODULE_ITEM_LIST@0..74 0: JS_CLASS_DECLARATION@0..74 0: JS_DECORATOR_LIST@0..0 1: (empty) @@ -147,7 +167,12 @@ JsScript { 3: R_CURLY@71..73 "}" [] [Whitespace(" ")] 9: R_CURLY@73..74 "}" [] [] 4: EOF@74..75 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` js_constructor_parameter_reserved_names.js:2:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `private` as an identifier in strict mode @@ -157,7 +182,6 @@ js_constructor_parameter_reserved_names.js:2:33 parse ━━━━━━━━ │ ^^^^^^^ 3 │ --- js_constructor_parameter_reserved_names.js:2:42 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `protected` as an identifier in strict mode @@ -167,7 +191,6 @@ js_constructor_parameter_reserved_names.js:2:42 parse ━━━━━━━━ │ ^^^^^^^^^ 3 │ --- js_constructor_parameter_reserved_names.js:2:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `public` as an identifier in strict mode @@ -177,6 +200,4 @@ js_constructor_parameter_reserved_names.js:2:53 parse ━━━━━━━━ │ ^^^^^^ 3 │ --- -// SCRIPT -class A { constructor(readonly, private, protected, public) {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_formal_parameter_error.js b/crates/biome_js_parser/tests/js_test_suite/error/js_formal_parameter_error.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_formal_parameter_error.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_formal_parameter_error.js diff --git a/crates/biome_js_parser/test_data/inline/err/js_formal_parameter_error.rast b/crates/biome_js_parser/tests/js_test_suite/error/js_formal_parameter_error.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/js_formal_parameter_error.rast rename to crates/biome_js_parser/tests/js_test_suite/error/js_formal_parameter_error.js.snap index 36627f76fb15..84e5863cd208 100644 --- a/crates/biome_js_parser/test_data/inline/err/js_formal_parameter_error.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_formal_parameter_error.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function a(x: string) {} +function b(x?) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -75,7 +91,11 @@ JsModule { ], eof_token: EOF@42..43 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..43 0: (empty) 1: (empty) @@ -129,7 +149,12 @@ JsModule { 2: JS_STATEMENT_LIST@41..41 3: R_CURLY@41..42 "}" [] [] 4: EOF@42..43 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` js_formal_parameter_error.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -141,7 +166,6 @@ js_formal_parameter_error.js:1:13 parse ━━━━━━━━━━━━━ i TypeScript only syntax --- js_formal_parameter_error.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × optional parameters are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -153,6 +177,4 @@ js_formal_parameter_error.js:2:13 parse ━━━━━━━━━━━━━ i TypeScript only syntax --- -function a(x: string) {} -function b(x?) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_invalid_assignment.js b/crates/biome_js_parser/tests/js_test_suite/error/js_invalid_assignment.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_invalid_assignment.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_invalid_assignment.js diff --git a/crates/biome_js_parser/test_data/inline/err/js_invalid_assignment.rast b/crates/biome_js_parser/tests/js_test_suite/error/js_invalid_assignment.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/js_invalid_assignment.rast rename to crates/biome_js_parser/tests/js_test_suite/error/js_invalid_assignment.js.snap index 252549c70113..0fd91b30e7af 100644 --- a/crates/biome_js_parser/test_data/inline/err/js_invalid_assignment.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_invalid_assignment.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +([=[(p[=[(p%]>([=[(p[=[( + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -120,7 +135,11 @@ JsModule { ], eof_token: EOF@24..25 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..25 0: (empty) 1: (empty) @@ -204,7 +223,12 @@ JsModule { 2: (empty) 1: (empty) 4: EOF@24..25 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` js_invalid_assignment.js:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a property, an expression, or a method but instead found '='. @@ -219,7 +243,6 @@ js_invalid_assignment.js:1:3 parse ━━━━━━━━━━━━━━━ │ ^ 2 │ --- js_invalid_assignment.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `[` @@ -230,7 +253,6 @@ js_invalid_assignment.js:1:4 parse ━━━━━━━━━━━━━━━ i Remove [ --- js_invalid_assignment.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '='. @@ -245,7 +267,6 @@ js_invalid_assignment.js:1:8 parse ━━━━━━━━━━━━━━━ │ ^ 2 │ --- js_invalid_assignment.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ']'. @@ -260,7 +281,6 @@ js_invalid_assignment.js:1:13 parse ━━━━━━━━━━━━━━ │ ^ 2 │ --- js_invalid_assignment.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a property, an expression, or a method but instead found '='. @@ -275,7 +295,6 @@ js_invalid_assignment.js:1:17 parse ━━━━━━━━━━━━━━ │ ^ 2 │ --- js_invalid_assignment.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `[` @@ -286,7 +305,6 @@ js_invalid_assignment.js:1:18 parse ━━━━━━━━━━━━━━ i Remove [ --- js_invalid_assignment.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '='. @@ -301,7 +319,6 @@ js_invalid_assignment.js:1:22 parse ━━━━━━━━━━━━━━ │ ^ 2 │ --- js_invalid_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead the file ends @@ -316,5 +333,4 @@ js_invalid_assignment.js:2:1 parse ━━━━━━━━━━━━━━━ > 2 │ │ --- -([=[(p[=[(p%]>([=[(p[=[( +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_regex_assignment.js b/crates/biome_js_parser/tests/js_test_suite/error/js_regex_assignment.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_regex_assignment.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_regex_assignment.js diff --git a/crates/biome_js_parser/test_data/inline/err/js_regex_assignment.rast b/crates/biome_js_parser/tests/js_test_suite/error/js_regex_assignment.js.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/err/js_regex_assignment.rast rename to crates/biome_js_parser/tests/js_test_suite/error/js_regex_assignment.js.snap index ba270cc8dec5..68f376330887 100644 --- a/crates/biome_js_parser/test_data/inline/err/js_regex_assignment.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_regex_assignment.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +/=0*_:m/=/*_:| + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -18,7 +33,11 @@ JsModule { ], eof_token: EOF@15..15 "" [] [], } +``` +## CST + +``` 0: JS_MODULE@0..15 0: (empty) 1: (empty) @@ -32,7 +51,12 @@ JsModule { 2: (empty) 1: (empty) 4: EOF@15..15 "" [] [] --- + +``` + +## Diagnostics + +``` js_regex_assignment.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `/=0*_:m/` @@ -43,7 +67,6 @@ js_regex_assignment.js:1:1 parse ━━━━━━━━━━━━━━━ i This expression cannot be assigned to --- js_regex_assignment.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unterminated block comment @@ -64,5 +87,4 @@ js_regex_assignment.js:2:1 parse ━━━━━━━━━━━━━━━ │ ^^ 2 │ --- -/=0*_:m/=/*_:| +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_rewind_at_eof_token.js b/crates/biome_js_parser/tests/js_test_suite/error/js_rewind_at_eof_token.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_rewind_at_eof_token.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_rewind_at_eof_token.js diff --git a/crates/biome_js_parser/test_data/inline/err/js_rewind_at_eof_token.rast b/crates/biome_js_parser/tests/js_test_suite/error/js_rewind_at_eof_token.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/js_rewind_at_eof_token.rast rename to crates/biome_js_parser/tests/js_test_suite/error/js_rewind_at_eof_token.js.snap index 25b7a45d0244..93c36c0413ee 100644 --- a/crates/biome_js_parser/test_data/inline/err/js_rewind_at_eof_token.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_rewind_at_eof_token.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(([zAgRvz=[=(e{V{ + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -68,7 +83,11 @@ JsModule { ], eof_token: EOF@17..18 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..18 0: (empty) 1: (empty) @@ -115,7 +134,12 @@ JsModule { 2: (empty) 1: (empty) 4: EOF@17..18 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` js_rewind_at_eof_token.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a property, an expression, or a method but instead found '='. @@ -130,7 +154,6 @@ js_rewind_at_eof_token.js:1:12 parse ━━━━━━━━━━━━━━ │ ^ 2 │ --- js_rewind_at_eof_token.js:1:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `(` @@ -141,7 +164,6 @@ js_rewind_at_eof_token.js:1:13 parse ━━━━━━━━━━━━━━ i Remove ( --- js_rewind_at_eof_token.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `{` @@ -152,7 +174,6 @@ js_rewind_at_eof_token.js:1:15 parse ━━━━━━━━━━━━━━ i Remove { --- js_rewind_at_eof_token.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `{` @@ -163,7 +184,6 @@ js_rewind_at_eof_token.js:1:17 parse ━━━━━━━━━━━━━━ i Remove { --- js_rewind_at_eof_token.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead the file ends @@ -178,5 +198,4 @@ js_rewind_at_eof_token.js:2:1 parse ━━━━━━━━━━━━━━ > 2 │ │ --- -(([zAgRvz=[=(e{V{ +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_right_shift_comments.js b/crates/biome_js_parser/tests/js_test_suite/error/js_right_shift_comments.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_right_shift_comments.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_right_shift_comments.js diff --git a/crates/biome_js_parser/test_data/inline/err/js_right_shift_comments.rast b/crates/biome_js_parser/tests/js_test_suite/error/js_right_shift_comments.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/js_right_shift_comments.rast rename to crates/biome_js_parser/tests/js_test_suite/error/js_right_shift_comments.js.snap index b40f5f8987b9..bf8843e18697 100644 --- a/crates/biome_js_parser/test_data/inline/err/js_right_shift_comments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_right_shift_comments.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +1 >> /* a comment */ > 2; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -22,7 +37,11 @@ JsModule { ], eof_token: EOF@25..26 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..26 0: (empty) 1: (empty) @@ -40,7 +59,12 @@ JsModule { 0: JS_NUMBER_LITERAL@23..24 "2" [] [] 1: SEMICOLON@24..25 ";" [] [] 4: EOF@25..26 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` js_right_shift_comments.js:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '>'. @@ -55,5 +79,4 @@ js_right_shift_comments.js:1:22 parse ━━━━━━━━━━━━━━ │ ^ 2 │ --- -1 >> /* a comment */ > 2; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/js_type_variable_annotation.js b/crates/biome_js_parser/tests/js_test_suite/error/js_type_variable_annotation.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/js_type_variable_annotation.js rename to crates/biome_js_parser/tests/js_test_suite/error/js_type_variable_annotation.js diff --git a/crates/biome_js_parser/test_data/inline/err/js_type_variable_annotation.rast b/crates/biome_js_parser/tests/js_test_suite/error/js_type_variable_annotation.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/js_type_variable_annotation.rast rename to crates/biome_js_parser/tests/js_test_suite/error/js_type_variable_annotation.js.snap index 864f973a452e..9916a6359784 100644 --- a/crates/biome_js_parser/test_data/inline/err/js_type_variable_annotation.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/js_type_variable_annotation.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a: string, b!: number; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -54,7 +69,11 @@ JsModule { ], eof_token: EOF@26..27 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..27 0: (empty) 1: (empty) @@ -83,7 +102,12 @@ JsModule { 0: NUMBER_KW@19..25 "number" [] [] 1: SEMICOLON@25..26 ";" [] [] 4: EOF@26..27 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` js_type_variable_annotation.js:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × type annotation are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -94,7 +118,6 @@ js_type_variable_annotation.js:1:6 parse ━━━━━━━━━━━━━ i TypeScript only syntax --- js_type_variable_annotation.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × definite assertion assignments are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -105,5 +128,4 @@ js_type_variable_annotation.js:1:17 parse ━━━━━━━━━━━━ i TypeScript only syntax --- -let a: string, b!: number; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx.snap index deec3939eab2..7374846ad909 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_child_expression_missing_r_curly.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_child_expression_missing_r_curly.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{ 4 + 3 + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -45,7 +60,11 @@ JsModule { ], eof_token: EOF@20..21 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..21 0: (empty) 1: (empty) @@ -79,7 +98,12 @@ JsModule { 3: R_ANGLE@19..20 ">" [] [] 1: (empty) 4: EOF@20..21 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_child_expression_missing_r_curly.jsx:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead found `<` @@ -90,5 +114,4 @@ jsx_child_expression_missing_r_curly.jsx:1:14 parse ━━━━━━━━━ i Remove < --- -{ 4 + 3 +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx.snap index 0484e08d1579..ffb0059a41a6 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_children_expression_missing_r_curly.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expression_missing_r_curly.jsx.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx + + { 5 + 3 + some text + + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -51,7 +69,11 @@ JsModule { ], eof_token: EOF@36..37 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..37 0: (empty) 1: (empty) @@ -89,7 +111,12 @@ JsModule { 3: R_ANGLE@35..36 ">" [] [] 1: (empty) 4: EOF@36..37 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_children_expression_missing_r_curly.jsx:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead found `some` @@ -103,8 +130,4 @@ jsx_children_expression_missing_r_curly.jsx:3:3 parse ━━━━━━━━ i Remove some --- - - { 5 + 3 - some text - +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx.snap index 76c7c7c3dd60..2960fe64e1d5 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_children_expressions_not_accepted.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_children_expressions_not_accepted.jsx.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
+ {import.meta} + {class A{}} + {super()} + {new.target} +
+ +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -103,7 +123,11 @@ JsModule { ], eof_token: EOF@69..70 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..70 0: (empty) 1: (empty) @@ -175,7 +199,12 @@ JsModule { 3: R_ANGLE@68..69 ">" [] [] 1: (empty) 4: EOF@69..70 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_children_expressions_not_accepted.jsx:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × This expression is not valid as a JSX expression. @@ -186,7 +215,6 @@ jsx_children_expressions_not_accepted.jsx:2:4 parse ━━━━━━━━━ 3 │ {class A{}} 4 │ {super()} --- jsx_children_expressions_not_accepted.jsx:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × This expression is not valid as a JSX expression. @@ -198,7 +226,6 @@ jsx_children_expressions_not_accepted.jsx:3:4 parse ━━━━━━━━━ 4 │ {super()} 5 │ {new.target} --- jsx_children_expressions_not_accepted.jsx:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `super` is only valid inside of a class constructor of a subclass. @@ -210,7 +237,6 @@ jsx_children_expressions_not_accepted.jsx:4:4 parse ━━━━━━━━━ 5 │ {new.target} 6 │
--- jsx_children_expressions_not_accepted.jsx:5:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × This expression is not valid as a JSX expression. @@ -222,10 +248,4 @@ jsx_children_expressions_not_accepted.jsx:5:4 parse ━━━━━━━━━ 6 │ 7 │ --- -
- {import.meta} - {class A{}} - {super()} - {new.target} -
+``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_element_mismatch.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_element_mismatch.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_element_mismatch.jsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_element_mismatch.jsx.snap index 11002745e6d9..1d473158ac76 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_closing_element_mismatch.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_element_mismatch.jsx.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +; +; +<><5>; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -152,7 +170,11 @@ JsModule { ], eof_token: EOF@74..75 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..75 0: (empty) 1: (empty) @@ -253,7 +275,12 @@ JsModule { 2: R_ANGLE@72..73 ">" [] [] 1: SEMICOLON@73..74 ";" [] [] 4: EOF@74..75 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_closing_element_mismatch.jsx:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected corresponding JSX closing tag for 'test'. @@ -277,7 +304,6 @@ jsx_closing_element_mismatch.jsx:1:1 parse ━━━━━━━━━━━━ 2 │ ; 3 │ ; --- jsx_closing_element_mismatch.jsx:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected corresponding JSX closing tag for 'test'. @@ -304,7 +330,6 @@ jsx_closing_element_mismatch.jsx:2:1 parse ━━━━━━━━━━━━ 3 │ ; 4 │ <><5>; --- jsx_closing_element_mismatch.jsx:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected corresponding JSX closing tag for 'nested'. @@ -334,7 +359,6 @@ jsx_closing_element_mismatch.jsx:3:7 parse ━━━━━━━━━━━━ 4 │ <><5>; 5 │ --- jsx_closing_element_mismatch.jsx:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected corresponding JSX closing tag for 'some'. @@ -364,7 +388,6 @@ jsx_closing_element_mismatch.jsx:3:1 parse ━━━━━━━━━━━━ 4 │ <><5>; 5 │ --- jsx_closing_element_mismatch.jsx:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier but instead found '5'. @@ -383,8 +406,4 @@ jsx_closing_element_mismatch.jsx:4:4 parse ━━━━━━━━━━━━ │ ^ 5 │ --- -; -; -; -<><5>; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx.snap index 1a18ef506e7d..2cecbc69480b 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_closing_missing_r_angle.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_closing_missing_r_angle.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +<>abcd + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -51,7 +66,11 @@ JsModule { ], eof_token: EOF@47..48 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -89,7 +108,12 @@ JsModule { 2: R_ANGLE@46..47 ">" [] [] 1: (empty) 4: EOF@47..48 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_closing_missing_r_angle.jsx:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `>` but instead found `more` @@ -100,5 +124,4 @@ jsx_closing_missing_r_angle.jsx:1:20 parse ━━━━━━━━━━━━ i Remove more --- -<>abcd +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx.snap index 442be5282709..5e280a2c1bad 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_expression_error.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_expression_error.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -39,7 +54,11 @@ JsModule { ], eof_token: EOF@30..31 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..31 0: (empty) 1: (empty) @@ -68,7 +87,12 @@ JsModule { 5: R_ANGLE@28..29 ">" [] [] 1: SEMICOLON@29..30 ";" [] [] 4: EOF@30..31 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_element_attribute_expression_error.jsx:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead found `asdf` @@ -79,5 +103,4 @@ jsx_element_attribute_expression_error.jsx:1:22 parse ━━━━━━━━ i Remove asdf --- -
; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx.snap index be73eaf7ffe0..369440c7b6d6 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_element_attribute_missing_value.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_element_attribute_missing_value.jsx.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function f() { + return
; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -64,7 +81,11 @@ JsModule { ], eof_token: EOF@57..58 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..58 0: (empty) 1: (empty) @@ -113,7 +134,12 @@ JsModule { 2: SEMICOLON@54..55 ";" [] [] 3: R_CURLY@55..57 "}" [Newline("\n")] [] 4: EOF@57..58 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_element_attribute_missing_value.jsx:2:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a JSX attribute value but instead found '>'. @@ -132,7 +158,4 @@ jsx_element_attribute_missing_value.jsx:2:33 parse ━━━━━━━━━ 3 │ } 4 │ --- -function f() { - return
; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx.snap index 66c4014d3083..737c0bad5bad 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_fragment_closing_missing_r_angle.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_fragment_closing_missing_r_angle.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
<>test + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -51,7 +66,11 @@ JsModule { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..35 0: (empty) 1: (empty) @@ -89,7 +108,12 @@ JsModule { 3: R_ANGLE@33..34 ">" [] [] 1: (empty) 4: EOF@34..35 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_fragment_closing_missing_r_angle.jsx:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `>` but instead found `5` @@ -100,5 +124,4 @@ jsx_fragment_closing_missing_r_angle.jsx:1:15 parse ━━━━━━━━━ i Remove 5 --- -
<>test +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_invalid_text.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_invalid_text.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_invalid_text.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_invalid_text.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_invalid_text.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_invalid_text.jsx.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/jsx_invalid_text.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_invalid_text.jsx.snap index a0c02bd27336..c7f95a6f2fe3 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_invalid_text.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_invalid_text.jsx.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx + test >; + invalid }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -64,7 +80,11 @@ JsModule { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..35 0: (empty) 1: (empty) @@ -111,7 +131,12 @@ JsModule { 3: R_ANGLE@32..33 ">" [] [] 1: SEMICOLON@33..34 ";" [] [] 4: EOF@34..35 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_invalid_text.jsx:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Unexpected token. Did you mean `{'>'}` or `>`? @@ -121,7 +146,6 @@ jsx_invalid_text.jsx:1:10 parse ━━━━━━━━━━━━━━━━ 2 │ invalid }; 3 │ --- jsx_invalid_text.jsx:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Unexpected token. Did you mean `{'}'}` or `}`? @@ -131,6 +155,4 @@ jsx_invalid_text.jsx:2:13 parse ━━━━━━━━━━━━━━━━ │ ^ 3 │ --- - test >; - invalid }; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_missing_closing_fragment.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_missing_closing_fragment.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_missing_closing_fragment.jsx.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_missing_closing_fragment.jsx.snap index 4db2bab525a0..b74fccc9a882 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_missing_closing_fragment.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_missing_closing_fragment.jsx.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +<>test; +<>test some text; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -84,7 +100,11 @@ JsModule { ], eof_token: EOF@48..48 "" [] [], } +``` +## CST + +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -140,7 +160,12 @@ JsModule { 2: (empty) 1: (empty) 4: EOF@48..48 "" [] [] --- + +``` + +## Diagnostics + +``` jsx_missing_closing_fragment.jsx:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × JSX fragment has no corresponding closing tag. @@ -164,7 +189,6 @@ jsx_missing_closing_fragment.jsx:1:1 parse ━━━━━━━━━━━━ 2 │ <>test some text; 3 │ --- jsx_missing_closing_fragment.jsx:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `<` but instead the file ends @@ -181,6 +205,4 @@ jsx_missing_closing_fragment.jsx:3:1 parse ━━━━━━━━━━━━ > 3 │ │ --- -<>test; -<>test some text; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_namespace_member_element_name.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_namespace_member_element_name.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_namespace_member_element_name.jsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_namespace_member_element_name.jsx.snap index aed5f065fccf..2969ba4738c8 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_namespace_member_element_name.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_namespace_member_element_name.jsx.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -107,7 +123,11 @@ JsModule { ], eof_token: EOF@61..62 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..62 0: (empty) 1: (empty) @@ -173,7 +193,12 @@ JsModule { 3: R_ANGLE@59..60 ">" [] [] 1: SEMICOLON@60..61 ";" [] [] 4: EOF@61..62 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_namespace_member_element_name.jsx:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × JSX property access expressions cannot include JSX namespace names. @@ -183,7 +208,6 @@ jsx_namespace_member_element_name.jsx:2:2 parse ━━━━━━━━━━ │ ^^^^^^^^^^^ 3 │ --- jsx_namespace_member_element_name.jsx:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × JSX property access expressions cannot include JSX namespace names. @@ -193,6 +217,4 @@ jsx_namespace_member_element_name.jsx:2:18 parse ━━━━━━━━━━ │ ^^^^^^^^^^^ 3 │ --- -; -; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx.snap index 08a414e28a91..a350aac5546f 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_opening_element_missing_r_angle.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_opening_element_missing_r_angle.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +<> some content + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -69,7 +84,11 @@ JsModule { ], eof_token: EOF@46..47 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..47 0: (empty) 1: (empty) @@ -120,7 +139,12 @@ JsModule { 2: R_ANGLE@45..46 ">" [] [] 1: (empty) 4: EOF@46..47 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_opening_element_missing_r_angle.jsx:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `>` but instead found `<` @@ -131,5 +155,4 @@ jsx_opening_element_missing_r_angle.jsx:1:9 parse ━━━━━━━━━━ i Remove < --- -<> some content +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_or_type_assertion.js b/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_or_type_assertion.js rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.cjs diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.cjs.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.cjs.snap index ce3642745d78..31afe6a59f5f 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_or_type_assertion.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.cjs.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function f() { + let a =
a
; // JSX + let b = b; // type assertion + let c = bd; // type assertion + let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + let d = a/; +} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -236,7 +258,11 @@ JsScript { ], eof_token: EOF@283..284 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_SCRIPT@0..284 0: (empty) 1: (empty) @@ -391,8 +417,13 @@ JsScript { 1: SEMICOLON@280..281 ";" [] [] 3: R_CURLY@281..283 "}" [Newline("\n")] [] 4: EOF@283..284 "" [Newline("\n")] [] --- -jsx_or_type_assertion.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +``` + +## Diagnostics + +``` +jsx_or_type_assertion.cjs:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -405,8 +436,7 @@ jsx_or_type_assertion.js:3:13 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- -jsx_or_type_assertion.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +jsx_or_type_assertion.cjs:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -419,8 +449,7 @@ jsx_or_type_assertion.js:4:13 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- -jsx_or_type_assertion.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +jsx_or_type_assertion.cjs:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -433,8 +462,7 @@ jsx_or_type_assertion.js:5:13 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- -jsx_or_type_assertion.js:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +jsx_or_type_assertion.cjs:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -447,8 +475,7 @@ jsx_or_type_assertion.js:6:13 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- -jsx_or_type_assertion.js:7:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +jsx_or_type_assertion.cjs:7:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × type assertion are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -461,12 +488,4 @@ jsx_or_type_assertion.js:7:13 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- -// SCRIPT -function f() { - let a =
a
; // JSX - let b = b; // type assertion - let c = b
d; // type assertion - let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. - let d = a/; -} +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.js.snap b/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.js.snap new file mode 100644 index 000000000000..d49f3274c9d0 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_or_type_assertion.js.snap @@ -0,0 +1,437 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +function f() { + let a =
a
; // JSX + let b = b; // type assertion + let c = b
d; // type assertion + let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + let d = a/; +} + +``` + + +## AST + +``` +JsModule { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + items: JsModuleItemList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..20 "f" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@20..21 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@21..23 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@23..24 "{" [] [], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@24..33 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@33..35 "a" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@35..37 "=" [] [Whitespace(" ")], + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@37..38 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@38..41 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@41..42 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@42..43 "a" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@43..44 "<" [] [], + slash_token: SLASH@44..45 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@45..48 "div" [] [], + }, + r_angle_token: R_ANGLE@48..49 ">" [] [], + }, + }, + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@49..57 ";" [] [Whitespace(" "), Comments("// JSX")], + }, + JsVariableStatement { + declaration: JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@57..66 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsIdentifierBinding { + name_token: IDENT@66..68 "b" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@68..70 "=" [] [Whitespace(" ")], + expression: JsxTagExpression { + tag: JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@70..71 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@71..77 "string" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@77..78 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@78..111 "b; // type assertion\n let c = " [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@111..112 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@112..118 "string" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@118..119 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@119..120 "b" [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@120..121 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@121..122 "a" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@122..123 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@123..156 "d; // type assertion\n let d = " [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@156..157 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@157..160 "div" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@160..161 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@161..162 "a" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@162..163 "<" [] [], + slash_token: SLASH@163..164 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@164..167 "div" [] [], + }, + r_angle_token: R_ANGLE@167..168 ">" [] [], + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@168..261 "/; // ambiguous: JSX or \"type assertion a less than regex /div>/\". Probably JSX.\n let d = " [] [], + }, + JsxElement { + opening_element: JsxOpeningElement { + l_angle_token: L_ANGLE@261..262 "<" [] [], + name: JsxName { + value_token: JSX_IDENT@262..268 "string" [] [], + }, + type_arguments: missing (optional), + attributes: JsxAttributeList [], + r_angle_token: R_ANGLE@268..269 ">" [] [], + }, + children: JsxChildList [ + JsxText { + value_token: JSX_TEXT_LITERAL@269..270 "a" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: L_ANGLE@270..271 "<" [] [], + slash_token: SLASH@271..272 "/" [] [], + name: JsxName { + value_token: JSX_IDENT@272..278 "string" [] [], + }, + r_angle_token: R_ANGLE@278..279 ">" [] [], + }, + }, + JsxText { + value_token: JSX_TEXT_LITERAL@279..284 "/;\n}\n" [] [], + }, + ], + closing_element: JsxClosingElement { + l_angle_token: missing (required), + slash_token: missing (required), + name: missing (required), + r_angle_token: missing (required), + }, + }, + ], + closing_element: JsxClosingElement { + l_angle_token: missing (required), + slash_token: missing (required), + name: missing (required), + r_angle_token: missing (required), + }, + }, + ], + closing_element: JsxClosingElement { + l_angle_token: missing (required), + slash_token: missing (required), + name: missing (required), + r_angle_token: missing (required), + }, + }, + }, + }, + }, + ], + }, + semicolon_token: missing (optional), + }, + ], + r_curly_token: missing (required), + }, + }, + ], + eof_token: EOF@284..284 "" [] [], +} +``` + +## CST + +``` +0: JS_MODULE@0..284 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_MODULE_ITEM_LIST@0..284 + 0: JS_FUNCTION_DECLARATION@0..284 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..20 + 0: IDENT@19..20 "f" [] [] + 4: (empty) + 5: JS_PARAMETERS@20..23 + 0: L_PAREN@20..21 "(" [] [] + 1: JS_PARAMETER_LIST@21..21 + 2: R_PAREN@21..23 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@23..284 + 0: L_CURLY@23..24 "{" [] [] + 1: JS_DIRECTIVE_LIST@24..24 + 2: JS_STATEMENT_LIST@24..284 + 0: JS_VARIABLE_STATEMENT@24..57 + 0: JS_VARIABLE_DECLARATION@24..49 + 0: (empty) + 1: LET_KW@24..33 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@33..49 + 0: JS_VARIABLE_DECLARATOR@33..49 + 0: JS_IDENTIFIER_BINDING@33..35 + 0: IDENT@33..35 "a" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@35..49 + 0: EQ@35..37 "=" [] [Whitespace(" ")] + 1: JSX_TAG_EXPRESSION@37..49 + 0: JSX_ELEMENT@37..49 + 0: JSX_OPENING_ELEMENT@37..42 + 0: L_ANGLE@37..38 "<" [] [] + 1: JSX_NAME@38..41 + 0: JSX_IDENT@38..41 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@41..41 + 4: R_ANGLE@41..42 ">" [] [] + 1: JSX_CHILD_LIST@42..43 + 0: JSX_TEXT@42..43 + 0: JSX_TEXT_LITERAL@42..43 "a" [] [] + 2: JSX_CLOSING_ELEMENT@43..49 + 0: L_ANGLE@43..44 "<" [] [] + 1: SLASH@44..45 "/" [] [] + 2: JSX_NAME@45..48 + 0: JSX_IDENT@45..48 "div" [] [] + 3: R_ANGLE@48..49 ">" [] [] + 1: SEMICOLON@49..57 ";" [] [Whitespace(" "), Comments("// JSX")] + 1: JS_VARIABLE_STATEMENT@57..284 + 0: JS_VARIABLE_DECLARATION@57..284 + 0: (empty) + 1: LET_KW@57..66 "let" [Newline("\n"), Whitespace(" ")] [Whitespace(" ")] + 2: JS_VARIABLE_DECLARATOR_LIST@66..284 + 0: JS_VARIABLE_DECLARATOR@66..284 + 0: JS_IDENTIFIER_BINDING@66..68 + 0: IDENT@66..68 "b" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@68..284 + 0: EQ@68..70 "=" [] [Whitespace(" ")] + 1: JSX_TAG_EXPRESSION@70..284 + 0: JSX_ELEMENT@70..284 + 0: JSX_OPENING_ELEMENT@70..78 + 0: L_ANGLE@70..71 "<" [] [] + 1: JSX_NAME@71..77 + 0: JSX_IDENT@71..77 "string" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@77..77 + 4: R_ANGLE@77..78 ">" [] [] + 1: JSX_CHILD_LIST@78..284 + 0: JSX_TEXT@78..111 + 0: JSX_TEXT_LITERAL@78..111 "b; // type assertion\n let c = " [] [] + 1: JSX_ELEMENT@111..284 + 0: JSX_OPENING_ELEMENT@111..119 + 0: L_ANGLE@111..112 "<" [] [] + 1: JSX_NAME@112..118 + 0: JSX_IDENT@112..118 "string" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@118..118 + 4: R_ANGLE@118..119 ">" [] [] + 1: JSX_CHILD_LIST@119..284 + 0: JSX_TEXT@119..120 + 0: JSX_TEXT_LITERAL@119..120 "b" [] [] + 1: JSX_ELEMENT@120..284 + 0: JSX_OPENING_ELEMENT@120..123 + 0: L_ANGLE@120..121 "<" [] [] + 1: JSX_NAME@121..122 + 0: JSX_IDENT@121..122 "a" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@122..122 + 4: R_ANGLE@122..123 ">" [] [] + 1: JSX_CHILD_LIST@123..284 + 0: JSX_TEXT@123..156 + 0: JSX_TEXT_LITERAL@123..156 "d; // type assertion\n let d = " [] [] + 1: JSX_ELEMENT@156..168 + 0: JSX_OPENING_ELEMENT@156..161 + 0: L_ANGLE@156..157 "<" [] [] + 1: JSX_NAME@157..160 + 0: JSX_IDENT@157..160 "div" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@160..160 + 4: R_ANGLE@160..161 ">" [] [] + 1: JSX_CHILD_LIST@161..162 + 0: JSX_TEXT@161..162 + 0: JSX_TEXT_LITERAL@161..162 "a" [] [] + 2: JSX_CLOSING_ELEMENT@162..168 + 0: L_ANGLE@162..163 "<" [] [] + 1: SLASH@163..164 "/" [] [] + 2: JSX_NAME@164..167 + 0: JSX_IDENT@164..167 "div" [] [] + 3: R_ANGLE@167..168 ">" [] [] + 2: JSX_TEXT@168..261 + 0: JSX_TEXT_LITERAL@168..261 "/; // ambiguous: JSX or \"type assertion a less than regex /div>/\". Probably JSX.\n let d = " [] [] + 3: JSX_ELEMENT@261..279 + 0: JSX_OPENING_ELEMENT@261..269 + 0: L_ANGLE@261..262 "<" [] [] + 1: JSX_NAME@262..268 + 0: JSX_IDENT@262..268 "string" [] [] + 2: (empty) + 3: JSX_ATTRIBUTE_LIST@268..268 + 4: R_ANGLE@268..269 ">" [] [] + 1: JSX_CHILD_LIST@269..270 + 0: JSX_TEXT@269..270 + 0: JSX_TEXT_LITERAL@269..270 "a" [] [] + 2: JSX_CLOSING_ELEMENT@270..279 + 0: L_ANGLE@270..271 "<" [] [] + 1: SLASH@271..272 "/" [] [] + 2: JSX_NAME@272..278 + 0: JSX_IDENT@272..278 "string" [] [] + 3: R_ANGLE@278..279 ">" [] [] + 4: JSX_TEXT@279..284 + 0: JSX_TEXT_LITERAL@279..284 "/;\n}\n" [] [] + 2: JSX_CLOSING_ELEMENT@284..284 + 0: (empty) + 1: (empty) + 2: (empty) + 3: (empty) + 2: JSX_CLOSING_ELEMENT@284..284 + 0: (empty) + 1: (empty) + 2: (empty) + 3: (empty) + 2: JSX_CLOSING_ELEMENT@284..284 + 0: (empty) + 1: (empty) + 2: (empty) + 3: (empty) + 1: (empty) + 3: (empty) + 4: EOF@284..284 "" [] [] + +``` + +## Diagnostics + +``` +jsx_or_type_assertion.js:6:87 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unexpected token. Did you mean `{'>'}` or `>`? + + 4 │ let b = b; // type assertion + 5 │ let c = b
d; // type assertion + > 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + │ ^ + 7 │ let d = a/; + 8 │ } + +jsx_or_type_assertion.js:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Unexpected token. Did you mean `{'}'}` or `}`? + + 6 │ let d =
a
/; // ambiguous: JSX or "type assertion a less than regex /div>/". Probably JSX. + 7 │ let d = a/; + > 8 │ } + │ ^ + 9 │ + +jsx_or_type_assertion.js:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `<` but instead the file ends + + 7 │ let d = a/; + 8 │ } + > 9 │ + │ + + i the file ends here + + 7 │ let d = a/; + 8 │ } + > 9 │ + │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx.snap index 4ce0d3297a2d..a0655b8d4a45 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_self_closing_element_missing_r_angle.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_self_closing_element_missing_r_angle.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +<>; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -47,7 +62,11 @@ JsModule { ], eof_token: EOF@40..41 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..41 0: (empty) 1: (empty) @@ -84,7 +103,12 @@ JsModule { 2: R_ANGLE@38..39 ">" [] [] 1: SEMICOLON@39..40 ";" [] [] 4: EOF@40..41 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_self_closing_element_missing_r_angle.jsx:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `>` but instead found `some` @@ -95,5 +119,4 @@ jsx_self_closing_element_missing_r_angle.jsx:1:11 parse ━━━━━━━━ i Remove some --- -<>; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_spread_attribute_error.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_attribute_error.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_spread_attribute_error.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_attribute_error.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_attribute_error.jsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_attribute_error.jsx.snap index b6ec7ebe7251..289ce0090b20 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_spread_attribute_error.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_attribute_error.jsx.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let obj = {}; +
; +; +; +
; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -154,7 +177,11 @@ JsModule { ], eof_token: EOF@169..170 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..170 0: (empty) 1: (empty) @@ -262,7 +289,12 @@ JsModule { 5: R_ANGLE@167..168 ">" [] [] 1: SEMICOLON@168..169 ";" [] [] 4: EOF@169..170 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_spread_attribute_error.jsx:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Comma operator isn't a valid value for a JSX spread argument. @@ -273,7 +305,6 @@ jsx_spread_attribute_error.jsx:2:8 parse ━━━━━━━━━━━━━ 3 │ ; 4 │ ; --- jsx_spread_attribute_error.jsx:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `{` but instead found `...` @@ -287,7 +318,6 @@ jsx_spread_attribute_error.jsx:3:4 parse ━━━━━━━━━━━━━ i Remove ... --- jsx_spread_attribute_error.jsx:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `...` but instead found `obj` @@ -301,7 +331,6 @@ jsx_spread_attribute_error.jsx:4:5 parse ━━━━━━━━━━━━━ i Remove obj --- jsx_spread_attribute_error.jsx:8:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead found `invalidProp` @@ -315,13 +344,4 @@ jsx_spread_attribute_error.jsx:8:7 parse ━━━━━━━━━━━━━ i Remove invalidProp --- -let obj = {}; -; -; -; -
; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_spread_no_expression.jsx b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_no_expression.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/jsx_spread_no_expression.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_no_expression.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/jsx_spread_no_expression.rast b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_no_expression.jsx.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/jsx_spread_no_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_no_expression.jsx.snap index 3f3338c63a05..00558184b0a0 100644 --- a/crates/biome_js_parser/test_data/inline/err/jsx_spread_no_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/jsx_spread_no_expression.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{...} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -38,7 +53,11 @@ JsModule { ], eof_token: EOF@18..19 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..19 0: (empty) 1: (empty) @@ -68,7 +87,12 @@ JsModule { 3: R_ANGLE@17..18 ">" [] [] 1: (empty) 4: EOF@18..19 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` jsx_spread_no_expression.jsx:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '}'. @@ -83,5 +107,4 @@ jsx_spread_no_expression.jsx:1:11 parse ━━━━━━━━━━━━━ │ ^ 2 │ --- -{...} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js diff --git a/crates/biome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.rast b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.rast rename to crates/biome_js_parser/tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js.snap index c716a93b2ebe..7b723b5ee82f 100644 --- a/crates/biome_js_parser/test_data/inline/err/labelled_function_decl_in_single_statement_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_decl_in_single_statement_context.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) label1: label2: function a() {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -46,7 +61,11 @@ JsModule { ], eof_token: EOF@41..42 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..42 0: (empty) 1: (empty) @@ -81,7 +100,12 @@ JsModule { 3: R_CURLY@40..41 "}" [] [] 5: (empty) 4: EOF@41..42 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` labelled_function_decl_in_single_statement_context.js:1:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × In strict mode code, functions can only be declared at top level or inside a block @@ -92,5 +116,4 @@ labelled_function_decl_in_single_statement_context.js:1:27 parse ━━━━━ i wrap the function in a block statement --- -if (true) label1: label2: function a() {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.js b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_declaration_strict_mode.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.js rename to crates/biome_js_parser/tests/js_test_suite/error/labelled_function_declaration_strict_mode.js diff --git a/crates/biome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.rast b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_declaration_strict_mode.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.rast rename to crates/biome_js_parser/tests/js_test_suite/error/labelled_function_declaration_strict_mode.js.snap index 4c7277f8cac8..fe8b08bcef4e 100644 --- a/crates/biome_js_parser/test_data/inline/err/labelled_function_declaration_strict_mode.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/labelled_function_declaration_strict_mode.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +label1: function a() {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -31,7 +46,11 @@ JsModule { ], eof_token: EOF@23..24 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..24 0: (empty) 1: (empty) @@ -55,7 +74,12 @@ JsModule { 2: JS_STATEMENT_LIST@22..22 3: R_CURLY@22..23 "}" [] [] 4: EOF@23..24 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` labelled_function_declaration_strict_mode.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × In strict mode code, functions can only be declared at top level or inside a block @@ -66,5 +90,4 @@ labelled_function_declaration_strict_mode.js:1:9 parse ━━━━━━━━ i wrap the function in a block statement --- -label1: function a() {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/let_array_with_new_line.js b/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/let_array_with_new_line.js rename to crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs.snap new file mode 100644 index 000000000000..5823820fac73 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.cjs.snap @@ -0,0 +1,118 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +L: let +[a] = 0; + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsLabeledStatement { + label: JsLabel { + value_token: IDENT@0..11 "L" [Comments("// SCRIPT"), Newline("\n")] [], + }, + colon_token: COLON@11..13 ":" [] [Whitespace(" ")], + body: JsBogusStatement { + items: [ + JsVariableDeclaration { + await_token: missing (optional), + kind: LET_KW@13..16 "let" [] [], + declarators: JsVariableDeclaratorList [ + JsVariableDeclarator { + id: JsArrayBindingPattern { + l_brack_token: L_BRACK@16..18 "[" [Newline("\n")] [], + elements: JsArrayBindingPatternElementList [ + JsArrayBindingPatternElement { + pattern: JsIdentifierBinding { + name_token: IDENT@18..19 "a" [] [], + }, + init: missing (optional), + }, + ], + r_brack_token: R_BRACK@19..21 "]" [] [Whitespace(" ")], + }, + variable_annotation: missing (optional), + initializer: JsInitializerClause { + eq_token: EQ@21..23 "=" [] [Whitespace(" ")], + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@23..24 "0" [] [], + }, + }, + }, + ], + }, + SEMICOLON@24..25 ";" [] [], + ], + }, + }, + ], + eof_token: EOF@25..26 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..26 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..25 + 0: JS_LABELED_STATEMENT@0..25 + 0: JS_LABEL@0..11 + 0: IDENT@0..11 "L" [Comments("// SCRIPT"), Newline("\n")] [] + 1: COLON@11..13 ":" [] [Whitespace(" ")] + 2: JS_BOGUS_STATEMENT@13..25 + 0: JS_VARIABLE_DECLARATION@13..24 + 0: (empty) + 1: LET_KW@13..16 "let" [] [] + 2: JS_VARIABLE_DECLARATOR_LIST@16..24 + 0: JS_VARIABLE_DECLARATOR@16..24 + 0: JS_ARRAY_BINDING_PATTERN@16..21 + 0: L_BRACK@16..18 "[" [Newline("\n")] [] + 1: JS_ARRAY_BINDING_PATTERN_ELEMENT_LIST@18..19 + 0: JS_ARRAY_BINDING_PATTERN_ELEMENT@18..19 + 0: JS_IDENTIFIER_BINDING@18..19 + 0: IDENT@18..19 "a" [] [] + 1: (empty) + 2: R_BRACK@19..21 "]" [] [Whitespace(" ")] + 1: (empty) + 2: JS_INITIALIZER_CLAUSE@21..24 + 0: EQ@21..23 "=" [] [Whitespace(" ")] + 1: JS_NUMBER_LITERAL_EXPRESSION@23..24 + 0: JS_NUMBER_LITERAL@23..24 "0" [] [] + 1: SEMICOLON@24..25 ";" [] [] + 4: EOF@25..26 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +let_array_with_new_line.cjs:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Lexical declaration cannot appear in a single-statement context + + 1 │ // SCRIPT + > 2 │ L: let + │ ^^^ + > 3 │ [a] = 0; + │ ^^^^^^^^ + 4 │ + + i Wrap this declaration in a block statement + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/let_array_with_new_line.rast b/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/let_array_with_new_line.rast rename to crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.js.snap index 3cb011f3b785..8f9945647c60 100644 --- a/crates/biome_js_parser/test_data/inline/err/let_array_with_new_line.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/let_array_with_new_line.js.snap @@ -1,8 +1,25 @@ -JsScript { +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +L: let +[a] = 0; + +``` + + +## AST + +``` +JsModule { bom_token: missing (optional), interpreter_token: missing (optional), directives: JsDirectiveList [], - statements: JsStatementList [ + items: JsModuleItemList [ JsLabeledStatement { label: JsLabel { value_token: IDENT@0..11 "L" [Comments("// SCRIPT"), Newline("\n")] [], @@ -44,12 +61,16 @@ JsScript { ], eof_token: EOF@25..26 "" [Newline("\n")] [], } +``` -0: JS_SCRIPT@0..26 +## CST + +``` +0: JS_MODULE@0..26 0: (empty) 1: (empty) 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..25 + 3: JS_MODULE_ITEM_LIST@0..25 0: JS_LABELED_STATEMENT@0..25 0: JS_LABEL@0..11 0: IDENT@0..11 "L" [Comments("// SCRIPT"), Newline("\n")] [] @@ -75,7 +96,12 @@ JsScript { 0: JS_NUMBER_LITERAL@23..24 "0" [] [] 1: SEMICOLON@24..25 ";" [] [] 4: EOF@25..26 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` let_array_with_new_line.js:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Lexical declaration cannot appear in a single-statement context @@ -89,7 +115,4 @@ let_array_with_new_line.js:2:4 parse ━━━━━━━━━━━━━━ i Wrap this declaration in a block statement --- -// SCRIPT -L: let -[a] = 0; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/let_newline_in_async_function.js b/crates/biome_js_parser/tests/js_test_suite/error/let_newline_in_async_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/let_newline_in_async_function.js rename to crates/biome_js_parser/tests/js_test_suite/error/let_newline_in_async_function.js diff --git a/crates/biome_js_parser/test_data/inline/err/let_newline_in_async_function.rast b/crates/biome_js_parser/tests/js_test_suite/error/let_newline_in_async_function.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/let_newline_in_async_function.rast rename to crates/biome_js_parser/tests/js_test_suite/error/let_newline_in_async_function.js.snap index 159ebd0520ba..090ac53175b1 100644 --- a/crates/biome_js_parser/test_data/inline/err/let_newline_in_async_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/let_newline_in_async_function.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +async function f() { + let + await 0; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -52,7 +70,11 @@ JsModule { ], eof_token: EOF@39..40 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..40 0: (empty) 1: (empty) @@ -91,7 +113,12 @@ JsModule { 1: SEMICOLON@36..37 ";" [] [] 3: R_CURLY@37..39 "}" [Newline("\n")] [] 4: EOF@39..40 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` let_newline_in_async_function.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context @@ -103,7 +130,6 @@ let_newline_in_async_function.js:3:3 parse ━━━━━━━━━━━━ 4 │ } 5 │ --- let_newline_in_async_function.js:3:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -134,8 +160,4 @@ let_newline_in_async_function.js:3:9 parse ━━━━━━━━━━━━ 4 │ } 5 │ --- -async function f() { - let - await 0; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js diff --git a/crates/biome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast b/crates/biome_js_parser/tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast rename to crates/biome_js_parser/tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js.snap index a7d66975b58b..af0158597856 100644 --- a/crates/biome_js_parser/test_data/inline/err/lexical_declaration_in_single_statement_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/lexical_declaration_in_single_statement_context.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) let a; +while (true) const b = 5; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -64,7 +80,11 @@ JsModule { ], eof_token: EOF@42..43 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..43 0: (empty) 1: (empty) @@ -109,7 +129,12 @@ JsModule { 0: JS_NUMBER_LITERAL@40..41 "5" [] [] 1: SEMICOLON@41..42 ";" [] [] 4: EOF@42..43 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` lexical_declaration_in_single_statement_context.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Lexical declaration cannot appear in a single-statement context @@ -121,7 +146,6 @@ lexical_declaration_in_single_statement_context.js:1:11 parse ━━━━━━ i Wrap this declaration in a block statement --- lexical_declaration_in_single_statement_context.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Lexical declaration cannot appear in a single-statement context @@ -133,6 +157,4 @@ lexical_declaration_in_single_statement_context.js:2:14 parse ━━━━━━ i Wrap this declaration in a block statement --- -if (true) let a; -while (true) const b = 5; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/literals.js b/crates/biome_js_parser/tests/js_test_suite/error/literals.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/literals.js rename to crates/biome_js_parser/tests/js_test_suite/error/literals.js diff --git a/crates/biome_js_parser/test_data/inline/err/literals.rast b/crates/biome_js_parser/tests/js_test_suite/error/literals.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/literals.rast rename to crates/biome_js_parser/tests/js_test_suite/error/literals.js.snap index 5663c0aecb8a..3bd80b9564ac 100644 --- a/crates/biome_js_parser/test_data/inline/err/literals.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/literals.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +00, 012, 08, 091, 0789 // parser errors +01n, 0_0, 01.2 // lexer errors +"test +continues" // unterminated string literal + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -61,7 +79,11 @@ JsModule { ], eof_token: EOF@118..119 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..119 0: (empty) 1: (empty) @@ -104,7 +126,12 @@ JsModule { 1: IDENT@76..86 "continues" [Newline("\n")] [] 2: ERROR_TOKEN@86..118 "\" // unterminated string literal" [] [] 4: EOF@118..119 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` literals.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × "0"-prefixed octal literals are deprecated; use the "0o" prefix instead. @@ -114,7 +141,6 @@ literals.js:1:1 parse ━━━━━━━━━━━━━━━━━━━ 2 │ 01n, 0_0, 01.2 // lexer errors 3 │ "test --- literals.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × "0"-prefixed octal literals are deprecated; use the "0o" prefix instead. @@ -124,7 +150,6 @@ literals.js:1:5 parse ━━━━━━━━━━━━━━━━━━━ 2 │ 01n, 0_0, 01.2 // lexer errors 3 │ "test --- literals.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decimals with leading zeros are not allowed in strict mode. @@ -134,7 +159,6 @@ literals.js:1:10 parse ━━━━━━━━━━━━━━━━━━━ 2 │ 01n, 0_0, 01.2 // lexer errors 3 │ "test --- literals.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decimals with leading zeros are not allowed in strict mode. @@ -144,7 +168,6 @@ literals.js:1:14 parse ━━━━━━━━━━━━━━━━━━━ 2 │ 01n, 0_0, 01.2 // lexer errors 3 │ "test --- literals.js:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decimals with leading zeros are not allowed in strict mode. @@ -154,7 +177,6 @@ literals.js:1:19 parse ━━━━━━━━━━━━━━━━━━━ 2 │ 01n, 0_0, 01.2 // lexer errors 3 │ "test --- literals.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Octal literals are not allowed for BigInts. @@ -165,7 +187,6 @@ literals.js:2:1 parse ━━━━━━━━━━━━━━━━━━━ 3 │ "test 4 │ continues" // unterminated string literal --- literals.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × numeric separator can not be used after leading 0 @@ -176,7 +197,6 @@ literals.js:2:7 parse ━━━━━━━━━━━━━━━━━━━ 3 │ "test 4 │ continues" // unterminated string literal --- literals.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unexpected number @@ -187,7 +207,6 @@ literals.js:2:11 parse ━━━━━━━━━━━━━━━━━━━ 3 │ "test 4 │ continues" // unterminated string literal --- literals.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unterminated string literal @@ -210,7 +229,6 @@ literals.js:3:1 parse ━━━━━━━━━━━━━━━━━━━ i The closing quote must be on the same line. --- literals.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unterminated string literal @@ -231,8 +249,4 @@ literals.js:4:10 parse ━━━━━━━━━━━━━━━━━━━ i The closing quote must be on the same line. --- -00, 012, 08, 091, 0789 // parser errors -01n, 0_0, 01.2 // lexer errors -"test -continues" // unterminated string literal +``` diff --git a/crates/biome_js_parser/test_data/inline/err/logical_expressions_err.js b/crates/biome_js_parser/tests/js_test_suite/error/logical_expressions_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/logical_expressions_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/logical_expressions_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/logical_expressions_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/logical_expressions_err.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/logical_expressions_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/logical_expressions_err.js.snap index 6866a2b1f863..206b842a41cd 100644 --- a/crates/biome_js_parser/test_data/inline/err/logical_expressions_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/logical_expressions_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo ?? * 2; +!foo && bar; +foo(foo ||) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -70,7 +87,11 @@ JsModule { ], eof_token: EOF@36..37 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..37 0: (empty) 1: (empty) @@ -119,7 +140,12 @@ JsModule { 2: R_PAREN@35..36 ")" [] [] 1: (empty) 4: EOF@36..37 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` logical_expressions_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `*` operator. @@ -131,7 +157,6 @@ logical_expressions_err.js:1:8 parse ━━━━━━━━━━━━━━ i This operator requires a left hand side value --- logical_expressions_err.js:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ')'. @@ -150,7 +175,4 @@ logical_expressions_err.js:3:11 parse ━━━━━━━━━━━━━━ │ ^ 4 │ --- -foo ?? * 2; -!foo && bar; -foo(foo ||) +``` diff --git a/crates/biome_js_parser/test_data/inline/err/method_getter_err.js b/crates/biome_js_parser/tests/js_test_suite/error/method_getter_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/method_getter_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/method_getter_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/method_getter_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/method_getter_err.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/method_getter_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/method_getter_err.js.snap index d9ed1d3eb5fe..f07b7ae1df41 100644 --- a/crates/biome_js_parser/test_data/inline/err/method_getter_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/method_getter_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo { + get {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -40,7 +57,11 @@ JsModule { ], eof_token: EOF@21..22 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..22 0: (empty) 1: (empty) @@ -70,7 +91,12 @@ JsModule { 1: JS_BOGUS_STATEMENT@19..21 0: R_CURLY@19..21 "}" [Newline("\n")] [] 4: EOF@21..22 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` method_getter_err.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none @@ -81,7 +107,6 @@ method_getter_err.js:2:2 parse ━━━━━━━━━━━━━━━━ 3 │ } 4 │ --- method_getter_err.js:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '{'. @@ -100,7 +125,6 @@ method_getter_err.js:2:6 parse ━━━━━━━━━━━━━━━━ 3 │ } 4 │ --- method_getter_err.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '}'. @@ -119,7 +143,4 @@ method_getter_err.js:3:1 parse ━━━━━━━━━━━━━━━━ │ ^ 4 │ --- -class foo { - get {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/module_closing_curly.ts b/crates/biome_js_parser/tests/js_test_suite/error/module_closing_curly.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/module_closing_curly.ts rename to crates/biome_js_parser/tests/js_test_suite/error/module_closing_curly.ts diff --git a/crates/biome_js_parser/test_data/inline/err/module_closing_curly.rast b/crates/biome_js_parser/tests/js_test_suite/error/module_closing_curly.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/module_closing_curly.rast rename to crates/biome_js_parser/tests/js_test_suite/error/module_closing_curly.ts.snap index cab6f4cd6847..f7005fa8f437 100644 --- a/crates/biome_js_parser/test_data/inline/err/module_closing_curly.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/module_closing_curly.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module A { + "name": "troublesome-lib", + "typings": "lib/index.d.ts", + "version": "0.0.1" +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -41,7 +60,11 @@ JsModule { ], eof_token: EOF@98..99 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..99 0: (empty) 1: (empty) @@ -73,7 +96,12 @@ JsModule { 9: JS_STRING_LITERAL@89..96 "\"0.0.1\"" [] [] 2: R_CURLY@96..98 "}" [Newline("\n")] [] 4: EOF@98..99 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` module_closing_curly.ts:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -100,9 +128,4 @@ module_closing_curly.ts:2:8 parse ━━━━━━━━━━━━━━━ 3 │ "typings": "lib/index.d.ts", 4 │ "version": "0.0.1" --- -declare module A { - "name": "troublesome-lib", - "typings": "lib/index.d.ts", - "version": "0.0.1" -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/multiple_default_exports_err.js b/crates/biome_js_parser/tests/js_test_suite/error/multiple_default_exports_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/multiple_default_exports_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/multiple_default_exports_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/multiple_default_exports_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/multiple_default_exports_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/multiple_default_exports_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/multiple_default_exports_err.js.snap index ab667da66cb2..175fe5e5afc9 100644 --- a/crates/biome_js_parser/test_data/inline/err/multiple_default_exports_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/multiple_default_exports_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default (class {}) +export default a + b; +export default (function a() {}) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -90,7 +107,11 @@ JsModule { ], eof_token: EOF@80..81 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..81 0: (empty) 1: (empty) @@ -155,7 +176,12 @@ JsModule { 3: R_CURLY@78..79 "}" [] [] 2: R_PAREN@79..80 ")" [] [] 4: EOF@80..81 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` multiple_default_exports_err.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal duplicate default export declarations @@ -181,7 +207,6 @@ multiple_default_exports_err.js:2:8 parse ━━━━━━━━━━━━ 2 │ export default a + b; 3 │ export default (function a() {}) --- multiple_default_exports_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal duplicate default export declarations @@ -207,7 +232,4 @@ multiple_default_exports_err.js:3:8 parse ━━━━━━━━━━━━ 2 │ export default a + b; 3 │ export default (function a() {}) --- -export default (class {}) -export default a + b; -export default (function a() {}) +``` diff --git a/crates/biome_js_parser/test_data/inline/err/new_exprs.js b/crates/biome_js_parser/tests/js_test_suite/error/new_exprs.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/new_exprs.js rename to crates/biome_js_parser/tests/js_test_suite/error/new_exprs.js diff --git a/crates/biome_js_parser/test_data/inline/err/new_exprs.rast b/crates/biome_js_parser/tests/js_test_suite/error/new_exprs.js.snap similarity index 89% rename from crates/biome_js_parser/test_data/inline/err/new_exprs.rast rename to crates/biome_js_parser/tests/js_test_suite/error/new_exprs.js.snap index 05e41bff537c..694ffe24b438 100644 --- a/crates/biome_js_parser/test_data/inline/err/new_exprs.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/new_exprs.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +new; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -15,7 +30,11 @@ JsModule { ], eof_token: EOF@4..5 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..5 0: (empty) 1: (empty) @@ -29,7 +48,12 @@ JsModule { 3: (empty) 1: SEMICOLON@3..4 ";" [] [] 4: EOF@4..5 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` new_exprs.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ';'. @@ -44,5 +68,4 @@ new_exprs.js:1:4 parse ━━━━━━━━━━━━━━━━━━━ │ ^ 2 │ --- -new; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.js b/crates/biome_js_parser/tests/js_test_suite/error/no_top_level_await_in_scripts.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.js rename to crates/biome_js_parser/tests/js_test_suite/error/no_top_level_await_in_scripts.cjs diff --git a/crates/biome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.rast b/crates/biome_js_parser/tests/js_test_suite/error/no_top_level_await_in_scripts.cjs.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.rast rename to crates/biome_js_parser/tests/js_test_suite/error/no_top_level_await_in_scripts.cjs.snap index 631b03eafa5a..5805ff7174b4 100644 --- a/crates/biome_js_parser/test_data/inline/err/no_top_level_await_in_scripts.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/no_top_level_await_in_scripts.cjs.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +async function test() {} +await test(); + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -49,7 +66,11 @@ JsScript { ], eof_token: EOF@48..49 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_SCRIPT@0..49 0: (empty) 1: (empty) @@ -87,8 +108,13 @@ JsScript { 2: R_PAREN@46..47 ")" [] [] 1: SEMICOLON@47..48 ";" [] [] 4: EOF@48..49 "" [Newline("\n")] [] --- -no_top_level_await_in_scripts.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +``` + +## Diagnostics + +``` +no_top_level_await_in_scripts.cjs:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `await` is only allowed within async functions and at the top levels of modules. @@ -98,7 +124,4 @@ no_top_level_await_in_scripts.js:3:1 parse ━━━━━━━━━━━━ │ ^^^^^ 4 │ --- -// SCRIPT -async function test() {} -await test(); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_binding_pattern.js b/crates/biome_js_parser/tests/js_test_suite/error/object_binding_pattern.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_binding_pattern.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_binding_pattern.js diff --git a/crates/biome_js_parser/test_data/inline/err/object_binding_pattern.rast b/crates/biome_js_parser/tests/js_test_suite/error/object_binding_pattern.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/object_binding_pattern.rast rename to crates/biome_js_parser/tests/js_test_suite/error/object_binding_pattern.js.snap index bcbe6a5b65de..bbd2d2237b6c 100644 --- a/crates/biome_js_parser/test_data/inline/err/object_binding_pattern.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_binding_pattern.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { 5 } } = { eval: "foo" }; +let { eval } = { eval: "foo" }; +let { 5, 6 } = { eval: "foo" }; +let { default , eval: } = {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -200,7 +218,11 @@ JsModule { ], eof_token: EOF@124..125 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..125 0: (empty) 1: (empty) @@ -339,7 +361,12 @@ JsModule { 2: R_CURLY@122..123 "}" [] [] 1: SEMICOLON@123..124 ";" [] [] 4: EOF@124..125 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` object_binding_pattern.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `}` @@ -351,7 +378,6 @@ object_binding_pattern.js:1:9 parse ━━━━━━━━━━━━━━ i Remove } --- object_binding_pattern.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Object and Array patterns require initializers. @@ -363,7 +389,6 @@ object_binding_pattern.js:1:5 parse ━━━━━━━━━━━━━━ i This pattern is declared, but it is not given an initialized value. --- object_binding_pattern.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '} ='. @@ -380,7 +405,6 @@ object_binding_pattern.js:1:11 parse ━━━━━━━━━━━━━━ 2 │ let { eval } = { eval: "foo" }; 3 │ let { 5, 6 } = { eval: "foo" }; --- object_binding_pattern.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `eval` as an identifier in strict mode @@ -391,7 +415,6 @@ object_binding_pattern.js:2:7 parse ━━━━━━━━━━━━━━ 3 │ let { 5, 6 } = { eval: "foo" }; 4 │ let { default , eval: } = {}; --- object_binding_pattern.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `,` @@ -405,7 +428,6 @@ object_binding_pattern.js:3:8 parse ━━━━━━━━━━━━━━ i Remove , --- object_binding_pattern.js:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `}` @@ -419,7 +441,6 @@ object_binding_pattern.js:3:12 parse ━━━━━━━━━━━━━━ i Remove } --- object_binding_pattern.js:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `,` @@ -432,7 +453,6 @@ object_binding_pattern.js:4:15 parse ━━━━━━━━━━━━━━ i Remove , --- object_binding_pattern.js:4:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern but instead found '}'. @@ -451,8 +471,4 @@ object_binding_pattern.js:4:23 parse ━━━━━━━━━━━━━━ │ ^ 5 │ --- -let { 5 } } = { eval: "foo" }; -let { eval } = { eval: "foo" }; -let { 5, 6 } = { eval: "foo" }; -let { default , eval: } = {}; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_err.js b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_expr_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/object_expr_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_err.js.snap index efcfe4a8163c..e3b7c1593937 100644 --- a/crates/biome_js_parser/test_data/inline/err/object_expr_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = {, foo} +let b = { foo bar } +let b = { foo + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -101,7 +118,11 @@ JsModule { ], eof_token: EOF@49..50 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..50 0: (empty) 1: (empty) @@ -171,7 +192,12 @@ JsModule { 2: (empty) 1: (empty) 4: EOF@49..50 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` object_expr_err.js:2:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `bar` @@ -184,7 +210,6 @@ object_expr_err.js:2:15 parse ━━━━━━━━━━━━━━━━ i Remove bar --- object_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead the file ends @@ -201,7 +226,4 @@ object_expr_err.js:4:1 parse ━━━━━━━━━━━━━━━━━ > 4 │ │ --- -let a = {, foo} -let b = { foo bar } -let b = { foo +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_error_prop_name.js b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_error_prop_name.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_expr_error_prop_name.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_error_prop_name.js diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_error_prop_name.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_error_prop_name.js.snap index 9418d1c9f636..267ea8c66c91 100644 --- a/crates/biome_js_parser/test_data/inline/err/object_expr_error_prop_name.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_error_prop_name.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = { /: 6, /: /foo/ } +let b = {{}} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -91,7 +107,11 @@ JsModule { ], eof_token: EOF@39..40 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..40 0: (empty) 1: (empty) @@ -147,7 +167,12 @@ JsModule { 2: JS_BOGUS_STATEMENT@38..39 0: R_CURLY@38..39 "}" [] [] 4: EOF@39..40 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` object_expr_error_prop_name.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method but instead found '/'. @@ -164,7 +189,6 @@ object_expr_error_prop_name.js:1:11 parse ━━━━━━━━━━━━ 2 │ let b = {{}} 3 │ --- object_expr_error_prop_name.js:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method but instead found '/'. @@ -181,7 +205,6 @@ object_expr_error_prop_name.js:1:17 parse ━━━━━━━━━━━━ 2 │ let b = {{}} 3 │ --- object_expr_error_prop_name.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{'. @@ -198,7 +221,6 @@ object_expr_error_prop_name.js:2:10 parse ━━━━━━━━━━━━ │ ^ 3 │ --- object_expr_error_prop_name.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '}'. @@ -215,6 +237,4 @@ object_expr_error_prop_name.js:2:12 parse ━━━━━━━━━━━━ │ ^ 3 │ --- -let a = { /: 6, /: /foo/ } -let b = {{}} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_method.js b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_expr_method.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_method.js diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_method.rast b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_method.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/object_expr_method.rast rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_method.js.snap index 2e5a461ee4e4..8224caada1f2 100644 --- a/crates/biome_js_parser/test_data/inline/err/object_expr_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_method.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let b = { foo) } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -41,7 +56,11 @@ JsModule { ], eof_token: EOF@16..17 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..17 0: (empty) 1: (empty) @@ -70,7 +89,12 @@ JsModule { 2: R_CURLY@15..16 "}" [] [] 1: (empty) 4: EOF@16..17 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` object_expr_method.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `)` @@ -81,5 +105,4 @@ object_expr_method.js:1:14 parse ━━━━━━━━━━━━━━━ i Remove ) --- -let b = { foo) } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.js b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_non_ident_literal_prop.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_non_ident_literal_prop.js diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_non_ident_literal_prop.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_non_ident_literal_prop.js.snap index 467cf8d56858..b4727e668730 100644 --- a/crates/biome_js_parser/test_data/inline/err/object_expr_non_ident_literal_prop.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_non_ident_literal_prop.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let d = {5} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +52,11 @@ JsModule { ], eof_token: EOF@11..12 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..12 0: (empty) 1: (empty) @@ -65,7 +84,12 @@ JsModule { 2: R_CURLY@10..11 "}" [] [] 1: (empty) 4: EOF@11..12 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` object_expr_non_ident_literal_prop.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `:` but instead found `}` @@ -76,5 +100,4 @@ object_expr_non_ident_literal_prop.js:1:11 parse ━━━━━━━━━━ i Remove } --- -let d = {5} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_setter.js b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_setter.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_expr_setter.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_setter.js diff --git a/crates/biome_js_parser/test_data/inline/err/object_expr_setter.rast b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_setter.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/object_expr_setter.rast rename to crates/biome_js_parser/tests/js_test_suite/error/object_expr_setter.js.snap index 59c622f44880..b3b04ba290a6 100644 --- a/crates/biome_js_parser/test_data/inline/err/object_expr_setter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_expr_setter.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let b = { + set foo() { + return 5; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -54,7 +73,11 @@ JsModule { ], eof_token: EOF@41..42 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..42 0: (empty) 1: (empty) @@ -95,7 +118,12 @@ JsModule { 2: R_CURLY@39..41 "}" [Newline("\n")] [] 1: (empty) 4: EOF@41..42 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` object_expr_setter.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a parameter but instead found ')'. @@ -114,9 +142,4 @@ object_expr_setter.js:2:10 parse ━━━━━━━━━━━━━━━ 3 │ return 5; 4 │ } --- -let b = { - set foo() { - return 5; - } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_property_binding_err.js b/crates/biome_js_parser/tests/js_test_suite/error/object_property_binding_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_property_binding_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_property_binding_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/object_property_binding_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/object_property_binding_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/object_property_binding_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/object_property_binding_err.js.snap index 7fa0476ead3b..6656a6162cc6 100644 --- a/crates/biome_js_parser/test_data/inline/err/object_property_binding_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_property_binding_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { foo: , bar } = {} +let { : lorem = "test" } = {} +let { , ipsum: bazz } = {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -124,7 +141,11 @@ JsModule { ], eof_token: EOF@80..81 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..81 0: (empty) 1: (empty) @@ -214,7 +235,12 @@ JsModule { 2: R_CURLY@79..80 "}" [] [] 1: (empty) 4: EOF@80..81 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` object_property_binding_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern but instead found ','. @@ -231,7 +257,6 @@ object_property_binding_err.js:1:12 parse ━━━━━━━━━━━━ 2 │ let { : lorem = "test" } = {} 3 │ let { , ipsum: bazz } = {} --- object_property_binding_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. @@ -250,7 +275,6 @@ object_property_binding_err.js:2:7 parse ━━━━━━━━━━━━━ 3 │ let { , ipsum: bazz } = {} 4 │ --- object_property_binding_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a member name, or a rest pattern but instead found ','. @@ -269,7 +293,4 @@ object_property_binding_err.js:3:7 parse ━━━━━━━━━━━━━ │ ^ 4 │ --- -let { foo: , bar } = {} -let { : lorem = "test" } = {} -let { , ipsum: bazz } = {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_shorthand_property_err.js b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_property_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_shorthand_property_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_property_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/object_shorthand_property_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_property_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/object_shorthand_property_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_property_err.js.snap index 8dd58860d9d5..21bd24c73da4 100644 --- a/crates/biome_js_parser/test_data/inline/err/object_shorthand_property_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_property_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { a b } = c +let { = "test" } = c +let { , d } = c + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -114,7 +131,11 @@ JsModule { ], eof_token: EOF@52..53 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..53 0: (empty) 1: (empty) @@ -193,7 +214,12 @@ JsModule { 0: IDENT@51..52 "c" [] [] 1: (empty) 4: EOF@52..53 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` object_shorthand_property_err.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `b` @@ -205,7 +231,6 @@ object_shorthand_property_err.js:1:9 parse ━━━━━━━━━━━━ i Remove b --- object_shorthand_property_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier but instead found '='. @@ -224,7 +249,6 @@ object_shorthand_property_err.js:2:7 parse ━━━━━━━━━━━━ 3 │ let { , d } = c 4 │ --- object_shorthand_property_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a member name, or a rest pattern but instead found ','. @@ -243,7 +267,4 @@ object_shorthand_property_err.js:3:7 parse ━━━━━━━━━━━━ │ ^ 4 │ --- -let { a b } = c -let { = "test" } = c -let { , d } = c +``` diff --git a/crates/biome_js_parser/test_data/inline/err/object_shorthand_with_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_with_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/object_shorthand_with_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_with_initializer.js diff --git a/crates/biome_js_parser/test_data/inline/err/object_shorthand_with_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_with_initializer.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/object_shorthand_with_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_with_initializer.js.snap index bc94df09cad7..ab22ca1f6bcd 100644 --- a/crates/biome_js_parser/test_data/inline/err/object_shorthand_with_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/object_shorthand_with_initializer.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({ arrow = () => {} }) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -44,7 +59,11 @@ JsModule { ], eof_token: EOF@22..23 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..23 0: (empty) 1: (empty) @@ -78,7 +97,12 @@ JsModule { 2: R_PAREN@21..22 ")" [] [] 1: (empty) 4: EOF@22..23 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` object_shorthand_with_initializer.js:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Did you mean to use a `:`? An `=` can only follow a property name when the containing object literal is part of a destructuring pattern. @@ -87,5 +111,4 @@ object_shorthand_with_initializer.js:1:10 parse ━━━━━━━━━━ │ ^ 2 │ --- -({ arrow = () => {} }) +``` diff --git a/crates/biome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.ts b/crates/biome_js_parser/tests/js_test_suite/error/optional_chain_call_without_arguments.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.ts rename to crates/biome_js_parser/tests/js_test_suite/error/optional_chain_call_without_arguments.ts diff --git a/crates/biome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast b/crates/biome_js_parser/tests/js_test_suite/error/optional_chain_call_without_arguments.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast rename to crates/biome_js_parser/tests/js_test_suite/error/optional_chain_call_without_arguments.ts.snap index b24531336c74..a4966c7ba2c1 100644 --- a/crates/biome_js_parser/test_data/inline/err/optional_chain_call_without_arguments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/optional_chain_call_without_arguments.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = { test: null }; +a.test?.; +a.test?. {} +(a, ,b) => {} +(a, b) =>; +(a: string; +(a, b) + => {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -181,7 +201,11 @@ JsModule { ], eof_token: EOF@64..65 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..65 0: (empty) 1: (empty) @@ -316,7 +340,12 @@ JsModule { 3: R_CURLY@63..64 "}" [] [] 1: (empty) 4: EOF@64..65 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` paren_or_arrow_expr_invalid_params.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -340,7 +369,6 @@ paren_or_arrow_expr_invalid_params.js:1:9 parse ━━━━━━━━━━ 2 │ (a, ,b) => {} 3 │ (a, b) =>; --- paren_or_arrow_expr_invalid_params.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a parameter but instead found ','. @@ -359,7 +387,6 @@ paren_or_arrow_expr_invalid_params.js:2:5 parse ━━━━━━━━━━ 3 │ (a, b) =>; 4 │ (a: string; --- paren_or_arrow_expr_invalid_params.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a function body, or an expression but instead found ';'. @@ -380,7 +407,6 @@ paren_or_arrow_expr_invalid_params.js:3:10 parse ━━━━━━━━━━ 4 │ (a: string; 5 │ (a, b) --- paren_or_arrow_expr_invalid_params.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -394,7 +420,6 @@ paren_or_arrow_expr_invalid_params.js:4:3 parse ━━━━━━━━━━ i TypeScript only syntax --- paren_or_arrow_expr_invalid_params.js:4:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `;` @@ -408,7 +433,6 @@ paren_or_arrow_expr_invalid_params.js:4:11 parse ━━━━━━━━━━ i Remove ; --- paren_or_arrow_expr_invalid_params.js:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Line terminator not permitted before arrow. @@ -419,10 +443,4 @@ paren_or_arrow_expr_invalid_params.js:6:2 parse ━━━━━━━━━━ │ ^^ 7 │ --- -(5 + 5) => {} -(a, ,b) => {} -(a, b) =>; -(a: string; -(a, b) - => {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.js b/crates/biome_js_parser/tests/js_test_suite/error/primary_expr_invalid_recovery.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.js rename to crates/biome_js_parser/tests/js_test_suite/error/primary_expr_invalid_recovery.js diff --git a/crates/biome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.rast b/crates/biome_js_parser/tests/js_test_suite/error/primary_expr_invalid_recovery.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.rast rename to crates/biome_js_parser/tests/js_test_suite/error/primary_expr_invalid_recovery.js.snap index 85e7a15ee417..7e0b5dfc4fc8 100644 --- a/crates/biome_js_parser/test_data/inline/err/primary_expr_invalid_recovery.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/primary_expr_invalid_recovery.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = \; foo(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -54,7 +69,11 @@ JsModule { ], eof_token: EOF@17..18 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..18 0: (empty) 1: (empty) @@ -85,7 +104,12 @@ JsModule { 2: R_PAREN@15..16 ")" [] [] 1: SEMICOLON@16..17 ";" [] [] 4: EOF@17..18 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` primary_expr_invalid_recovery.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unexpected token `\` @@ -94,5 +118,4 @@ primary_expr_invalid_recovery.js:1:9 parse ━━━━━━━━━━━━ │ ^ 2 │ --- -let a = \; foo(); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/private_name_presence_check_recursive.js b/crates/biome_js_parser/tests/js_test_suite/error/private_name_presence_check_recursive.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/private_name_presence_check_recursive.js rename to crates/biome_js_parser/tests/js_test_suite/error/private_name_presence_check_recursive.js diff --git a/crates/biome_js_parser/test_data/inline/err/private_name_presence_check_recursive.rast b/crates/biome_js_parser/tests/js_test_suite/error/private_name_presence_check_recursive.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/private_name_presence_check_recursive.rast rename to crates/biome_js_parser/tests/js_test_suite/error/private_name_presence_check_recursive.js.snap index 567dd3388565..46e88d950306 100644 --- a/crates/biome_js_parser/test_data/inline/err/private_name_presence_check_recursive.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/private_name_presence_check_recursive.js.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + #prop; + test() { + #prop in #prop in this; + 5 + #prop; + #prop + #prop + 5; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -115,7 +138,11 @@ JsModule { ], eof_token: EOF@96..97 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..97 0: (empty) 1: (empty) @@ -197,7 +224,12 @@ JsModule { 3: R_CURLY@91..94 "}" [Newline("\n"), Whitespace(" ")] [] 9: R_CURLY@94..96 "}" [Newline("\n")] [] 4: EOF@96..97 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` private_name_presence_check_recursive.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression @@ -209,7 +241,6 @@ private_name_presence_check_recursive.js:4:13 parse ━━━━━━━━━ 5 │ 5 + #prop; 6 │ #prop --- private_name_presence_check_recursive.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression @@ -221,7 +252,6 @@ private_name_presence_check_recursive.js:5:8 parse ━━━━━━━━━ 6 │ #prop 7 │ #prop + 5; --- private_name_presence_check_recursive.js:6:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression @@ -233,7 +263,6 @@ private_name_presence_check_recursive.js:6:4 parse ━━━━━━━━━ 7 │ #prop + 5; 8 │ } --- private_name_presence_check_recursive.js:7:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression @@ -245,13 +274,4 @@ private_name_presence_check_recursive.js:7:4 parse ━━━━━━━━━ 8 │ } 9 │ } --- -class A { - #prop; - test() { - #prop in #prop in this; - 5 + #prop; - #prop - #prop + 5; - } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/private_name_with_space.js b/crates/biome_js_parser/tests/js_test_suite/error/private_name_with_space.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/private_name_with_space.js rename to crates/biome_js_parser/tests/js_test_suite/error/private_name_with_space.js diff --git a/crates/biome_js_parser/test_data/inline/err/private_name_with_space.rast b/crates/biome_js_parser/tests/js_test_suite/error/private_name_with_space.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/private_name_with_space.rast rename to crates/biome_js_parser/tests/js_test_suite/error/private_name_with_space.js.snap index 10e41e407a2f..e57f8999c83b 100644 --- a/crates/biome_js_parser/test_data/inline/err/private_name_with_space.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/private_name_with_space.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + # test; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -40,7 +57,11 @@ JsModule { ], eof_token: EOF@20..21 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..21 0: (empty) 1: (empty) @@ -74,7 +95,12 @@ JsModule { 4: SEMICOLON@17..18 ";" [] [] 9: R_CURLY@18..20 "}" [Newline("\n")] [] 4: EOF@20..21 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` private_name_with_space.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Unexpected space or comment between `#` and identifier @@ -87,7 +113,6 @@ private_name_with_space.js:2:3 parse ━━━━━━━━━━━━━━ i remove the space here --- private_name_with_space.js:2:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the class property, but found none @@ -98,7 +123,4 @@ private_name_with_space.js:2:2 parse ━━━━━━━━━━━━━━ 3 │ } 4 │ --- -class A { - # test; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/property_assignment_target_err.js b/crates/biome_js_parser/tests/js_test_suite/error/property_assignment_target_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/property_assignment_target_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/property_assignment_target_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/property_assignment_target_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/property_assignment_target_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/property_assignment_target_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/property_assignment_target_err.js.snap index db6255dcc170..2204fa54ae71 100644 --- a/crates/biome_js_parser/test_data/inline/err/property_assignment_target_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/property_assignment_target_err.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({:y} = {}); +({=y} = {}); +({:="test"} = {}); +({:=} = {}); +({ a b } = {}); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -163,7 +182,11 @@ JsModule { ], eof_token: EOF@73..74 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..74 0: (empty) 1: (empty) @@ -282,7 +305,12 @@ JsModule { 2: R_PAREN@71..72 ")" [] [] 1: SEMICOLON@72..73 ";" [] [] 4: EOF@73..74 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` property_assignment_target_err.js:1:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. @@ -299,7 +327,6 @@ property_assignment_target_err.js:1:3 parse ━━━━━━━━━━━━ 2 │ ({=y} = {}); 3 │ ({:="test"} = {}); --- property_assignment_target_err.js:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier but instead found '='. @@ -318,7 +345,6 @@ property_assignment_target_err.js:2:3 parse ━━━━━━━━━━━━ 3 │ ({:="test"} = {}); 4 │ ({:=} = {}); --- property_assignment_target_err.js:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. @@ -339,7 +365,6 @@ property_assignment_target_err.js:3:3 parse ━━━━━━━━━━━━ 4 │ ({:=} = {}); 5 │ ({ a b } = {}); --- property_assignment_target_err.js:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, or an assignment target but instead found '='. @@ -360,7 +385,6 @@ property_assignment_target_err.js:3:4 parse ━━━━━━━━━━━━ 4 │ ({:=} = {}); 5 │ ({ a b } = {}); --- property_assignment_target_err.js:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, or a computed property but instead found ':'. @@ -381,7 +405,6 @@ property_assignment_target_err.js:4:3 parse ━━━━━━━━━━━━ 5 │ ({ a b } = {}); 6 │ --- property_assignment_target_err.js:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, or an assignment target but instead found '='. @@ -402,7 +425,6 @@ property_assignment_target_err.js:4:4 parse ━━━━━━━━━━━━ 5 │ ({ a b } = {}); 6 │ --- property_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found '}'. @@ -423,7 +445,6 @@ property_assignment_target_err.js:4:5 parse ━━━━━━━━━━━━ 5 │ ({ a b } = {}); 6 │ --- property_assignment_target_err.js:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `b` @@ -436,9 +457,4 @@ property_assignment_target_err.js:5:6 parse ━━━━━━━━━━━━ i Remove b --- -({:y} = {}); -({=y} = {}); -({:="test"} = {}); -({:=} = {}); -({ a b } = {}); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/regex.js b/crates/biome_js_parser/tests/js_test_suite/error/regex.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/regex.js rename to crates/biome_js_parser/tests/js_test_suite/error/regex.js diff --git a/crates/biome_js_parser/test_data/inline/err/regex.rast b/crates/biome_js_parser/tests/js_test_suite/error/regex.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/regex.rast rename to crates/biome_js_parser/tests/js_test_suite/error/regex.js.snap index 7fa4f1dd3152..b82c5d9881e6 100644 --- a/crates/biome_js_parser/test_data/inline/err/regex.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/regex.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +/[\p{Control}--[\t\n]]/vv; +/[\p{Control}--[\t\n]]/uv; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -18,7 +34,11 @@ JsModule { ], eof_token: EOF@53..54 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..54 0: (empty) 1: (empty) @@ -33,7 +53,12 @@ JsModule { 0: JS_REGEX_LITERAL@26..52 "/[\\p{Control}--[\\t\\n]]/uv" [Newline("\n")] [] 1: SEMICOLON@52..53 ";" [] [] 4: EOF@53..54 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` regex.js:1:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Duplicate flag `v`. @@ -45,7 +70,6 @@ regex.js:1:25 parse ━━━━━━━━━━━━━━━━━━━━ i This flag was already used. --- regex.js:2:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid regex flag. @@ -57,6 +81,4 @@ regex.js:2:25 parse ━━━━━━━━━━━━━━━━━━━━ i The 'u' and 'v' regular expression flags cannot be enabled at the same time. --- -/[\p{Control}--[\t\n]]/vv; -/[\p{Control}--[\t\n]]/uv; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/rest_property_assignment_target_err.js b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_assignment_target_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/rest_property_assignment_target_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/rest_property_assignment_target_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/rest_property_assignment_target_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_assignment_target_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/rest_property_assignment_target_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/rest_property_assignment_target_err.js.snap index 978734496b6f..94786ee30386 100644 --- a/crates/biome_js_parser/test_data/inline/err/rest_property_assignment_target_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_assignment_target_err.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({ ... } = a); +({ ...c = "default" } = a); +({ ...{a} } = b); +({ ...rest, other_assignment } = a); +({ ...rest, } = a); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -184,7 +203,11 @@ JsModule { ], eof_token: EOF@117..118 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..118 0: (empty) 1: (empty) @@ -294,7 +317,12 @@ JsModule { 2: R_PAREN@115..116 ")" [] [] 1: SEMICOLON@116..117 ";" [] [] 4: EOF@117..118 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` rest_property_assignment_target_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, or an assignment target but instead found '}'. @@ -311,7 +339,6 @@ rest_property_assignment_target_err.js:1:8 parse ━━━━━━━━━━ 2 │ ({ ...c = "default" } = a); 3 │ ({ ...{a} } = b); --- rest_property_assignment_target_err.js:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element cannot have a default @@ -338,7 +365,6 @@ rest_property_assignment_target_err.js:2:9 parse ━━━━━━━━━━ 3 │ ({ ...{a} } = b); 4 │ ({ ...rest, other_assignment } = a); --- rest_property_assignment_target_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × object and array assignment targets are not allowed in rest patterns @@ -350,7 +376,6 @@ rest_property_assignment_target_err.js:3:7 parse ━━━━━━━━━━ 4 │ ({ ...rest, other_assignment } = a); 5 │ ({ ...rest, } = a); --- rest_property_assignment_target_err.js:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element must be the last element @@ -364,7 +389,6 @@ rest_property_assignment_target_err.js:4:4 parse ━━━━━━━━━━ i Move the rest element to the end of the pattern, right before the closing '}' --- rest_property_assignment_target_err.js:5:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element may not have a trailing comma @@ -391,9 +415,4 @@ rest_property_assignment_target_err.js:5:11 parse ━━━━━━━━━━ │ ^^^^^^^ 6 │ --- -({ ... } = a); -({ ...c = "default" } = a); -({ ...{a} } = b); -({ ...rest, other_assignment } = a); -({ ...rest, } = a); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/rest_property_binding_err.js b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_binding_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/rest_property_binding_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/rest_property_binding_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/rest_property_binding_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_binding_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/rest_property_binding_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/rest_property_binding_err.js.snap index f723bde64079..1dc8bce33cbf 100644 --- a/crates/biome_js_parser/test_data/inline/err/rest_property_binding_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/rest_property_binding_err.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { ... } = a; +let { ...c = "default" } = a; +let { ...{a} } = b; +let { ...rest, other_assignment } = a; +let { ...rest2, } = a; +async function test() { + let { ...await } = a; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -277,7 +299,11 @@ JsModule { ], eof_token: EOF@178..179 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..179 0: (empty) 1: (empty) @@ -434,7 +460,12 @@ JsModule { 1: SEMICOLON@175..176 ";" [] [] 3: R_CURLY@176..178 "}" [Newline("\n")] [] 4: EOF@178..179 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` rest_property_binding_err.js:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier but instead found '}'. @@ -451,7 +482,6 @@ rest_property_binding_err.js:1:11 parse ━━━━━━━━━━━━━ 2 │ let { ...c = "default" } = a; 3 │ let { ...{a} } = b; --- rest_property_binding_err.js:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element cannot have a default @@ -478,7 +508,6 @@ rest_property_binding_err.js:2:12 parse ━━━━━━━━━━━━━ 3 │ let { ...{a} } = b; 4 │ let { ...rest, other_assignment } = a; --- rest_property_binding_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected identifier binding @@ -492,7 +521,6 @@ rest_property_binding_err.js:3:10 parse ━━━━━━━━━━━━━ i Object rest patterns must bind to an identifier, other patterns are not allowed. --- rest_property_binding_err.js:4:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element must be the last element @@ -506,7 +534,6 @@ rest_property_binding_err.js:4:7 parse ━━━━━━━━━━━━━ i Move the rest element to the end of the pattern, right before the closing '}' --- rest_property_binding_err.js:5:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest element may not have a trailing comma @@ -536,7 +563,6 @@ rest_property_binding_err.js:5:15 parse ━━━━━━━━━━━━━ 6 │ async function test() { 7 │ let { ...await } = a; --- rest_property_binding_err.js:7:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of `await` as an identifier in an async context @@ -548,12 +574,4 @@ rest_property_binding_err.js:7:12 parse ━━━━━━━━━━━━━ 8 │ } 9 │ --- -let { ... } = a; -let { ...c = "default" } = a; -let { ...{a} } = b; -let { ...rest, other_assignment } = a; -let { ...rest2, } = a; -async function test() { - let { ...await } = a; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/return_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/return_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/return_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/return_stmt_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/return_stmt_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/return_stmt_err.js.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/err/return_stmt_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/return_stmt_err.js.snap index 6d73b7e56b44..b71585ce3995 100644 --- a/crates/biome_js_parser/test_data/inline/err/return_stmt_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/return_stmt_err.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +return; +return foo; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -23,7 +39,11 @@ JsModule { ], eof_token: EOF@19..20 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..20 0: (empty) 1: (empty) @@ -39,7 +59,12 @@ JsModule { 0: IDENT@15..18 "foo" [] [] 2: SEMICOLON@18..19 ";" [] [] 4: EOF@19..20 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` return_stmt_err.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal return statement outside of a function @@ -49,7 +74,6 @@ return_stmt_err.js:1:1 parse ━━━━━━━━━━━━━━━━━ 2 │ return foo; 3 │ --- return_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal return statement outside of a function @@ -59,6 +83,4 @@ return_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━ │ ^^^^^^^^^^^ 3 │ --- -return; -return foo; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/semicolons_err.js b/crates/biome_js_parser/tests/js_test_suite/error/semicolons_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/semicolons_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/semicolons_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/semicolons_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/semicolons_err.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/semicolons_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/semicolons_err.js.snap index ab214d4279fc..a443d9a70c57 100644 --- a/crates/biome_js_parser/test_data/inline/err/semicolons_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/semicolons_err.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let foo = bar throw foo + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -38,7 +53,11 @@ JsModule { ], eof_token: EOF@23..24 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..24 0: (empty) 1: (empty) @@ -66,7 +85,12 @@ JsModule { 0: IDENT@20..23 "foo" [] [] 2: (empty) 4: EOF@23..24 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` semicolons_err.js:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -87,5 +111,4 @@ semicolons_err.js:1:15 parse ━━━━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^^^ 2 │ --- -let foo = bar throw foo +``` diff --git a/crates/biome_js_parser/test_data/inline/err/sequence_expr.js b/crates/biome_js_parser/tests/js_test_suite/error/sequence_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/sequence_expr.js rename to crates/biome_js_parser/tests/js_test_suite/error/sequence_expr.js diff --git a/crates/biome_js_parser/test_data/inline/err/sequence_expr.rast b/crates/biome_js_parser/tests/js_test_suite/error/sequence_expr.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/sequence_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/error/sequence_expr.js.snap index d1cc5658f1d4..9d268a2701dc 100644 --- a/crates/biome_js_parser/test_data/inline/err/sequence_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/sequence_expr.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +1, 2, , 4 + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -28,7 +43,11 @@ JsModule { ], eof_token: EOF@9..10 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..10 0: (empty) 1: (empty) @@ -50,7 +69,12 @@ JsModule { 0: JS_NUMBER_LITERAL@8..9 "4" [] [] 1: (empty) 4: EOF@9..10 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` sequence_expr.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ','. @@ -65,5 +89,4 @@ sequence_expr.js:1:7 parse ━━━━━━━━━━━━━━━━━ │ ^ 2 │ --- -1, 2, , 4 +``` diff --git a/crates/biome_js_parser/test_data/inline/err/setter_class_member.js b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/setter_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/error/setter_class_member.js diff --git a/crates/biome_js_parser/test_data/inline/err/setter_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_member.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/setter_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/error/setter_class_member.js.snap index 6491a8855476..9f2d4e24a816 100644 --- a/crates/biome_js_parser/test_data/inline/err/setter_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_member.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Setters { + set foo() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -38,7 +55,11 @@ JsModule { ], eof_token: EOF@32..33 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..33 0: (empty) 1: (empty) @@ -71,7 +92,12 @@ JsModule { 3: R_CURLY@29..30 "}" [] [] 9: R_CURLY@30..32 "}" [Newline("\n")] [] 4: EOF@32..33 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` setter_class_member.js:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a parameter but instead found ')'. @@ -90,7 +116,4 @@ setter_class_member.js:2:11 parse ━━━━━━━━━━━━━━━ 3 │ } 4 │ --- -class Setters { - set foo() {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/setter_class_no_body.js b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_no_body.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/setter_class_no_body.js rename to crates/biome_js_parser/tests/js_test_suite/error/setter_class_no_body.js diff --git a/crates/biome_js_parser/test_data/inline/err/setter_class_no_body.rast b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_no_body.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/setter_class_no_body.rast rename to crates/biome_js_parser/tests/js_test_suite/error/setter_class_no_body.js.snap index 77fe1e99520d..bd989fd00380 100644 --- a/crates/biome_js_parser/test_data/inline/err/setter_class_no_body.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/setter_class_no_body.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Setters { + set foo(a) +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -41,7 +58,11 @@ JsModule { ], eof_token: EOF@30..31 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..31 0: (empty) 1: (empty) @@ -76,7 +97,12 @@ JsModule { 7: (empty) 9: R_CURLY@28..30 "}" [Newline("\n")] [] 4: EOF@30..31 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` setter_class_no_body.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class method body but instead found '}'. @@ -95,7 +121,4 @@ setter_class_no_body.js:3:1 parse ━━━━━━━━━━━━━━━ │ ^ 4 │ --- -class Setters { - set foo(a) -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/spread.js b/crates/biome_js_parser/tests/js_test_suite/error/spread.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/spread.js rename to crates/biome_js_parser/tests/js_test_suite/error/spread.js diff --git a/crates/biome_js_parser/test_data/inline/err/spread.rast b/crates/biome_js_parser/tests/js_test_suite/error/spread.js.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/err/spread.rast rename to crates/biome_js_parser/tests/js_test_suite/error/spread.js.snap index 5d7508fbbab1..39f345c30766 100644 --- a/crates/biome_js_parser/test_data/inline/err/spread.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/spread.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +[...] + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -19,7 +34,11 @@ JsModule { ], eof_token: EOF@5..6 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..6 0: (empty) 1: (empty) @@ -35,7 +54,12 @@ JsModule { 2: R_BRACK@4..5 "]" [] [] 1: (empty) 4: EOF@5..6 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` spread.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found ']'. @@ -50,5 +74,4 @@ spread.js:1:5 parse ━━━━━━━━━━━━━━━━━━━━ │ ^ 2 │ --- -[...] +``` diff --git a/crates/biome_js_parser/test_data/inline/err/statements_closing_curly.js b/crates/biome_js_parser/tests/js_test_suite/error/statements_closing_curly.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/statements_closing_curly.js rename to crates/biome_js_parser/tests/js_test_suite/error/statements_closing_curly.js diff --git a/crates/biome_js_parser/test_data/inline/err/statements_closing_curly.rast b/crates/biome_js_parser/tests/js_test_suite/error/statements_closing_curly.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/statements_closing_curly.rast rename to crates/biome_js_parser/tests/js_test_suite/error/statements_closing_curly.js.snap index cd4c0724667a..772b3bb5d0fe 100644 --- a/crates/biome_js_parser/test_data/inline/err/statements_closing_curly.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/statements_closing_curly.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{ +"name": "troublesome-lib", +"typings": "lib/index.d.ts", +"version": "0.0.1" +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -32,7 +51,11 @@ JsModule { ], eof_token: EOF@78..79 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..79 0: (empty) 1: (empty) @@ -58,7 +81,12 @@ JsModule { 9: JS_STRING_LITERAL@69..76 "\"0.0.1\"" [] [] 2: R_CURLY@76..78 "}" [Newline("\n")] [] 4: EOF@78..79 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` statements_closing_curly.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -85,9 +113,4 @@ statements_closing_curly.js:2:7 parse ━━━━━━━━━━━━━━ 3 │ "typings": "lib/index.d.ts", 4 │ "version": "0.0.1" --- -{ -"name": "troublesome-lib", -"typings": "lib/index.d.ts", -"version": "0.0.1" -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/subscripts_err.js b/crates/biome_js_parser/tests/js_test_suite/error/subscripts_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/subscripts_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/subscripts_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/subscripts_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/subscripts_err.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/subscripts_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/subscripts_err.js.snap index ada99321d544..501a26cc7057 100644 --- a/crates/biome_js_parser/test_data/inline/err/subscripts_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/subscripts_err.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo()?.baz[].; +BAR`b + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -57,7 +73,11 @@ JsModule { ], eof_token: EOF@21..21 "" [] [], } +``` +## CST + +``` 0: JS_MODULE@0..21 0: (empty) 1: (empty) @@ -100,7 +120,12 @@ JsModule { 4: (empty) 1: (empty) 4: EOF@21..21 "" [] [] --- + +``` + +## Diagnostics + +``` subscripts_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ']'. @@ -117,7 +142,6 @@ subscripts_err.js:1:12 parse ━━━━━━━━━━━━━━━━━ 2 │ BAR`b 3 │ --- subscripts_err.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier but instead found ';'. @@ -134,7 +158,6 @@ subscripts_err.js:1:14 parse ━━━━━━━━━━━━━━━━━ 2 │ BAR`b 3 │ --- subscripts_err.js:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unterminated template literal @@ -145,6 +168,4 @@ subscripts_err.js:2:5 parse ━━━━━━━━━━━━━━━━━ > 3 │ │ --- -foo()?.baz[].; -BAR`b +``` diff --git a/crates/biome_js_parser/test_data/inline/err/super_expression_err.js b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/super_expression_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/super_expression_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/super_expression_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_err.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/super_expression_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/super_expression_err.js.snap index 69ce960f7921..028ff7954273 100644 --- a/crates/biome_js_parser/test_data/inline/err/super_expression_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_err.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Test extends B { + test() { + super(); + super?.test(); + } +} +super(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -109,7 +130,11 @@ JsModule { ], eof_token: EOF@80..81 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..81 0: (empty) 1: (empty) @@ -188,7 +213,12 @@ JsModule { 2: R_PAREN@78..79 ")" [] [] 1: SEMICOLON@79..80 ";" [] [] 4: EOF@80..81 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` super_expression_err.js:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `super` is only valid inside of a class constructor of a subclass. @@ -200,7 +230,6 @@ super_expression_err.js:3:5 parse ━━━━━━━━━━━━━━━ 4 │ super?.test(); 5 │ } --- super_expression_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Super doesn't support optional chaining as super can never be null @@ -212,7 +241,6 @@ super_expression_err.js:4:5 parse ━━━━━━━━━━━━━━━ 5 │ } 6 │ } --- super_expression_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `super` is only valid inside of a class constructor of a subclass. @@ -223,11 +251,4 @@ super_expression_err.js:7:1 parse ━━━━━━━━━━━━━━━ │ ^^^^^ 8 │ --- -class Test extends B { - test() { - super(); - super?.test(); - } -} -super(); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/super_expression_in_constructor_parameter_list.js b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/super_expression_in_constructor_parameter_list.js rename to crates/biome_js_parser/tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js diff --git a/crates/biome_js_parser/test_data/inline/err/super_expression_in_constructor_parameter_list.rast b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/super_expression_in_constructor_parameter_list.rast rename to crates/biome_js_parser/tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js.snap index 8f83c3064bf6..89c5d120376a 100644 --- a/crates/biome_js_parser/test_data/inline/err/super_expression_in_constructor_parameter_list.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/super_expression_in_constructor_parameter_list.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A extends B { constructor(super()) {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -59,7 +74,11 @@ JsModule { ], eof_token: EOF@45..46 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..46 0: (empty) 1: (empty) @@ -100,7 +119,12 @@ JsModule { 1: JS_BOGUS_STATEMENT@44..45 0: R_CURLY@44..45 "}" [] [] 4: EOF@45..46 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` super_expression_in_constructor_parameter_list.js:1:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a parameter but instead found 'super('. @@ -115,7 +139,6 @@ super_expression_in_constructor_parameter_list.js:1:33 parse ━━━━━━ │ ^^^^^^ 2 │ --- super_expression_in_constructor_parameter_list.js:1:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class method body but instead found ')'. @@ -130,7 +153,6 @@ super_expression_in_constructor_parameter_list.js:1:40 parse ━━━━━━ │ ^ 2 │ --- super_expression_in_constructor_parameter_list.js:1:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '}'. @@ -145,5 +167,4 @@ super_expression_in_constructor_parameter_list.js:1:45 parse ━━━━━━ │ ^ 2 │ --- -class A extends B { constructor(super()) {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/switch_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/switch_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/switch_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/switch_stmt_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/switch_stmt_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/switch_stmt_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/switch_stmt_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/switch_stmt_err.js.snap index 8b784cbf6682..f7ccbfa5d9d0 100644 --- a/crates/biome_js_parser/test_data/inline/err/switch_stmt_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/switch_stmt_err.js.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +switch foo {} +switch {} +switch { var i = 0 } +switch { var i = 0; case "bar": {} } +switch (foo) { + default: {} + default: {} +} +switch (foo) { case : } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -154,7 +177,11 @@ JsModule { ], eof_token: EOF@150..151 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..151 0: (empty) 1: (empty) @@ -269,7 +296,12 @@ JsModule { 3: JS_STATEMENT_LIST@149..149 6: R_CURLY@149..150 "}" [] [] 4: EOF@150..151 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` switch_stmt_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `foo` @@ -281,7 +313,6 @@ switch_stmt_err.js:1:8 parse ━━━━━━━━━━━━━━━━━ i Remove foo --- switch_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `{` @@ -293,7 +324,6 @@ switch_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━ i Remove { --- switch_stmt_err.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `{` @@ -306,7 +336,6 @@ switch_stmt_err.js:2:8 parse ━━━━━━━━━━━━━━━━━ i Remove { --- switch_stmt_err.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `{` @@ -320,7 +349,6 @@ switch_stmt_err.js:3:8 parse ━━━━━━━━━━━━━━━━━ i Remove { --- switch_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a default, or a case but instead found 'var i = 0'. @@ -341,7 +369,6 @@ switch_stmt_err.js:3:10 parse ━━━━━━━━━━━━━━━━ 4 │ switch { var i = 0; case "bar": {} } 5 │ switch (foo) { --- switch_stmt_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `{` @@ -355,7 +382,6 @@ switch_stmt_err.js:4:8 parse ━━━━━━━━━━━━━━━━━ i Remove { --- switch_stmt_err.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a default, or a case but instead found 'var i = 0;'. @@ -376,7 +402,6 @@ switch_stmt_err.js:4:10 parse ━━━━━━━━━━━━━━━━ 5 │ switch (foo) { 6 │ default: {} --- switch_stmt_err.js:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Multiple default clauses inside of a switch statement are not allowed @@ -406,7 +431,6 @@ switch_stmt_err.js:7:3 parse ━━━━━━━━━━━━━━━━━ 7 │ default: {} 8 │ } --- switch_stmt_err.js:9:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ':'. @@ -425,13 +449,4 @@ switch_stmt_err.js:9:21 parse ━━━━━━━━━━━━━━━━ │ ^ 10 │ --- -switch foo {} -switch {} -switch { var i = 0 } -switch { var i = 0; case "bar": {} } -switch (foo) { - default: {} - default: {} -} -switch (foo) { case : } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/template_after_optional_chain.js b/crates/biome_js_parser/tests/js_test_suite/error/template_after_optional_chain.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/template_after_optional_chain.js rename to crates/biome_js_parser/tests/js_test_suite/error/template_after_optional_chain.js diff --git a/crates/biome_js_parser/test_data/inline/err/template_after_optional_chain.rast b/crates/biome_js_parser/tests/js_test_suite/error/template_after_optional_chain.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/template_after_optional_chain.rast rename to crates/biome_js_parser/tests/js_test_suite/error/template_after_optional_chain.js.snap index 7d7b1f2806e3..85852e2b765c 100644 --- a/crates/biome_js_parser/test_data/inline/err/template_after_optional_chain.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/template_after_optional_chain.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +obj.val?.prop`template` +obj.val?.[expr]`template` +obj.func?.(args)`template` + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -112,7 +129,11 @@ JsModule { ], eof_token: EOF@76..77 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..77 0: (empty) 1: (empty) @@ -185,7 +206,12 @@ JsModule { 3: BACKTICK@75..76 "`" [] [] 1: (empty) 4: EOF@76..77 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` template_after_optional_chain.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Tagged template expressions are not permitted in an optional chain. @@ -195,7 +221,6 @@ template_after_optional_chain.js:1:1 parse ━━━━━━━━━━━━ 2 │ obj.val?.[expr]`template` 3 │ obj.func?.(args)`template` --- template_after_optional_chain.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Tagged template expressions are not permitted in an optional chain. @@ -206,7 +231,6 @@ template_after_optional_chain.js:2:1 parse ━━━━━━━━━━━━ 3 │ obj.func?.(args)`template` 4 │ --- template_after_optional_chain.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Tagged template expressions are not permitted in an optional chain. @@ -217,7 +241,4 @@ template_after_optional_chain.js:3:1 parse ━━━━━━━━━━━━ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 │ --- -obj.val?.prop`template` -obj.val?.[expr]`template` -obj.func?.(args)`template` +``` diff --git a/crates/biome_js_parser/test_data/inline/err/template_literal.js b/crates/biome_js_parser/tests/js_test_suite/error/template_literal.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/template_literal.js rename to crates/biome_js_parser/tests/js_test_suite/error/template_literal.js diff --git a/crates/biome_js_parser/test_data/inline/err/template_literal.rast b/crates/biome_js_parser/tests/js_test_suite/error/template_literal.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/template_literal.rast rename to crates/biome_js_parser/tests/js_test_suite/error/template_literal.js.snap index 9c31fbffd8a9..b65f997476f2 100644 --- a/crates/biome_js_parser/test_data/inline/err/template_literal.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/template_literal.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = `foo ${}` +let b = `${a a}` + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -84,7 +100,11 @@ JsModule { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..35 0: (empty) 1: (empty) @@ -139,7 +159,12 @@ JsModule { 2: BACKTICK@33..34 "`" [] [] 1: (empty) 4: EOF@34..35 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` template_literal.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '}'. @@ -156,7 +181,6 @@ template_literal.js:1:16 parse ━━━━━━━━━━━━━━━━ 2 │ let b = `${a a}` 3 │ --- template_literal.js:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead found `a` @@ -168,6 +192,4 @@ template_literal.js:2:14 parse ━━━━━━━━━━━━━━━━ i Remove a --- -let a = `foo ${}` -let b = `${a a}` +``` diff --git a/crates/biome_js_parser/test_data/inline/err/template_literal_unterminated.js b/crates/biome_js_parser/tests/js_test_suite/error/template_literal_unterminated.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/template_literal_unterminated.js rename to crates/biome_js_parser/tests/js_test_suite/error/template_literal_unterminated.js diff --git a/crates/biome_js_parser/test_data/inline/err/template_literal_unterminated.rast b/crates/biome_js_parser/tests/js_test_suite/error/template_literal_unterminated.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/template_literal_unterminated.rast rename to crates/biome_js_parser/tests/js_test_suite/error/template_literal_unterminated.js.snap index da0b7ce0d4ca..fab9a7659dbd 100644 --- a/crates/biome_js_parser/test_data/inline/err/template_literal_unterminated.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/template_literal_unterminated.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = `${foo} bar + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -44,7 +59,11 @@ JsModule { ], eof_token: EOF@20..20 "" [] [], } +``` +## CST + +``` 0: JS_MODULE@0..20 0: (empty) 1: (empty) @@ -77,7 +96,12 @@ JsModule { 4: (empty) 1: (empty) 4: EOF@20..20 "" [] [] --- + +``` + +## Diagnostics + +``` template_literal_unterminated.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unterminated template literal @@ -87,5 +111,4 @@ template_literal_unterminated.js:1:16 parse ━━━━━━━━━━━━ > 2 │ │ --- -let a = `${foo} bar +``` diff --git a/crates/biome_js_parser/test_data/inline/err/throw_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/throw_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/throw_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/throw_stmt_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/throw_stmt_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/throw_stmt_err.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/throw_stmt_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/throw_stmt_err.js.snap index 66b0f553194b..413c99943cd3 100644 --- a/crates/biome_js_parser/test_data/inline/err/throw_stmt_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/throw_stmt_err.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +throw +new Error("oh no :(") +throw; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +54,11 @@ JsModule { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..35 0: (empty) 1: (empty) @@ -66,7 +87,12 @@ JsModule { 1: (empty) 2: SEMICOLON@33..34 ";" [] [] 4: EOF@34..35 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` throw_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Linebreaks between a throw statement and the error to be thrown are not allowed @@ -87,7 +113,6 @@ throw_stmt_err.js:2:1 parse ━━━━━━━━━━━━━━━━━ 3 │ throw; 4 │ --- throw_stmt_err.js:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ';'. @@ -106,7 +131,4 @@ throw_stmt_err.js:3:6 parse ━━━━━━━━━━━━━━━━━ │ ^ 4 │ --- -throw -new Error("oh no :(") -throw; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_member_ansi.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_member_ansi.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_abstract_member_ansi.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_member_ansi.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_member_ansi.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_member_ansi.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_abstract_member_ansi.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_member_ansi.ts.snap index 3c34d6bbc332..cb56e9d3bc6e 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_abstract_member_ansi.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_member_ansi.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -111,7 +126,11 @@ JsModule { ], eof_token: EOF@124..125 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..125 0: (empty) 1: (empty) @@ -192,7 +211,12 @@ JsModule { 3: (empty) 9: R_CURLY@123..124 "}" [] [] 4: EOF@124..125 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_abstract_member_ansi.ts:1:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class method body but instead found 'abstract'. @@ -207,7 +231,6 @@ ts_abstract_member_ansi.ts:1:43 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^ 2 │ --- ts_abstract_member_ansi.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot appear on a constructor declaration. @@ -216,7 +239,6 @@ ts_abstract_member_ansi.ts:1:20 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^ 2 │ --- ts_abstract_member_ansi.ts:1:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the method declaration, but found none @@ -225,7 +247,6 @@ ts_abstract_member_ansi.ts:1:43 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^^^^^^ 2 │ --- ts_abstract_member_ansi.ts:1:61 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the method declaration, but found none @@ -234,7 +255,6 @@ ts_abstract_member_ansi.ts:1:61 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^^^^^^^^^^ 2 │ --- ts_abstract_member_ansi.ts:1:83 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the method declaration, but found none @@ -243,5 +263,4 @@ ts_abstract_member_ansi.ts:1:83 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2 │ --- -abstract class A { abstract constructor() abstract method() abstract get getter() abstract set setter(value) abstract prop } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts.snap index ad178e49df32..10e02dde6045 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_be_definite.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_be_definite.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { + abstract name!: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -45,7 +62,11 @@ JsModule { ], eof_token: EOF@49..50 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..50 0: (empty) 1: (empty) @@ -77,7 +98,12 @@ JsModule { 3: SEMICOLON@46..47 ";" [] [] 9: R_CURLY@47..49 "}" [Newline("\n")] [] 4: EOF@49..50 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_abstract_property_cannot_be_definite.ts:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A definite assignment operator '!' cannot appear on an 'abstract' property. @@ -88,7 +114,4 @@ ts_abstract_property_cannot_be_definite.ts:2:19 parse ━━━━━━━━ 3 │ } 4 │ --- -abstract class A { - abstract name!: string; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts.snap index 226a36a92371..8be8e10b4dbd 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_abstract_property_cannot_have_initiliazers.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_abstract_property_cannot_have_initiliazers.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { + abstract name: string = ""; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -46,7 +63,11 @@ JsModule { ], eof_token: EOF@52..53 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..53 0: (empty) 1: (empty) @@ -80,7 +101,12 @@ JsModule { 4: SEMICOLON@49..50 ";" [] [] 9: R_CURLY@50..52 "}" [Newline("\n")] [] 4: EOF@52..53 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_abstract_property_cannot_have_initiliazers.ts:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Property cannot have an initializer because it is marked abstract. @@ -91,7 +117,4 @@ ts_abstract_property_cannot_have_initiliazers.ts:2:27 parse ━━━━━━ 3 │ } 4 │ --- -abstract class A { - abstract name: string = ""; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_ambient_async_method.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_async_method.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_ambient_async_method.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_async_method.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_ambient_async_method.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_async_method.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_ambient_async_method.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_async_method.ts.snap index 56ae7e6c1e19..c7cde39640e3 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_ambient_async_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_async_method.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { async method(); } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -38,7 +53,11 @@ JsModule { ], eof_token: EOF@35..36 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..36 0: (empty) 1: (empty) @@ -68,7 +87,12 @@ JsModule { 3: SEMICOLON@32..34 ";" [] [Whitespace(" ")] 9: R_CURLY@34..35 "}" [] [] 4: EOF@35..36 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_ambient_async_method.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'async' modifier cannot be used in an ambient context. @@ -77,5 +101,4 @@ ts_ambient_async_method.ts:1:19 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^^^^ 2 │ --- -declare class A { async method(); } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_ambient_context_semi.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_context_semi.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_ambient_context_semi.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_context_semi.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_ambient_context_semi.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_context_semi.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_ambient_context_semi.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_context_semi.ts.snap index 8b1ee51490d0..209642f922cc 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_ambient_context_semi.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_ambient_context_semi.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { method() method2() method3() } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -72,7 +87,11 @@ JsModule { ], eof_token: EOF@48..49 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..49 0: (empty) 1: (empty) @@ -132,7 +151,12 @@ JsModule { 7: (empty) 9: R_CURLY@47..48 "}" [] [] 4: EOF@48..49 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_ambient_context_semi.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the method declaration, but found none @@ -141,7 +165,6 @@ ts_ambient_context_semi.ts:1:19 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^ 2 │ --- ts_ambient_context_semi.ts:1:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected a semicolon to end the method declaration, but found none @@ -150,5 +173,4 @@ ts_ambient_context_semi.ts:1:28 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^^ 2 │ --- -declare class A { method() method2() method3() } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_annotated_property_initializer_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_annotated_property_initializer_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_annotated_property_initializer_ambient_context.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_annotated_property_initializer_ambient_context.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts.snap index cf797885754e..66fe78acb282 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_annotated_property_initializer_ambient_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_annotated_property_initializer_ambient_context.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class T { readonly b: string = "test"; } +class T { declare readonly b: string = "test"; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -92,7 +108,11 @@ JsModule { ], eof_token: EOF@97..98 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..98 0: (empty) 1: (empty) @@ -157,7 +177,12 @@ JsModule { 4: SEMICOLON@94..96 ";" [] [Whitespace(" ")] 9: R_CURLY@96..97 "}" [] [] 4: EOF@97..98 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_annotated_property_initializer_ambient_context.ts:1:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × In ambient contexts, properties cannot have both a type annotation and an initializer. @@ -174,7 +199,6 @@ ts_annotated_property_initializer_ambient_context.ts:1:38 parse ━━━━━ 2 │ class T { declare readonly b: string = "test"; } 3 │ --- ts_annotated_property_initializer_ambient_context.ts:2:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × In ambient contexts, properties cannot have both a type annotation and an initializer. @@ -191,6 +215,4 @@ ts_annotated_property_initializer_ambient_context.ts:2:38 parse ━━━━━ │ ^^^^^^^^ 3 │ --- -declare class T { readonly b: string = "test"; } -class T { declare readonly b: string = "test"; } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_arrow_function_this_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_arrow_function_this_parameter.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_arrow_function_this_parameter.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_arrow_function_this_parameter.ts.snap index 04fc121156ac..e3b26ef66438 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_arrow_function_this_parameter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_arrow_function_this_parameter.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = (this: string) => {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -53,7 +68,11 @@ JsModule { ], eof_token: EOF@28..29 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..29 0: (empty) 1: (empty) @@ -92,7 +111,12 @@ JsModule { 3: R_CURLY@27..28 "}" [] [] 1: (empty) 4: EOF@28..29 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_arrow_function_this_parameter.ts:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An arrow function cannot have a 'this' parameter. @@ -101,5 +125,4 @@ ts_arrow_function_this_parameter.ts:1:10 parse ━━━━━━━━━━━ │ ^^^^^^^^^^^^ 2 │ --- -let a = (this: string) => {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts.snap index 9d0789cb947a..11cef1c73a02 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_as_assignment_no_parenthesize.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_as_assignment_no_parenthesize.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a: any; +a as string = "string"; +(a() as string) = "string"; + a = 3; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -101,7 +119,11 @@ JsModule { ], eof_token: EOF@79..80 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..80 0: (empty) 1: (empty) @@ -169,7 +191,12 @@ JsModule { 0: JS_NUMBER_LITERAL@77..78 "3" [] [] 1: SEMICOLON@78..79 ";" [] [] 4: EOF@79..80 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_as_assignment_no_parenthesize.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `a()` @@ -183,7 +210,6 @@ ts_as_assignment_no_parenthesize.ts:3:2 parse ━━━━━━━━━━━ i This expression cannot be assigned to --- ts_as_assignment_no_parenthesize.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to ` a` @@ -196,8 +222,4 @@ ts_as_assignment_no_parenthesize.ts:4:1 parse ━━━━━━━━━━━ i This expression cannot be assigned to --- -let a: any; -a as string = "string"; -(a() as string) = "string"; - a = 3; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_broken_class_member_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_broken_class_member_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_broken_class_member_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_broken_class_member_modifiers.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_broken_class_member_modifiers.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_broken_class_member_modifiers.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_broken_class_member_modifiers.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_broken_class_member_modifiers.ts.snap index 8daeac265886..d7a52d42ef2e 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_broken_class_member_modifiers.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_broken_class_member_modifiers.ts.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class C { + @decorator + } +class CC { + @ + } +class @ +class C@ + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -78,7 +100,11 @@ JsModule { ], eof_token: EOF@58..59 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..59 0: (empty) 1: (empty) @@ -124,7 +150,12 @@ JsModule { 0: AT@57..58 "@" [] [] 1: (empty) 4: EOF@58..59 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_broken_class_member_modifiers.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '}'. @@ -145,7 +176,6 @@ ts_broken_class_member_modifiers.ts:3:2 parse ━━━━━━━━━━━ 4 │ class CC { 5 │ @ --- ts_broken_class_member_modifiers.ts:6:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '}'. @@ -166,7 +196,6 @@ ts_broken_class_member_modifiers.ts:6:2 parse ━━━━━━━━━━━ 7 │ class @ 8 │ class C@ --- ts_broken_class_member_modifiers.ts:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name @@ -178,7 +207,6 @@ ts_broken_class_member_modifiers.ts:7:1 parse ━━━━━━━━━━━ 8 │ class C@ 9 │ --- ts_broken_class_member_modifiers.ts:7:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `{` but instead found `@` @@ -192,7 +220,6 @@ ts_broken_class_member_modifiers.ts:7:7 parse ━━━━━━━━━━━ i Remove @ --- ts_broken_class_member_modifiers.ts:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `{` but instead found `@` @@ -205,7 +232,6 @@ ts_broken_class_member_modifiers.ts:8:8 parse ━━━━━━━━━━━ i Remove @ --- ts_broken_class_member_modifiers.ts:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found the end of the file. @@ -222,7 +248,6 @@ ts_broken_class_member_modifiers.ts:9:1 parse ━━━━━━━━━━━ > 9 │ │ --- ts_broken_class_member_modifiers.ts:8:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid decorator `class C@` @@ -233,7 +258,6 @@ ts_broken_class_member_modifiers.ts:8:1 parse ━━━━━━━━━━━ │ ^^^^^^^^ 9 │ --- ts_broken_class_member_modifiers.ts:9:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found the end of the file. @@ -250,12 +274,4 @@ ts_broken_class_member_modifiers.ts:9:1 parse ━━━━━━━━━━━ > 9 │ │ --- -class C { - @decorator - } -class CC { - @ - } -class @ -class C@ +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts.snap index 9e84f1513f86..0cc3fd1a6a4e 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_catch_declaration_non_any_unknown_type_annotation.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_catch_declaration_non_any_unknown_type_annotation.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +try {} catch (error: Error) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -38,7 +53,11 @@ JsModule { ], eof_token: EOF@30..31 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..31 0: (empty) 1: (empty) @@ -68,7 +87,12 @@ JsModule { 1: JS_STATEMENT_LIST@29..29 2: R_CURLY@29..30 "}" [] [] 4: EOF@30..31 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_catch_declaration_non_any_unknown_type_annotation.ts:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Catch clause variable type annotation must be 'any' or 'unknown' if specified. @@ -77,5 +101,4 @@ ts_catch_declaration_non_any_unknown_type_annotation.ts:1:22 parse ━━━━ │ ^^^^^ 2 │ --- -try {} catch (error: Error) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_declare_modifier_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_declare_modifier_error.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_declare_modifier_error.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_declare_modifier_error.ts.snap index dde5b27eba1d..532f8992f79a 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_declare_modifier_error.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_declare_modifier_error.ts.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + declare method(): string; + declare constructor(declare readonly prop) {} + declare get test() { return "a" } + declare set test(value: string) {} + declare [name: string]: string; + declare accessor foo: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -218,7 +240,11 @@ JsModule { ], eof_token: EOF@241..242 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..242 0: (empty) 1: (empty) @@ -355,7 +381,12 @@ JsModule { 3: SEMICOLON@238..239 ";" [] [] 9: R_CURLY@239..241 "}" [Newline("\n")] [] 4: EOF@241..242 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_class_declare_modifier_error.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier is only allowed on properties. @@ -366,7 +397,6 @@ ts_class_declare_modifier_error.ts:2:5 parse ━━━━━━━━━━━ 3 │ declare constructor(declare readonly prop) {} 4 │ declare get test() { return "a" } --- ts_class_declare_modifier_error.ts:3:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' cannot appear on a parameter. @@ -378,7 +408,6 @@ ts_class_declare_modifier_error.ts:3:25 parse ━━━━━━━━━━━ 4 │ declare get test() { return "a" } 5 │ declare set test(value: string) {} --- ts_class_declare_modifier_error.ts:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' cannot appear on a constructor declaration. @@ -390,7 +419,6 @@ ts_class_declare_modifier_error.ts:3:5 parse ━━━━━━━━━━━ 4 │ declare get test() { return "a" } 5 │ declare set test(value: string) {} --- ts_class_declare_modifier_error.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier is only allowed on properties. @@ -402,7 +430,6 @@ ts_class_declare_modifier_error.ts:4:5 parse ━━━━━━━━━━━ 5 │ declare set test(value: string) {} 6 │ declare [name: string]: string; --- ts_class_declare_modifier_error.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier is only allowed on properties. @@ -414,7 +441,6 @@ ts_class_declare_modifier_error.ts:5:5 parse ━━━━━━━━━━━ 6 │ declare [name: string]: string; 7 │ declare accessor foo: string; --- ts_class_declare_modifier_error.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier cannot appear on an index signature. @@ -426,7 +452,6 @@ ts_class_declare_modifier_error.ts:6:5 parse ━━━━━━━━━━━ 7 │ declare accessor foo: string; 8 │ } --- ts_class_declare_modifier_error.ts:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' cannot be used with 'accessor' modifier. @@ -456,12 +481,4 @@ ts_class_declare_modifier_error.ts:7:5 parse ━━━━━━━━━━━ 8 │ } 9 │ --- -class Test { - declare method(): string; - declare constructor(declare readonly prop) {} - declare get test() { return "a" } - declare set test(value: string) {} - declare [name: string]: string; - declare accessor foo: string; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_heritage_clause_errors.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_heritage_clause_errors.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_heritage_clause_errors.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_heritage_clause_errors.ts.snap index 7e565168f5a4..e339afae431c 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_heritage_clause_errors.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_heritage_clause_errors.ts.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A {} +interface Int {} +class B implements Int extends A {} +class C implements Int implements Int {} +class D implements {} +class E extends {} +class F extends E, {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -155,7 +176,11 @@ JsModule { ], eof_token: EOF@167..168 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..168 0: (empty) 1: (empty) @@ -269,7 +294,12 @@ JsModule { 5: JS_CLASS_MEMBER_LIST@166..166 6: R_CURLY@166..167 "}" [] [] 4: EOF@167..168 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_class_heritage_clause_errors.ts:3:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'extends' clause must precede 'implements' clause. @@ -290,7 +320,6 @@ ts_class_heritage_clause_errors.ts:3:24 parse ━━━━━━━━━━━ 4 │ class C implements Int implements Int {} 5 │ class D implements {} --- ts_class_heritage_clause_errors.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'implements' clause already seen. @@ -311,7 +340,6 @@ ts_class_heritage_clause_errors.ts:4:24 parse ━━━━━━━━━━━ 5 │ class D implements {} 6 │ class E extends {} --- ts_class_heritage_clause_errors.ts:5:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'implements' list cannot be empty. @@ -323,7 +351,6 @@ ts_class_heritage_clause_errors.ts:5:20 parse ━━━━━━━━━━━ 6 │ class E extends {} 7 │ class F extends E, {} --- ts_class_heritage_clause_errors.ts:6:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'extends' list cannot be empty. @@ -335,7 +362,6 @@ ts_class_heritage_clause_errors.ts:6:16 parse ━━━━━━━━━━━ 7 │ class F extends E, {} 8 │ --- ts_class_heritage_clause_errors.ts:7:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Trailing comma not allowed. @@ -346,11 +372,4 @@ ts_class_heritage_clause_errors.ts:7:18 parse ━━━━━━━━━━━ │ ^ 8 │ --- -class A {} -interface Int {} -class B implements Int extends A {} -class C implements Int implements Int {} -class D implements {} -class E extends {} -class F extends E, {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts.snap index d64acc1d2598..cd94256313e5 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_initializer_with_modifiers.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_initializer_with_modifiers.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + public static { } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -32,7 +49,11 @@ JsModule { ], eof_token: EOF@31..32 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..32 0: (empty) 1: (empty) @@ -58,7 +79,12 @@ JsModule { 4: R_CURLY@28..29 "}" [] [] 9: R_CURLY@29..31 "}" [Newline("\n")] [] 4: EOF@31..32 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_class_initializer_with_modifiers.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Static class blocks cannot have any modifier. @@ -69,7 +95,4 @@ ts_class_initializer_with_modifiers.ts:2:3 parse ━━━━━━━━━━ 3 │ } 4 │ --- -class A { - public static { } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts.snap index 567021c823df..ff4add3ddc4d 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_invalid_modifier_combinations.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_invalid_modifier_combinations.ts.snap @@ -1,3 +1,38 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Base { base1; base2; } +abstract class Test extends Base { + override override base1; + declare declare a; + private protected public c; + private private d; + protected protected e; + public public f; + abstract abstract g; + static static h; + readonly readonly i; + override declare base2; + private abstract j; + abstract #j; + abstract static k; + abstract async l(); + declare async m(); + declare #l; + declare accessor p; + accessor accessor r; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -355,7 +390,11 @@ JsModule { ], eof_token: EOF@495..496 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..496 0: (empty) 1: (empty) @@ -572,7 +611,12 @@ JsModule { 2: SEMICOLON@492..493 ";" [] [] 9: R_CURLY@493..495 "}" [Newline("\n")] [] 4: EOF@495..496 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_class_invalid_modifier_combinations.ts:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'override' already seen @@ -602,7 +646,6 @@ ts_class_invalid_modifier_combinations.ts:3:14 parse ━━━━━━━━━ 4 │ declare declare a; 5 │ private protected public c; --- ts_class_invalid_modifier_combinations.ts:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' already seen @@ -632,7 +675,6 @@ ts_class_invalid_modifier_combinations.ts:4:13 parse ━━━━━━━━━ 5 │ private protected public c; 6 │ private private d; --- ts_class_invalid_modifier_combinations.ts:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Accessibility modifier already seen. @@ -662,7 +704,6 @@ ts_class_invalid_modifier_combinations.ts:5:13 parse ━━━━━━━━━ 6 │ private private d; 7 │ protected protected e; --- ts_class_invalid_modifier_combinations.ts:5:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Accessibility modifier already seen. @@ -692,7 +733,6 @@ ts_class_invalid_modifier_combinations.ts:5:23 parse ━━━━━━━━━ 6 │ private private d; 7 │ protected protected e; --- ts_class_invalid_modifier_combinations.ts:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Accessibility modifier already seen. @@ -722,7 +762,6 @@ ts_class_invalid_modifier_combinations.ts:6:13 parse ━━━━━━━━━ 7 │ protected protected e; 8 │ public public f; --- ts_class_invalid_modifier_combinations.ts:7:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Accessibility modifier already seen. @@ -752,7 +791,6 @@ ts_class_invalid_modifier_combinations.ts:7:15 parse ━━━━━━━━━ 8 │ public public f; 9 │ abstract abstract g; --- ts_class_invalid_modifier_combinations.ts:8:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Accessibility modifier already seen. @@ -782,7 +820,6 @@ ts_class_invalid_modifier_combinations.ts:8:12 parse ━━━━━━━━━ 9 │ abstract abstract g; 10 │ static static h; --- ts_class_invalid_modifier_combinations.ts:9:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' already seen @@ -812,7 +849,6 @@ ts_class_invalid_modifier_combinations.ts:9:14 parse ━━━━━━━━━ 10 │ static static h; 11 │ readonly readonly i; --- ts_class_invalid_modifier_combinations.ts:10:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'static' already seen @@ -842,7 +878,6 @@ ts_class_invalid_modifier_combinations.ts:10:12 parse ━━━━━━━━ 11 │ readonly readonly i; 12 │ override declare base2; --- ts_class_invalid_modifier_combinations.ts:11:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'readonly' already seen @@ -872,7 +907,6 @@ ts_class_invalid_modifier_combinations.ts:11:14 parse ━━━━━━━━ 12 │ override declare base2; 13 │ private abstract j; --- ts_class_invalid_modifier_combinations.ts:12:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' cannot be used with 'override' modifier. @@ -902,7 +936,6 @@ ts_class_invalid_modifier_combinations.ts:12:14 parse ━━━━━━━━ 13 │ private abstract j; 14 │ abstract #j; --- ts_class_invalid_modifier_combinations.ts:13:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'private' cannot be used with 'abstract' modifier. @@ -932,7 +965,6 @@ ts_class_invalid_modifier_combinations.ts:13:5 parse ━━━━━━━━━ 14 │ abstract #j; 15 │ abstract static k; --- ts_class_invalid_modifier_combinations.ts:14:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' modifier cannot be used with a private identifier'. @@ -944,7 +976,6 @@ ts_class_invalid_modifier_combinations.ts:14:5 parse ━━━━━━━━━ 15 │ abstract static k; 16 │ abstract async l(); --- ts_class_invalid_modifier_combinations.ts:15:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot be used with 'static' modifier. @@ -974,7 +1005,6 @@ ts_class_invalid_modifier_combinations.ts:15:5 parse ━━━━━━━━━ 16 │ abstract async l(); 17 │ declare async m(); --- ts_class_invalid_modifier_combinations.ts:16:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × async members cannot be abstract @@ -986,7 +1016,6 @@ ts_class_invalid_modifier_combinations.ts:16:5 parse ━━━━━━━━━ 17 │ declare async m(); 18 │ declare #l; --- ts_class_invalid_modifier_combinations.ts:17:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier is only allowed on properties. @@ -998,7 +1027,6 @@ ts_class_invalid_modifier_combinations.ts:17:5 parse ━━━━━━━━━ 18 │ declare #l; 19 │ declare accessor p; --- ts_class_invalid_modifier_combinations.ts:18:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier cannot be used with a private identifier'. @@ -1010,7 +1038,6 @@ ts_class_invalid_modifier_combinations.ts:18:5 parse ━━━━━━━━━ 19 │ declare accessor p; 20 │ accessor accessor r; --- ts_class_invalid_modifier_combinations.ts:19:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' cannot be used with 'accessor' modifier. @@ -1040,7 +1067,6 @@ ts_class_invalid_modifier_combinations.ts:19:5 parse ━━━━━━━━━ 20 │ accessor accessor r; 21 │ } --- ts_class_invalid_modifier_combinations.ts:20:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'accessor' already seen @@ -1070,25 +1096,4 @@ ts_class_invalid_modifier_combinations.ts:20:14 parse ━━━━━━━━ 21 │ } 22 │ --- -class Base { base1; base2; } -abstract class Test extends Base { - override override base1; - declare declare a; - private protected public c; - private private d; - protected protected e; - public public f; - abstract abstract g; - static static h; - readonly readonly i; - override declare base2; - private abstract j; - abstract #j; - abstract static k; - abstract async l(); - declare async m(); - declare #l; - declare accessor p; - accessor accessor r; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_member_accessor_readonly_precedence.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_member_accessor_readonly_precedence.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_member_accessor_readonly_precedence.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_class_member_accessor_readonly_precedence.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts.snap index f6e95c0837e4..7616d237593f 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_member_accessor_readonly_precedence.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_member_accessor_readonly_precedence.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + readonly accessor foo: number = 1; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -49,7 +66,11 @@ JsModule { ], eof_token: EOF@50..51 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..51 0: (empty) 1: (empty) @@ -85,7 +106,12 @@ JsModule { 4: SEMICOLON@47..48 ";" [] [] 9: R_CURLY@48..50 "}" [Newline("\n")] [] 4: EOF@50..51 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_class_member_accessor_readonly_precedence.ts:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'accessor' must precede 'readonly' @@ -112,7 +138,4 @@ ts_class_member_accessor_readonly_precedence.ts:2:14 parse ━━━━━━━ 3 │ } 4 │ --- -class A { - readonly accessor foo: number = 1; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_modifier_precedence.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_modifier_precedence.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_modifier_precedence.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_modifier_precedence.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_modifier_precedence.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_modifier_precedence.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_class_modifier_precedence.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_modifier_precedence.ts.snap index 5d32a2ba79fa..7952af4e6449 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_modifier_precedence.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_modifier_precedence.ts.snap @@ -1,3 +1,36 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Base { base1; base2; base3; base4;} +abstract class Test extends Base { + // Accessibility + readonly private a: string; + override protected base1; + static private b: string; + abstract protected d: string; + // Static + readonly static c: string; + accessor static d: string; + override static base2: string; + // Accessor + readonly accessor e: string; + override accessor f: string; + // abstract + override abstract base3: string; + // override + readonly override base4: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -316,7 +349,11 @@ JsModule { ], eof_token: EOF@524..525 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..525 0: (empty) 1: (empty) @@ -519,7 +556,12 @@ JsModule { 3: SEMICOLON@521..522 ";" [] [] 9: R_CURLY@522..524 "}" [Newline("\n")] [] 4: EOF@524..525 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_class_modifier_precedence.ts:4:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'private' must precede 'readonly' @@ -549,7 +591,6 @@ ts_class_modifier_precedence.ts:4:14 parse ━━━━━━━━━━━━ 5 │ override protected base1; 6 │ static private b: string; --- ts_class_modifier_precedence.ts:5:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'protected' must precede 'override' @@ -579,7 +620,6 @@ ts_class_modifier_precedence.ts:5:14 parse ━━━━━━━━━━━━ 6 │ static private b: string; 7 │ abstract protected d: string; --- ts_class_modifier_precedence.ts:6:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'private' must precede 'static' @@ -609,7 +649,6 @@ ts_class_modifier_precedence.ts:6:12 parse ━━━━━━━━━━━━ 7 │ abstract protected d: string; 8 │ // Static --- ts_class_modifier_precedence.ts:7:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'protected' must precede 'abstract' @@ -639,7 +678,6 @@ ts_class_modifier_precedence.ts:7:14 parse ━━━━━━━━━━━━ 8 │ // Static 9 │ readonly static c: string; --- ts_class_modifier_precedence.ts:9:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'static' must precede 'readonly' @@ -669,7 +707,6 @@ ts_class_modifier_precedence.ts:9:14 parse ━━━━━━━━━━━━ 10 │ accessor static d: string; 11 │ override static base2: string; --- ts_class_modifier_precedence.ts:10:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'static' must precede 'accessor' @@ -699,7 +736,6 @@ ts_class_modifier_precedence.ts:10:14 parse ━━━━━━━━━━━━ 11 │ override static base2: string; 12 │ // Accessor --- ts_class_modifier_precedence.ts:11:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'static' must precede 'override' @@ -729,7 +765,6 @@ ts_class_modifier_precedence.ts:11:14 parse ━━━━━━━━━━━━ 12 │ // Accessor 13 │ readonly accessor e: string; --- ts_class_modifier_precedence.ts:13:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'accessor' must precede 'readonly' @@ -759,7 +794,6 @@ ts_class_modifier_precedence.ts:13:14 parse ━━━━━━━━━━━━ 14 │ override accessor f: string; 15 │ // abstract --- ts_class_modifier_precedence.ts:14:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'accessor' cannot be used with 'override' modifier. @@ -789,7 +823,6 @@ ts_class_modifier_precedence.ts:14:14 parse ━━━━━━━━━━━━ 15 │ // abstract 16 │ override abstract base3: string; --- ts_class_modifier_precedence.ts:16:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' must precede 'override' @@ -819,7 +852,6 @@ ts_class_modifier_precedence.ts:16:14 parse ━━━━━━━━━━━━ 17 │ // override 18 │ readonly override base4: string; --- ts_class_modifier_precedence.ts:18:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'override' must precede 'readonly' @@ -849,23 +881,4 @@ ts_class_modifier_precedence.ts:18:14 parse ━━━━━━━━━━━━ 19 │ } 20 │ --- -class Base { base1; base2; base3; base4;} -abstract class Test extends Base { - // Accessibility - readonly private a: string; - override protected base1; - static private b: string; - abstract protected d: string; - // Static - readonly static c: string; - accessor static d: string; - override static base2: string; - // Accessor - readonly accessor e: string; - override accessor f: string; - // abstract - override abstract base3: string; - // override - readonly override base4: string; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_name_reserved_as_type.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_name_reserved_as_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_name_reserved_as_type.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_name_reserved_as_type.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_name_reserved_as_type.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_name_reserved_as_type.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_class_name_reserved_as_type.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_name_reserved_as_type.ts.snap index 198aff638578..45bc5212978d 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_name_reserved_as_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_name_reserved_as_type.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class undefined {} +class string {} +class any {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -48,7 +65,11 @@ JsModule { ], eof_token: EOF@47..48 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -91,7 +112,12 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@46..46 9: R_CURLY@46..47 "}" [] [] 4: EOF@47..48 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_class_name_reserved_as_type.ts:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `undefined` cannot be used as a class name because it is already reserved as a type @@ -101,7 +127,6 @@ ts_class_name_reserved_as_type.ts:1:7 parse ━━━━━━━━━━━━ 2 │ class string {} 3 │ class any {} --- ts_class_name_reserved_as_type.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `string` cannot be used as a class name because it is already reserved as a type @@ -112,7 +137,6 @@ ts_class_name_reserved_as_type.ts:2:7 parse ━━━━━━━━━━━━ 3 │ class any {} 4 │ --- ts_class_name_reserved_as_type.ts:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `any` cannot be used as a class name because it is already reserved as a type @@ -123,7 +147,4 @@ ts_class_name_reserved_as_type.ts:3:7 parse ━━━━━━━━━━━━ │ ^^^ 4 │ --- -class undefined {} -class string {} -class any {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_type_parameters_errors.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_type_parameters_errors.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_class_type_parameters_errors.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_type_parameters_errors.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_class_type_parameters_errors.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_type_parameters_errors.ts.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/ts_class_type_parameters_errors.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_class_type_parameters_errors.ts.snap index c0200c69e77d..c9b4c17924ea 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_class_type_parameters_errors.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_class_type_parameters_errors.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class BuildError<> {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -24,7 +39,11 @@ JsModule { ], eof_token: EOF@21..22 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..22 0: (empty) 1: (empty) @@ -46,7 +65,12 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@20..20 9: R_CURLY@20..21 "}" [] [] 4: EOF@21..22 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_class_type_parameters_errors.ts:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -61,5 +85,4 @@ ts_class_type_parameters_errors.ts:1:18 parse ━━━━━━━━━━━ │ ^ 2 │ --- -class BuildError<> {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts.snap index 08bf1b505692..89c77156d741 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_concrete_class_with_abstract_members.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_concrete_class_with_abstract_members.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + abstract my_age: number; + abstract name(): string; + abstract get age(): number; + abstract set age(v); +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -111,7 +131,11 @@ JsModule { ], eof_token: EOF@122..123 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..123 0: (empty) 1: (empty) @@ -187,7 +211,12 @@ JsModule { 6: SEMICOLON@119..120 ";" [] [] 9: R_CURLY@120..122 "}" [Newline("\n")] [] 4: EOF@122..123 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_concrete_class_with_abstract_members.ts:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Only abstract classes can have abstract members @@ -198,7 +227,6 @@ ts_concrete_class_with_abstract_members.ts:2:4 parse ━━━━━━━━━ 3 │ abstract name(): string; 4 │ abstract get age(): number; --- ts_concrete_class_with_abstract_members.ts:3:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Only abstract classes can have abstract members @@ -210,7 +238,6 @@ ts_concrete_class_with_abstract_members.ts:3:4 parse ━━━━━━━━━ 4 │ abstract get age(): number; 5 │ abstract set age(v); --- ts_concrete_class_with_abstract_members.ts:4:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Only abstract classes can have abstract members @@ -222,7 +249,6 @@ ts_concrete_class_with_abstract_members.ts:4:4 parse ━━━━━━━━━ 5 │ abstract set age(v); 6 │ } --- ts_concrete_class_with_abstract_members.ts:5:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Only abstract classes can have abstract members @@ -234,10 +260,4 @@ ts_concrete_class_with_abstract_members.ts:5:4 parse ━━━━━━━━━ 6 │ } 7 │ --- -class A { - abstract my_age: number; - abstract name(): string; - abstract get age(): number; - abstract set age(v); -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_construct_signature_member_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_construct_signature_member_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_construct_signature_member_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_construct_signature_member_err.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_construct_signature_member_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_construct_signature_member_err.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_construct_signature_member_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_construct_signature_member_err.ts.snap index 58d825738d14..116ef2d6eb31 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_construct_signature_member_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_construct_signature_member_err.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type C = { new <>(a: A, b: B): string } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -77,7 +92,11 @@ JsModule { ], eof_token: EOF@39..40 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..40 0: (empty) 1: (empty) @@ -135,7 +154,12 @@ JsModule { 2: R_CURLY@38..39 "}" [] [] 5: (empty) 4: EOF@39..40 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_construct_signature_member_err.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -150,5 +174,4 @@ ts_construct_signature_member_err.ts:1:17 parse ━━━━━━━━━━ │ ^ 2 │ --- -type C = { new <>(a: A, b: B): string } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_this_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_this_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_constructor_this_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_this_parameter.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_this_parameter.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_this_parameter.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_constructor_this_parameter.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_this_parameter.ts.snap index 6020f9857424..5ba58b1f4276 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_constructor_this_parameter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_this_parameter.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class C { constructor(this) {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -44,7 +59,11 @@ JsModule { ], eof_token: EOF@32..33 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..33 0: (empty) 1: (empty) @@ -78,7 +97,12 @@ JsModule { 3: R_CURLY@29..31 "}" [] [Whitespace(" ")] 9: R_CURLY@31..32 "}" [] [] 4: EOF@32..33 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_constructor_this_parameter.ts:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A constructor cannot have a 'this' parameter. @@ -87,5 +111,4 @@ ts_constructor_this_parameter.ts:1:23 parse ━━━━━━━━━━━━ │ ^^^^ 2 │ --- -class C { constructor(this) {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_constructor_type_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_err.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_err.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_constructor_type_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_err.ts.snap index 5e8a33b24496..56f2d79e2878 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_err.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type C = new<>(a: A, b: B) => string; +type D = abstract new<>(a: A, b: B) => string; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -132,7 +148,11 @@ JsModule { ], eof_token: EOF@84..85 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..85 0: (empty) 1: (empty) @@ -231,7 +251,12 @@ JsModule { 0: STRING_KW@77..83 "string" [] [] 5: SEMICOLON@83..84 ";" [] [] 4: EOF@84..85 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_constructor_type_err.ts:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -248,7 +273,6 @@ ts_constructor_type_err.ts:1:14 parse ━━━━━━━━━━━━━━ 2 │ type D = abstract new<>(a: A, b: B) => string; 3 │ --- ts_constructor_type_err.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -265,6 +289,4 @@ ts_constructor_type_err.ts:2:23 parse ━━━━━━━━━━━━━━ │ ^ 3 │ --- -type C = new<>(a: A, b: B) => string; -type D = abstract new<>(a: A, b: B) => string; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_constructor_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_parameters.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_parameters.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_parameters.ts.snap index eff33c49d873..8c2faf0376a3 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_constructor_type_parameters.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_constructor_type_parameters.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { constructor(b) {} } +class A { constructor<>(b) {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -113,7 +129,11 @@ JsModule { ], eof_token: EOF@64..65 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..65 0: (empty) 1: (empty) @@ -198,7 +218,12 @@ JsModule { 3: R_CURLY@61..63 "}" [] [Whitespace(" ")] 9: R_CURLY@63..64 "}" [] [] 4: EOF@64..65 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_constructor_type_parameters.ts:1:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × constructors cannot have type parameters. @@ -208,7 +233,6 @@ ts_constructor_type_parameters.ts:1:22 parse ━━━━━━━━━━━ 2 │ class A { constructor<>(b) {} } 3 │ --- ts_constructor_type_parameters.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -225,7 +249,6 @@ ts_constructor_type_parameters.ts:2:23 parse ━━━━━━━━━━━ │ ^ 3 │ --- ts_constructor_type_parameters.ts:2:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × constructors cannot have type parameters. @@ -235,6 +258,4 @@ ts_constructor_type_parameters.ts:2:22 parse ━━━━━━━━━━━ │ ^^ 3 │ --- -class A { constructor(b) {} } -class A { constructor<>(b) {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_async_function.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_async_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_async_function.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_async_function.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_async_function.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_async_function.ts.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_async_function.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_async_function.ts.snap index 5fa8f2dc5c2e..c69e254273a0 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_async_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_async_function.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare async function test(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -26,7 +41,11 @@ JsModule { ], eof_token: EOF@30..31 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..31 0: (empty) 1: (empty) @@ -45,7 +64,12 @@ JsModule { 2: R_PAREN@28..29 ")" [] [] 4: SEMICOLON@29..30 ";" [] [] 4: EOF@30..31 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_declare_async_function.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'async' modifier cannot be used in an ambient context. @@ -54,5 +78,4 @@ ts_declare_async_function.ts:1:9 parse ━━━━━━━━━━━━━ │ ^^^^^ 2 │ --- -declare async function test(); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_const_initializer.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_const_initializer.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_const_initializer.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_const_initializer.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_const_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_const_initializer.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_const_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_const_initializer.ts.snap index 12357ed8e3f9..1033c6715b41 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_const_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_const_initializer.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare @decorator class D {} +declare @decorator abstract class D {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -68,7 +84,11 @@ JsModule { ], eof_token: EOF@68..69 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..69 0: (empty) 1: (empty) @@ -115,7 +135,12 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@67..67 9: R_CURLY@67..68 "}" [] [] 4: EOF@68..69 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_declare_const_initializer.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -127,7 +152,6 @@ ts_declare_const_initializer.ts:1:9 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_declare_const_initializer.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -139,6 +163,4 @@ ts_declare_const_initializer.ts:2:9 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -declare @decorator class D {} -declare @decorator abstract class D {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_export_declaration_missing_id.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_function_export_declaration_missing_id.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_export_declaration_missing_id.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_function_export_declaration_missing_id.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts.snap index 78251ec20c4c..8562dd73b7a8 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_export_declaration_missing_id.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_export_declaration_missing_id.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module 'x' { + export function(option: any): void +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -58,7 +75,11 @@ JsModule { ], eof_token: EOF@59..60 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..60 0: (empty) 1: (empty) @@ -102,7 +123,12 @@ JsModule { 6: (empty) 2: R_CURLY@57..59 "}" [Newline("\n")] [] 4: EOF@59..60 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_declare_function_export_declaration_missing_id.ts:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern but instead found '('. @@ -121,7 +147,4 @@ ts_declare_function_export_declaration_missing_id.ts:2:18 parse ━━━━━ 3 │ } 4 │ --- -declare module 'x' { - export function(option: any): void -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_with_body.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_with_body.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_function_with_body.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_with_body.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_with_body.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_with_body.ts.snap index b9102ad14df4..9a878bce1d6f 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_function_with_body.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_function_with_body.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare function test(a: A): string { return "ambient function with a body"; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -76,7 +91,11 @@ JsModule { ], eof_token: EOF@81..82 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..82 0: (empty) 1: (empty) @@ -129,7 +148,12 @@ JsModule { 2: SEMICOLON@78..80 ";" [] [Whitespace(" ")] 3: R_CURLY@80..81 "}" [] [] 4: EOF@81..82 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_declare_function_with_body.ts:1:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A 'declare' function cannot have a function body @@ -140,5 +164,4 @@ ts_declare_function_with_body.ts:1:40 parse ━━━━━━━━━━━━ i remove this body --- -declare function test(a: A): string { return "ambient function with a body"; } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_generator_function.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_generator_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_generator_function.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_generator_function.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_generator_function.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_generator_function.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_generator_function.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_generator_function.ts.snap index 27df0533ef2a..0c537290332d 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_generator_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_generator_function.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare function* test(): void; +declare module 'x' { + export default function* test(): void +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -78,7 +96,11 @@ JsModule { ], eof_token: EOF@94..95 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..95 0: (empty) 1: (empty) @@ -129,7 +151,12 @@ JsModule { 0: VOID_KW@88..92 "void" [] [] 2: R_CURLY@92..94 "}" [Newline("\n")] [] 4: EOF@94..95 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_declare_generator_function.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Generators are not allowed in an ambient context. @@ -139,7 +166,6 @@ ts_declare_generator_function.ts:1:17 parse ━━━━━━━━━━━━ 2 │ declare module 'x' { 3 │ export default function* test(): void --- ts_declare_generator_function.ts:3:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Generators are not allowed in an ambient context. @@ -151,8 +177,4 @@ ts_declare_generator_function.ts:3:26 parse ━━━━━━━━━━━━ 4 │ } 5 │ --- -declare function* test(): void; -declare module 'x' { - export default function* test(): void -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_property_private_name.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_property_private_name.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_property_private_name.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_property_private_name.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_property_private_name.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_property_private_name.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_property_private_name.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_property_private_name.ts.snap index 1aec1d41becf..535aee81dc49 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_property_private_name.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_property_private_name.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { declare #name(); }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -45,7 +60,11 @@ JsModule { ], eof_token: EOF@29..30 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..30 0: (empty) 1: (empty) @@ -78,7 +97,12 @@ JsModule { 1: JS_EMPTY_STATEMENT@28..29 0: SEMICOLON@28..29 ";" [] [] 4: EOF@29..30 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_declare_property_private_name.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'declare' modifier is only allowed on properties. @@ -87,5 +111,4 @@ ts_declare_property_private_name.ts:1:11 parse ━━━━━━━━━━━ │ ^^^^^^^ 2 │ --- -class A { declare #name(); }; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_using.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_using.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_using.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_using.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_declare_using.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_using.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_declare_using.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_declare_using.ts.snap index 6df23dcf372e..0f432f6bad9b 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_declare_using.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_declare_using.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare using x: null +declare await using x: null + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -64,7 +80,11 @@ JsModule { ], eof_token: EOF@49..50 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..50 0: (empty) 1: (empty) @@ -109,7 +129,12 @@ JsModule { 2: (empty) 1: (empty) 4: EOF@49..50 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_declare_using.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -133,7 +158,6 @@ ts_declare_using.ts:1:9 parse ━━━━━━━━━━━━━━━━ 2 │ declare await using x: null 3 │ --- ts_declare_using.ts:1:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Using declarations must have an initialized value. @@ -145,7 +169,6 @@ ts_declare_using.ts:1:15 parse ━━━━━━━━━━━━━━━━ i This variable needs to be initialized. --- ts_declare_using.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -169,7 +192,6 @@ ts_declare_using.ts:2:9 parse ━━━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^^ 3 │ --- ts_declare_using.ts:2:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Using declarations must have an initialized value. @@ -181,6 +203,4 @@ ts_declare_using.ts:2:21 parse ━━━━━━━━━━━━━━━━ i This variable needs to be initialized. --- -declare using x: null -declare await using x: null +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_constructor.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_constructor.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_constructor.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_constructor.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_constructor.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_constructor.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_constructor.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_constructor.ts.snap index 24a5299afee8..59ae5dd42bef 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_constructor.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_constructor.ts.snap @@ -1,3 +1,29 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class C { + constructor(@foo readonly x: number) {} +} +class CC { + constructor(@foo @dec(arg) readonly x: number) {} +} +class CC { + constructor(@foo @dec.method(arg) readonly x: number) {} +} +class CCC { + constructor(@foo @dec.method(arg) private readonly x: number) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -386,7 +412,11 @@ JsModule { ], eof_token: EOF@279..280 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..280 0: (empty) 1: (empty) @@ -628,7 +658,12 @@ JsModule { 3: R_CURLY@276..277 "}" [] [] 9: R_CURLY@277..279 "}" [Newline("\n")] [] 4: EOF@279..280 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_constructor.ts:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -643,7 +678,6 @@ ts_decorator_constructor.ts:2:17 parse ━━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_constructor.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -659,7 +693,6 @@ ts_decorator_constructor.ts:5:17 parse ━━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_constructor.ts:8:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -675,7 +708,6 @@ ts_decorator_constructor.ts:8:17 parse ━━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_constructor.ts:11:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -691,16 +723,4 @@ ts_decorator_constructor.ts:11:17 parse ━━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- -class C { - constructor(@foo readonly x: number) {} -} -class CC { - constructor(@foo @dec(arg) readonly x: number) {} -} -class CC { - constructor(@foo @dec.method(arg) readonly x: number) {} -} -class CCC { - constructor(@foo @dec.method(arg) private readonly x: number) {} -} +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_object.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_object.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.ts.snap index e6270575e39d..ddefc96391f7 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_object.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_object.ts.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ + method(@dec x, second, @dec third = 'default') {} + method(@dec.fn() x, second, @dec.fn() third = 'default') {} + method(@dec() x, second, @dec() third = 'default') {} + set val(@dec x) {} + set val(@dec.fn() x) {} + set val(@dec() x) {} +}) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -426,7 +448,11 @@ JsModule { ], eof_token: EOF@257..258 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..258 0: (empty) 1: (empty) @@ -705,7 +731,12 @@ JsModule { 2: R_PAREN@256..257 ")" [] [] 1: (empty) 4: EOF@257..258 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_object.ts:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -718,7 +749,6 @@ ts_decorator_object.ts:2:12 parse ━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_object.ts:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -731,7 +761,6 @@ ts_decorator_object.ts:2:28 parse ━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_object.ts:3:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `method` @@ -745,7 +774,6 @@ ts_decorator_object.ts:3:5 parse ━━━━━━━━━━━━━━━ i Remove method --- ts_decorator_object.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -759,7 +787,6 @@ ts_decorator_object.ts:3:12 parse ━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_object.ts:3:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -773,7 +800,6 @@ ts_decorator_object.ts:3:33 parse ━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_object.ts:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `method` @@ -787,7 +813,6 @@ ts_decorator_object.ts:4:5 parse ━━━━━━━━━━━━━━━ i Remove method --- ts_decorator_object.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -801,7 +826,6 @@ ts_decorator_object.ts:4:12 parse ━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_object.ts:4:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -815,7 +839,6 @@ ts_decorator_object.ts:4:30 parse ━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_object.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `set` @@ -829,7 +852,6 @@ ts_decorator_object.ts:5:5 parse ━━━━━━━━━━━━━━━ i Remove set --- ts_decorator_object.ts:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -843,7 +865,6 @@ ts_decorator_object.ts:5:13 parse ━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_object.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `set` @@ -857,7 +878,6 @@ ts_decorator_object.ts:6:5 parse ━━━━━━━━━━━━━━━ i Remove set --- ts_decorator_object.ts:6:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -871,7 +891,6 @@ ts_decorator_object.ts:6:13 parse ━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_object.ts:7:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `set` @@ -885,7 +904,6 @@ ts_decorator_object.ts:7:5 parse ━━━━━━━━━━━━━━━ i Remove set --- ts_decorator_object.ts:7:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -899,12 +917,4 @@ ts_decorator_object.ts:7:13 parse ━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -({ - method(@dec x, second, @dec third = 'default') {} - method(@dec.fn() x, second, @dec.fn() third = 'default') {} - method(@dec() x, second, @dec() third = 'default') {} - set val(@dec x) {} - set val(@dec.fn() x) {} - set val(@dec() x) {} -}) +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.ts.snap index 007d8923b068..80b30da1a539 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_ambient_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_ambient_function.ts.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module a { + function method(@dec x, second, @dec third = 'default') {} + function method(@dec.fn() x, second, @dec.fn() third = 'default') {} + function method(@dec() x, second, @dec() third = 'default') {} +} +declare function method(@dec x, second, @dec third = 'default') +declare function method(@dec.fn() x, second, @dec.fn() third = 'default') +declare function method(@dec() x, second, @dec() third = 'default') + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -564,7 +586,11 @@ JsModule { ], eof_token: EOF@423..424 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..424 0: (empty) 1: (empty) @@ -920,7 +946,12 @@ JsModule { 5: (empty) 6: (empty) 4: EOF@423..424 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_on_ambient_function.ts:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -933,7 +964,6 @@ ts_decorator_on_ambient_function.ts:2:19 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:2:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -946,7 +976,6 @@ ts_decorator_on_ambient_function.ts:2:35 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:2:59 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A 'declare' function cannot have a function body @@ -959,7 +988,6 @@ ts_decorator_on_ambient_function.ts:2:59 parse ━━━━━━━━━━━ i remove this body --- ts_decorator_on_ambient_function.ts:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -973,7 +1001,6 @@ ts_decorator_on_ambient_function.ts:3:19 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:3:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -987,7 +1014,6 @@ ts_decorator_on_ambient_function.ts:3:40 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:3:69 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A 'declare' function cannot have a function body @@ -1001,7 +1027,6 @@ ts_decorator_on_ambient_function.ts:3:69 parse ━━━━━━━━━━━ i remove this body --- ts_decorator_on_ambient_function.ts:4:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1015,7 +1040,6 @@ ts_decorator_on_ambient_function.ts:4:19 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:4:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1029,7 +1053,6 @@ ts_decorator_on_ambient_function.ts:4:37 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:4:63 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A 'declare' function cannot have a function body @@ -1043,7 +1066,6 @@ ts_decorator_on_ambient_function.ts:4:63 parse ━━━━━━━━━━━ i remove this body --- ts_decorator_on_ambient_function.ts:6:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1057,7 +1079,6 @@ ts_decorator_on_ambient_function.ts:6:25 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:6:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1071,7 +1092,6 @@ ts_decorator_on_ambient_function.ts:6:41 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:7:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1085,7 +1105,6 @@ ts_decorator_on_ambient_function.ts:7:25 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:7:46 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1099,7 +1118,6 @@ ts_decorator_on_ambient_function.ts:7:46 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:8:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1112,7 +1130,6 @@ ts_decorator_on_ambient_function.ts:8:25 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_ambient_function.ts:8:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1125,12 +1142,4 @@ ts_decorator_on_ambient_function.ts:8:43 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -declare module a { - function method(@dec x, second, @dec third = 'default') {} - function method(@dec.fn() x, second, @dec.fn() third = 'default') {} - function method(@dec() x, second, @dec() third = 'default') {} -} -declare function method(@dec x, second, @dec third = 'default') -declare function method(@dec.fn() x, second, @dec.fn() third = 'default') -declare function method(@dec() x, second, @dec() third = 'default') +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.ts.snap index a55a1cb86e62..649d13fcdaf3 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_arrow_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_arrow_function.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +const method = (@dec x, second, @dec third = 'default') => {}; +const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; +const method = (@dec() x, second, @dec() third = 'default') => {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -327,7 +344,11 @@ JsModule { ], eof_token: EOF@202..203 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..203 0: (empty) 1: (empty) @@ -541,7 +562,12 @@ JsModule { 3: R_CURLY@200..201 "}" [] [] 1: SEMICOLON@201..202 ";" [] [] 4: EOF@202..203 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_on_arrow_function.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -553,7 +579,6 @@ ts_decorator_on_arrow_function.ts:1:17 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_arrow_function.ts:1:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -565,7 +590,6 @@ ts_decorator_on_arrow_function.ts:1:33 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_arrow_function.ts:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -578,7 +602,6 @@ ts_decorator_on_arrow_function.ts:2:17 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_arrow_function.ts:2:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -591,7 +614,6 @@ ts_decorator_on_arrow_function.ts:2:38 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_arrow_function.ts:3:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -604,7 +626,6 @@ ts_decorator_on_arrow_function.ts:3:17 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_arrow_function.ts:3:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -617,7 +638,4 @@ ts_decorator_on_arrow_function.ts:3:35 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -const method = (@dec x, second, @dec third = 'default') => {}; -const method = (@dec.fn() x, second, @dec.fn() third = 'default') => {}; -const method = (@dec() x, second, @dec() third = 'default') => {}; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_method.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_method.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_method.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_method.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_method.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_method.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_method.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_method.ts.snap index e013a5f71cb1..e9abdb26e989 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_method.ts.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + method(@dec x, second, @dec third = 'default') {} + method(@dec.fn() x, second, @dec.fn() third = 'default') {} + method(@dec() x, second, @dec() third = 'default') {} + static method(@dec x, second, @dec third = 'default') {} + static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + static method(@dec() x, second, @dec() third = 'default') {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -597,7 +619,11 @@ JsModule { ], eof_token: EOF@384..385 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..385 0: (empty) 1: (empty) @@ -988,7 +1014,12 @@ JsModule { 3: R_CURLY@381..382 "}" [] [] 9: R_CURLY@382..384 "}" [Newline("\n")] [] 4: EOF@384..385 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_on_class_method.ts:2:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1003,7 +1034,6 @@ ts_decorator_on_class_method.ts:2:12 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:2:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1018,7 +1048,6 @@ ts_decorator_on_class_method.ts:2:28 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1034,7 +1063,6 @@ ts_decorator_on_class_method.ts:3:12 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:3:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1050,7 +1078,6 @@ ts_decorator_on_class_method.ts:3:33 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:4:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1066,7 +1093,6 @@ ts_decorator_on_class_method.ts:4:12 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:4:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1082,7 +1108,6 @@ ts_decorator_on_class_method.ts:4:30 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:5:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1098,7 +1123,6 @@ ts_decorator_on_class_method.ts:5:19 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:5:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1114,7 +1138,6 @@ ts_decorator_on_class_method.ts:5:35 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:6:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1130,7 +1153,6 @@ ts_decorator_on_class_method.ts:6:19 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:6:40 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1146,7 +1168,6 @@ ts_decorator_on_class_method.ts:6:40 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:7:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1162,7 +1183,6 @@ ts_decorator_on_class_method.ts:7:19 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_method.ts:7:37 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -1178,12 +1198,4 @@ ts_decorator_on_class_method.ts:7:37 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- -class A { - method(@dec x, second, @dec third = 'default') {} - method(@dec.fn() x, second, @dec.fn() third = 'default') {} - method(@dec() x, second, @dec() third = 'default') {} - static method(@dec x, second, @dec third = 'default') {} - static method(@dec.fn() x, second, @dec.fn() third = 'default') {} - static method(@dec() x, second, @dec() third = 'default') {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_setter.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_setter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_setter.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_setter.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_setter.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_setter.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_setter.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_setter.ts.snap index 9f9ea5c9d5ec..23f140a9b864 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_class_setter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_class_setter.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + set val(@dec x) {} + set val(@dec.fn() x) {} + set val(@dec() x) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -150,7 +169,11 @@ JsModule { ], eof_token: EOF@87..88 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..88 0: (empty) 1: (empty) @@ -253,7 +276,12 @@ JsModule { 3: R_CURLY@84..85 "}" [] [] 9: R_CURLY@85..87 "}" [Newline("\n")] [] 4: EOF@87..88 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_on_class_setter.ts:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -268,7 +296,6 @@ ts_decorator_on_class_setter.ts:2:13 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_setter.ts:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -284,7 +311,6 @@ ts_decorator_on_class_setter.ts:3:13 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_decorator_on_class_setter.ts:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -300,9 +326,4 @@ ts_decorator_on_class_setter.ts:4:13 parse ━━━━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- -class A { - set val(@dec x) {} - set val(@dec.fn() x) {} - set val(@dec() x) {} -} +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.ts.snap index a5e71b5d4fe9..7352a5aaf35d 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_constructor_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_constructor_type.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type I = new(@dec x, second, @dec third = 'default') => string; +type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; +type I = abstract new(@dec() x, second, @dec() third = 'default') => string; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -291,7 +308,11 @@ JsModule { ], eof_token: EOF@223..224 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..224 0: (empty) 1: (empty) @@ -481,7 +502,12 @@ JsModule { 0: STRING_KW@216..222 "string" [] [] 5: SEMICOLON@222..223 ";" [] [] 4: EOF@223..224 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_on_constructor_type.ts:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -493,7 +519,6 @@ ts_decorator_on_constructor_type.ts:1:14 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_constructor_type.ts:1:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -505,7 +530,6 @@ ts_decorator_on_constructor_type.ts:1:30 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_constructor_type.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -518,7 +542,6 @@ ts_decorator_on_constructor_type.ts:2:23 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_constructor_type.ts:2:44 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -531,7 +554,6 @@ ts_decorator_on_constructor_type.ts:2:44 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_constructor_type.ts:3:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -544,7 +566,6 @@ ts_decorator_on_constructor_type.ts:3:23 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_constructor_type.ts:3:41 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -557,7 +578,4 @@ ts_decorator_on_constructor_type.ts:3:41 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -type I = new(@dec x, second, @dec third = 'default') => string; -type I = abstract new(@dec.fn() x, second, @dec.fn() third = 'default') => string; -type I = abstract new(@dec() x, second, @dec() third = 'default') => string; +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.ts.snap index e71f4cf2c02c..dd68ba5da85c 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_declaration.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function method(@dec x, second, @dec third = 'default') {} +function method(@dec.fn() x, second, @dec.fn() third = 'default') {} +function method(@dec() x, second, @dec() third = 'default') {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -285,7 +302,11 @@ JsModule { ], eof_token: EOF@190..191 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..191 0: (empty) 1: (empty) @@ -472,7 +493,12 @@ JsModule { 2: JS_STATEMENT_LIST@189..189 3: R_CURLY@189..190 "}" [] [] 4: EOF@190..191 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_on_function_declaration.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -484,7 +510,6 @@ ts_decorator_on_function_declaration.ts:1:17 parse ━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_declaration.ts:1:33 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -496,7 +521,6 @@ ts_decorator_on_function_declaration.ts:1:33 parse ━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_declaration.ts:2:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -509,7 +533,6 @@ ts_decorator_on_function_declaration.ts:2:17 parse ━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_declaration.ts:2:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -522,7 +545,6 @@ ts_decorator_on_function_declaration.ts:2:38 parse ━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_declaration.ts:3:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -535,7 +557,6 @@ ts_decorator_on_function_declaration.ts:3:17 parse ━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_declaration.ts:3:35 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -548,7 +569,4 @@ ts_decorator_on_function_declaration.ts:3:35 parse ━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -function method(@dec x, second, @dec third = 'default') {} -function method(@dec.fn() x, second, @dec.fn() third = 'default') {} -function method(@dec() x, second, @dec() third = 'default') {} +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.ts.snap index d9653f143a63..072b471ee8ce 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_expression.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +const expr = function method(@dec x, second, @dec third = 'default') {} +const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} +const expr = function method(@dec() x, second, @dec() third = 'default') {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -339,7 +356,11 @@ JsModule { ], eof_token: EOF@229..230 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..230 0: (empty) 1: (empty) @@ -562,7 +583,12 @@ JsModule { 3: R_CURLY@228..229 "}" [] [] 1: (empty) 4: EOF@229..230 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_on_function_expression.ts:1:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -574,7 +600,6 @@ ts_decorator_on_function_expression.ts:1:30 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_expression.ts:1:46 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -586,7 +611,6 @@ ts_decorator_on_function_expression.ts:1:46 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_expression.ts:2:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -599,7 +623,6 @@ ts_decorator_on_function_expression.ts:2:30 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_expression.ts:2:51 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -612,7 +635,6 @@ ts_decorator_on_function_expression.ts:2:51 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_expression.ts:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -625,7 +647,6 @@ ts_decorator_on_function_expression.ts:3:30 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_expression.ts:3:48 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -638,7 +659,4 @@ ts_decorator_on_function_expression.ts:3:48 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -const expr = function method(@dec x, second, @dec third = 'default') {} -const expr = function method(@dec.fn() x, second, @dec.fn() third = 'default') {} -const expr = function method(@dec() x, second, @dec() third = 'default') {} +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.ts.snap index de9b6a155dd4..f96019f31a88 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_function_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_function_type.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type I = (@dec x, second, @dec third = 'default') => string; +type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; +type I = (@dec() x, second, @dec() third = 'default') => string; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -288,7 +305,11 @@ JsModule { ], eof_token: EOF@196..197 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..197 0: (empty) 1: (empty) @@ -472,7 +493,12 @@ JsModule { 14: JS_EMPTY_STATEMENT@195..196 0: SEMICOLON@195..196 ";" [] [] 4: EOF@196..197 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_on_function_type.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type but instead found '@'. @@ -489,7 +515,6 @@ ts_decorator_on_function_type.ts:1:11 parse ━━━━━━━━━━━━ 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; --- ts_decorator_on_function_type.ts:1:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -501,7 +526,6 @@ ts_decorator_on_function_type.ts:1:27 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_type.ts:1:49 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -525,7 +549,6 @@ ts_decorator_on_function_type.ts:1:49 parse ━━━━━━━━━━━━ 2 │ type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; --- ts_decorator_on_function_type.ts:2:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type but instead found '@'. @@ -544,7 +567,6 @@ ts_decorator_on_function_type.ts:2:11 parse ━━━━━━━━━━━━ 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; 4 │ --- ts_decorator_on_function_type.ts:2:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -557,7 +579,6 @@ ts_decorator_on_function_type.ts:2:32 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_type.ts:2:59 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -584,7 +605,6 @@ ts_decorator_on_function_type.ts:2:59 parse ━━━━━━━━━━━━ 3 │ type I = (@dec() x, second, @dec() third = 'default') => string; 4 │ --- ts_decorator_on_function_type.ts:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type but instead found '@'. @@ -603,7 +623,6 @@ ts_decorator_on_function_type.ts:3:11 parse ━━━━━━━━━━━━ │ ^ 4 │ --- ts_decorator_on_function_type.ts:3:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -616,7 +635,6 @@ ts_decorator_on_function_type.ts:3:29 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_function_type.ts:3:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -643,7 +661,4 @@ ts_decorator_on_function_type.ts:3:53 parse ━━━━━━━━━━━━ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 │ --- -type I = (@dec x, second, @dec third = 'default') => string; -type I = (@dec.fn() x, second, @dec.fn() third = 'default') => string; -type I = (@dec() x, second, @dec() third = 'default') => string; +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.ts.snap index bce3f113090e..b3ff807803c3 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_on_signature_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_on_signature_member.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = {new (@dec x, second, @dec third = 'default'): string; } +type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } +type C = { + new(@dec() x, second, @dec() third = 'default'): string; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -318,7 +336,11 @@ JsModule { ], eof_token: EOF@212..213 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..213 0: (empty) 1: (empty) @@ -525,7 +547,12 @@ JsModule { 2: (empty) 5: (empty) 4: EOF@212..213 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_on_signature_member.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -537,7 +564,6 @@ ts_decorator_on_signature_member.ts:1:16 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_signature_member.ts:1:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -549,7 +575,6 @@ ts_decorator_on_signature_member.ts:1:32 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_signature_member.ts:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -562,7 +587,6 @@ ts_decorator_on_signature_member.ts:2:18 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_signature_member.ts:2:39 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -575,7 +599,6 @@ ts_decorator_on_signature_member.ts:2:39 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_signature_member.ts:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -588,7 +611,6 @@ ts_decorator_on_signature_member.ts:4:6 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_signature_member.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -601,7 +623,6 @@ ts_decorator_on_signature_member.ts:4:24 parse ━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_on_signature_member.ts:5:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead the file ends @@ -618,8 +639,4 @@ ts_decorator_on_signature_member.ts:5:1 parse ━━━━━━━━━━━ > 5 │ │ --- -type A = {new (@dec x, second, @dec third = 'default'): string; } -type B = {method(@dec.fn() x, second, @dec.fn() third = 'default'): string; } -type C = { - new(@dec() x, second, @dec() third = 'default'): string; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_setter_signature.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_setter_signature.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_setter_signature.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_setter_signature.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_setter_signature.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_setter_signature.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_setter_signature.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_setter_signature.ts.snap index 5d4bddcfeb08..61ed7f4f14b2 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_setter_signature.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_setter_signature.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { set a(@dec b: number) } +type B = { set a(@dec(val) b) } +type AA = { set a(@dec b: number) } +type BB = { set a(@dec(val) b) } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -224,7 +242,11 @@ JsModule { ], eof_token: EOF@135..136 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..136 0: (empty) 1: (empty) @@ -371,7 +393,12 @@ JsModule { 2: R_CURLY@134..135 "}" [] [] 5: (empty) 4: EOF@135..136 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_setter_signature.ts:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -383,7 +410,6 @@ ts_decorator_setter_signature.ts:1:18 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_setter_signature.ts:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -396,7 +422,6 @@ ts_decorator_setter_signature.ts:2:18 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_setter_signature.ts:3:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -410,7 +435,6 @@ ts_decorator_setter_signature.ts:3:19 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_setter_signature.ts:4:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -423,8 +447,4 @@ ts_decorator_setter_signature.ts:4:19 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -type A = { set a(@dec b: number) } -type B = { set a(@dec(val) b) } -type AA = { set a(@dec b: number) } -type BB = { set a(@dec(val) b) } +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.ts.snap index 52739a59b219..0d8dd2a3c1f6 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + method(@dec this) {} + method(@dec(val) this) {} + method(@dec.fn(val) this) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -177,7 +196,11 @@ JsModule { ], eof_token: EOF@93..94 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..94 0: (empty) 1: (empty) @@ -286,7 +309,12 @@ JsModule { 3: R_CURLY@90..91 "}" [] [] 9: R_CURLY@91..93 "}" [Newline("\n")] [] 4: EOF@93..94 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_this_parameter.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -299,7 +327,6 @@ ts_decorator_this_parameter.ts:2:10 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_this_parameter.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -313,7 +340,6 @@ ts_decorator_this_parameter.ts:3:10 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_this_parameter.ts:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -327,9 +353,4 @@ ts_decorator_this_parameter.ts:4:10 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -class A { - method(@dec this) {} - method(@dec(val) this) {} - method(@dec.fn(val) this) {} -} +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.ts.snap index c2fd38c3602e..47d38ba913f7 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_decorator_this_parameter_option.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_decorator_this_parameter_option.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + method(@dec this) {} + method(@dec(val) this) {} + method(@dec.fn(val) this) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -177,7 +196,11 @@ JsModule { ], eof_token: EOF@93..94 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..94 0: (empty) 1: (empty) @@ -286,7 +309,12 @@ JsModule { 3: R_CURLY@90..91 "}" [] [] 9: R_CURLY@91..93 "}" [Newline("\n")] [] 4: EOF@93..94 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_decorator_this_parameter_option.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -299,7 +327,6 @@ ts_decorator_this_parameter_option.ts:2:10 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_this_parameter_option.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -313,7 +340,6 @@ ts_decorator_this_parameter_option.ts:3:10 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_decorator_this_parameter_option.ts:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -327,9 +353,4 @@ ts_decorator_this_parameter_option.ts:4:10 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -class A { - method(@dec this) {} - method(@dec(val) this) {} - method(@dec.fn(val) this) {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts.snap index 3598496a7536..a4508e6ea7bd 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_definite_assignment_in_ambient_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_assignment_in_ambient_context.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { prop!: string } +class B { declare prop!: string } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -77,7 +93,11 @@ JsModule { ], eof_token: EOF@67..68 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..68 0: (empty) 1: (empty) @@ -132,7 +152,12 @@ JsModule { 0: STRING_KW@59..66 "string" [] [Whitespace(" ")] 9: R_CURLY@66..67 "}" [] [] 4: EOF@67..68 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_definite_assignment_in_ambient_context.ts:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Definite assignment operators '!' aren't allowed in ambient contexts. @@ -142,7 +167,6 @@ ts_definite_assignment_in_ambient_context.ts:1:23 parse ━━━━━━━━ 2 │ class B { declare prop!: string } 3 │ --- ts_definite_assignment_in_ambient_context.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Definite assignment operators '!' aren't allowed in ambient contexts. @@ -152,6 +176,4 @@ ts_definite_assignment_in_ambient_context.ts:2:23 parse ━━━━━━━━ │ ^ 3 │ --- -declare class A { prop!: string } -class B { declare prop!: string } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_variable_with_initializer.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_definite_variable_with_initializer.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_variable_with_initializer.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_definite_variable_with_initializer.ts.snap index a474db6a2804..d763f9d72c7f 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_definite_variable_with_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_definite_variable_with_initializer.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a!: string = "test"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -35,7 +50,11 @@ JsModule { ], eof_token: EOF@24..25 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..25 0: (empty) 1: (empty) @@ -61,7 +80,12 @@ JsModule { 0: JS_STRING_LITERAL@17..23 "\"test\"" [] [] 1: SEMICOLON@23..24 ";" [] [] 4: EOF@24..25 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_definite_variable_with_initializer.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Declarations with initializers cannot also have definite assignment assertions. @@ -76,5 +100,4 @@ ts_definite_variable_with_initializer.ts:1:16 parse ━━━━━━━━━ │ ^^^^^^^^^ 2 │ --- -let a!: string = "test"; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_declare.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_declare.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_export_declare.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_declare.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_declare.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_declare.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_export_declare.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_declare.ts.snap index dcc3360802a3..af7ab3919c5f 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_export_declare.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_declare.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export declare @decorator class D {} +export declare @decorator abstract class D {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -80,7 +96,11 @@ JsModule { ], eof_token: EOF@82..83 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..83 0: (empty) 1: (empty) @@ -133,7 +153,12 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@81..81 9: R_CURLY@81..82 "}" [] [] 4: EOF@82..83 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_export_declare.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -145,7 +170,6 @@ ts_export_declare.ts:1:16 parse ━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_export_declare.ts:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -157,6 +181,4 @@ ts_export_declare.ts:2:16 parse ━━━━━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -export declare @decorator class D {} -export declare @decorator abstract class D {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_default_enum.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_default_enum.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_export_default_enum.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_default_enum.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_default_enum.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_default_enum.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_export_default_enum.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_default_enum.ts.snap index fcac7f7e43b5..0431a483fe15 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_export_default_enum.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_default_enum.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default enum A { X, Y, Z } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -48,7 +63,11 @@ JsModule { ], eof_token: EOF@33..34 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..34 0: (empty) 1: (empty) @@ -82,7 +101,12 @@ JsModule { 1: (empty) 5: R_CURLY@32..33 "}" [] [] 4: EOF@33..34 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_export_default_enum.ts:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'export default' isn't allowed for 'enum's. Move the 'enum' declaration in its own statement and then export the enum's name. @@ -91,5 +115,4 @@ ts_export_default_enum.ts:1:16 parse ━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^^^^^^^ 2 │ --- -export default enum A { X, Y, Z } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_syntax_in_js.js b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_syntax_in_js.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_export_syntax_in_js.js rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_syntax_in_js.js diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_syntax_in_js.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_syntax_in_js.js.snap index 1f0a674706fa..8c99861da541 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_export_syntax_in_js.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_syntax_in_js.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a, b, c; +export type { a }; +export { type b }; +export { type c as cc }; +export type { d } from "./d"; +export { type e } from "./e"; +export { type e as ee } from "./e"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -205,7 +226,11 @@ JsModule { ], eof_token: EOF@171..172 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..172 0: (empty) 1: (empty) @@ -326,7 +351,12 @@ JsModule { 0: JS_STRING_LITERAL@165..170 "\"./e\"" [] [] 5: SEMICOLON@170..171 ";" [] [] 4: EOF@171..172 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_export_syntax_in_js.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'export type' declarations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -339,7 +369,6 @@ ts_export_syntax_in_js.js:2:8 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- ts_export_syntax_in_js.js:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × export { type ident }' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -353,7 +382,6 @@ ts_export_syntax_in_js.js:3:10 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- ts_export_syntax_in_js.js:4:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × export { type ident }' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -367,7 +395,6 @@ ts_export_syntax_in_js.js:4:10 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- ts_export_syntax_in_js.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'export type' declarations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -381,7 +408,6 @@ ts_export_syntax_in_js.js:5:8 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- ts_export_syntax_in_js.js:6:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × export { type ident }'' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -395,7 +421,6 @@ ts_export_syntax_in_js.js:6:10 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- ts_export_syntax_in_js.js:7:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × export { type ident }'' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -408,11 +433,4 @@ ts_export_syntax_in_js.js:7:10 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- -let a, b, c; -export type { a }; -export { type b }; -export { type c as cc }; -export type { d } from "./d"; -export { type e } from "./e"; -export { type e as ee } from "./e"; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_type.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_export_type.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_type.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_export_type.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_type.ts.snap similarity index 91% rename from crates/biome_js_parser/test_data/inline/err/ts_export_type.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_export_type.ts.snap index 34583ce5341f..33a4d086c4bb 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_export_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_export_type.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export type + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -19,7 +34,11 @@ JsModule { ], eof_token: EOF@11..12 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..12 0: (empty) 1: (empty) @@ -35,7 +54,12 @@ JsModule { 0: IDENT@7..11 "type" [] [] 1: (empty) 4: EOF@11..12 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_export_type.ts:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration but instead found 'type'. @@ -50,5 +74,4 @@ ts_export_type.ts:1:8 parse ━━━━━━━━━━━━━━━━━ │ ^^^^ 2 │ --- -export type +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_extends_trailing_comma.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_extends_trailing_comma.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_extends_trailing_comma.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_extends_trailing_comma.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_extends_trailing_comma.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_extends_trailing_comma.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_extends_trailing_comma.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_extends_trailing_comma.ts.snap index 5012a9f9e089..b085a281534c 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_extends_trailing_comma.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_extends_trailing_comma.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A {} +interface B extends A, {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -40,7 +56,11 @@ JsModule { ], eof_token: EOF@40..41 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..41 0: (empty) 1: (empty) @@ -73,7 +93,12 @@ JsModule { 5: TS_TYPE_MEMBER_LIST@39..39 6: R_CURLY@39..40 "}" [] [] 4: EOF@40..41 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_extends_trailing_comma.ts:2:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Trailing comma not allowed. @@ -83,6 +108,4 @@ ts_extends_trailing_comma.ts:2:22 parse ━━━━━━━━━━━━━ │ ^ 3 │ --- -interface A {} -interface B extends A, {} +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.options.json b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.ts.snap index cfdab3adde40..3a9c029444b9 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a(@dec x) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -47,7 +62,11 @@ JsModule { ], eof_token: EOF@21..22 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..22 0: (empty) 1: (empty) @@ -80,7 +99,12 @@ JsModule { 2: JS_STATEMENT_LIST@20..20 3: R_CURLY@20..21 "}" [] [] 4: EOF@21..22 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_formal_parameter_decorator.ts:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -91,5 +115,4 @@ ts_formal_parameter_decorator.ts:1:12 parse ━━━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -function a(@dec x) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator_option.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator_option.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator_option.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator_option.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts.snap index dda25418d6ac..efefd5577e6c 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_decorator_option.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_decorator_option.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Foo { + constructor(@dec x) {} + method(@dec x) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -100,7 +118,11 @@ JsModule { ], eof_token: EOF@60..61 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..61 0: (empty) 1: (empty) @@ -168,7 +190,12 @@ JsModule { 3: R_CURLY@57..58 "}" [] [] 9: R_CURLY@58..60 "}" [Newline("\n")] [] 4: EOF@60..61 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_formal_parameter_decorator_option.ts:2:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -183,7 +210,6 @@ ts_formal_parameter_decorator_option.ts:2:16 parse ━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- ts_formal_parameter_decorator_option.ts:3:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -199,8 +225,4 @@ ts_formal_parameter_decorator_option.ts:3:11 parse ━━━━━━━━━ i You can enable parameter decorators by setting the `unsafeParameterDecoratorsEnabled` option to `true` in your configuration file. --- -class Foo { - constructor(@dec x) {} - method(@dec x) {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_error.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_error.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_error.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_error.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_error.ts.snap index 1ab3957c2216..7a684b4212c6 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_formal_parameter_error.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_formal_parameter_error.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a(x?: string = "test") {} +function b(...rest: string[] = "init") {} +function c(...rest, b: string) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -140,7 +157,11 @@ JsModule { ], eof_token: EOF@110..111 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..111 0: (empty) 1: (empty) @@ -243,7 +264,12 @@ JsModule { 2: JS_STATEMENT_LIST@109..109 3: R_CURLY@109..110 "}" [] [] 4: EOF@110..111 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_formal_parameter_error.ts:1:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Parameter cannot have question mark and initializer @@ -253,7 +279,6 @@ ts_formal_parameter_error.ts:1:23 parse ━━━━━━━━━━━━━ 2 │ function b(...rest: string[] = "init") {} 3 │ function c(...rest, b: string) {} --- ts_formal_parameter_error.ts:2:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest elements may not have default initializers @@ -264,7 +289,6 @@ ts_formal_parameter_error.ts:2:30 parse ━━━━━━━━━━━━━ 3 │ function c(...rest, b: string) {} 4 │ --- ts_formal_parameter_error.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × rest elements may not have trailing commas @@ -275,7 +299,4 @@ ts_formal_parameter_error.ts:3:12 parse ━━━━━━━━━━━━━ │ ^^^^^^^ 4 │ --- -function a(x?: string = "test") {} -function b(...rest: string[] = "init") {} -function c(...rest, b: string) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_function_overload_generator.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_overload_generator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_function_overload_generator.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_function_overload_generator.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_function_overload_generator.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_overload_generator.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_function_overload_generator.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_function_overload_generator.ts.snap index 5e074872e63c..7cbf0d0f0a25 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_function_overload_generator.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_overload_generator.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function* test(a: string); +function* test(a: string) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -72,7 +88,11 @@ JsModule { ], eof_token: EOF@55..56 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..56 0: (empty) 1: (empty) @@ -126,7 +146,12 @@ JsModule { 2: JS_STATEMENT_LIST@54..54 3: R_CURLY@54..55 "}" [] [] 4: EOF@55..56 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_function_overload_generator.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An overload signature cannot be declared as a generator. @@ -136,6 +161,4 @@ ts_function_overload_generator.ts:1:9 parse ━━━━━━━━━━━━ 2 │ function* test(a: string) {} 3 │ --- -function* test(a: string); -function* test(a: string) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_function_type_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_type_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_function_type_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_function_type_err.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_function_type_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_type_err.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_function_type_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_function_type_err.ts.snap index f10ba8a867d1..83720bc0b869 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_function_type_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_function_type_err.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type G = <>(a: A, b: B) => string + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -67,7 +82,11 @@ JsModule { ], eof_token: EOF@33..34 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..34 0: (empty) 1: (empty) @@ -118,7 +137,12 @@ JsModule { 0: STRING_KW@27..33 "string" [] [] 5: (empty) 4: EOF@33..34 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_function_type_err.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -133,5 +157,4 @@ ts_function_type_err.ts:1:11 parse ━━━━━━━━━━━━━━━ │ ^ 2 │ --- -type G = <>(a: A, b: B) => string +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters.ts.snap index 5de85027c479..b12f0b29f8ca 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + get a(): A {} + set a(value: A) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -109,7 +127,11 @@ JsModule { ], eof_token: EOF@55..56 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..56 0: (empty) 1: (empty) @@ -190,7 +212,12 @@ JsModule { 3: R_CURLY@52..53 "}" [] [] 9: R_CURLY@53..55 "}" [Newline("\n")] [] 4: EOF@55..56 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_getter_setter_type_parameters.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An accessor cannot have type parameters. @@ -201,7 +228,6 @@ ts_getter_setter_type_parameters.ts:2:7 parse ━━━━━━━━━━━ 3 │ set a(value: A) {} 4 │ } --- ts_getter_setter_type_parameters.ts:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An accessor cannot have type parameters. @@ -213,8 +239,4 @@ ts_getter_setter_type_parameters.ts:3:7 parse ━━━━━━━━━━━ 4 │ } 5 │ --- -class Test { - get a(): A {} - set a(value: A) {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters_errors.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters_errors.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters_errors.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters_errors.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts.snap index 7fc27bfa86a0..39bbeb333e97 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_getter_setter_type_parameters_errors.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_getter_setter_type_parameters_errors.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + get a<>(): A {} + set a<>(value: A) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -91,7 +109,11 @@ JsModule { ], eof_token: EOF@53..54 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..54 0: (empty) 1: (empty) @@ -160,7 +182,12 @@ JsModule { 3: R_CURLY@50..51 "}" [] [] 9: R_CURLY@51..53 "}" [Newline("\n")] [] 4: EOF@53..54 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_getter_setter_type_parameters_errors.ts:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -179,7 +206,6 @@ ts_getter_setter_type_parameters_errors.ts:2:8 parse ━━━━━━━━━ 3 │ set a<>(value: A) {} 4 │ } --- ts_getter_setter_type_parameters_errors.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An accessor cannot have type parameters. @@ -190,7 +216,6 @@ ts_getter_setter_type_parameters_errors.ts:2:7 parse ━━━━━━━━━ 3 │ set a<>(value: A) {} 4 │ } --- ts_getter_setter_type_parameters_errors.ts:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -211,7 +236,6 @@ ts_getter_setter_type_parameters_errors.ts:3:8 parse ━━━━━━━━━ 4 │ } 5 │ --- ts_getter_setter_type_parameters_errors.ts:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An accessor cannot have type parameters. @@ -223,8 +247,4 @@ ts_getter_setter_type_parameters_errors.ts:3:7 parse ━━━━━━━━━ 4 │ } 5 │ --- -class Test { - get a<>(): A {} - set a<>(value: A) {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts.snap index 945f590ae58f..9e63969625c9 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_abstract.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_abstract.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { + abstract [a: number]: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -52,7 +69,11 @@ JsModule { ], eof_token: EOF@54..55 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..55 0: (empty) 1: (empty) @@ -89,7 +110,12 @@ JsModule { 5: SEMICOLON@51..52 ";" [] [] 9: R_CURLY@52..54 "}" [Newline("\n")] [] 4: EOF@54..55 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_index_signature_class_member_cannot_be_abstract.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' modifier cannot appear on an index signature. @@ -100,7 +126,4 @@ ts_index_signature_class_member_cannot_be_abstract.ts:2:5 parse ━━━━━ 3 │ } 4 │ --- -abstract class A { - abstract [a: number]: string; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts.snap index 7893cf90ddc0..e7de0f6185bf 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_be_accessor.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_be_accessor.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { + accessor [a: number]: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -52,7 +69,11 @@ JsModule { ], eof_token: EOF@54..55 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..55 0: (empty) 1: (empty) @@ -89,7 +110,12 @@ JsModule { 5: SEMICOLON@51..52 ";" [] [] 9: R_CURLY@52..54 "}" [Newline("\n")] [] 4: EOF@54..55 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_index_signature_class_member_cannot_be_accessor.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'accessor' modifier cannot appear on an index signature. @@ -100,7 +126,4 @@ ts_index_signature_class_member_cannot_be_accessor.ts:2:5 parse ━━━━━ 3 │ } 4 │ --- -abstract class A { - accessor [a: number]: string; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts.snap index fb99d8e3fb9e..27da0f717b21 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_cannot_have_visibility_modifiers.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_cannot_have_visibility_modifiers.ts.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + public [a: number]: string; +} +class B { + private [a: number]: string; +} +class C { + protected [a: number]: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -144,7 +167,11 @@ JsModule { ], eof_token: EOF@138..139 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..139 0: (empty) 1: (empty) @@ -241,7 +268,12 @@ JsModule { 5: SEMICOLON@135..136 ";" [] [] 9: R_CURLY@136..138 "}" [Newline("\n")] [] 4: EOF@138..139 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━ × 'public' modifier cannot appear on an index signature. @@ -252,7 +284,6 @@ ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:2:5 parse 3 │ } 4 │ class B { --- ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━ × 'private' modifier cannot appear on an index signature. @@ -264,7 +295,6 @@ ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:5:5 parse 6 │ } 7 │ class C { --- ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:8:5 parse ━━━━━━━━━━━━━━━━━━━━━━ × 'protected' modifier cannot appear on an index signature. @@ -276,13 +306,4 @@ ts_index_signature_class_member_cannot_have_visibility_modifiers.ts:8:5 parse 9 │ } 10 │ --- -class A { - public [a: number]: string; -} -class B { - private [a: number]: string; -} -class C { - protected [a: number]: string; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts.snap index 39132728aeed..0046fa04d94d 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_class_member_static_readonly_precedence.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_class_member_static_readonly_precedence.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + readonly static [a: number]: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -53,7 +70,11 @@ JsModule { ], eof_token: EOF@52..53 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..53 0: (empty) 1: (empty) @@ -92,7 +113,12 @@ JsModule { 5: SEMICOLON@49..50 ";" [] [] 9: R_CURLY@50..52 "}" [Newline("\n")] [] 4: EOF@52..53 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_index_signature_class_member_static_readonly_precedence.ts:2:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'static' must precede 'readonly' @@ -119,7 +145,4 @@ ts_index_signature_class_member_static_readonly_precedence.ts:2:14 parse ━━ 3 │ } 4 │ --- -class A { - readonly static [a: number]: string; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts.snap index 17b523506df3..92228c7bf475 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_be_static.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_be_static.ts.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A { + static [index: string]: string +} +interface B { + public [index: string]: string +} +interface C { + private [index: string]: string +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -120,7 +143,11 @@ JsModule { ], eof_token: EOF@153..154 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..154 0: (empty) 1: (empty) @@ -193,7 +220,12 @@ JsModule { 0: STRING_KW@145..151 "string" [] [] 4: R_CURLY@151..153 "}" [Newline("\n")] [] 4: EOF@153..154 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_index_signature_interface_member_cannot_be_static.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × index signature members cannot be static @@ -204,7 +236,6 @@ ts_index_signature_interface_member_cannot_be_static.ts:2:5 parse ━━━━ 3 │ } 4 │ interface B { --- ts_index_signature_interface_member_cannot_be_static.ts:5:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × index signature members cannot be public @@ -216,7 +247,6 @@ ts_index_signature_interface_member_cannot_be_static.ts:5:5 parse ━━━━ 6 │ } 7 │ interface C { --- ts_index_signature_interface_member_cannot_be_static.ts:8:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × index signature members cannot be private @@ -228,13 +258,4 @@ ts_index_signature_interface_member_cannot_be_static.ts:8:5 parse ━━━━ 9 │ } 10 │ --- -interface A { - static [index: string]: string -} -interface B { - public [index: string]: string -} -interface C { - private [index: string]: string -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts.snap index 1c5b93ac1b65..87a51cb6e718 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_index_signature_interface_member_cannot_have_visibility_modifiers.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A { + public [a: number]: string; +} +interface B { + private [a: number]: string; +} +interface C { + protected [a: number]: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -123,7 +146,11 @@ JsModule { ], eof_token: EOF@150..151 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..151 0: (empty) 1: (empty) @@ -199,7 +226,12 @@ JsModule { 5: SEMICOLON@147..148 ";" [] [] 4: R_CURLY@148..150 "}" [Newline("\n")] [] 4: EOF@150..151 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:2:5 parse ━━━━━━━━━━━━━━━━━━ × index signature members cannot be public @@ -210,7 +242,6 @@ ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:2:5 pars 3 │ } 4 │ interface B { --- ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:5:5 parse ━━━━━━━━━━━━━━━━━━ × index signature members cannot be private @@ -222,7 +253,6 @@ ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:5:5 pars 6 │ } 7 │ interface C { --- ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:8:5 parse ━━━━━━━━━━━━━━━━━━ × index signature members cannot be protected @@ -234,13 +264,4 @@ ts_index_signature_interface_member_cannot_have_visibility_modifiers.ts:8:5 pars 9 │ } 10 │ --- -interface A { - public [a: number]: string; -} -interface B { - private [a: number]: string; -} -interface C { - protected [a: number]: string; -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_infer_type_not_allowed.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_infer_type_not_allowed.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_infer_type_not_allowed.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_infer_type_not_allowed.ts.snap index a512341adea4..4b007f645817 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_infer_type_not_allowed.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_infer_type_not_allowed.ts.snap @@ -1,3 +1,30 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type WithSelectors = S extends { getState: () => infer T } + ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } + : never; +type TV1 = `${infer X}`; +type T61 = (infer A) extends infer B ? infer C : infer D; +type A = {a: infer T} +type A = () => infer T; +let s: (infer string)[] = symbol(); +let s: unique (infer string); +let s: [number, ...infer string] +let s: [(infer string)?] +let s: (infer string)[a] +let s: a[(infer string)] + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -535,7 +562,11 @@ JsModule { ], eof_token: EOF@438..439 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..439 0: (empty) 1: (empty) @@ -897,7 +928,12 @@ JsModule { 2: (empty) 1: (empty) 4: EOF@438..439 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_infer_type_not_allowed.ts:2:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -908,7 +944,6 @@ ts_infer_type_not_allowed.ts:2:26 parse ━━━━━━━━━━━━━ 3 │ : never; 4 │ type TV1 = `${infer X}`; --- ts_infer_type_not_allowed.ts:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -920,7 +955,6 @@ ts_infer_type_not_allowed.ts:4:15 parse ━━━━━━━━━━━━━ 5 │ type T61 = (infer A) extends infer B ? infer C : infer D; 6 │ type A = {a: infer T} --- ts_infer_type_not_allowed.ts:5:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -932,7 +966,6 @@ ts_infer_type_not_allowed.ts:5:16 parse ━━━━━━━━━━━━━ 6 │ type A = {a: infer T} 7 │ type A = () => infer T; --- ts_infer_type_not_allowed.ts:5:43 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -944,7 +977,6 @@ ts_infer_type_not_allowed.ts:5:43 parse ━━━━━━━━━━━━━ 6 │ type A = {a: infer T} 7 │ type A = () => infer T; --- ts_infer_type_not_allowed.ts:5:53 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -956,7 +988,6 @@ ts_infer_type_not_allowed.ts:5:53 parse ━━━━━━━━━━━━━ 6 │ type A = {a: infer T} 7 │ type A = () => infer T; --- ts_infer_type_not_allowed.ts:6:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -968,7 +999,6 @@ ts_infer_type_not_allowed.ts:6:14 parse ━━━━━━━━━━━━━ 7 │ type A = () => infer T; 8 │ let s: (infer string)[] = symbol(); --- ts_infer_type_not_allowed.ts:7:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -980,7 +1010,6 @@ ts_infer_type_not_allowed.ts:7:16 parse ━━━━━━━━━━━━━ 8 │ let s: (infer string)[] = symbol(); 9 │ let s: unique (infer string); --- ts_infer_type_not_allowed.ts:8:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -992,7 +1021,6 @@ ts_infer_type_not_allowed.ts:8:9 parse ━━━━━━━━━━━━━ 9 │ let s: unique (infer string); 10 │ let s: [number, ...infer string] --- ts_infer_type_not_allowed.ts:9:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -1004,7 +1032,6 @@ ts_infer_type_not_allowed.ts:9:16 parse ━━━━━━━━━━━━━ 10 │ let s: [number, ...infer string] 11 │ let s: [(infer string)?] --- ts_infer_type_not_allowed.ts:10:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -1016,7 +1043,6 @@ ts_infer_type_not_allowed.ts:10:20 parse ━━━━━━━━━━━━━ 11 │ let s: [(infer string)?] 12 │ let s: (infer string)[a] --- ts_infer_type_not_allowed.ts:11:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -1028,7 +1054,6 @@ ts_infer_type_not_allowed.ts:11:10 parse ━━━━━━━━━━━━━ 12 │ let s: (infer string)[a] 13 │ let s: a[(infer string)] --- ts_infer_type_not_allowed.ts:12:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -1040,7 +1065,6 @@ ts_infer_type_not_allowed.ts:12:9 parse ━━━━━━━━━━━━━ 13 │ let s: a[(infer string)] 14 │ --- ts_infer_type_not_allowed.ts:13:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'infer' declarations are only permitted in the 'extends' clause of a conditional type. @@ -1051,17 +1075,4 @@ ts_infer_type_not_allowed.ts:13:11 parse ━━━━━━━━━━━━━ │ ^^^^^^^^^^^^ 14 │ --- -type WithSelectors = S extends { getState: () => infer T } - ? { use: { [K in keyof infer /*error*/ T]: () => T[K] } } - : never; -type TV1 = `${infer X}`; -type T61 = (infer A) extends infer B ? infer C : infer D; -type A = {a: infer T} -type A = () => infer T; -let s: (infer string)[] = symbol(); -let s: unique (infer string); -let s: [number, ...infer string] -let s: [(infer string)?] -let s: (infer string)[a] -let s: a[(infer string)] +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expression_property_access.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expression_property_access.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_instantiation_expression_property_access.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expression_property_access.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expression_property_access.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expression_property_access.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_instantiation_expression_property_access.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expression_property_access.ts.snap index d04ee0e60cf2..b10067702817 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expression_property_access.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expression_property_access.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +f.c; +f?.c; +a?.f.d; +f.g; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -138,7 +156,11 @@ JsModule { ], eof_token: EOF@38..39 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..39 0: (empty) 1: (empty) @@ -230,7 +252,12 @@ JsModule { 2: R_ANGLE@36..37 ">" [] [] 1: SEMICOLON@37..38 ";" [] [] 4: EOF@38..39 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_instantiation_expression_property_access.ts:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An instantiation expression cannot be followed by a property access. @@ -242,7 +269,6 @@ ts_instantiation_expression_property_access.ts:1:1 parse ━━━━━━━ i You can either wrap the instantiation expression in parentheses, or delete the type arguments. --- ts_instantiation_expression_property_access.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An instantiation expression cannot be followed by a property access. @@ -255,7 +281,6 @@ ts_instantiation_expression_property_access.ts:2:1 parse ━━━━━━━ i You can either wrap the instantiation expression in parentheses, or delete the type arguments. --- ts_instantiation_expression_property_access.ts:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An instantiation expression cannot be followed by a property access. @@ -269,7 +294,6 @@ ts_instantiation_expression_property_access.ts:3:1 parse ━━━━━━━ i You can either wrap the instantiation expression in parentheses, or delete the type arguments. --- ts_instantiation_expression_property_access.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An instantiation expression cannot be followed by a property access. @@ -282,8 +306,4 @@ ts_instantiation_expression_property_access.ts:4:1 parse ━━━━━━━ i You can either wrap the instantiation expression in parentheses, or delete the type arguments. --- -f.c; -f?.c; -a?.f.d; -f.g; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expressions_1.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expressions_1.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expressions_1.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expressions_1.ts.snap index b0ff4b61f0cf..8fc811e75262 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_instantiation_expressions_1.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_instantiation_expressions_1.ts.snap @@ -1,3 +1,41 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +const a8 = f; // Relational operator error +const b1 = f?.; // Error, `(` expected +f << f; +f = g; +f >> f; +f >= f; +f < f; +f > f; +f import<1>; +f yield; +f ++; +f --; +f /= 1; +f <= f; +f +[]; +f +as {}; +f +satisfies {}; +class C5 { + protected specialFoo = f #bar = 123 +} +for (const a = b.test in []) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -760,7 +798,11 @@ JsModule { ], eof_token: EOF@401..402 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..402 0: (empty) 1: (empty) @@ -1256,7 +1298,12 @@ JsModule { 1: JS_STATEMENT_LIST@400..400 2: R_CURLY@400..401 "}" [] [] 4: EOF@401..402 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_instantiation_expressions_1.ts:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ';'. @@ -1273,7 +1320,6 @@ ts_instantiation_expressions_1.ts:1:29 parse ━━━━━━━━━━━ 2 │ const b1 = f?.; // Error, `(` expected 3 │ f << f; --- ts_instantiation_expressions_1.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `;` @@ -1286,7 +1332,6 @@ ts_instantiation_expressions_1.ts:2:23 parse ━━━━━━━━━━━ i Remove ; --- ts_instantiation_expressions_1.ts:3:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `<` @@ -1300,7 +1345,6 @@ ts_instantiation_expressions_1.ts:3:10 parse ━━━━━━━━━━━ i Remove < --- ts_instantiation_expressions_1.ts:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a parenthesis '(' but instead found ';'. @@ -1321,7 +1365,6 @@ ts_instantiation_expressions_1.ts:3:13 parse ━━━━━━━━━━━ 4 │ f = g; 5 │ f >> f; --- ts_instantiation_expressions_1.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `f` @@ -1335,7 +1378,6 @@ ts_instantiation_expressions_1.ts:4:1 parse ━━━━━━━━━━━━ i This expression cannot be assigned to --- ts_instantiation_expressions_1.ts:5:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression for the left hand side of the `>>` operator. @@ -1349,7 +1391,6 @@ ts_instantiation_expressions_1.ts:5:6 parse ━━━━━━━━━━━━ i This operator requires a left hand side value --- ts_instantiation_expressions_1.ts:6:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '>='. @@ -1370,7 +1411,6 @@ ts_instantiation_expressions_1.ts:6:6 parse ━━━━━━━━━━━━ 7 │ f < f; 8 │ f > f; --- ts_instantiation_expressions_1.ts:7:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `>` but instead found `;` @@ -1384,7 +1424,6 @@ ts_instantiation_expressions_1.ts:7:12 parse ━━━━━━━━━━━ i Remove ; --- ts_instantiation_expressions_1.ts:8:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '>'. @@ -1405,7 +1444,6 @@ ts_instantiation_expressions_1.ts:8:6 parse ━━━━━━━━━━━━ 9 │ f import<1>; 10 │ f yield; --- ts_instantiation_expressions_1.ts:9:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found 'import'. @@ -1426,7 +1464,6 @@ ts_instantiation_expressions_1.ts:9:6 parse ━━━━━━━━━━━━ 10 │ f yield; 11 │ f ++; --- ts_instantiation_expressions_1.ts:9:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a default import, a namespace import, or a named import but instead found '<'. @@ -1447,7 +1484,6 @@ ts_instantiation_expressions_1.ts:9:12 parse ━━━━━━━━━━━ 10 │ f yield; 11 │ f ++; --- ts_instantiation_expressions_1.ts:9:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ';'. @@ -1468,7 +1504,6 @@ ts_instantiation_expressions_1.ts:9:15 parse ━━━━━━━━━━━ 10 │ f yield; 11 │ f ++; --- ts_instantiation_expressions_1.ts:10:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode @@ -1480,7 +1515,6 @@ ts_instantiation_expressions_1.ts:10:6 parse ━━━━━━━━━━━ 11 │ f ++; 12 │ f --; --- ts_instantiation_expressions_1.ts:11:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, or a member expression but instead found ';'. @@ -1501,7 +1535,6 @@ ts_instantiation_expressions_1.ts:11:8 parse ━━━━━━━━━━━ 12 │ f --; 13 │ f /= 1; --- ts_instantiation_expressions_1.ts:12:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, or a member expression but instead found ';'. @@ -1522,7 +1555,6 @@ ts_instantiation_expressions_1.ts:12:8 parse ━━━━━━━━━━━ 13 │ f /= 1; 14 │ f <= f; --- ts_instantiation_expressions_1.ts:13:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unterminated regex literal @@ -1552,7 +1584,6 @@ ts_instantiation_expressions_1.ts:13:11 parse ━━━━━━━━━━━ 14 │ f <= f; 15 │ f --- ts_instantiation_expressions_1.ts:16:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found ']'. @@ -1573,7 +1604,6 @@ ts_instantiation_expressions_1.ts:16:2 parse ━━━━━━━━━━━ 17 │ f 18 │ as {}; --- ts_instantiation_expressions_1.ts:18:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -1603,7 +1633,6 @@ ts_instantiation_expressions_1.ts:18:4 parse ━━━━━━━━━━━ 19 │ f 20 │ satisfies {}; --- ts_instantiation_expressions_1.ts:20:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -1633,7 +1662,6 @@ ts_instantiation_expressions_1.ts:20:11 parse ━━━━━━━━━━━ 21 │ class C5 { 22 │ protected specialFoo = f #bar = 123 --- ts_instantiation_expressions_1.ts:22:38 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Private names are only allowed on the left side of a 'in' expression @@ -1645,7 +1673,6 @@ ts_instantiation_expressions_1.ts:22:38 parse ━━━━━━━━━━━ 23 │ } 24 │ for (const a = b.test in []) {} --- ts_instantiation_expressions_1.ts:22:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `f #bar` @@ -1659,7 +1686,6 @@ ts_instantiation_expressions_1.ts:22:28 parse ━━━━━━━━━━━ i This expression cannot be assigned to --- ts_instantiation_expressions_1.ts:24:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `for..in` statement declarators cannot have an initializer expression @@ -1670,28 +1696,4 @@ ts_instantiation_expressions_1.ts:24:14 parse ━━━━━━━━━━━ │ ^^^^^^^^^^^^^^^^ 25 │ --- -const a8 = f; // Relational operator error -const b1 = f?.; // Error, `(` expected -f << f; -f = g; -f >> f; -f >= f; -f < f; -f > f; -f import<1>; -f yield; -f ++; -f --; -f /= 1; -f <= f; -f -[]; -f -as {}; -f -satisfies {}; -class C5 { - protected specialFoo = f #bar = 123 -} -for (const a = b.test in []) {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_interface_heritage_clause_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_interface_heritage_clause_error.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_interface_heritage_clause_error.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_interface_heritage_clause_error.ts.snap index 78febb2a784d..1c35be9d9fd3 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_interface_heritage_clause_error.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_interface_heritage_clause_error.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A {} +interface B implements A {} +interface C extends A extends B {} +interface D extends {} +interface E extends A, {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -109,7 +128,11 @@ JsModule { ], eof_token: EOF@126..127 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..127 0: (empty) 1: (empty) @@ -188,7 +211,12 @@ JsModule { 5: TS_TYPE_MEMBER_LIST@125..125 6: R_CURLY@125..126 "}" [] [] 4: EOF@126..127 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_interface_heritage_clause_error.ts:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Interface declaration cannot have 'implements' clause. @@ -199,7 +227,6 @@ ts_interface_heritage_clause_error.ts:2:13 parse ━━━━━━━━━━ 3 │ interface C extends A extends B {} 4 │ interface D extends {} --- ts_interface_heritage_clause_error.ts:3:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'extends' clause already seen. @@ -220,7 +247,6 @@ ts_interface_heritage_clause_error.ts:3:23 parse ━━━━━━━━━━ 4 │ interface D extends {} 5 │ interface E extends A, {} --- ts_interface_heritage_clause_error.ts:4:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'extends' list cannot be empty. @@ -232,7 +258,6 @@ ts_interface_heritage_clause_error.ts:4:21 parse ━━━━━━━━━━ 5 │ interface E extends A, {} 6 │ --- ts_interface_heritage_clause_error.ts:5:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Trailing comma not allowed. @@ -243,9 +268,4 @@ ts_interface_heritage_clause_error.ts:5:22 parse ━━━━━━━━━━ │ ^ 6 │ --- -interface A {} -interface B implements A {} -interface C extends A extends B {} -interface D extends {} -interface E extends A, {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_invalid_decorated_class_members.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_invalid_decorated_class_members.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_invalid_decorated_class_members.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_invalid_decorated_class_members.ts.snap index 16f5aaca1630..d43fc757ba0d 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_invalid_decorated_class_members.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_invalid_decorated_class_members.ts.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class Test { + @test constructor() {} + @test declare prop; + @test method(); + @test [index: string]: string; + @test abstract method2(); + @test abstract get getter(); + @test abstract set setter(val); +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -213,7 +236,11 @@ JsModule { ], eof_token: EOF@214..215 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..215 0: (empty) 1: (empty) @@ -351,7 +378,12 @@ JsModule { 6: SEMICOLON@211..212 ";" [] [] 9: R_CURLY@212..214 "}" [Newline("\n")] [] 4: EOF@214..215 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_invalid_decorated_class_members.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -364,7 +396,6 @@ ts_invalid_decorated_class_members.ts:2:3 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_invalid_decorated_class_members.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -378,7 +409,6 @@ ts_invalid_decorated_class_members.ts:4:3 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_invalid_decorated_class_members.ts:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -392,7 +422,6 @@ ts_invalid_decorated_class_members.ts:5:3 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_invalid_decorated_class_members.ts:6:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -406,7 +435,6 @@ ts_invalid_decorated_class_members.ts:6:3 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_invalid_decorated_class_members.ts:7:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -420,7 +448,6 @@ ts_invalid_decorated_class_members.ts:7:3 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- ts_invalid_decorated_class_members.ts:8:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Decorators are not valid here. @@ -434,13 +461,4 @@ ts_invalid_decorated_class_members.ts:8:3 parse ━━━━━━━━━━ i Decorators are only valid on class declarations, class expressions, and class methods. --- -abstract class Test { - @test constructor() {} - @test declare prop; - @test method(); - @test [index: string]: string; - @test abstract method2(); - @test abstract get getter(); - @test abstract set setter(val); -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_members_with_missing_body.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_method_members_with_missing_body.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_members_with_missing_body.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_method_members_with_missing_body.ts.snap index 5312913a79a8..dd39e2a41e61 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_method_members_with_missing_body.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_members_with_missing_body.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + constructor() method() get test() + set test(value) +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -81,7 +99,11 @@ JsModule { ], eof_token: EOF@74..75 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..75 0: (empty) 1: (empty) @@ -148,7 +170,12 @@ JsModule { 7: (empty) 9: R_CURLY@72..74 "}" [Newline("\n")] [] 4: EOF@74..75 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_method_members_with_missing_body.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class method body but instead found 'method'. @@ -167,7 +194,6 @@ ts_method_members_with_missing_body.ts:2:20 parse ━━━━━━━━━━ 3 │ set test(value) 4 │ } --- ts_method_members_with_missing_body.ts:2:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class method body but instead found 'get'. @@ -186,7 +212,6 @@ ts_method_members_with_missing_body.ts:2:29 parse ━━━━━━━━━━ 3 │ set test(value) 4 │ } --- ts_method_members_with_missing_body.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class method body but instead found 'set'. @@ -207,7 +232,6 @@ ts_method_members_with_missing_body.ts:3:6 parse ━━━━━━━━━━ 4 │ } 5 │ --- ts_method_members_with_missing_body.ts:4:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class method body but instead found '}'. @@ -226,8 +250,4 @@ ts_method_members_with_missing_body.ts:4:1 parse ━━━━━━━━━━ │ ^ 5 │ --- -class Test { - constructor() method() get test() - set test(value) -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_object_member_body_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_object_member_body_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_method_object_member_body_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_method_object_member_body_error.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_object_member_body_error.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_object_member_body_error.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/ts_method_object_member_body_error.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_method_object_member_body_error.ts.snap index d97bae12d462..70353ea83bb6 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_method_object_member_body_error.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_object_member_body_error.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ + x<>(maybeA: any): maybeA is A { return true }, + async *id<>(param: Promise): AsyncIterableIterator { yield await param }, +}) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -172,7 +190,11 @@ JsModule { ], eof_token: EOF@140..141 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..141 0: (empty) 1: (empty) @@ -294,7 +316,12 @@ JsModule { 2: R_PAREN@139..140 ")" [] [] 1: (empty) 4: EOF@140..141 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_method_object_member_body_error.ts:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -313,7 +340,6 @@ ts_method_object_member_body_error.ts:2:7 parse ━━━━━━━━━━ 3 │ async *id<>(param: Promise): AsyncIterableIterator { yield await param }, 4 │ }) --- ts_method_object_member_body_error.ts:3:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -334,8 +360,4 @@ ts_method_object_member_body_error.ts:3:15 parse ━━━━━━━━━━ 4 │ }) 5 │ --- -({ - x<>(maybeA: any): maybeA is A { return true }, - async *id<>(param: Promise): AsyncIterableIterator { yield await param }, -}) +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_signature_generator.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_signature_generator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_method_signature_generator.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_method_signature_generator.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_method_signature_generator.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_signature_generator.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_method_signature_generator.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_method_signature_generator.ts.snap index ec2b4402eb51..ce850fa521fa 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_method_signature_generator.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_method_signature_generator.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { * method(); } +abstract class B { abstract * method(); } +class C { + * overload(); + * overload() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -125,7 +145,11 @@ JsModule { ], eof_token: EOF@125..126 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..126 0: (empty) 1: (empty) @@ -220,7 +244,12 @@ JsModule { 3: R_CURLY@122..123 "}" [] [] 9: R_CURLY@123..125 "}" [Newline("\n")] [] 4: EOF@125..126 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_method_signature_generator.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A method signature cannot be declared as a generator. @@ -230,7 +259,6 @@ ts_method_signature_generator.ts:1:19 parse ━━━━━━━━━━━━ 2 │ abstract class B { abstract * method(); } 3 │ class C { --- ts_method_signature_generator.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A method signature cannot be declared as a generator. @@ -241,7 +269,6 @@ ts_method_signature_generator.ts:2:20 parse ━━━━━━━━━━━━ 3 │ class C { 4 │ * overload(); --- ts_method_signature_generator.ts:4:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A method signature cannot be declared as a generator. @@ -253,10 +280,4 @@ ts_method_signature_generator.ts:4:6 parse ━━━━━━━━━━━━ 5 │ * overload() {} 6 │ } --- -declare class A { * method(); } -abstract class B { abstract * method(); } -class C { - * overload(); - * overload() {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_module_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_module_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_module_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_module_err.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_module_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_module_err.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_module_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_module_err.ts.snap index f02e2287347c..0acb392aae7a 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_module_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_module_err.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module a; // missing body +declare module "a" declare module "b"; // missing semi + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -41,7 +57,11 @@ JsModule { ], eof_token: EOF@88..89 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..89 0: (empty) 1: (empty) @@ -72,7 +92,12 @@ JsModule { 2: TS_EMPTY_EXTERNAL_MODULE_DECLARATION_BODY@71..88 0: SEMICOLON@71..88 ";" [] [Whitespace(" "), Comments("// missing semi")] 4: EOF@88..89 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_module_err.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `{` but instead found `;` @@ -84,7 +109,6 @@ ts_module_err.ts:1:17 parse ━━━━━━━━━━━━━━━━━ i Remove ; --- ts_module_err.ts:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -108,6 +132,4 @@ ts_module_err.ts:2:20 parse ━━━━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 │ --- -declare module a; // missing body -declare module "a" declare module "b"; // missing semi +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_named_import_specifier_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_named_import_specifier_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_named_import_specifier_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_named_import_specifier_error.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_named_import_specifier_error.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_named_import_specifier_error.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_named_import_specifier_error.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_named_import_specifier_error.ts.snap index d7651765879b..635b990767b4 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_named_import_specifier_error.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_named_import_specifier_error.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import { default } from "./mod"; +import { type default } from "./mod"; +import { "literal-name" } from "./mod"; +import { type "literal-name" } from "./mod"; +import { + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -125,7 +144,11 @@ JsModule { ], eof_token: EOF@164..165 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..165 0: (empty) 1: (empty) @@ -220,7 +243,12 @@ JsModule { 4: (empty) 2: (empty) 4: EOF@164..165 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_named_import_specifier_error.ts:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `as` but instead found `}` @@ -232,7 +260,6 @@ ts_named_import_specifier_error.ts:1:18 parse ━━━━━━━━━━━ i Remove } --- ts_named_import_specifier_error.ts:2:23 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `as` but instead found `}` @@ -245,7 +272,6 @@ ts_named_import_specifier_error.ts:2:23 parse ━━━━━━━━━━━ i Remove } --- ts_named_import_specifier_error.ts:3:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `as` but instead found `}` @@ -259,7 +285,6 @@ ts_named_import_specifier_error.ts:3:25 parse ━━━━━━━━━━━ i Remove } --- ts_named_import_specifier_error.ts:4:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `as` but instead found `}` @@ -273,7 +298,6 @@ ts_named_import_specifier_error.ts:4:30 parse ━━━━━━━━━━━ i Remove } --- ts_named_import_specifier_error.ts:6:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead the file ends @@ -290,9 +314,4 @@ ts_named_import_specifier_error.ts:6:1 parse ━━━━━━━━━━━ > 6 │ │ --- -import { default } from "./mod"; -import { type default } from "./mod"; -import { "literal-name" } from "./mod"; -import { type "literal-name" } from "./mod"; -import { +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_new_operator.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_new_operator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_new_operator.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_new_operator.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_new_operator.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_new_operator.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_new_operator.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_new_operator.ts.snap index ba02ecd44d52..307a8cb0d5e6 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_new_operator.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_new_operator.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +new A(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -45,7 +60,11 @@ JsModule { ], eof_token: EOF@20..21 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..21 0: (empty) 1: (empty) @@ -79,7 +98,12 @@ JsModule { 2: R_PAREN@18..19 ")" [] [] 1: SEMICOLON@19..20 ";" [] [] 4: EOF@20..21 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_new_operator.ts:1:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Parenthesized expression didnt contain anything @@ -90,5 +114,4 @@ ts_new_operator.ts:1:19 parse ━━━━━━━━━━━━━━━━ i Expected an expression here --- -new A(); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_getter_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_object_getter_type_parameters.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_getter_type_parameters.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_object_getter_type_parameters.ts.snap index 499350f11960..be47faa80c3f 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_object_getter_type_parameters.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_getter_type_parameters.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ get a(): A {} }); +({ get a<>(): A {} }); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -101,7 +117,11 @@ JsModule { ], eof_token: EOF@46..47 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..47 0: (empty) 1: (empty) @@ -174,7 +194,12 @@ JsModule { 2: R_PAREN@44..45 ")" [] [] 1: SEMICOLON@45..46 ";" [] [] 4: EOF@46..47 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_object_getter_type_parameters.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An accessor cannot have type parameters. @@ -184,7 +209,6 @@ ts_object_getter_type_parameters.ts:1:9 parse ━━━━━━━━━━━ 2 │ ({ get a<>(): A {} }); 3 │ --- ts_object_getter_type_parameters.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -201,7 +225,6 @@ ts_object_getter_type_parameters.ts:2:10 parse ━━━━━━━━━━━ │ ^ 3 │ --- ts_object_getter_type_parameters.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An accessor cannot have type parameters. @@ -211,6 +234,4 @@ ts_object_getter_type_parameters.ts:2:9 parse ━━━━━━━━━━━ │ ^^ 3 │ --- -({ get a(): A {} }); -({ get a<>(): A {} }); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_return_type.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_return_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_object_setter_return_type.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_return_type.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_return_type.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_return_type.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_object_setter_return_type.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_return_type.ts.snap index 322d9e1ec846..29dfe6d89c2b 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_return_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_return_type.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ set a(value: string): void {} }); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -55,7 +70,11 @@ JsModule { ], eof_token: EOF@36..37 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..37 0: (empty) 1: (empty) @@ -96,7 +115,12 @@ JsModule { 2: R_PAREN@34..35 ")" [] [] 1: SEMICOLON@35..36 ";" [] [] 4: EOF@36..37 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_object_setter_return_type.ts:1:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A 'set' accessor cannot have a return type annotation. @@ -105,5 +129,4 @@ ts_object_setter_return_type.ts:1:24 parse ━━━━━━━━━━━━ │ ^^^^^^ 2 │ --- -({ set a(value: string): void {} }); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_type_parameters.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_type_parameters.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_type_parameters.ts.snap index 1ef6ff7efd74..57877709254d 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_object_setter_type_parameters.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_object_setter_type_parameters.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ set a(value: A) {} }); +({ set a<>(value: A) {} }); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -117,7 +133,11 @@ JsModule { ], eof_token: EOF@56..57 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..57 0: (empty) 1: (empty) @@ -202,7 +222,12 @@ JsModule { 2: R_PAREN@54..55 ")" [] [] 1: SEMICOLON@55..56 ";" [] [] 4: EOF@56..57 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_object_setter_type_parameters.ts:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An accessor cannot have type parameters. @@ -212,7 +237,6 @@ ts_object_setter_type_parameters.ts:1:9 parse ━━━━━━━━━━━ 2 │ ({ set a<>(value: A) {} }); 3 │ --- ts_object_setter_type_parameters.ts:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found '>'. @@ -229,7 +253,6 @@ ts_object_setter_type_parameters.ts:2:10 parse ━━━━━━━━━━━ │ ^ 3 │ --- ts_object_setter_type_parameters.ts:2:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × An accessor cannot have type parameters. @@ -239,6 +262,4 @@ ts_object_setter_type_parameters.ts:2:9 parse ━━━━━━━━━━━ │ ^^ 3 │ --- -({ set a(value: A) {} }); -({ set a<>(value: A) {} }); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_initializer_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_property_initializer_ambient_context.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_initializer_ambient_context.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_property_initializer_ambient_context.ts.snap index ae8d309db339..55cf1fd887e9 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_property_initializer_ambient_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_initializer_ambient_context.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { prop = "test"; } +class B { declare prop = "test"; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -71,7 +87,11 @@ JsModule { ], eof_token: EOF@69..70 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..70 0: (empty) 1: (empty) @@ -126,7 +146,12 @@ JsModule { 4: SEMICOLON@66..68 ";" [] [Whitespace(" ")] 9: R_CURLY@68..69 "}" [] [] 4: EOF@69..70 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_property_initializer_ambient_context.ts:1:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × In ambient contexts, properties with initializers need to be readonly. @@ -136,7 +161,6 @@ ts_property_initializer_ambient_context.ts:1:24 parse ━━━━━━━━ 2 │ class B { declare prop = "test"; } 3 │ --- ts_property_initializer_ambient_context.ts:2:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × In ambient contexts, properties with initializers need to be readonly. @@ -146,6 +170,4 @@ ts_property_initializer_ambient_context.ts:2:24 parse ━━━━━━━━ │ ^^^^^^^^ 3 │ --- -declare class A { prop = "test"; } -class B { declare prop = "test"; } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_property_parameter_pattern.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_parameter_pattern.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_property_parameter_pattern.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_property_parameter_pattern.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_property_parameter_pattern.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_parameter_pattern.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_property_parameter_pattern.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_property_parameter_pattern.ts.snap index fb5aeaf779c0..2cb936d079fe 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_property_parameter_pattern.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_property_parameter_pattern.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { constructor(private { x, y }, protected [a, b]) {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -104,7 +119,11 @@ JsModule { ], eof_token: EOF@62..63 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..63 0: (empty) 1: (empty) @@ -177,7 +196,12 @@ JsModule { 3: R_CURLY@59..61 "}" [] [Whitespace(" ")] 9: R_CURLY@61..62 "}" [] [] 4: EOF@62..63 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_property_parameter_pattern.ts:1:31 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A parameter property may not be declared using a binding pattern. @@ -186,7 +210,6 @@ ts_property_parameter_pattern.ts:1:31 parse ━━━━━━━━━━━━ │ ^^^^^^^^ 2 │ --- ts_property_parameter_pattern.ts:1:51 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A parameter property may not be declared using a binding pattern. @@ -195,5 +218,4 @@ ts_property_parameter_pattern.ts:1:51 parse ━━━━━━━━━━━━ │ ^^^^^^ 2 │ --- -class A { constructor(private { x, y }, protected [a, b]) {} } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts.snap index 9c035e746d6c..fcab826afabe 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_readonly_modifier_non_class_or_indexer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_readonly_modifier_non_class_or_indexer.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + readonly constructor() {} + readonly method() {} + readonly get test() { return "a"; } + readonly set test(value: string) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -139,7 +159,11 @@ JsModule { ], eof_token: EOF@141..142 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..142 0: (empty) 1: (empty) @@ -231,7 +255,12 @@ JsModule { 3: R_CURLY@138..139 "}" [] [] 9: R_CURLY@139..141 "}" [Newline("\n")] [] 4: EOF@141..142 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_readonly_modifier_non_class_or_indexer.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'readonly' cannot appear on a constructor declaration. @@ -242,7 +271,6 @@ ts_readonly_modifier_non_class_or_indexer.ts:2:3 parse ━━━━━━━━ 3 │ readonly method() {} 4 │ readonly get test() { return "a"; } --- ts_readonly_modifier_non_class_or_indexer.ts:3:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Readonly can only appear on a property declaration or index signature. @@ -254,7 +282,6 @@ ts_readonly_modifier_non_class_or_indexer.ts:3:3 parse ━━━━━━━━ 4 │ readonly get test() { return "a"; } 5 │ readonly set test(value: string) {} --- ts_readonly_modifier_non_class_or_indexer.ts:4:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Readonly can only appear on a property declaration or index signature. @@ -266,7 +293,6 @@ ts_readonly_modifier_non_class_or_indexer.ts:4:3 parse ━━━━━━━━ 5 │ readonly set test(value: string) {} 6 │ } --- ts_readonly_modifier_non_class_or_indexer.ts:5:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Readonly can only appear on a property declaration or index signature. @@ -278,10 +304,4 @@ ts_readonly_modifier_non_class_or_indexer.ts:5:3 parse ━━━━━━━━ 6 │ } 7 │ --- -class Test { - readonly constructor() {} - readonly method() {} - readonly get test() { return "a"; } - readonly set test(value: string) {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts.snap index 0b296f16646c..695cbfb4c0c0 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_assignment_no_parenthesize.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_assignment_no_parenthesize.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a: any; +a satisfies string = "string"; +(a() satisfies string) = "string"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -78,7 +95,11 @@ JsModule { ], eof_token: EOF@77..78 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..78 0: (empty) 1: (empty) @@ -132,7 +153,12 @@ JsModule { 0: JS_STRING_LITERAL@68..76 "\"string\"" [] [] 1: SEMICOLON@76..77 ";" [] [] 4: EOF@77..78 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_satisfies_assignment_no_parenthesize.ts:3:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `a()` @@ -145,7 +171,4 @@ ts_satisfies_assignment_no_parenthesize.ts:3:2 parse ━━━━━━━━━ i This expression cannot be assigned to --- -let a: any; -a satisfies string = "string"; -(a() satisfies string) = "string"; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_expression.js b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_satisfies_expression.js rename to crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_expression.js diff --git a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_expression.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_expression.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_satisfies_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_expression.js.snap index 8dc2c2202013..cdef9d67e797 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_satisfies_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_satisfies_expression.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let x = "hello" satisfies string; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -35,7 +50,11 @@ JsModule { ], eof_token: EOF@33..34 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..34 0: (empty) 1: (empty) @@ -60,7 +79,12 @@ JsModule { 0: STRING_KW@26..32 "string" [] [] 1: SEMICOLON@32..33 ";" [] [] 4: EOF@33..34 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_satisfies_expression.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'satisfies' expression are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax. @@ -71,5 +95,4 @@ ts_satisfies_expression.js:1:9 parse ━━━━━━━━━━━━━━ i TypeScript only syntax --- -let x = "hello" satisfies string; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_setter_return_type_annotation.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_setter_return_type_annotation.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_setter_return_type_annotation.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_setter_return_type_annotation.ts.snap index 0eb9d98674ad..6cca46af41f1 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_setter_return_type_annotation.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_setter_return_type_annotation.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + set a(value: string): void {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -58,7 +75,11 @@ JsModule { ], eof_token: EOF@48..49 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..49 0: (empty) 1: (empty) @@ -103,7 +124,12 @@ JsModule { 3: R_CURLY@45..46 "}" [] [] 9: R_CURLY@46..48 "}" [Newline("\n")] [] 4: EOF@48..49 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_setter_return_type_annotation.ts:2:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A 'set' accessor cannot have a return type annotation. @@ -114,7 +140,4 @@ ts_setter_return_type_annotation.ts:2:25 parse ━━━━━━━━━━━ 3 │ } 4 │ --- -class Test { - set a(value: string): void {} -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_static_initialization_block_member_with_decorators.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_static_initialization_block_member_with_decorators.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_static_initialization_block_member_with_decorators.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_static_initialization_block_member_with_decorators.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts.snap index 70bae5cefe81..43c14b33f24c 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_static_initialization_block_member_with_decorators.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_static_initialization_block_member_with_decorators.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Foo { + @dec static { + this.a = "test"; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -56,7 +75,11 @@ JsModule { ], eof_token: EOF@54..55 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..55 0: (empty) 1: (empty) @@ -97,7 +120,12 @@ JsModule { 4: R_CURLY@48..52 "}" [Newline("\n"), Whitespace(" ")] [] 9: R_CURLY@52..54 "}" [Newline("\n")] [] 4: EOF@54..55 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_static_initialization_block_member_with_decorators.ts:2:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Static class blocks cannot have any modifier. @@ -108,9 +136,4 @@ ts_static_initialization_block_member_with_decorators.ts:2:3 parse ━━━━ 3 │ this.a = "test"; 4 │ } --- -class Foo { - @dec static { - this.a = "test"; - } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_template_literal_error.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_template_literal_error.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_template_literal_error.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_template_literal_error.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_template_literal_error.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_template_literal_error.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/ts_template_literal_error.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_template_literal_error.ts.snap index c9e4fc2c3f32..76b5c8b67cf1 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_template_literal_error.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_template_literal_error.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = "a"; +type B = "b" +type C = `${A B}bcd` +type D = `${A B` + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -104,7 +122,11 @@ JsModule { ], eof_token: EOF@64..65 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..65 0: (empty) 1: (empty) @@ -170,7 +192,12 @@ JsModule { 2: BACKTICK@63..64 "`" [] [] 5: (empty) 4: EOF@64..65 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_template_literal_error.ts:3:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead found `B` @@ -184,7 +211,6 @@ ts_template_literal_error.ts:3:15 parse ━━━━━━━━━━━━━ i Remove B --- ts_template_literal_error.ts:4:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead found `B` @@ -197,8 +223,4 @@ ts_template_literal_error.ts:4:15 parse ━━━━━━━━━━━━━ i Remove B --- -type A = "a"; -type B = "b" -type C = `${A B}bcd` -type D = `${A B` +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts.snap index d06b8b3b096c..4531f65ea49d 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_cannot_be_optional_and_rest.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_cannot_be_optional_and_rest.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = [ ...name?: string[] ] + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -42,7 +57,11 @@ JsModule { ], eof_token: EOF@31..32 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..32 0: (empty) 1: (empty) @@ -71,7 +90,12 @@ JsModule { 2: R_BRACK@30..31 "]" [] [] 5: (empty) 4: EOF@31..32 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_tuple_type_cannot_be_optional_and_rest.ts:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × A tuple member cannot be both optional and rest. @@ -80,5 +104,4 @@ ts_tuple_type_cannot_be_optional_and_rest.ts:1:12 parse ━━━━━━━━ │ ^^^^^^^^^^^^^^^^^^ 2 │ --- -type A = [ ...name?: string[] ] +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_incomplete.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_incomplete.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_incomplete.ts.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_incomplete.ts.snap index d97ce2d23f5e..7ea83b73e51b 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_tuple_type_incomplete.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_tuple_type_incomplete.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = [string, + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -25,7 +40,11 @@ JsModule { ], eof_token: EOF@17..18 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..18 0: (empty) 1: (empty) @@ -46,7 +65,12 @@ JsModule { 2: (empty) 5: (empty) 4: EOF@17..18 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_tuple_type_incomplete.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type but instead found the end of the file. @@ -61,5 +85,4 @@ ts_tuple_type_incomplete.ts:2:1 parse ━━━━━━━━━━━━━━ > 2 │ │ --- -type A = [string, +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_alias_cannot_be_reserved_word.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_type_alias_cannot_be_reserved_word.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_alias_cannot_be_reserved_word.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_type_alias_cannot_be_reserved_word.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts.snap index aff9905e9423..2871ee864184 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_type_alias_cannot_be_reserved_word.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_alias_cannot_be_reserved_word.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type undefined = any; +type any = any; +type string = any; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -51,7 +68,11 @@ JsModule { ], eof_token: EOF@56..57 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..57 0: (empty) 1: (empty) @@ -82,7 +103,12 @@ JsModule { 0: ANY_KW@52..55 "any" [] [] 4: SEMICOLON@55..56 ";" [] [] 4: EOF@56..57 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_type_alias_cannot_be_reserved_word.ts:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Type alias cannot be undefined @@ -92,7 +118,6 @@ ts_type_alias_cannot_be_reserved_word.ts:1:6 parse ━━━━━━━━━ 2 │ type any = any; 3 │ type string = any; --- ts_type_alias_cannot_be_reserved_word.ts:2:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Type alias cannot be any @@ -103,7 +128,6 @@ ts_type_alias_cannot_be_reserved_word.ts:2:6 parse ━━━━━━━━━ 3 │ type string = any; 4 │ --- ts_type_alias_cannot_be_reserved_word.ts:3:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Type alias cannot be string @@ -114,7 +138,4 @@ ts_type_alias_cannot_be_reserved_word.ts:3:6 parse ━━━━━━━━━ │ ^^^^^^ 4 │ --- -type undefined = any; -type any = any; -type string = any; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts.snap index b8df3b80c280..9a1f6e01b2d7 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_type_assertions_not_valid_at_new_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_assertions_not_valid_at_new_expr.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +var test2 = new Test2(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -55,7 +70,11 @@ JsModule { ], eof_token: EOF@29..30 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..30 0: (empty) 1: (empty) @@ -96,7 +115,12 @@ JsModule { 2: R_PAREN@27..28 ")" [] [] 1: SEMICOLON@28..29 ";" [] [] 4: EOF@29..30 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` ts_type_assertions_not_valid_at_new_expr.ts:1:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression but instead found '<'. @@ -111,5 +135,4 @@ ts_type_assertions_not_valid_at_new_expr.ts:1:17 parse ━━━━━━━━ │ ^ 2 │ --- -var test2 = new Test2(); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.ts b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_parameters_incomplete.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.ts rename to crates/biome_js_parser/tests/js_test_suite/error/ts_type_parameters_incomplete.ts diff --git a/crates/biome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_parameters_incomplete.ts.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast rename to crates/biome_js_parser/tests/js_test_suite/error/ts_type_parameters_incomplete.ts.snap index 338a3fe60152..0abd0bd78c54 100644 --- a/crates/biome_js_parser/test_data/inline/err/ts_type_parameters_incomplete.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/ts_type_parameters_incomplete.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A` but instead the file ends @@ -68,5 +92,4 @@ ts_type_parameters_incomplete.ts:2:1 parse ━━━━━━━━━━━━ > 2 │ │ --- -type A 2 │ │ --- -func() {} +export function foo() {} +export function foo1() {} +export function foo2() {} +let foo: Foo +let foo: Foo +declare function foo() +declare function foo() +declare let foo: Foo +declare let foo: Foo +foo = function () {} +foo = function () {} +class Foo { foo(): T {} } +class Foo { foo(): T {} } +foo = { foo(): T {} }; +foo = { foo(): T {} }; +() => {}; +() => {}; +() => {}; +let x: () => {}; +let x: () => {}; +let x: () => {}; +let x: new () => {}; +let x: new () => {}; +let x: new () => {}; +let x: { y(): any }; +let x: { y(): any }; +let x: { y(): any }; +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +function foo() {} +function foo() {} +type Foo = {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -2013,7 +2067,11 @@ JsModule { ], eof_token: EOF@1072..1073 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..1073 0: (empty) 1: (empty) @@ -3150,7 +3208,12 @@ JsModule { 2: R_CURLY@1070..1071 "}" [] [] 5: SEMICOLON@1071..1072 ";" [] [] 4: EOF@1072..1073 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` type_parameter_modifier.ts:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3160,7 +3223,6 @@ type_parameter_modifier.ts:1:29 parse ━━━━━━━━━━━━━━ 2 │ export function foo() {} 3 │ export function foo1() {} --- type_parameter_modifier.ts:2:21 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3171,7 +3233,6 @@ type_parameter_modifier.ts:2:21 parse ━━━━━━━━━━━━━━ 3 │ export function foo1() {} 4 │ export function foo2() {} --- type_parameter_modifier.ts:3:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3183,7 +3244,6 @@ type_parameter_modifier.ts:3:22 parse ━━━━━━━━━━━━━━ 4 │ export function foo2() {} 5 │ let foo: Foo --- type_parameter_modifier.ts:4:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3195,7 +3255,6 @@ type_parameter_modifier.ts:4:22 parse ━━━━━━━━━━━━━━ 5 │ let foo: Foo 6 │ let foo: Foo --- type_parameter_modifier.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `T` @@ -3209,7 +3268,6 @@ type_parameter_modifier.ts:5:17 parse ━━━━━━━━━━━━━━ i Remove T --- type_parameter_modifier.ts:6:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `T` @@ -3223,7 +3281,6 @@ type_parameter_modifier.ts:6:18 parse ━━━━━━━━━━━━━━ i Remove T --- type_parameter_modifier.ts:7:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3235,7 +3292,6 @@ type_parameter_modifier.ts:7:22 parse ━━━━━━━━━━━━━━ 8 │ declare function foo() 9 │ declare let foo: Foo --- type_parameter_modifier.ts:8:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3247,7 +3303,6 @@ type_parameter_modifier.ts:8:22 parse ━━━━━━━━━━━━━━ 9 │ declare let foo: Foo 10 │ declare let foo: Foo --- type_parameter_modifier.ts:9:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `T` @@ -3261,7 +3316,6 @@ type_parameter_modifier.ts:9:25 parse ━━━━━━━━━━━━━━ i Remove T --- type_parameter_modifier.ts:10:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `T` @@ -3275,7 +3329,6 @@ type_parameter_modifier.ts:10:26 parse ━━━━━━━━━━━━━ i Remove T --- type_parameter_modifier.ts:11:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3287,7 +3340,6 @@ type_parameter_modifier.ts:11:17 parse ━━━━━━━━━━━━━ 12 │ foo = function () {} 13 │ class Foo { foo(): T {} } --- type_parameter_modifier.ts:12:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3299,7 +3351,6 @@ type_parameter_modifier.ts:12:17 parse ━━━━━━━━━━━━━ 13 │ class Foo { foo(): T {} } 14 │ class Foo { foo(): T {} } --- type_parameter_modifier.ts:13:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3311,7 +3362,6 @@ type_parameter_modifier.ts:13:17 parse ━━━━━━━━━━━━━ 14 │ class Foo { foo(): T {} } 15 │ foo = { foo(): T {} }; --- type_parameter_modifier.ts:14:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3323,7 +3373,6 @@ type_parameter_modifier.ts:14:17 parse ━━━━━━━━━━━━━ 15 │ foo = { foo(): T {} }; 16 │ foo = { foo(): T {} }; --- type_parameter_modifier.ts:15:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3335,7 +3384,6 @@ type_parameter_modifier.ts:15:13 parse ━━━━━━━━━━━━━ 16 │ foo = { foo(): T {} }; 17 │ () => {}; --- type_parameter_modifier.ts:16:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3347,7 +3395,6 @@ type_parameter_modifier.ts:16:13 parse ━━━━━━━━━━━━━ 17 │ () => {}; 18 │ () => {}; --- type_parameter_modifier.ts:17:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3359,7 +3406,6 @@ type_parameter_modifier.ts:17:2 parse ━━━━━━━━━━━━━━ 18 │ () => {}; 19 │ () => {}; --- type_parameter_modifier.ts:18:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3371,7 +3417,6 @@ type_parameter_modifier.ts:18:2 parse ━━━━━━━━━━━━━━ 19 │ () => {}; 20 │ let x: () => {}; --- type_parameter_modifier.ts:19:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3383,7 +3428,6 @@ type_parameter_modifier.ts:19:2 parse ━━━━━━━━━━━━━━ 20 │ let x: () => {}; 21 │ let x: () => {}; --- type_parameter_modifier.ts:19:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3395,7 +3439,6 @@ type_parameter_modifier.ts:19:8 parse ━━━━━━━━━━━━━━ 20 │ let x: () => {}; 21 │ let x: () => {}; --- type_parameter_modifier.ts:20:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3407,7 +3450,6 @@ type_parameter_modifier.ts:20:9 parse ━━━━━━━━━━━━━━ 21 │ let x: () => {}; 22 │ let x: () => {}; --- type_parameter_modifier.ts:21:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3419,7 +3461,6 @@ type_parameter_modifier.ts:21:9 parse ━━━━━━━━━━━━━━ 22 │ let x: () => {}; 23 │ let x: new () => {}; --- type_parameter_modifier.ts:22:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3431,7 +3472,6 @@ type_parameter_modifier.ts:22:9 parse ━━━━━━━━━━━━━━ 23 │ let x: new () => {}; 24 │ let x: new () => {}; --- type_parameter_modifier.ts:22:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3443,7 +3483,6 @@ type_parameter_modifier.ts:22:15 parse ━━━━━━━━━━━━━ 23 │ let x: new () => {}; 24 │ let x: new () => {}; --- type_parameter_modifier.ts:23:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3455,7 +3494,6 @@ type_parameter_modifier.ts:23:13 parse ━━━━━━━━━━━━━ 24 │ let x: new () => {}; 25 │ let x: new () => {}; --- type_parameter_modifier.ts:24:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3467,7 +3505,6 @@ type_parameter_modifier.ts:24:13 parse ━━━━━━━━━━━━━ 25 │ let x: new () => {}; 26 │ let x: { y(): any }; --- type_parameter_modifier.ts:25:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3479,7 +3516,6 @@ type_parameter_modifier.ts:25:13 parse ━━━━━━━━━━━━━ 26 │ let x: { y(): any }; 27 │ let x: { y(): any }; --- type_parameter_modifier.ts:25:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3491,7 +3527,6 @@ type_parameter_modifier.ts:25:19 parse ━━━━━━━━━━━━━ 26 │ let x: { y(): any }; 27 │ let x: { y(): any }; --- type_parameter_modifier.ts:26:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3503,7 +3538,6 @@ type_parameter_modifier.ts:26:12 parse ━━━━━━━━━━━━━ 27 │ let x: { y(): any }; 28 │ let x: { y(): any }; --- type_parameter_modifier.ts:27:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3515,7 +3549,6 @@ type_parameter_modifier.ts:27:12 parse ━━━━━━━━━━━━━ 28 │ let x: { y(): any }; 29 │ type Foo = {} --- type_parameter_modifier.ts:28:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3527,7 +3560,6 @@ type_parameter_modifier.ts:28:12 parse ━━━━━━━━━━━━━ 29 │ type Foo = {} 30 │ type Foo = {} --- type_parameter_modifier.ts:28:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3539,7 +3571,6 @@ type_parameter_modifier.ts:28:18 parse ━━━━━━━━━━━━━ 29 │ type Foo = {} 30 │ type Foo = {} --- type_parameter_modifier.ts:29:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unexpected token `\` @@ -3551,7 +3582,6 @@ type_parameter_modifier.ts:29:11 parse ━━━━━━━━━━━━━ 30 │ type Foo = {} 31 │ type Foo = {} --- type_parameter_modifier.ts:29:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `\u006E` @@ -3565,7 +3595,6 @@ type_parameter_modifier.ts:29:12 parse ━━━━━━━━━━━━━ i Remove \u006E --- type_parameter_modifier.ts:29:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `T` @@ -3579,7 +3608,6 @@ type_parameter_modifier.ts:29:19 parse ━━━━━━━━━━━━━ i Remove T --- type_parameter_modifier.ts:30:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unexpected token `\` @@ -3591,7 +3619,6 @@ type_parameter_modifier.ts:30:12 parse ━━━━━━━━━━━━━ 31 │ type Foo = {} 32 │ type Foo = {} --- type_parameter_modifier.ts:30:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `\u0074` @@ -3605,7 +3632,6 @@ type_parameter_modifier.ts:30:13 parse ━━━━━━━━━━━━━ i Remove \u0074 --- type_parameter_modifier.ts:30:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `T` @@ -3619,7 +3645,6 @@ type_parameter_modifier.ts:30:20 parse ━━━━━━━━━━━━━ i Remove T --- type_parameter_modifier.ts:31:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found 'in'. @@ -3640,7 +3665,6 @@ type_parameter_modifier.ts:31:13 parse ━━━━━━━━━━━━━ 32 │ type Foo = {} 33 │ type Foo = {} --- type_parameter_modifier.ts:32:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a type parameter but instead found 'in'. @@ -3661,7 +3685,6 @@ type_parameter_modifier.ts:32:14 parse ━━━━━━━━━━━━━ 33 │ type Foo = {} 34 │ type Foo = {} --- type_parameter_modifier.ts:33:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' must precede 'out' @@ -3691,7 +3714,6 @@ type_parameter_modifier.ts:33:14 parse ━━━━━━━━━━━━━ 34 │ type Foo = {} 35 │ type Foo = {} --- type_parameter_modifier.ts:34:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `public` as an identifier in strict mode @@ -3703,7 +3725,6 @@ type_parameter_modifier.ts:34:10 parse ━━━━━━━━━━━━━ 35 │ type Foo = {} 36 │ type Foo = {} --- type_parameter_modifier.ts:34:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `T` @@ -3717,7 +3738,6 @@ type_parameter_modifier.ts:34:17 parse ━━━━━━━━━━━━━ i Remove T --- type_parameter_modifier.ts:35:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `,` but instead found `T` @@ -3731,7 +3751,6 @@ type_parameter_modifier.ts:35:15 parse ━━━━━━━━━━━━━ i Remove T --- type_parameter_modifier.ts:36:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' already seen @@ -3761,7 +3780,6 @@ type_parameter_modifier.ts:36:17 parse ━━━━━━━━━━━━━ 37 │ type Foo = {} 38 │ function foo() {} --- type_parameter_modifier.ts:37:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' already seen @@ -3791,7 +3809,6 @@ type_parameter_modifier.ts:37:17 parse ━━━━━━━━━━━━━ 38 │ function foo() {} 39 │ function foo() {} --- type_parameter_modifier.ts:38:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'in' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3803,7 +3820,6 @@ type_parameter_modifier.ts:38:14 parse ━━━━━━━━━━━━━ 39 │ function foo() {} 40 │ type Foo = {}; --- type_parameter_modifier.ts:39:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'out' modifier can only appear on a type parameter of a class, interface or type alias. @@ -3815,7 +3831,6 @@ type_parameter_modifier.ts:39:14 parse ━━━━━━━━━━━━━ 40 │ type Foo = {}; 41 │ --- type_parameter_modifier.ts:40:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'const' modifier can only appear on a type parameter of a function, method or class. @@ -3826,44 +3841,4 @@ type_parameter_modifier.ts:40:10 parse ━━━━━━━━━━━━━ │ ^^^^^ 41 │ --- -export default function foo() {} -export function foo() {} -export function foo1() {} -export function foo2() {} -let foo: Foo -let foo: Foo -declare function foo() -declare function foo() -declare let foo: Foo -declare let foo: Foo -foo = function () {} -foo = function () {} -class Foo { foo(): T {} } -class Foo { foo(): T {} } -foo = { foo(): T {} }; -foo = { foo(): T {} }; -() => {}; -() => {}; -() => {}; -let x: () => {}; -let x: () => {}; -let x: () => {}; -let x: new () => {}; -let x: new () => {}; -let x: new () => {}; -let x: { y(): any }; -let x: { y(): any }; -let x: { y(): any }; -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -type Foo = {} -function foo() {} -function foo() {} -type Foo = {}; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_class_member_should_not_have_body.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_class_member_should_not_have_body.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_class_member_should_not_have_body.rast b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_class_member_should_not_have_body.rast rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts.snap index 9d6b0272ad61..a01f4045eb3c 100644 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_class_member_should_not_have_body.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_class_member_should_not_have_body.ts.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class AbstractMembers { + abstract constructor() { } + abstract display(): void { } + abstract get my_name() { } + abstract set my_name(name) { } + abstract #private_name() { } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -150,7 +171,11 @@ JsModule { ], eof_token: EOF@197..198 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..198 0: (empty) 1: (empty) @@ -254,7 +279,12 @@ JsModule { 3: R_CURLY@194..195 "}" [] [] 9: R_CURLY@195..197 "}" [Newline("\n")] [] 4: EOF@197..198 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` typescript_abstract_class_member_should_not_have_body.ts:2:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot appear on a constructor declaration. @@ -265,7 +295,6 @@ typescript_abstract_class_member_should_not_have_body.ts:2:5 parse ━━━━ 3 │ abstract display(): void { } 4 │ abstract get my_name() { } --- typescript_abstract_class_member_should_not_have_body.ts:3:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × abstract members should not have a body @@ -277,7 +306,6 @@ typescript_abstract_class_member_should_not_have_body.ts:3:30 parse ━━━━ 4 │ abstract get my_name() { } 5 │ abstract set my_name(name) { } --- typescript_abstract_class_member_should_not_have_body.ts:4:28 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × abstract members should not have a body @@ -289,7 +317,6 @@ typescript_abstract_class_member_should_not_have_body.ts:4:28 parse ━━━━ 5 │ abstract set my_name(name) { } 6 │ abstract #private_name() { } --- typescript_abstract_class_member_should_not_have_body.ts:5:32 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × abstract members should not have a body @@ -301,7 +328,6 @@ typescript_abstract_class_member_should_not_have_body.ts:5:32 parse ━━━━ 6 │ abstract #private_name() { } 7 │ } --- typescript_abstract_class_member_should_not_have_body.ts:6:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × abstract members should not have a body @@ -313,7 +339,6 @@ typescript_abstract_class_member_should_not_have_body.ts:6:30 parse ━━━━ 7 │ } 8 │ --- typescript_abstract_class_member_should_not_have_body.ts:6:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' modifier cannot be used with a private identifier'. @@ -325,11 +350,4 @@ typescript_abstract_class_member_should_not_have_body.ts:6:5 parse ━━━━ 7 │ } 8 │ --- -abstract class AbstractMembers { - abstract constructor() { } - abstract display(): void { } - abstract get my_name() { } - abstract set my_name(name) { } - abstract #private_name() { } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.rast b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.rast rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts.snap index 41d11ee629b3..d97b61a7dc08 100644 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_abstract_accessor_precedence.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_abstract_accessor_precedence.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { accessor abstract foo: number; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -43,7 +58,11 @@ JsModule { ], eof_token: EOF@51..52 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..52 0: (empty) 1: (empty) @@ -75,7 +94,12 @@ JsModule { 3: SEMICOLON@48..50 ";" [] [Whitespace(" ")] 9: R_CURLY@50..51 "}" [] [] 4: EOF@51..52 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` typescript_abstract_classes_abstract_accessor_precedence.ts:1:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' must precede 'accessor' @@ -96,5 +120,4 @@ typescript_abstract_classes_abstract_accessor_precedence.ts:1:29 parse ━━━ │ ^^^^^^^^ 2 │ --- -abstract class A { accessor abstract foo: number; } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.rast b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts.snap similarity index 91% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.rast rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts.snap index 9bc827809816..88a5426f90bc 100644 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_incomplete.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_incomplete.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -21,7 +36,11 @@ JsModule { ], eof_token: EOF@18..19 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..19 0: (empty) 1: (empty) @@ -41,7 +60,12 @@ JsModule { 1: JS_EMPTY_STATEMENT@17..18 0: SEMICOLON@17..18 ";" [] [] 4: EOF@18..19 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` typescript_abstract_classes_incomplete.ts:1:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × class declarations must have a name @@ -50,5 +74,4 @@ typescript_abstract_classes_incomplete.ts:1:10 parse ━━━━━━━━━ │ ^^^^^^ 2 │ --- -abstract class {}; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts.snap index d3f6822477e4..a6923c385b60 100644 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_async_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_async_member.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class B { abstract async a(); } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -38,7 +53,11 @@ JsModule { ], eof_token: EOF@40..41 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..41 0: (empty) 1: (empty) @@ -68,7 +87,12 @@ JsModule { 4: SEMICOLON@37..39 ";" [] [Whitespace(" ")] 9: R_CURLY@39..40 "}" [] [] 4: EOF@40..41 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` typescript_abstract_classes_invalid_abstract_async_member.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × async members cannot be abstract @@ -77,5 +101,4 @@ typescript_abstract_classes_invalid_abstract_async_member.ts:1:20 parse ━━ │ ^^^^^^^^ 2 │ --- -abstract class B { abstract async a(); } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts.snap index fec8fe143f3c..ef09dae9e1f6 100644 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_constructor.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_constructor.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { abstract constructor();}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -44,7 +59,11 @@ JsModule { ], eof_token: EOF@44..45 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..45 0: (empty) 1: (empty) @@ -76,7 +95,12 @@ JsModule { 1: JS_EMPTY_STATEMENT@43..44 0: SEMICOLON@43..44 ";" [] [] 4: EOF@44..45 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` typescript_abstract_classes_invalid_abstract_constructor.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot appear on a constructor declaration. @@ -85,5 +109,4 @@ typescript_abstract_classes_invalid_abstract_constructor.ts:1:20 parse ━━━ │ ^^^^^^^^ 2 │ --- -abstract class A { abstract constructor();}; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts.snap index 40ecfbcf77b8..06e9e0008671 100644 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_abstract_private_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_abstract_private_member.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { abstract #name(); }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -43,7 +58,11 @@ JsModule { ], eof_token: EOF@39..40 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..40 0: (empty) 1: (empty) @@ -76,7 +95,12 @@ JsModule { 1: JS_EMPTY_STATEMENT@38..39 0: SEMICOLON@38..39 ";" [] [] 4: EOF@39..40 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` typescript_abstract_classes_invalid_abstract_private_member.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' modifier cannot be used with a private identifier'. @@ -85,5 +109,4 @@ typescript_abstract_classes_invalid_abstract_private_member.ts:1:20 parse ━━ │ ^^^^^^^^ 2 │ --- -abstract class A { abstract #name(); }; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts.snap index ebfb756525e3..d7662c8747d4 100644 --- a/crates/biome_js_parser/test_data/inline/err/typescript_abstract_classes_invalid_static_abstract_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_abstract_classes_invalid_static_abstract_member.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { abstract static fn1(); } +abstract class B { static abstract fn1(); } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -78,7 +94,11 @@ JsModule { ], eof_token: EOF@87..88 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..88 0: (empty) 1: (empty) @@ -135,7 +155,12 @@ JsModule { 3: SEMICOLON@84..86 ";" [] [Whitespace(" ")] 9: R_CURLY@86..87 "}" [] [] 4: EOF@87..88 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` typescript_abstract_classes_invalid_static_abstract_member.ts:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot be used with 'static' modifier. @@ -159,7 +184,6 @@ typescript_abstract_classes_invalid_static_abstract_member.ts:1:20 parse ━━ 2 │ abstract class B { static abstract fn1(); } 3 │ --- typescript_abstract_classes_invalid_static_abstract_member.ts:2:27 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × 'abstract' cannot be used with 'static' modifier. @@ -183,6 +207,4 @@ typescript_abstract_classes_invalid_static_abstract_member.ts:2:27 parse ━━ │ ^^^^^^ 3 │ --- -abstract class A { abstract static fn1(); } -abstract class B { static abstract fn1(); } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast b/crates/biome_js_parser/tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts.snap index 20f5c64dc224..77fc66c38bea 100644 --- a/crates/biome_js_parser/test_data/inline/err/typescript_classes_invalid_accessibility_modifier_private_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_classes_invalid_accessibility_modifier_private_member.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { private #name; protected #other; public #baz; }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -66,7 +81,11 @@ JsModule { ], eof_token: EOF@58..59 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..59 0: (empty) 1: (empty) @@ -111,7 +130,12 @@ JsModule { 1: JS_EMPTY_STATEMENT@57..58 0: SEMICOLON@57..58 ";" [] [] 4: EOF@58..59 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` typescript_classes_invalid_accessibility_modifier_private_member.ts:1:11 parse ━━━━━━━━━━━━━━━━━━━━━ × An accessibility modifier cannot be used with a private identifier. @@ -120,7 +144,6 @@ typescript_classes_invalid_accessibility_modifier_private_member.ts:1:11 parse │ ^^^^^^^ 2 │ --- typescript_classes_invalid_accessibility_modifier_private_member.ts:1:26 parse ━━━━━━━━━━━━━━━━━━━━━ × An accessibility modifier cannot be used with a private identifier. @@ -129,7 +152,6 @@ typescript_classes_invalid_accessibility_modifier_private_member.ts:1:26 parse │ ^^^^^^^^^ 2 │ --- typescript_classes_invalid_accessibility_modifier_private_member.ts:1:44 parse ━━━━━━━━━━━━━━━━━━━━━ × An accessibility modifier cannot be used with a private identifier. @@ -138,5 +160,4 @@ typescript_classes_invalid_accessibility_modifier_private_member.ts:1:44 parse │ ^^^^^^ 2 │ --- -class A { private #name; protected #other; public #baz; }; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_enum_incomplete.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_enum_incomplete.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_enum_incomplete.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_enum_incomplete.ts diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_enum_incomplete.rast b/crates/biome_js_parser/tests/js_test_suite/error/typescript_enum_incomplete.ts.snap similarity index 89% rename from crates/biome_js_parser/test_data/inline/err/typescript_enum_incomplete.rast rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_enum_incomplete.ts.snap index 7069b0b29817..358cf177c960 100644 --- a/crates/biome_js_parser/test_data/inline/err/typescript_enum_incomplete.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_enum_incomplete.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +enum A { + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -16,7 +31,11 @@ JsModule { ], eof_token: EOF@8..9 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..9 0: (empty) 1: (empty) @@ -31,7 +50,12 @@ JsModule { 4: TS_ENUM_MEMBER_LIST@8..8 5: (empty) 4: EOF@8..9 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` typescript_enum_incomplete.ts:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `}` but instead the file ends @@ -46,5 +70,4 @@ typescript_enum_incomplete.ts:2:1 parse ━━━━━━━━━━━━━ > 2 │ │ --- -enum A { +``` diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.ts b/crates/biome_js_parser/tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.ts rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts diff --git a/crates/biome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts.snap index 4d18261007b8..bbab360ca691 100644 --- a/crates/biome_js_parser/test_data/inline/err/typescript_members_with_body_in_ambient_context_should_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/typescript_members_with_body_in_ambient_context_should_err.ts.snap @@ -1,3 +1,31 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class Test { + constructor() {} + name() {} + get test(): string { return ""; } + set test(v) {} +} +declare namespace n { + class Test { + constructor() {} + name() {} + get test(): string { return ""; } + set test(v) {} + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -244,7 +272,11 @@ JsModule { ], eof_token: EOF@275..276 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..276 0: (empty) 1: (empty) @@ -419,7 +451,12 @@ JsModule { 9: R_CURLY@266..273 "}" [Newline("\n"), Whitespace(" ")] [] 2: R_CURLY@273..275 "}" [Newline("\n")] [] 4: EOF@275..276 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` typescript_members_with_body_in_ambient_context_should_err.ts:2:19 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body @@ -430,7 +467,6 @@ typescript_members_with_body_in_ambient_context_should_err.ts:2:19 parse ━━ 3 │ name() {} 4 │ get test(): string { return ""; } --- typescript_members_with_body_in_ambient_context_should_err.ts:3:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body @@ -442,7 +478,6 @@ typescript_members_with_body_in_ambient_context_should_err.ts:3:12 parse ━━ 4 │ get test(): string { return ""; } 5 │ set test(v) {} --- typescript_members_with_body_in_ambient_context_should_err.ts:4:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body @@ -454,7 +489,6 @@ typescript_members_with_body_in_ambient_context_should_err.ts:4:24 parse ━━ 5 │ set test(v) {} 6 │ } --- typescript_members_with_body_in_ambient_context_should_err.ts:5:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body @@ -466,7 +500,6 @@ typescript_members_with_body_in_ambient_context_should_err.ts:5:17 parse ━━ 6 │ } 7 │ declare namespace n { --- typescript_members_with_body_in_ambient_context_should_err.ts:9:24 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body @@ -478,7 +511,6 @@ typescript_members_with_body_in_ambient_context_should_err.ts:9:24 parse ━━ 10 │ name() {} 11 │ get test(): string { return ""; } --- typescript_members_with_body_in_ambient_context_should_err.ts:10:17 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body @@ -490,7 +522,6 @@ typescript_members_with_body_in_ambient_context_should_err.ts:10:17 parse ━━ 11 │ get test(): string { return ""; } 12 │ set test(v) {} --- typescript_members_with_body_in_ambient_context_should_err.ts:11:29 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body @@ -502,7 +533,6 @@ typescript_members_with_body_in_ambient_context_should_err.ts:11:29 parse ━━ 12 │ set test(v) {} 13 │ } --- typescript_members_with_body_in_ambient_context_should_err.ts:12:22 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━ × members inside ambient contexts should not have a body @@ -514,18 +544,4 @@ typescript_members_with_body_in_ambient_context_should_err.ts:12:22 parse ━━ 13 │ } 14 │ } --- -declare class Test { - constructor() {} - name() {} - get test(): string { return ""; } - set test(v) {} -} -declare namespace n { - class Test { - constructor() {} - name() {} - get test(): string { return ""; } - set test(v) {} - } -} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/unary_delete.js b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/unary_delete.js rename to crates/biome_js_parser/tests/js_test_suite/error/unary_delete.js diff --git a/crates/biome_js_parser/test_data/inline/err/unary_delete.rast b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/unary_delete.rast rename to crates/biome_js_parser/tests/js_test_suite/error/unary_delete.js.snap index 82b924bff478..7d6d213e09c7 100644 --- a/crates/biome_js_parser/test_data/inline/err/unary_delete.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +delete ident; +delete obj.#member; +delete func().#member; +delete obj?.#member; +delete obj?.inner.#member; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -114,7 +133,11 @@ JsModule { ], eof_token: EOF@104..105 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..105 0: (empty) 1: (empty) @@ -187,7 +210,12 @@ JsModule { 1: IDENT@97..103 "member" [] [] 1: SEMICOLON@103..104 ";" [] [] 4: EOF@104..105 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` unary_delete.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a single identifier @@ -197,7 +225,6 @@ unary_delete.js:1:8 parse ━━━━━━━━━━━━━━━━━━ 2 │ delete obj.#member; 3 │ delete func().#member; --- unary_delete.js:2:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member @@ -208,7 +235,6 @@ unary_delete.js:2:8 parse ━━━━━━━━━━━━━━━━━━ 3 │ delete func().#member; 4 │ delete obj?.#member; --- unary_delete.js:3:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member @@ -220,7 +246,6 @@ unary_delete.js:3:8 parse ━━━━━━━━━━━━━━━━━━ 4 │ delete obj?.#member; 5 │ delete obj?.inner.#member; --- unary_delete.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member @@ -232,7 +257,6 @@ unary_delete.js:4:8 parse ━━━━━━━━━━━━━━━━━━ 5 │ delete obj?.inner.#member; 6 │ --- unary_delete.js:5:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member @@ -243,9 +267,4 @@ unary_delete.js:5:8 parse ━━━━━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^^^^^^^ 6 │ --- -delete ident; -delete obj.#member; -delete func().#member; -delete obj?.#member; -delete obj?.inner.#member; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/unary_delete_parenthesized.js b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete_parenthesized.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/unary_delete_parenthesized.js rename to crates/biome_js_parser/tests/js_test_suite/error/unary_delete_parenthesized.js diff --git a/crates/biome_js_parser/test_data/inline/err/unary_delete_parenthesized.rast b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete_parenthesized.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/unary_delete_parenthesized.rast rename to crates/biome_js_parser/tests/js_test_suite/error/unary_delete_parenthesized.js.snap index ba659845801b..36b50e26c0a4 100644 --- a/crates/biome_js_parser/test_data/inline/err/unary_delete_parenthesized.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/unary_delete_parenthesized.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +delete (ident); +delete ((ident)); +delete (obj.key, ident); +delete (obj.#member); +delete (func().#member); +delete (obj?.#member); +delete (obj?.inner.#member); +delete (obj.key, obj.#key); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -224,7 +246,11 @@ JsModule { ], eof_token: EOF@185..186 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..186 0: (empty) 1: (empty) @@ -368,7 +394,12 @@ JsModule { 2: R_PAREN@183..184 ")" [] [] 1: SEMICOLON@184..185 ";" [] [] 4: EOF@185..186 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` unary_delete_parenthesized.js:1:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a single identifier @@ -378,7 +409,6 @@ unary_delete_parenthesized.js:1:9 parse ━━━━━━━━━━━━━ 2 │ delete ((ident)); 3 │ delete (obj.key, ident); --- unary_delete_parenthesized.js:2:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a single identifier @@ -389,7 +419,6 @@ unary_delete_parenthesized.js:2:10 parse ━━━━━━━━━━━━━ 3 │ delete (obj.key, ident); 4 │ delete (obj.#member); --- unary_delete_parenthesized.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a single identifier @@ -401,7 +430,6 @@ unary_delete_parenthesized.js:3:18 parse ━━━━━━━━━━━━━ 4 │ delete (obj.#member); 5 │ delete (func().#member); --- unary_delete_parenthesized.js:4:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member @@ -413,7 +441,6 @@ unary_delete_parenthesized.js:4:9 parse ━━━━━━━━━━━━━ 5 │ delete (func().#member); 6 │ delete (obj?.#member); --- unary_delete_parenthesized.js:5:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member @@ -425,7 +452,6 @@ unary_delete_parenthesized.js:5:9 parse ━━━━━━━━━━━━━ 6 │ delete (obj?.#member); 7 │ delete (obj?.inner.#member); --- unary_delete_parenthesized.js:6:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member @@ -437,7 +463,6 @@ unary_delete_parenthesized.js:6:9 parse ━━━━━━━━━━━━━ 7 │ delete (obj?.inner.#member); 8 │ delete (obj.key, obj.#key); --- unary_delete_parenthesized.js:7:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member @@ -449,7 +474,6 @@ unary_delete_parenthesized.js:7:9 parse ━━━━━━━━━━━━━ 8 │ delete (obj.key, obj.#key); 9 │ --- unary_delete_parenthesized.js:8:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × the target for a delete operator cannot be a private member @@ -460,12 +484,4 @@ unary_delete_parenthesized.js:8:18 parse ━━━━━━━━━━━━━ │ ^^^^^^^^ 9 │ --- -delete (ident); -delete ((ident)); -delete (obj.key, ident); -delete (obj.#member); -delete (func().#member); -delete (obj?.#member); -delete (obj?.inner.#member); -delete (obj.key, obj.#key); +``` diff --git a/crates/biome_js_parser/test_data/inline/err/unary_expr.js b/crates/biome_js_parser/tests/js_test_suite/error/unary_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/unary_expr.js rename to crates/biome_js_parser/tests/js_test_suite/error/unary_expr.js diff --git a/crates/biome_js_parser/test_data/inline/err/unary_expr.rast b/crates/biome_js_parser/tests/js_test_suite/error/unary_expr.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/unary_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/error/unary_expr.js.snap index 0fb04f6234db..95b07e0fd297 100644 --- a/crates/biome_js_parser/test_data/inline/err/unary_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/unary_expr.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +++ ; +-- ; +-; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -27,7 +44,11 @@ JsModule { ], eof_token: EOF@12..13 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..13 0: (empty) 1: (empty) @@ -49,7 +70,12 @@ JsModule { 1: (empty) 1: SEMICOLON@11..12 ";" [] [] 4: EOF@12..13 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` unary_expr.js:1:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, or a member expression but instead found ';'. @@ -66,7 +92,6 @@ unary_expr.js:1:4 parse ━━━━━━━━━━━━━━━━━━ 2 │ -- ; 3 │ -; --- unary_expr.js:2:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, or a member expression but instead found ';'. @@ -85,7 +110,4 @@ unary_expr.js:2:4 parse ━━━━━━━━━━━━━━━━━━ 3 │ -; 4 │ --- -++ ; --- ; --; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/unterminated_string.jsx b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_string.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/unterminated_string.jsx rename to crates/biome_js_parser/tests/js_test_suite/error/unterminated_string.jsx diff --git a/crates/biome_js_parser/test_data/inline/err/unterminated_string.rast b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_string.jsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/unterminated_string.rast rename to crates/biome_js_parser/tests/js_test_suite/error/unterminated_string.jsx.snap index 7771a7192ff1..68d8debec187 100644 --- a/crates/biome_js_parser/test_data/inline/err/unterminated_string.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_string.jsx.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +const f = () => ( +
+ ); +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -79,7 +98,11 @@ JsModule { ], eof_token: EOF@132..132 "" [] [], } +``` +## CST + +``` 0: JS_MODULE@0..132 0: (empty) 1: (empty) @@ -131,7 +154,12 @@ JsModule { 2: R_PAREN@127..131 ")" [Newline("\n"), Whitespace(" ")] [] 1: SEMICOLON@131..132 ";" [] [] 4: EOF@132..132 "" [] [] --- + +``` + +## Diagnostics + +``` unterminated_string.jsx:4:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × unterminated string literal @@ -154,10 +182,4 @@ unterminated_string.jsx:4:45 parse ━━━━━━━━━━━━━━━ i The closing quote must be on the same line. --- -const f = () => ( -
- ); \ No newline at end of file +``` diff --git a/crates/biome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.js b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_unicode_codepoint.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.js rename to crates/biome_js_parser/tests/js_test_suite/error/unterminated_unicode_codepoint.js diff --git a/crates/biome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.rast b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_unicode_codepoint.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.rast rename to crates/biome_js_parser/tests/js_test_suite/error/unterminated_unicode_codepoint.js.snap index 5104047b1c82..574a84af974d 100644 --- a/crates/biome_js_parser/test_data/inline/err/unterminated_unicode_codepoint.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/unterminated_unicode_codepoint.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let s = "\u{200"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +52,11 @@ JsModule { ], eof_token: EOF@17..18 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..18 0: (empty) 1: (empty) @@ -56,7 +75,12 @@ JsModule { 0: ERROR_TOKEN@8..16 "\"\\u{200\"" [] [] 1: SEMICOLON@16..17 ";" [] [] 4: EOF@17..18 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` unterminated_unicode_codepoint.js:1:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected hex digits for a unicode code point escape, but encountered an invalid character @@ -65,5 +89,4 @@ unterminated_unicode_codepoint.js:1:16 parse ━━━━━━━━━━━ │ ^ 2 │ --- -let s = "\u{200"; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.js b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.js rename to crates/biome_js_parser/tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js diff --git a/crates/biome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.rast b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js.snap index 3021960adfa3..f4111f312f1a 100644 --- a/crates/biome_js_parser/test_data/inline/err/using_declaration_not_allowed_in_for_in_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_not_allowed_in_for_in_statement.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for (using x in y) {}; +for (await using x in y) {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -66,7 +82,11 @@ JsModule { ], eof_token: EOF@51..52 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..52 0: (empty) 1: (empty) @@ -117,7 +137,12 @@ JsModule { 3: JS_EMPTY_STATEMENT@50..51 0: SEMICOLON@50..51 ";" [] [] 4: EOF@51..52 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` using_declaration_not_allowed_in_for_in_statement.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × The left-hand side of a 'for...in' statement cannot be a 'using' declaration @@ -127,7 +152,6 @@ using_declaration_not_allowed_in_for_in_statement.js:1:12 parse ━━━━━ 2 │ for (await using x in y) {}; 3 │ --- using_declaration_not_allowed_in_for_in_statement.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × The left-hand side of a 'for...in' statement cannot be a 'using' declaration @@ -137,6 +161,4 @@ using_declaration_not_allowed_in_for_in_statement.js:2:18 parse ━━━━━ │ ^ 3 │ --- -for (using x in y) {}; -for (await using x in y) {}; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/using_declaration_statement_err.js b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_statement_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/using_declaration_statement_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/using_declaration_statement_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/using_declaration_statement_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_statement_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/using_declaration_statement_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/using_declaration_statement_err.js.snap index 402913d30174..dc1007deeaf9 100644 --- a/crates/biome_js_parser/test_data/inline/err/using_declaration_statement_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/using_declaration_statement_err.js.snap @@ -1,3 +1,27 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +using a; +using {b}; +using c = d, e; +export using m = n; +await using f; +await using g = h, j; +await using [o] = p; +export await using q = r; +await let s; +await const t = 1; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -263,7 +287,11 @@ JsModule { ], eof_token: EOF@171..172 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..172 0: (empty) 1: (empty) @@ -438,7 +466,12 @@ JsModule { 0: JS_NUMBER_LITERAL@169..170 "1" [] [] 1: SEMICOLON@170..171 ";" [] [] 4: EOF@171..172 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` using_declaration_statement_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Using declarations must have an initialized value. @@ -450,7 +483,6 @@ using_declaration_statement_err.js:1:7 parse ━━━━━━━━━━━ i This variable needs to be initialized. --- using_declaration_statement_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -477,7 +509,6 @@ using_declaration_statement_err.js:2:7 parse ━━━━━━━━━━━ 3 │ using c = d, e; 4 │ export using m = n; --- using_declaration_statement_err.js:3:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Using declarations must have an initialized value. @@ -491,7 +522,6 @@ using_declaration_statement_err.js:3:14 parse ━━━━━━━━━━━ i This variable needs to be initialized. --- using_declaration_statement_err.js:4:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration but instead found 'using'. @@ -512,7 +542,6 @@ using_declaration_statement_err.js:4:8 parse ━━━━━━━━━━━ 5 │ await using f; 6 │ await using g = h, j; --- using_declaration_statement_err.js:5:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Using declarations must have an initialized value. @@ -526,7 +555,6 @@ using_declaration_statement_err.js:5:13 parse ━━━━━━━━━━━ i This variable needs to be initialized. --- using_declaration_statement_err.js:6:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Using declarations must have an initialized value. @@ -540,7 +568,6 @@ using_declaration_statement_err.js:6:20 parse ━━━━━━━━━━━ i This variable needs to be initialized. --- using_declaration_statement_err.js:7:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Invalid assignment to `await using [o]` @@ -554,7 +581,6 @@ using_declaration_statement_err.js:7:1 parse ━━━━━━━━━━━ i This expression cannot be assigned to --- using_declaration_statement_err.js:8:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a class, a function, or a variable declaration but instead found 'await'. @@ -575,7 +601,6 @@ using_declaration_statement_err.js:8:8 parse ━━━━━━━━━━━ 9 │ await let s; 10 │ await const t = 1; --- using_declaration_statement_err.js:9:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `let` as an identifier in strict mode @@ -587,7 +612,6 @@ using_declaration_statement_err.js:9:7 parse ━━━━━━━━━━━ 10 │ await const t = 1; 11 │ --- using_declaration_statement_err.js:9:11 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -617,7 +641,6 @@ using_declaration_statement_err.js:9:11 parse ━━━━━━━━━━━ 10 │ await const t = 1; 11 │ --- using_declaration_statement_err.js:10:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an unary expression but instead found 'const'. @@ -636,14 +659,4 @@ using_declaration_statement_err.js:10:7 parse ━━━━━━━━━━━ │ ^^^^^ 11 │ --- -using a; -using {b}; -using c = d, e; -export using m = n; -await using f; -await using g = h, j; -await using [o] = p; -export await using q = r; -await let s; -await const t = 1; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/var_decl_err.js b/crates/biome_js_parser/tests/js_test_suite/error/var_decl_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/var_decl_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/var_decl_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/var_decl_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/var_decl_err.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/var_decl_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/var_decl_err.js.snap index 50b441f03e8d..c9f03af11eb9 100644 --- a/crates/biome_js_parser/test_data/inline/err/var_decl_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/var_decl_err.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +var a =; +const b = 5 let c = 5; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -67,7 +83,11 @@ JsModule { ], eof_token: EOF@31..32 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..32 0: (empty) 1: (empty) @@ -115,7 +135,12 @@ JsModule { 0: JS_NUMBER_LITERAL@29..30 "5" [] [] 1: SEMICOLON@30..31 ";" [] [] 4: EOF@31..32 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` var_decl_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an expression, or an assignment but instead found ';'. @@ -132,7 +157,6 @@ var_decl_err.js:1:8 parse ━━━━━━━━━━━━━━━━━━ 2 │ const b = 5 let c = 5; 3 │ --- var_decl_err.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a semicolon or an implicit semicolon after a statement, but found none @@ -156,6 +180,4 @@ var_decl_err.js:2:13 parse ━━━━━━━━━━━━━━━━━ │ ^^^^^^^^^^^^ 3 │ --- -var a =; -const b = 5 let c = 5; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declaration_statement_err.js b/crates/biome_js_parser/tests/js_test_suite/error/variable_declaration_statement_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/variable_declaration_statement_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/variable_declaration_statement_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/variable_declaration_statement_err.js.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/variable_declaration_statement_err.js.snap index f6d6a95b5547..5298bdc01a79 100644 --- a/crates/biome_js_parser/test_data/inline/err/variable_declaration_statement_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/variable_declaration_statement_err.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a, { b } = { a: 10 } +const c = 1, { d } = { a: 10 } +const e; +let [f]; +const { g }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -177,7 +196,11 @@ JsModule { ], eof_token: EOF@86..87 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..87 0: (empty) 1: (empty) @@ -300,7 +323,12 @@ JsModule { 2: (empty) 1: SEMICOLON@85..86 ";" [] [] 4: EOF@86..87 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` variable_declaration_statement_err.js:3:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Const declarations must have an initialized value. @@ -314,7 +342,6 @@ variable_declaration_statement_err.js:3:7 parse ━━━━━━━━━━ i This variable needs to be initialized. --- variable_declaration_statement_err.js:4:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Object and Array patterns require initializers. @@ -328,7 +355,6 @@ variable_declaration_statement_err.js:4:5 parse ━━━━━━━━━━ i This pattern is declared, but it is not given an initialized value. --- variable_declaration_statement_err.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Object and Array patterns require initializers. @@ -341,9 +367,4 @@ variable_declaration_statement_err.js:5:7 parse ━━━━━━━━━━ i This pattern is declared, but it is not given an initialized value. --- -let a, { b } = { a: 10 } -const c = 1, { d } = { a: 10 } -const e; -let [f]; -const { g }; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_empty.js b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_empty.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/variable_declarator_list_empty.js rename to crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_empty.js diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_empty.rast b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_empty.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/err/variable_declarator_list_empty.rast rename to crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_empty.js.snap index 76aecae0c680..6abece3d6c9b 100644 --- a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_empty.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_empty.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +const; +const + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -31,7 +47,11 @@ JsModule { ], eof_token: EOF@12..13 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..13 0: (empty) 1: (empty) @@ -47,7 +67,12 @@ JsModule { 0: CONST_KW@6..12 "const" [Newline("\n")] [] 1: JS_BOGUS@12..12 4: EOF@12..13 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` variable_declarator_list_empty.js:1:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern but instead found ';'. @@ -64,7 +89,6 @@ variable_declarator_list_empty.js:1:6 parse ━━━━━━━━━━━━ 2 │ const 3 │ --- variable_declarator_list_empty.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern but instead found the end of the file. @@ -81,6 +105,4 @@ variable_declarator_list_empty.js:3:1 parse ━━━━━━━━━━━━ > 3 │ │ --- -const; -const +``` diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.js b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_incomplete.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.js rename to crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_incomplete.js diff --git a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_incomplete.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast rename to crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_incomplete.js.snap index a20e74c9b0be..c1424db1e3e5 100644 --- a/crates/biome_js_parser/test_data/inline/err/variable_declarator_list_incomplete.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/variable_declarator_list_incomplete.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +const a = 1, + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -29,7 +44,11 @@ JsModule { ], eof_token: EOF@12..13 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..13 0: (empty) 1: (empty) @@ -52,7 +71,12 @@ JsModule { 2: (empty) 1: (empty) 4: EOF@12..13 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` variable_declarator_list_incomplete.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected an identifier, an array pattern, or an object pattern but instead found the end of the file. @@ -67,5 +91,4 @@ variable_declarator_list_incomplete.js:2:1 parse ━━━━━━━━━━ > 2 │ │ --- -const a = 1, +``` diff --git a/crates/biome_js_parser/test_data/inline/err/while_stmt_err.js b/crates/biome_js_parser/tests/js_test_suite/error/while_stmt_err.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/while_stmt_err.js rename to crates/biome_js_parser/tests/js_test_suite/error/while_stmt_err.js diff --git a/crates/biome_js_parser/test_data/inline/err/while_stmt_err.rast b/crates/biome_js_parser/tests/js_test_suite/error/while_stmt_err.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/while_stmt_err.rast rename to crates/biome_js_parser/tests/js_test_suite/error/while_stmt_err.js.snap index 296823ef27af..ef73535472e7 100644 --- a/crates/biome_js_parser/test_data/inline/err/while_stmt_err.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/while_stmt_err.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +while true {} +while {} +while (true {} +while true) } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -57,7 +75,11 @@ JsModule { ], eof_token: EOF@51..52 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..52 0: (empty) 1: (empty) @@ -102,7 +124,12 @@ JsModule { 4: JS_BOGUS_STATEMENT@50..51 0: R_CURLY@50..51 "}" [] [] 4: EOF@51..52 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` while_stmt_err.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `true` @@ -114,7 +141,6 @@ while_stmt_err.js:1:7 parse ━━━━━━━━━━━━━━━━━ i Remove true --- while_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `{` @@ -126,7 +152,6 @@ while_stmt_err.js:1:12 parse ━━━━━━━━━━━━━━━━━ i Remove { --- while_stmt_err.js:2:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `{` @@ -139,7 +164,6 @@ while_stmt_err.js:2:7 parse ━━━━━━━━━━━━━━━━━ i Remove { --- while_stmt_err.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `)` but instead found `{` @@ -153,7 +177,6 @@ while_stmt_err.js:3:13 parse ━━━━━━━━━━━━━━━━━ i Remove { --- while_stmt_err.js:4:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × expected `(` but instead found `true` @@ -166,7 +189,6 @@ while_stmt_err.js:4:7 parse ━━━━━━━━━━━━━━━━━ i Remove true --- while_stmt_err.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Expected a statement but instead found '}'. @@ -185,8 +207,4 @@ while_stmt_err.js:4:13 parse ━━━━━━━━━━━━━━━━━ │ ^ 5 │ --- -while true {} -while {} -while (true {} -while true) } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_module.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_module.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_at_top_level_module.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_module.js diff --git a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_module.rast b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_module.js.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/err/yield_at_top_level_module.rast rename to crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_module.js.snap index 2edcbc367553..7d70596444e9 100644 --- a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_module.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_module.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +yield 10; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -20,7 +35,11 @@ JsModule { ], eof_token: EOF@9..10 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..10 0: (empty) 1: (empty) @@ -35,7 +54,12 @@ JsModule { 0: JS_NUMBER_LITERAL@6..8 "10" [] [] 1: SEMICOLON@8..9 ";" [] [] 4: EOF@9..10 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` yield_at_top_level_module.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. @@ -44,5 +68,4 @@ yield_at_top_level_module.js:1:1 parse ━━━━━━━━━━━━━ │ ^^^^^ 2 │ --- -yield 10; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_script.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_at_top_level_script.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs.snap new file mode 100644 index 000000000000..2b8d2517a04c --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.cjs.snap @@ -0,0 +1,73 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +yield 10; + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@0..16 "yield" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@16..18 "10" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@18..19 ";" [] [], + }, + ], + eof_token: EOF@19..20 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..20 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..19 + 0: JS_EXPRESSION_STATEMENT@0..19 + 0: JS_BOGUS_EXPRESSION@0..18 + 0: YIELD_KW@0..16 "yield" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@16..18 + 0: (empty) + 1: JS_NUMBER_LITERAL_EXPRESSION@16..18 + 0: JS_NUMBER_LITERAL@16..18 "10" [] [] + 1: SEMICOLON@18..19 ";" [] [] + 4: EOF@19..20 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +yield_at_top_level_script.cjs:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ // SCRIPT + > 2 │ yield 10; + │ ^^^^^ + 3 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_script.rast b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.js.snap similarity index 86% rename from crates/biome_js_parser/test_data/inline/err/yield_at_top_level_script.rast rename to crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.js.snap index d58b96ce7cfa..d2e8bbf11ed9 100644 --- a/crates/biome_js_parser/test_data/inline/err/yield_at_top_level_script.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_at_top_level_script.js.snap @@ -1,8 +1,24 @@ -JsScript { +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +yield 10; + +``` + + +## AST + +``` +JsModule { bom_token: missing (optional), interpreter_token: missing (optional), directives: JsDirectiveList [], - statements: JsStatementList [ + items: JsModuleItemList [ JsExpressionStatement { expression: JsBogusExpression { items: [ @@ -20,12 +36,16 @@ JsScript { ], eof_token: EOF@19..20 "" [Newline("\n")] [], } +``` -0: JS_SCRIPT@0..20 +## CST + +``` +0: JS_MODULE@0..20 0: (empty) 1: (empty) 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..19 + 3: JS_MODULE_ITEM_LIST@0..19 0: JS_EXPRESSION_STATEMENT@0..19 0: JS_BOGUS_EXPRESSION@0..18 0: YIELD_KW@0..16 "yield" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] @@ -35,7 +55,12 @@ JsScript { 0: JS_NUMBER_LITERAL@16..18 "10" [] [] 1: SEMICOLON@18..19 ";" [] [] 4: EOF@19..20 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` yield_at_top_level_script.js:2:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. @@ -45,6 +70,4 @@ yield_at_top_level_script.js:2:1 parse ━━━━━━━━━━━━━ │ ^^^^^ 3 │ --- -// SCRIPT -yield 10; +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_expr_in_parameter_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_expr_in_parameter_initializer.js diff --git a/crates/biome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/error/yield_expr_in_parameter_initializer.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/error/yield_expr_in_parameter_initializer.js.snap index 74eba4688b08..92a71fd94661 100644 --- a/crates/biome_js_parser/test_data/inline/err/yield_expr_in_parameter_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_expr_in_parameter_initializer.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function* test(a = yield "test") {} +function test2(a = yield "test") {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -94,7 +110,11 @@ JsModule { ], eof_token: EOF@71..72 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..72 0: (empty) 1: (empty) @@ -163,7 +183,12 @@ JsModule { 2: JS_STATEMENT_LIST@70..70 3: R_CURLY@70..71 "}" [] [] 4: EOF@71..72 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` yield_expr_in_parameter_initializer.js:1:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. @@ -173,7 +198,6 @@ yield_expr_in_parameter_initializer.js:1:20 parse ━━━━━━━━━━ 2 │ function test2(a = yield "test") {} 3 │ --- yield_expr_in_parameter_initializer.js:2:20 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. @@ -183,6 +207,4 @@ yield_expr_in_parameter_initializer.js:2:20 parse ━━━━━━━━━━ │ ^^^^^ 3 │ --- -function* test(a = yield "test") {} -function test2(a = yield "test") {} +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function.js diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function.rast b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function.rast rename to crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function.js.snap index 9a8084111015..3a0db6d00674 100644 --- a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { yield bar; } +function foo() { yield 10; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -80,7 +96,11 @@ JsModule { ], eof_token: EOF@58..59 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..59 0: (empty) 1: (empty) @@ -138,7 +158,12 @@ JsModule { 1: SEMICOLON@55..57 ";" [] [Whitespace(" ")] 3: R_CURLY@57..58 "}" [] [] 4: EOF@58..59 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` yield_in_non_generator_function.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. @@ -148,7 +173,6 @@ yield_in_non_generator_function.js:1:18 parse ━━━━━━━━━━━ 2 │ function foo() { yield 10; } 3 │ --- yield_in_non_generator_function.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. @@ -158,6 +182,4 @@ yield_in_non_generator_function.js:2:18 parse ━━━━━━━━━━━ │ ^^^^^ 3 │ --- -function foo() { yield bar; } -function foo() { yield 10; } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_module.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_module.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_module.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_module.js diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_module.rast b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_module.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_module.rast rename to crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_module.js.snap index 89d7056b2832..14c9550a5df5 100644 --- a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_module.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_module.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { yield; } +function foo() { yield foo; } +function foo() { yield *foo; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -120,7 +137,11 @@ JsModule { ], eof_token: EOF@86..87 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..87 0: (empty) 1: (empty) @@ -202,7 +223,12 @@ JsModule { 1: SEMICOLON@83..85 ";" [] [Whitespace(" ")] 3: R_CURLY@85..86 "}" [] [] 4: EOF@86..87 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` yield_in_non_generator_function_module.js:1:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode @@ -212,7 +238,6 @@ yield_in_non_generator_function_module.js:1:18 parse ━━━━━━━━━ 2 │ function foo() { yield foo; } 3 │ function foo() { yield *foo; } --- yield_in_non_generator_function_module.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. @@ -223,7 +248,6 @@ yield_in_non_generator_function_module.js:2:18 parse ━━━━━━━━━ 3 │ function foo() { yield *foo; } 4 │ --- yield_in_non_generator_function_module.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Illegal use of reserved keyword `yield` as an identifier in strict mode @@ -234,7 +258,4 @@ yield_in_non_generator_function_module.js:3:18 parse ━━━━━━━━━ │ ^^^^^ 4 │ --- -function foo() { yield; } -function foo() { yield foo; } -function foo() { yield *foo; } +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_script.js b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_script.js rename to crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs diff --git a/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs.snap b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs.snap new file mode 100644 index 000000000000..db10deb8b3dc --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.cjs.snap @@ -0,0 +1,188 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function foo() { yield bar; } +function foo() { yield 10; } + +``` + + +## AST + +``` +JsScript { + bom_token: missing (optional), + interpreter_token: missing (optional), + directives: JsDirectiveList [], + statements: JsStatementList [ + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@19..22 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@22..23 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@23..25 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@25..27 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@27..33 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsIdentifierExpression { + name: JsReferenceIdentifier { + value_token: IDENT@33..36 "bar" [] [], + }, + }, + }, + ], + }, + semicolon_token: SEMICOLON@36..38 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@38..39 "}" [] [], + }, + }, + JsFunctionDeclaration { + async_token: missing (optional), + function_token: FUNCTION_KW@39..49 "function" [Newline("\n")] [Whitespace(" ")], + star_token: missing (optional), + id: JsIdentifierBinding { + name_token: IDENT@49..52 "foo" [] [], + }, + type_parameters: missing (optional), + parameters: JsParameters { + l_paren_token: L_PAREN@52..53 "(" [] [], + items: JsParameterList [], + r_paren_token: R_PAREN@53..55 ")" [] [Whitespace(" ")], + }, + return_type_annotation: missing (optional), + body: JsFunctionBody { + l_curly_token: L_CURLY@55..57 "{" [] [Whitespace(" ")], + directives: JsDirectiveList [], + statements: JsStatementList [ + JsExpressionStatement { + expression: JsBogusExpression { + items: [ + YIELD_KW@57..63 "yield" [] [Whitespace(" ")], + JsYieldArgument { + star_token: missing (optional), + expression: JsNumberLiteralExpression { + value_token: JS_NUMBER_LITERAL@63..65 "10" [] [], + }, + }, + ], + }, + semicolon_token: SEMICOLON@65..67 ";" [] [Whitespace(" ")], + }, + ], + r_curly_token: R_CURLY@67..68 "}" [] [], + }, + }, + ], + eof_token: EOF@68..69 "" [Newline("\n")] [], +} +``` + +## CST + +``` +0: JS_SCRIPT@0..69 + 0: (empty) + 1: (empty) + 2: JS_DIRECTIVE_LIST@0..0 + 3: JS_STATEMENT_LIST@0..68 + 0: JS_FUNCTION_DECLARATION@0..39 + 0: (empty) + 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@19..22 + 0: IDENT@19..22 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@22..25 + 0: L_PAREN@22..23 "(" [] [] + 1: JS_PARAMETER_LIST@23..23 + 2: R_PAREN@23..25 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@25..39 + 0: L_CURLY@25..27 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@27..27 + 2: JS_STATEMENT_LIST@27..38 + 0: JS_EXPRESSION_STATEMENT@27..38 + 0: JS_BOGUS_EXPRESSION@27..36 + 0: YIELD_KW@27..33 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@33..36 + 0: (empty) + 1: JS_IDENTIFIER_EXPRESSION@33..36 + 0: JS_REFERENCE_IDENTIFIER@33..36 + 0: IDENT@33..36 "bar" [] [] + 1: SEMICOLON@36..38 ";" [] [Whitespace(" ")] + 3: R_CURLY@38..39 "}" [] [] + 1: JS_FUNCTION_DECLARATION@39..68 + 0: (empty) + 1: FUNCTION_KW@39..49 "function" [Newline("\n")] [Whitespace(" ")] + 2: (empty) + 3: JS_IDENTIFIER_BINDING@49..52 + 0: IDENT@49..52 "foo" [] [] + 4: (empty) + 5: JS_PARAMETERS@52..55 + 0: L_PAREN@52..53 "(" [] [] + 1: JS_PARAMETER_LIST@53..53 + 2: R_PAREN@53..55 ")" [] [Whitespace(" ")] + 6: (empty) + 7: JS_FUNCTION_BODY@55..68 + 0: L_CURLY@55..57 "{" [] [Whitespace(" ")] + 1: JS_DIRECTIVE_LIST@57..57 + 2: JS_STATEMENT_LIST@57..67 + 0: JS_EXPRESSION_STATEMENT@57..67 + 0: JS_BOGUS_EXPRESSION@57..65 + 0: YIELD_KW@57..63 "yield" [] [Whitespace(" ")] + 1: JS_YIELD_ARGUMENT@63..65 + 0: (empty) + 1: JS_NUMBER_LITERAL_EXPRESSION@63..65 + 0: JS_NUMBER_LITERAL@63..65 "10" [] [] + 1: SEMICOLON@65..67 ";" [] [Whitespace(" ")] + 3: R_CURLY@67..68 "}" [] [] + 4: EOF@68..69 "" [Newline("\n")] [] + +``` + +## Diagnostics + +``` +yield_in_non_generator_function_script.cjs:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ // SCRIPT + > 2 │ function foo() { yield bar; } + │ ^^^^^ + 3 │ function foo() { yield 10; } + 4 │ + +yield_in_non_generator_function_script.cjs:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `yield` is only allowed within generator functions. + + 1 │ // SCRIPT + 2 │ function foo() { yield bar; } + > 3 │ function foo() { yield 10; } + │ ^^^^^ + 4 │ + +``` diff --git a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_script.rast b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_script.rast rename to crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.js.snap index 5688ecca46e3..cb7d0c7591ad 100644 --- a/crates/biome_js_parser/test_data/inline/err/yield_in_non_generator_function_script.rast +++ b/crates/biome_js_parser/tests/js_test_suite/error/yield_in_non_generator_function_script.js.snap @@ -1,8 +1,25 @@ -JsScript { +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// SCRIPT +function foo() { yield bar; } +function foo() { yield 10; } + +``` + + +## AST + +``` +JsModule { bom_token: missing (optional), interpreter_token: missing (optional), directives: JsDirectiveList [], - statements: JsStatementList [ + items: JsModuleItemList [ JsFunctionDeclaration { async_token: missing (optional), function_token: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")], @@ -80,12 +97,16 @@ JsScript { ], eof_token: EOF@68..69 "" [Newline("\n")] [], } +``` -0: JS_SCRIPT@0..69 +## CST + +``` +0: JS_MODULE@0..69 0: (empty) 1: (empty) 2: JS_DIRECTIVE_LIST@0..0 - 3: JS_STATEMENT_LIST@0..68 + 3: JS_MODULE_ITEM_LIST@0..68 0: JS_FUNCTION_DECLARATION@0..39 0: (empty) 1: FUNCTION_KW@0..19 "function" [Comments("// SCRIPT"), Newline("\n")] [Whitespace(" ")] @@ -138,7 +159,12 @@ JsScript { 1: SEMICOLON@65..67 ";" [] [Whitespace(" ")] 3: R_CURLY@67..68 "}" [] [] 4: EOF@68..69 "" [Newline("\n")] [] --- + +``` + +## Diagnostics + +``` yield_in_non_generator_function_script.js:2:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. @@ -149,7 +175,6 @@ yield_in_non_generator_function_script.js:2:18 parse ━━━━━━━━━ 3 │ function foo() { yield 10; } 4 │ --- yield_in_non_generator_function_script.js:3:18 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × `yield` is only allowed within generator functions. @@ -160,7 +185,4 @@ yield_in_non_generator_function_script.js:3:18 parse ━━━━━━━━━ │ ^^^^^ 4 │ --- -// SCRIPT -function foo() { yield bar; } -function foo() { yield 10; } +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/arguments_in_definition_file.d.ts b/crates/biome_js_parser/tests/js_test_suite/ok/arguments_in_definition_file.d.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/arguments_in_definition_file.d.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/arguments_in_definition_file.d.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/arguments_in_definition_file.d.rast b/crates/biome_js_parser/tests/js_test_suite/ok/arguments_in_definition_file.d.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/arguments_in_definition_file.d.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/arguments_in_definition_file.d.ts.snap index 328c37e9074a..a203b355b3bb 100644 --- a/crates/biome_js_parser/test_data/inline/ok/arguments_in_definition_file.d.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/arguments_in_definition_file.d.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a(...arguments: any[]): void; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -44,7 +59,11 @@ JsModule { ], eof_token: EOF@38..39 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..39 0: (empty) 1: (empty) @@ -78,3 +97,5 @@ JsModule { 0: VOID_KW@33..37 "void" [] [] 6: SEMICOLON@37..38 ";" [] [] 4: EOF@38..39 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target.js diff --git a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target.rast b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/array_assignment_target.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target.js.snap index 38b5b072a9aa..039249adbe6c 100644 --- a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +[foo, bar] = baz; +[,,,b,,c,] = baz; +[a = "test", a.b, call().b] = baz; +[((a))] = baz; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -173,7 +191,11 @@ JsModule { ], eof_token: EOF@85..86 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..86 0: (empty) 1: (empty) @@ -295,3 +317,5 @@ JsModule { 0: IDENT@81..84 "baz" [] [] 1: SEMICOLON@84..85 ";" [] [] 4: EOF@85..86 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target_rest.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target_rest.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_assignment_target_rest.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target_rest.js diff --git a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target_rest.rast b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target_rest.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/array_assignment_target_rest.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target_rest.js.snap index a1cacd14c8c9..23ef6362ccbd 100644 --- a/crates/biome_js_parser/test_data/inline/ok/array_assignment_target_rest.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_assignment_target_rest.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +([ ...abcd ] = a); +([ ...(abcd) ] = a); +([ ...m.test ] = c); +([ ...m[call()] ] = c); +([ ...any.expression().b ] = c); +([ ...[x, y] ] = b); +([ ...[ ...a ] ] = c); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -275,7 +296,11 @@ JsModule { ], eof_token: EOF@161..162 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..162 0: (empty) 1: (empty) @@ -463,3 +488,5 @@ JsModule { 2: R_PAREN@159..160 ")" [] [] 1: SEMICOLON@160..161 ";" [] [] 4: EOF@161..162 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_binding.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_binding.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_binding.js diff --git a/crates/biome_js_parser/test_data/inline/ok/array_binding.rast b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/array_binding.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/array_binding.js.snap index 1abd4a84308c..b50da03da83c 100644 --- a/crates/biome_js_parser/test_data/inline/ok/array_binding.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = "b"; +let [c, b] = [1, 2]; +let [d, ...abcd] = [1]; +let [e = "default", x] = [] +let [, f, ...rest] = [] +let [[...rest2], { g }] = [] + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -259,7 +279,11 @@ JsModule { ], eof_token: EOF@138..139 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..139 0: (empty) 1: (empty) @@ -439,3 +463,5 @@ JsModule { 2: R_BRACK@137..138 "]" [] [] 1: (empty) 4: EOF@138..139 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_binding_rest.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding_rest.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_binding_rest.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_binding_rest.js diff --git a/crates/biome_js_parser/test_data/inline/ok/array_binding_rest.rast b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding_rest.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/array_binding_rest.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/array_binding_rest.js.snap index eea296ff1379..91d49bbc7e01 100644 --- a/crates/biome_js_parser/test_data/inline/ok/array_binding_rest.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_binding_rest.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let [ ...abcd ] = a; +let [ ...[x, y] ] = b; +let [ ...[ ...a ] ] = c; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -127,7 +144,11 @@ JsModule { ], eof_token: EOF@68..69 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..69 0: (empty) 1: (empty) @@ -214,3 +235,5 @@ JsModule { 0: IDENT@66..67 "c" [] [] 1: SEMICOLON@67..68 ";" [] [] 4: EOF@68..69 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_element_in_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_element_in_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_element_in_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_element_in_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/array_element_in_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/array_element_in_expr.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/array_element_in_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/array_element_in_expr.js.snap index 07175c3290f1..0702f8559794 100644 --- a/crates/biome_js_parser/test_data/inline/ok/array_element_in_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_element_in_expr.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for(["a" in {}];;) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +52,11 @@ JsModule { ], eof_token: EOF@21..22 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..22 0: (empty) 1: (empty) @@ -68,3 +87,5 @@ JsModule { 1: JS_STATEMENT_LIST@20..20 2: R_CURLY@20..21 "}" [] [] 4: EOF@21..22 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/array_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/array_expr.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/array_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/array_expr.js.snap index daeb474ae86a..6d4671b41fed 100644 --- a/crates/biome_js_parser/test_data/inline/ok/array_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_expr.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +[foo, bar]; +[foo]; +[,foo]; +[foo,]; +[,,,,,foo,,,,]; +[...a, ...b]; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -128,7 +148,11 @@ JsModule { ], eof_token: EOF@64..65 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..65 0: (empty) 1: (empty) @@ -221,3 +245,5 @@ JsModule { 2: R_BRACK@62..63 "]" [] [] 1: SEMICOLON@63..64 ";" [] [] 4: EOF@64..65 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/array_or_object_member_assignment.js b/crates/biome_js_parser/tests/js_test_suite/ok/array_or_object_member_assignment.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/array_or_object_member_assignment.js rename to crates/biome_js_parser/tests/js_test_suite/ok/array_or_object_member_assignment.js diff --git a/crates/biome_js_parser/test_data/inline/ok/array_or_object_member_assignment.rast b/crates/biome_js_parser/tests/js_test_suite/ok/array_or_object_member_assignment.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/array_or_object_member_assignment.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/array_or_object_member_assignment.js.snap index f73a79270b76..9b1d7049b521 100644 --- a/crates/biome_js_parser/test_data/inline/ok/array_or_object_member_assignment.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/array_or_object_member_assignment.js.snap @@ -1,3 +1,33 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +[{ + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}.y = 42] = [23]; +({ x: { + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}.y = 42 } = { x: 23 }); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -258,7 +288,11 @@ JsModule { ], eof_token: EOF@301..302 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..302 0: (empty) 1: (empty) @@ -441,3 +475,5 @@ JsModule { 2: R_PAREN@299..300 ")" [] [] 1: SEMICOLON@300..301 ";" [] [] 4: EOF@301..302 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_in_alternate.js b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_in_alternate.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/arrow_expr_in_alternate.js rename to crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_in_alternate.js diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_exrp_in_alternate.rast b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_in_alternate.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_arrow_exrp_in_alternate.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_in_alternate.js.snap index 9c370a772485..66157258fd51 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_exrp_in_alternate.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_in_alternate.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +a ? (b) : a => {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -42,7 +57,11 @@ JsModule { ], eof_token: EOF@18..19 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..19 0: (empty) 1: (empty) @@ -75,3 +94,5 @@ JsModule { 3: R_CURLY@16..17 "}" [] [] 1: SEMICOLON@17..18 ";" [] [] 4: EOF@18..19 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_single_param.js b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_single_param.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/arrow_expr_single_param.js rename to crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_single_param.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_single_param.rast b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_single_param.cjs.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/arrow_expr_single_param.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_single_param.cjs.snap index 3783bc797f31..35cc1324fa05 100644 --- a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_single_param.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_expr_single_param.cjs.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +foo => {} +yield => {} +await => {} +baz => +{} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -78,7 +98,11 @@ JsScript { ], eof_token: EOF@53..54 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..54 0: (empty) 1: (empty) @@ -141,3 +165,5 @@ JsScript { 3: R_CURLY@52..53 "}" [] [] 1: (empty) 4: EOF@53..54 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_in_constructor.js b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_in_constructor.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/arrow_in_constructor.js rename to crates/biome_js_parser/tests/js_test_suite/ok/arrow_in_constructor.js diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_in_constructor.rast b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_in_constructor.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/arrow_in_constructor.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/arrow_in_constructor.js.snap index 3e48b38eb5a6..fd6069b9cf01 100644 --- a/crates/biome_js_parser/test_data/inline/ok/arrow_in_constructor.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/arrow_in_constructor.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + constructor() { + () => { super() }; + () => super(); + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -101,7 +121,11 @@ JsModule { ], eof_token: EOF@74..75 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..75 0: (empty) 1: (empty) @@ -180,3 +204,5 @@ JsModule { 3: R_CURLY@69..72 "}" [Newline("\n"), Whitespace(" ")] [] 9: R_CURLY@72..74 "}" [Newline("\n")] [] 4: EOF@74..75 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/assign_eval_member_or_computed_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/assign_eval_member_or_computed_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/assign_eval_member_or_computed_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/assign_eval_member_or_computed_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js.snap index 27d23a3e645f..435d83496101 100644 --- a/crates/biome_js_parser/test_data/inline/ok/assign_eval_member_or_computed_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/assign_eval_member_or_computed_expr.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +eval.foo = 10 +arguments[1] = "baz" +eval[2] = "Chungking Express" + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -68,7 +85,11 @@ JsModule { ], eof_token: EOF@64..65 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..65 0: (empty) 1: (empty) @@ -116,3 +137,5 @@ JsModule { 0: JS_STRING_LITERAL@45..64 "\"Chungking Express\"" [] [] 1: (empty) 4: EOF@64..65 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/assign_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/assign_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/assign_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/assign_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/assign_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/assign_expr.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/assign_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/assign_expr.js.snap index 347859d74841..c6a07bd4312c 100644 --- a/crates/biome_js_parser/test_data/inline/ok/assign_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/assign_expr.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo += bar = b ??= 3; +foo -= bar; +(foo = bar); +[foo, bar] = baz; +[foo, bar = "default", ...rest] = baz; +[,,,foo,bar] = baz; +({ bar, baz } = {}); +({ bar: [baz = "baz"], foo = "foo", ...rest } = {}); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -268,7 +290,11 @@ JsModule { ], eof_token: EOF@197..198 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..198 0: (empty) 1: (empty) @@ -454,3 +480,5 @@ JsModule { 2: R_PAREN@195..196 ")" [] [] 1: SEMICOLON@196..197 ";" [] [] 4: EOF@197..198 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/assignment_shorthand_prop_with_initializer.js b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/assignment_shorthand_prop_with_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js diff --git a/crates/biome_js_parser/test_data/inline/ok/assignment_shorthand_prop_with_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/assignment_shorthand_prop_with_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js.snap index 56f3e55091d7..280be59d60f8 100644 --- a/crates/biome_js_parser/test_data/inline/ok/assignment_shorthand_prop_with_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_shorthand_prop_with_initializer.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ({ arrow = () => {} } of [{}]) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -60,7 +75,11 @@ JsModule { ], eof_token: EOF@37..38 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..38 0: (empty) 1: (empty) @@ -108,3 +127,5 @@ JsModule { 1: JS_STATEMENT_LIST@36..36 2: R_CURLY@36..37 "}" [] [] 4: EOF@37..38 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/ok/assignment_target.js diff --git a/crates/biome_js_parser/test_data/inline/ok/assignment_target.rast b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_target.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/assignment_target.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/assignment_target.js.snap index 41bce70fcb30..af3e791ca8c9 100644 --- a/crates/biome_js_parser/test_data/inline/ok/assignment_target.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/assignment_target.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo += bar = b ??= 3; +a.foo -= bar; +(foo = bar); +(((foo))) = bar; +a["test"] = bar; +a.call().chain().member = x; +++count === 3 +a['b'] = c[d] = "test" + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -224,7 +246,11 @@ JsModule { ], eof_token: EOF@148..149 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..149 0: (empty) 1: (empty) @@ -377,3 +403,5 @@ JsModule { 0: JS_STRING_LITERAL@142..148 "\"test\"" [] [] 1: (empty) 4: EOF@148..149 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/async_arrow_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/async_arrow_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/async_arrow_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/async_arrow_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/async_arrow_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/async_arrow_expr.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/async_arrow_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/async_arrow_expr.js.snap index 2bb2555a6048..2d6f502479c6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/async_arrow_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/async_arrow_expr.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = async foo => {} +let b = async (bar) => {} +async (foo, bar, ...baz) => foo + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -132,7 +149,11 @@ JsModule { ], eof_token: EOF@81..82 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..82 0: (empty) 1: (empty) @@ -232,3 +253,5 @@ JsModule { 0: IDENT@78..81 "foo" [] [] 1: (empty) 4: EOF@81..82 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/async_continue_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/async_continue_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/async_continue_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/async_continue_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/async_continue_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/async_continue_stmt.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/async_continue_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/async_continue_stmt.js.snap index 4458f99537e6..d38647ec8d3d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/async_continue_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/async_continue_stmt.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +async: for(a of b) continue async; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -34,7 +49,11 @@ JsModule { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..35 0: (empty) 1: (empty) @@ -61,3 +80,5 @@ JsModule { 0: IDENT@28..33 "async" [] [] 2: SEMICOLON@33..34 ";" [] [] 4: EOF@34..35 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/async_function_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/async_function_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/async_function_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/async_function_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/async_function_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/async_function_expr.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/async_function_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/async_function_expr.js.snap index f663be43b0de..2ce88bbff2f2 100644 --- a/crates/biome_js_parser/test_data/inline/ok/async_function_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/async_function_expr.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = async function() {}; +let b = async function foo() {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -82,7 +98,11 @@ JsModule { ], eof_token: EOF@61..62 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..62 0: (empty) 1: (empty) @@ -146,3 +166,5 @@ JsModule { 3: R_CURLY@59..60 "}" [] [] 1: SEMICOLON@60..61 ";" [] [] 4: EOF@61..62 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/async_ident.js b/crates/biome_js_parser/tests/js_test_suite/ok/async_ident.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/async_ident.js rename to crates/biome_js_parser/tests/js_test_suite/ok/async_ident.js diff --git a/crates/biome_js_parser/test_data/inline/ok/async_ident.rast b/crates/biome_js_parser/tests/js_test_suite/ok/async_ident.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/async_ident.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/async_ident.js.snap index 43293d9c1213..d551ada4318d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/async_ident.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/async_ident.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = async; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -29,7 +44,11 @@ JsModule { ], eof_token: EOF@14..15 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..15 0: (empty) 1: (empty) @@ -51,3 +70,5 @@ JsModule { 0: IDENT@8..13 "async" [] [] 1: SEMICOLON@13..14 ";" [] [] 4: EOF@14..15 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/async_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/async_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/async_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/async_method.js diff --git a/crates/biome_js_parser/test_data/inline/ok/async_method.rast b/crates/biome_js_parser/tests/js_test_suite/ok/async_method.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/async_method.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/async_method.js.snap index a54dbbc30b66..9f9d19c1a36a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/async_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/async_method.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo { + async foo() {} + async *foo() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -65,7 +83,11 @@ JsModule { ], eof_token: EOF@46..47 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..47 0: (empty) 1: (empty) @@ -120,3 +142,5 @@ JsModule { 3: R_CURLY@43..44 "}" [] [] 9: R_CURLY@44..46 "}" [Newline("\n")] [] 4: EOF@46..47 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/await_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/await_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/await_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/await_expression.js diff --git a/crates/biome_js_parser/test_data/inline/ok/await_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/await_expression.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/await_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/await_expression.js.snap index 6bc51ace81d3..28c0a9d8648d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/await_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/await_expression.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +async function test() { + await inner(); + await (inner()) + await inner(); +} +async function inner() { + return 4; +} +await test(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -141,7 +163,11 @@ JsModule { ], eof_token: EOF@130..131 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..131 0: (empty) 1: (empty) @@ -246,3 +272,5 @@ JsModule { 2: R_PAREN@128..129 ")" [] [] 1: SEMICOLON@129..130 ";" [] [] 4: EOF@130..131 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/await_in_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/ok/await_in_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/await_in_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/await_in_ambient_context.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/await_in_ambient_context.rast b/crates/biome_js_parser/tests/js_test_suite/ok/await_in_ambient_context.ts.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/await_in_ambient_context.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/await_in_ambient_context.ts.snap index 0a3e988672bb..224be29c8a21 100644 --- a/crates/biome_js_parser/test_data/inline/ok/await_in_ambient_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/await_in_ambient_context.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare const await: any; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -30,7 +45,11 @@ JsModule { ], eof_token: EOF@25..26 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..26 0: (empty) 1: (empty) @@ -53,3 +72,5 @@ JsModule { 2: (empty) 1: SEMICOLON@24..25 ";" [] [] 4: EOF@25..26 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/binary_expressions.js b/crates/biome_js_parser/tests/js_test_suite/ok/binary_expressions.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/binary_expressions.js rename to crates/biome_js_parser/tests/js_test_suite/ok/binary_expressions.js diff --git a/crates/biome_js_parser/test_data/inline/ok/binary_expressions.rast b/crates/biome_js_parser/tests/js_test_suite/ok/binary_expressions.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/binary_expressions.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/binary_expressions.js.snap index a8f24cf8c689..6e5e8d8ae140 100644 --- a/crates/biome_js_parser/test_data/inline/ok/binary_expressions.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/binary_expressions.js.snap @@ -1,3 +1,30 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +5 * 5 +6 ** 6 ** 7 +1 + 2 * 3 +(1 + 2) * 3 +1 / 2 +74 in foo +foo instanceof Array +foo ?? bar +a >> b +a >>> b +1 + 1 + 1 + 1 +5 + 6 - 1 * 2 / 1 ** 6 +class Test { #name; test() { true && #name in {} } } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -298,7 +325,11 @@ JsModule { ], eof_token: EOF@192..193 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..193 0: (empty) 1: (empty) @@ -504,3 +535,5 @@ JsModule { 3: R_CURLY@189..191 "}" [] [Whitespace(" ")] 9: R_CURLY@191..192 "}" [] [] 4: EOF@192..193 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/block_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/block_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/block_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/block_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/block_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/block_stmt.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/block_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/block_stmt.js.snap index c8aa77a796ff..990173152ce4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/block_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/block_stmt.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +{} +{{{{}}}} +{ foo = bar; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -54,7 +71,11 @@ JsModule { ], eof_token: EOF@26..27 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..27 0: (empty) 1: (empty) @@ -94,3 +115,5 @@ JsModule { 1: SEMICOLON@23..25 ";" [] [Whitespace(" ")] 2: R_CURLY@25..26 "}" [] [] 4: EOF@26..27 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/bom_character.js b/crates/biome_js_parser/tests/js_test_suite/ok/bom_character.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/bom_character.js rename to crates/biome_js_parser/tests/js_test_suite/ok/bom_character.js diff --git a/crates/biome_js_parser/test_data/inline/ok/bom_character.rast b/crates/biome_js_parser/tests/js_test_suite/ok/bom_character.js.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/ok/bom_character.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/bom_character.js.snap index 5ec15b9e72b1..e0e3dc771576 100644 --- a/crates/biome_js_parser/test_data/inline/ok/bom_character.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/bom_character.js.snap @@ -1,3 +1,17 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo ( ) {} +``` + + +## AST + +``` JsModule { bom_token: UNICODE_BOM@0..3 "\u{feff}" [] [], interpreter_token: missing (optional), @@ -27,7 +41,11 @@ JsModule { ], eof_token: EOF@22..22 "" [] [], } +``` + +## CST +``` 0: JS_MODULE@0..22 0: UNICODE_BOM@0..3 "\u{feff}" [] [] 1: (empty) @@ -51,3 +69,5 @@ JsModule { 2: JS_STATEMENT_LIST@21..21 3: R_CURLY@21..22 "}" [] [] 4: EOF@22..22 "" [] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/break_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/break_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/break_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/break_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/break_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/break_stmt.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/break_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/break_stmt.js.snap index cd20c58bc99f..38b680bede8a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/break_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/break_stmt.js.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +while (true) { + break; + foo: { + break foo; + } +} +out: while (true) { + break out; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -71,7 +94,11 @@ JsModule { ], eof_token: EOF@87..88 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..88 0: (empty) 1: (empty) @@ -124,3 +151,5 @@ JsModule { 2: SEMICOLON@84..85 ";" [] [] 2: R_CURLY@85..87 "}" [Newline("\n")] [] 4: EOF@87..88 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/built_in_module_name.ts b/crates/biome_js_parser/tests/js_test_suite/ok/built_in_module_name.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/built_in_module_name.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/built_in_module_name.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/built_in_module_name.rast b/crates/biome_js_parser/tests/js_test_suite/ok/built_in_module_name.ts.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/ok/built_in_module_name.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/built_in_module_name.ts.snap index 944b1b64708a..ca2ce6b0ab31 100644 --- a/crates/biome_js_parser/test_data/inline/ok/built_in_module_name.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/built_in_module_name.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +// https://github.com/rome/tools/issues/2959 +module number {} +module string {} +declare module never {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -42,7 +60,11 @@ JsModule { ], eof_token: EOF@102..103 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..103 0: (empty) 1: (empty) @@ -75,3 +97,5 @@ JsModule { 1: JS_MODULE_ITEM_LIST@101..101 2: R_CURLY@101..102 "}" [] [] 4: EOF@102..103 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/call_arguments.js b/crates/biome_js_parser/tests/js_test_suite/ok/call_arguments.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/call_arguments.js rename to crates/biome_js_parser/tests/js_test_suite/ok/call_arguments.js diff --git a/crates/biome_js_parser/test_data/inline/ok/call_arguments.rast b/crates/biome_js_parser/tests/js_test_suite/ok/call_arguments.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/call_arguments.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/call_arguments.js.snap index 4f65c8840cbd..25c92b64fc75 100644 --- a/crates/biome_js_parser/test_data/inline/ok/call_arguments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/call_arguments.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo(...args) {} +let a, b, c, d; +foo(a); +foo(a, b,); +foo(a, b, ...c); +foo(...a, ...b, c, ...d,); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -218,7 +238,11 @@ JsModule { ], eof_token: EOF@104..105 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..105 0: (empty) 1: (empty) @@ -371,3 +395,5 @@ JsModule { 2: R_PAREN@102..103 ")" [] [] 1: SEMICOLON@103..104 ";" [] [] 4: EOF@104..105 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_await_property_initializer.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_await_property_initializer.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_await_property_initializer.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_await_property_initializer.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/class_await_property_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_await_property_initializer.cjs.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/class_await_property_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_await_property_initializer.cjs.snap index 98d951b886b4..a4f9f4d13fa4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_await_property_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_await_property_initializer.cjs.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +async function* test() { + class A { + prop = await; + } +} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -59,7 +79,11 @@ JsScript { ], eof_token: EOF@70..71 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_SCRIPT@0..71 0: (empty) 1: (empty) @@ -106,3 +130,5 @@ JsScript { 9: R_CURLY@64..68 "}" [Newline("\n"), Whitespace(" ")] [] 3: R_CURLY@68..70 "}" [Newline("\n")] [] 4: EOF@70..71 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_constructor_parameter_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_constructor_parameter_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/class_constructor_parameter_modifiers.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/class_constructor_parameter_modifiers.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts.snap index de969550a078..1dcfe4f1e2d3 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_constructor_parameter_modifiers.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_constructor_parameter_modifiers.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Base { name!: string; other!: string } +class Sub extends Base { + constructor(private priv: string, protected prot: string, public pub: string, override name: string, readonly read: string, protected override readonly other: string) { + super(); + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -255,7 +275,11 @@ JsModule { ], eof_token: EOF@258..259 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..259 0: (empty) 1: (empty) @@ -438,3 +462,5 @@ JsModule { 3: R_CURLY@253..256 "}" [Newline("\n"), Whitespace(" ")] [] 9: R_CURLY@256..258 "}" [Newline("\n")] [] 4: EOF@258..259 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_declaration.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_declaration.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_declaration.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_declaration.js diff --git a/crates/biome_js_parser/test_data/inline/ok/class_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_declaration.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/class_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_declaration.js.snap index a6a5223eecff..07aae911a3f7 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_declaration.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo {} +class foo extends bar {} +class foo extends foo.bar {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -70,7 +87,11 @@ JsModule { ], eof_token: EOF@66..67 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..67 0: (empty) 1: (empty) @@ -127,3 +148,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@65..65 9: R_CURLY@65..66 "}" [] [] 4: EOF@66..67 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_declare.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_declare.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_declare.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_declare.js diff --git a/crates/biome_js_parser/test_data/inline/ok/class_declare.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_declare.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/class_declare.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_declare.js.snap index e13384788e09..e46095cbd0ac 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_declare.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_declare.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { declare() {} } +class B { declare = foo } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -74,7 +90,11 @@ JsModule { ], eof_token: EOF@50..51 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..51 0: (empty) 1: (empty) @@ -134,3 +154,5 @@ JsModule { 4: (empty) 9: R_CURLY@49..50 "}" [] [] 4: EOF@50..51 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_decorator.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_decorator.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_decorator.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_decorator.js diff --git a/crates/biome_js_parser/test_data/inline/ok/class_decorator.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_decorator.js.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/ok/class_decorator.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_decorator.js.snap index 4475d5474dac..04ee832a1e26 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_decorator.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_decorator.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +@decorator +class Foo { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -29,7 +45,11 @@ JsModule { ], eof_token: EOF@24..25 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..25 0: (empty) 1: (empty) @@ -53,3 +73,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@23..23 9: R_CURLY@23..24 "}" [] [] 4: EOF@24..25 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_empty_element.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_empty_element.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_empty_element.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_empty_element.js diff --git a/crates/biome_js_parser/test_data/inline/ok/class_empty_element.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_empty_element.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/class_empty_element.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_empty_element.js.snap index 1d2c395cd9ea..1b6958e600d2 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_empty_element.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_empty_element.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo { ;;;;;;;;;; get foo() {};;;;} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -79,7 +94,11 @@ JsModule { ], eof_token: EOF@40..41 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..41 0: (empty) 1: (empty) @@ -139,3 +158,5 @@ JsModule { 0: SEMICOLON@38..39 ";" [] [] 9: R_CURLY@39..40 "}" [] [] 4: EOF@40..41 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/class_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_expr.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/class_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_expr.js.snap index a4243de306e2..53f5ab3bda1b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_expr.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = class {}; +let b = class foo { + constructor() {} +} +foo[class {}] + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -108,7 +127,11 @@ JsModule { ], eof_token: EOF@71..72 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..72 0: (empty) 1: (empty) @@ -192,3 +215,5 @@ JsModule { 4: R_BRACK@70..71 "]" [] [] 1: (empty) 4: EOF@71..72 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_member_modifiers.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers.js diff --git a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/class_member_modifiers.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers.js.snap index dda605103332..1f81e0ce22b5 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { public() {} } +class A { static protected() {} } +class A { static } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -108,7 +125,11 @@ JsModule { ], eof_token: EOF@76..77 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..77 0: (empty) 1: (empty) @@ -196,3 +217,5 @@ JsModule { 4: (empty) 9: R_CURLY@75..76 "}" [] [] 4: EOF@76..77 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers_no_asi.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers_no_asi.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_member_modifiers_no_asi.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers_no_asi.js diff --git a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers_no_asi.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers_no_asi.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/class_member_modifiers_no_asi.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers_no_asi.js.snap index 92199912d9fa..960f199212d2 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_member_modifiers_no_asi.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_member_modifiers_no_asi.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + static + foo() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -47,7 +65,11 @@ JsModule { ], eof_token: EOF@31..32 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..32 0: (empty) 1: (empty) @@ -86,3 +108,5 @@ JsModule { 3: R_CURLY@28..29 "}" [] [] 9: R_CURLY@29..31 "}" [Newline("\n")] [] 4: EOF@31..32 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_named_abstract_is_valid_in_js.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_named_abstract_is_valid_in_js.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js diff --git a/crates/biome_js_parser/test_data/inline/ok/class_named_abstract_is_valid_in_js.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js.snap similarity index 89% rename from crates/biome_js_parser/test_data/inline/ok/class_named_abstract_is_valid_in_js.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js.snap index 24f5cb0325d2..a861efcc11cb 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_named_abstract_is_valid_in_js.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_named_abstract_is_valid_in_js.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class abstract {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -20,7 +35,11 @@ JsModule { ], eof_token: EOF@17..18 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..18 0: (empty) 1: (empty) @@ -39,3 +58,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@16..16 9: R_CURLY@16..17 "}" [] [] 4: EOF@17..18 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/class_static_constructor_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/class_static_constructor_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/class_static_constructor_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/class_static_constructor_method.js diff --git a/crates/biome_js_parser/test_data/inline/ok/class_static_constructor_method.rast b/crates/biome_js_parser/tests/js_test_suite/ok/class_static_constructor_method.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/class_static_constructor_method.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/class_static_constructor_method.js.snap index 69ee6cbf1f31..9cec67c69cc0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/class_static_constructor_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/class_static_constructor_method.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class B { static constructor() {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -47,7 +62,11 @@ JsModule { ], eof_token: EOF@35..36 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..36 0: (empty) 1: (empty) @@ -86,3 +105,5 @@ JsModule { 3: R_CURLY@32..34 "}" [] [Whitespace(" ")] 9: R_CURLY@34..35 "}" [] [] 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/computed_member_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/computed_member_expression.js diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_expression.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/computed_member_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/computed_member_expression.js.snap index 0c3f31cc9986..3b3bfb0f0187 100644 --- a/crates/biome_js_parser/test_data/inline/ok/computed_member_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_expression.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo[bar] +foo[5 + 5] +foo["bar"] +foo[bar][baz] +foo?.[bar] + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -108,7 +127,11 @@ JsModule { ], eof_token: EOF@55..56 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..56 0: (empty) 1: (empty) @@ -184,3 +207,5 @@ JsModule { 4: R_BRACK@54..55 "]" [] [] 1: (empty) 4: EOF@55..56 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_in.js b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_in.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/computed_member_in.js rename to crates/biome_js_parser/tests/js_test_suite/ok/computed_member_in.js diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_in.rast b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_in.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/computed_member_in.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/computed_member_in.js.snap index 9a9c5ceb4fce..6b2175fd923c 100644 --- a/crates/biome_js_parser/test_data/inline/ok/computed_member_in.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_in.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ({}["x" in {}];;) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -41,7 +56,11 @@ JsModule { ], eof_token: EOF@24..25 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..25 0: (empty) 1: (empty) @@ -76,3 +95,5 @@ JsModule { 1: JS_STATEMENT_LIST@23..23 2: R_CURLY@23..24 "}" [] [] 4: EOF@24..25 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_name_in.js b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_name_in.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/computed_member_name_in.js rename to crates/biome_js_parser/tests/js_test_suite/ok/computed_member_name_in.js diff --git a/crates/biome_js_parser/test_data/inline/ok/computed_member_name_in.rast b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_name_in.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/computed_member_name_in.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/computed_member_name_in.js.snap index 4ccfda0f76ef..18f1b4ecc5cd 100644 --- a/crates/biome_js_parser/test_data/inline/ok/computed_member_name_in.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/computed_member_name_in.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ({["x" in {}]: 3} ;;) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -47,7 +62,11 @@ JsModule { ], eof_token: EOF@28..29 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..29 0: (empty) 1: (empty) @@ -85,3 +104,5 @@ JsModule { 1: JS_STATEMENT_LIST@27..27 2: R_CURLY@27..28 "}" [] [] 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/conditional_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/conditional_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/conditional_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/conditional_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/conditional_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/conditional_expr.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/conditional_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/conditional_expr.js.snap index 6074facf03b1..e83ccfd634b8 100644 --- a/crates/biome_js_parser/test_data/inline/ok/conditional_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/conditional_expr.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo ? bar : baz +foo ? bar : baz ? bar : baz + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -64,7 +80,11 @@ JsModule { ], eof_token: EOF@43..44 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..44 0: (empty) 1: (empty) @@ -108,3 +128,5 @@ JsModule { 0: IDENT@40..43 "baz" [] [] 1: (empty) 4: EOF@43..44 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/constructor_class_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/constructor_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/constructor_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/constructor_class_member.js diff --git a/crates/biome_js_parser/test_data/inline/ok/constructor_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/constructor_class_member.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/constructor_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/constructor_class_member.js.snap index a30a54e70828..e291c329fc5c 100644 --- a/crates/biome_js_parser/test_data/inline/ok/constructor_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/constructor_class_member.js.snap @@ -1,3 +1,27 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Foo { + constructor(a) { + this.a = a; + } +} +class Bar { + "constructor"(b) { + this.b = b; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -132,7 +156,11 @@ JsModule { ], eof_token: EOF@107..108 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..108 0: (empty) 1: (empty) @@ -229,3 +257,5 @@ JsModule { 3: R_CURLY@101..105 "}" [Newline("\n"), Whitespace(" ")] [] 9: R_CURLY@105..107 "}" [Newline("\n")] [] 4: EOF@107..108 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/continue_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/continue_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/continue_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/continue_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/continue_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/continue_stmt.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/continue_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/continue_stmt.js.snap index c85e11e69d92..9dd22a37ba92 100644 --- a/crates/biome_js_parser/test_data/inline/ok/continue_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/continue_stmt.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +outer: while(true) { +while (true) { + continue; + continue outer; + } + continue +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -57,7 +78,11 @@ JsModule { ], eof_token: EOF@85..86 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..86 0: (empty) 1: (empty) @@ -101,3 +126,5 @@ JsModule { 2: (empty) 2: R_CURLY@83..85 "}" [Newline("\n")] [] 4: EOF@85..86 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/debugger_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/debugger_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/debugger_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/debugger_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/debugger_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/debugger_stmt.js.snap similarity index 81% rename from crates/biome_js_parser/test_data/inline/ok/debugger_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/debugger_stmt.js.snap index e4cb474f5422..799691dcee13 100644 --- a/crates/biome_js_parser/test_data/inline/ok/debugger_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/debugger_stmt.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +debugger; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -10,7 +25,11 @@ JsModule { ], eof_token: EOF@9..10 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..10 0: (empty) 1: (empty) @@ -20,3 +39,5 @@ JsModule { 0: DEBUGGER_KW@0..8 "debugger" [] [] 1: SEMICOLON@8..9 ";" [] [] 4: EOF@9..10 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/decorator.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator.ts.snap index 4262058e5678..272ff0038727 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator.ts.snap @@ -1,3 +1,41 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +// class expressions +let a = @decorator class {}; +let b = @decorator @functionDecorator(1,2,3) class {}; +let c = @first @second class Foo {} +// class declarations +@decorator class Foo {}; +@decorator @functionDecorator(1,2,3) class Bar {}; +@first @second class Baz {} +// abstract class declarations +@decorator abstract class Foo {}; +@decorator @functionDecorator(1,2,3) abstract class Bar {}; +@first @second abstract class Baz {} +// exported class declarations +export @decorator class Foo {}; +export @decorator @functionDecorator(1,2,3) class Bar {}; +export @first @second class Baz {} +@decorator +export class Foo { } +@first.field @second @(() => decorator)() +export class Bar {} +@before +export @after class Foo { } +@before.field @before @(() => decorator)() +export @after.field @after @(() => decorator)() class Bar {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -771,7 +809,11 @@ JsModule { ], eof_token: EOF@818..819 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..819 0: (empty) 1: (empty) @@ -1323,3 +1365,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@817..817 9: R_CURLY@817..818 "}" [] [] 4: EOF@818..819 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration.ts.snap index d64c5e0fb37c..bf51612b5d82 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function foo() { + @decorator abstract class A {} + @first.field @second @(() => decorator)() + abstract class Bar {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -120,7 +139,11 @@ JsModule { ], eof_token: EOF@128..129 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..129 0: (empty) 1: (empty) @@ -211,3 +234,5 @@ JsModule { 9: R_CURLY@125..126 "}" [] [] 3: R_CURLY@126..128 "}" [Newline("\n")] [] 4: EOF@128..129 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration_top_level.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration_top_level.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration_top_level.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration_top_level.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts.snap index adc94c1db19f..f93dd93ee5d8 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_declaration_top_level.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_declaration_top_level.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator abstract class A {} +@first.field @second @(() => decorator)() +abstract class Bar {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -98,7 +115,11 @@ JsModule { ], eof_token: EOF@94..95 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..95 0: (empty) 1: (empty) @@ -172,3 +193,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@93..93 9: R_CURLY@93..94 "}" [] [] 4: EOF@94..95 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts.snap index 2f1a448a6a8b..c0786eb0dad3 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_abstract_class_export_default_declaration_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_abstract_class_export_default_declaration_clause.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default abstract class Foo { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +53,11 @@ JsModule { ], eof_token: EOF@48..49 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..49 0: (empty) 1: (empty) @@ -67,3 +87,5 @@ JsModule { 9: R_CURLY@47..48 "}" [] [] 2: (empty) 4: EOF@48..49 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration.js b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration.js rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration.js diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration.js.snap index d13e8676a6bf..d1edfb328cbc 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() { + @decorator + class Foo { } + @first.field @second @(() => decorator)() + class Bar {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -120,7 +140,11 @@ JsModule { ], eof_token: EOF@118..119 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..119 0: (empty) 1: (empty) @@ -211,3 +235,5 @@ JsModule { 9: R_CURLY@115..116 "}" [] [] 3: R_CURLY@116..118 "}" [Newline("\n")] [] 4: EOF@118..119 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration_top_level.js b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration_top_level.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration_top_level.js rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration_top_level.js diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration_top_level.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration_top_level.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration_top_level.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration_top_level.js.snap index 13986e270a8d..77d3ff5a210b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_declaration_top_level.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_declaration_top_level.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +@decorator +class Foo { } +@first.field @second @(() => decorator)() +class Bar {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -98,7 +116,11 @@ JsModule { ], eof_token: EOF@79..80 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..80 0: (empty) 1: (empty) @@ -172,3 +194,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@78..78 9: R_CURLY@78..79 "}" [] [] 4: EOF@79..80 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_export_default_declaration_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_export_default_declaration_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_export_default_declaration_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_export_default_declaration_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts.snap index 8e11b44e3399..f432a1761b26 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_export_default_declaration_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_export_default_declaration_clause.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default class Foo { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +53,11 @@ JsModule { ], eof_token: EOF@39..40 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..40 0: (empty) 1: (empty) @@ -67,3 +87,5 @@ JsModule { 9: R_CURLY@38..39 "}" [] [] 2: (empty) 4: EOF@39..40 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member.ts.snap index fe860496e74a..706946ea79c4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member.ts.snap @@ -1,3 +1,59 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Foo { +// properties +@dec foo = 2; +@dec @(await dec) @dec() foo = 2; +@dec public foo = 1; +@dec @(await dec) @dec() public foo = 1; +@dec static foo = 2; +@dec @(await dec) @dec() static foo = 2; +@dec accessor foo = 2; +@dec @(await dec) @dec() accessor foo = 2; +@dec readonly foo = 2; +@dec @(await dec) @dec() readonly foo = 2; +@dec override foo = 2; +@dec @(await dec) @dec() override foo = 2; +// methods +@dec foo() {} +@dec @(await dec) @dec() foo() {} +@dec public foo() {} +@dec @(await dec) @dec() public foo() {} +@dec static foo() {} +@dec @(await dec) @dec() static foo() {} +@dec override foo() {} +@dec @(await dec) @dec() override foo() {} +// getters +@dec get foo() {} +@dec @(await dec) @dec() get foo() {} +@dec public get foo() {} +@dec @(await dec) @dec() public get foo() {} +@dec static get foo() {} +@dec @(await dec) @dec() static get foo() {} +@dec override get foo() {} +@dec @(await dec) @dec() override get foo() {} +// setters +@dec set foo(val) {} +@dec @(await dec) @dec() set foo(val) {} +@dec public set foo(val) {} +@dec @(await dec) @dec() public set foo(val) {} +@dec static set foo(val) {} +@dec @(await dec) @dec() static set foo(val) {} +@dec override set foo(val) {} +@dec @(await dec) @dec() override set foo(val) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -1677,7 +1733,11 @@ JsModule { ], eof_token: EOF@1232..1233 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..1233 0: (empty) 1: (empty) @@ -2856,3 +2916,5 @@ JsModule { 3: R_CURLY@1229..1230 "}" [] [] 9: R_CURLY@1230..1232 "}" [Newline("\n")] [] 4: EOF@1232..1233 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member_in_ts.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member_in_ts.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_member_in_ts.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member_in_ts.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member_in_ts.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member_in_ts.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_member_in_ts.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member_in_ts.ts.snap index 3cb288224c31..c9df76cb8145 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_member_in_ts.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_member_in_ts.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class Qux { + @dec declare static foo: string; +} +class Bar { + @dec readonly foo = '123'; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -90,7 +110,11 @@ JsModule { ], eof_token: EOF@101..102 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..102 0: (empty) 1: (empty) @@ -156,3 +180,5 @@ JsModule { 4: SEMICOLON@98..99 ";" [] [] 9: R_CURLY@99..101 "}" [Newline("\n")] [] 4: EOF@101..102 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_not_top_level.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_not_top_level.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_not_top_level.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_not_top_level.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_class_not_top_level.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_not_top_level.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/decorator_class_not_top_level.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_not_top_level.ts.snap index 89b9acd32a36..f5e33aef83f1 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_class_not_top_level.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_class_not_top_level.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +if (a) { + @dec class MyClass {} +} +function foo() { + @dec class MyClass {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -91,7 +111,11 @@ JsModule { ], eof_token: EOF@77..78 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..78 0: (empty) 1: (empty) @@ -161,3 +185,5 @@ JsModule { 9: R_CURLY@74..75 "}" [] [] 3: R_CURLY@75..77 "}" [Newline("\n")] [] 4: EOF@77..78 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_class_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_class_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_class_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_class_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_class_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_class_clause.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_class_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_class_clause.js.snap index 4515d542d5dd..ac8b0a474dfb 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_class_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_class_clause.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export @decorator class Bar {}; +export @first @second class Foo { + constructor() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -89,7 +107,11 @@ JsModule { ], eof_token: EOF@88..89 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..89 0: (empty) 1: (empty) @@ -156,3 +178,5 @@ JsModule { 3: R_CURLY@85..86 "}" [] [] 9: R_CURLY@86..88 "}" [Newline("\n")] [] 4: EOF@88..89 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_class_and_interface.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_class_and_interface.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_class_and_interface.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_class_and_interface.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts.snap index bd8cfe5c423e..e3891e138f0a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_class_and_interface.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_class_and_interface.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default interface A{}; +export default interface A{}; +export default class A{}; +export default interface A{}; +export default interface A{}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -119,7 +138,11 @@ JsModule { ], eof_token: EOF@145..146 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..146 0: (empty) 1: (empty) @@ -214,3 +237,5 @@ JsModule { 9: JS_EMPTY_STATEMENT@144..145 0: SEMICOLON@144..145 ";" [] [] 4: EOF@145..146 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_function_overload.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_function_overload.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_function_overload.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_function_overload.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts.snap index f3bbf8a4a2d4..52f27dad9414 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_function_overload.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_function_overload.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default function a():void; +export default function a(v: number):void; +export default function a(v?: any){ +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -121,7 +139,11 @@ JsModule { ], eof_token: EOF@114..115 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..115 0: (empty) 1: (empty) @@ -213,3 +235,5 @@ JsModule { 3: R_CURLY@112..114 "}" [Newline("\n")] [] 2: (empty) 4: EOF@114..115 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_interface.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_interface.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_interface.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_interface.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts.snap index 366dc1038abc..2f8c86edcde2 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_function_and_interface.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_function_and_interface.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default interface A{}; +export default interface A{}; +export default function a(){}; +export default interface A{}; +export default interface A{}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -126,7 +145,11 @@ JsModule { ], eof_token: EOF@150..151 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..151 0: (empty) 1: (empty) @@ -226,3 +249,5 @@ JsModule { 9: JS_EMPTY_STATEMENT@149..150 0: SEMICOLON@149..150 ";" [] [] 4: EOF@150..151 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_1.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_1.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_1.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_1.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_1.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_1.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_1.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_1.ts.snap index 8e11b44e3399..f432a1761b26 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_1.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_1.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@decorator +export default class Foo { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +53,11 @@ JsModule { ], eof_token: EOF@39..40 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..40 0: (empty) 1: (empty) @@ -67,3 +87,5 @@ JsModule { 9: R_CURLY@38..39 "}" [] [] 2: (empty) 4: EOF@39..40 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_2.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_2.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_2.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_2.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_2.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_2.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_2.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_2.ts.snap index 620463f65261..fc2f9e04006b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_2.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_2.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@first.field @second @(() => decorator)() +export default class Bar {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -83,7 +99,11 @@ JsModule { ], eof_token: EOF@69..70 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..70 0: (empty) 1: (empty) @@ -146,3 +166,5 @@ JsModule { 9: R_CURLY@68..69 "}" [] [] 2: (empty) 4: EOF@69..70 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_3.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_3.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_3.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_3.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_3.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_3.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_3.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_3.ts.snap index a7ff67aefe79..19f908015c77 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_3.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_3.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@before +export default @after class Foo { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -46,7 +62,11 @@ JsModule { ], eof_token: EOF@43..44 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..44 0: (empty) 1: (empty) @@ -81,3 +101,5 @@ JsModule { 9: R_CURLY@42..43 "}" [] [] 2: (empty) 4: EOF@43..44 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_4.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_4.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_4.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_4.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_4.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_4.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_4.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_4.ts.snap index c1bf6012ac40..d2a177a8ab11 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_4.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_4.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts + @before + export default abstract class Foo { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +53,11 @@ JsModule { ], eof_token: EOF@47..48 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -67,3 +87,5 @@ JsModule { 9: R_CURLY@46..47 "}" [] [] 2: (empty) 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_5.ts b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_5.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_5.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_5.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_5.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_5.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_5.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_5.ts.snap index 4b4fd1265043..866463eee8d9 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_default_top_level_5.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_default_top_level_5.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts + @before + export default @after abstract class Foo { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -46,7 +62,11 @@ JsModule { ], eof_token: EOF@54..55 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..55 0: (empty) 1: (empty) @@ -81,3 +101,5 @@ JsModule { 9: R_CURLY@53..54 "}" [] [] 2: (empty) 4: EOF@54..55 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_top_level.js b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_top_level.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_top_level.js rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_top_level.js diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_export_top_level.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_top_level.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/decorator_export_top_level.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_top_level.js.snap index 0056b30e4c96..1cf5f55cfc5a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_export_top_level.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_export_top_level.js.snap @@ -1,3 +1,27 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +@decorator +export class Foo { } +@first.field @second @(() => decorator)() +export class Bar {} +@before +export @after class Foo { } + @before + export abstract class Foo { } + @before + export @after abstract class Foo { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -205,7 +229,11 @@ JsModule { ], eof_token: EOF@216..217 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..217 0: (empty) 1: (empty) @@ -355,3 +383,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@215..215 9: R_CURLY@215..216 "}" [] [] 4: EOF@216..217 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_expression_class.js b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_expression_class.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/decorator_expression_class.js rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_expression_class.js diff --git a/crates/biome_js_parser/test_data/inline/ok/decorator_expression_class.rast b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_expression_class.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/decorator_expression_class.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/decorator_expression_class.js.snap index 2fb101b21396..bb6bf83c4619 100644 --- a/crates/biome_js_parser/test_data/inline/ok/decorator_expression_class.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/decorator_expression_class.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = @decorator class {}; +let b = @first @second class foo { + constructor() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -110,7 +128,11 @@ JsModule { ], eof_token: EOF@83..84 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..84 0: (empty) 1: (empty) @@ -190,3 +212,5 @@ JsModule { 8: R_CURLY@81..83 "}" [Newline("\n")] [] 1: (empty) 4: EOF@83..84 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/destructuring_initializer_binding.js b/crates/biome_js_parser/tests/js_test_suite/ok/destructuring_initializer_binding.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/destructuring_initializer_binding.js rename to crates/biome_js_parser/tests/js_test_suite/ok/destructuring_initializer_binding.js diff --git a/crates/biome_js_parser/test_data/inline/ok/destructuring_initializer_binding.rast b/crates/biome_js_parser/tests/js_test_suite/ok/destructuring_initializer_binding.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/destructuring_initializer_binding.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/destructuring_initializer_binding.js.snap index 0b2908d0b3c0..4a586320a883 100644 --- a/crates/biome_js_parser/test_data/inline/ok/destructuring_initializer_binding.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/destructuring_initializer_binding.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +const { value, f = (value) => value } = item + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -73,7 +88,11 @@ JsModule { ], eof_token: EOF@44..45 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..45 0: (empty) 1: (empty) @@ -126,3 +145,5 @@ JsModule { 0: IDENT@40..44 "item" [] [] 1: (empty) 4: EOF@44..45 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/directives.js b/crates/biome_js_parser/tests/js_test_suite/ok/directives.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/directives.js rename to crates/biome_js_parser/tests/js_test_suite/ok/directives.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/directives.rast b/crates/biome_js_parser/tests/js_test_suite/ok/directives.cjs.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/directives.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/directives.cjs.snap index 472e5c0d3bd2..177a0838c83f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/directives.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/directives.cjs.snap @@ -1,3 +1,41 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +"use new" +let a = 10; +"use strict"; // not a directive +function test() { + 'use strict'; + let b = 10; + 'use strict'; // not a directive +} +(function () { + "use strict"; + "use strict" + .length; // not a directive + let c = 10; + "use strict"; // not a directive +}); +let b = () => { + "use strict"; + let e = 10; + "use strict"; // not a directive +} +{ + "use strict"; // not a directive +} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -246,7 +284,11 @@ JsScript { ], eof_token: EOF@403..404 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_SCRIPT@0..404 0: (empty) 1: (empty) @@ -419,3 +461,5 @@ JsScript { 1: SEMICOLON@381..401 ";" [] [Whitespace(" "), Comments("// not a directive")] 2: R_CURLY@401..403 "}" [Newline("\n")] [] 4: EOF@403..404 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/directives_redundant.js b/crates/biome_js_parser/tests/js_test_suite/ok/directives_redundant.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/directives_redundant.js rename to crates/biome_js_parser/tests/js_test_suite/ok/directives_redundant.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/directives_redundant.rast b/crates/biome_js_parser/tests/js_test_suite/ok/directives_redundant.cjs.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/directives_redundant.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/directives_redundant.cjs.snap index 73e56746a9cf..9a2e66a046ba 100644 --- a/crates/biome_js_parser/test_data/inline/ok/directives_redundant.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/directives_redundant.cjs.snap @@ -1,3 +1,29 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function test() { + "use strict"; + function inner_a() { + "use strict"; + } + function inner_b() { + function inner_inner() { + "use strict"; + } + } +} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -107,7 +133,11 @@ JsScript { ], eof_token: EOF@172..173 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_SCRIPT@0..173 0: (empty) 1: (empty) @@ -191,3 +221,5 @@ JsScript { 3: R_CURLY@166..170 "}" [Newline("\n"), Whitespace(" ")] [] 3: R_CURLY@170..172 "}" [Newline("\n")] [] 4: EOF@172..173 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/do-while-asi.js b/crates/biome_js_parser/tests/js_test_suite/ok/do-while-asi.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/do-while-asi.js rename to crates/biome_js_parser/tests/js_test_suite/ok/do-while-asi.js diff --git a/crates/biome_js_parser/test_data/inline/ok/do-while-asi.rast b/crates/biome_js_parser/tests/js_test_suite/ok/do-while-asi.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/do-while-asi.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/do-while-asi.js.snap index 40497e22c229..35b186817f9b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/do-while-asi.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/do-while-asi.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +do do do ; while (x) while (x) while (x) x = 39; +do do ; while (x); while (x) x = 39 + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -96,7 +112,11 @@ JsModule { ], eof_token: EOF@84..85 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..85 0: (empty) 1: (empty) @@ -168,3 +188,5 @@ JsModule { 0: JS_NUMBER_LITERAL@82..84 "39" [] [] 1: (empty) 4: EOF@84..85 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/do_while_statement.js b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/do_while_statement.js rename to crates/biome_js_parser/tests/js_test_suite/ok/do_while_statement.js diff --git a/crates/biome_js_parser/test_data/inline/ok/do_while_statement.rast b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_statement.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/do_while_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/do_while_statement.js.snap index bf135af27ca9..d1f71b425e58 100644 --- a/crates/biome_js_parser/test_data/inline/ok/do_while_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_statement.js.snap @@ -1,3 +1,27 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +do console.log("test"); while(true) +do { + console.log("test") +} while (true); +let a = 1; +do +do { + a = a + 1 +} while(a < 5) +while (a < 100) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -169,7 +193,11 @@ JsModule { ], eof_token: EOF@140..141 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..141 0: (empty) 1: (empty) @@ -289,3 +317,5 @@ JsModule { 5: R_PAREN@139..140 ")" [] [] 6: (empty) 4: EOF@140..141 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/do_while_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/do_while_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/do_while_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/do_while_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_stmt.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/do_while_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/do_while_stmt.js.snap index e0524efe6abf..c41d3200e2ec 100644 --- a/crates/biome_js_parser/test_data/inline/ok/do_while_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/do_while_stmt.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +do { } while (true) +do { throw Error("foo") } while (true) +do { break; } while (true) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -80,7 +97,11 @@ JsModule { ], eof_token: EOF@85..86 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..86 0: (empty) 1: (empty) @@ -142,3 +163,5 @@ JsModule { 5: R_PAREN@84..85 ")" [] [] 6: (empty) 4: EOF@85..86 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/empty_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/empty_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/empty_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/empty_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/empty_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/empty_stmt.js.snap similarity index 78% rename from crates/biome_js_parser/test_data/inline/ok/empty_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/empty_stmt.js.snap index 34f08109009d..5c4e6f1b6105 100644 --- a/crates/biome_js_parser/test_data/inline/ok/empty_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/empty_stmt.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -9,7 +24,11 @@ JsModule { ], eof_token: EOF@1..2 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..2 0: (empty) 1: (empty) @@ -18,3 +37,5 @@ JsModule { 0: JS_EMPTY_STATEMENT@0..1 0: SEMICOLON@0..1 ";" [] [] 4: EOF@1..2 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/exponent_unary_parenthesized.js b/crates/biome_js_parser/tests/js_test_suite/ok/exponent_unary_parenthesized.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/exponent_unary_parenthesized.js rename to crates/biome_js_parser/tests/js_test_suite/ok/exponent_unary_parenthesized.js diff --git a/crates/biome_js_parser/test_data/inline/ok/exponent_unary_parenthesized.rast b/crates/biome_js_parser/tests/js_test_suite/ok/exponent_unary_parenthesized.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/exponent_unary_parenthesized.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/exponent_unary_parenthesized.js.snap index ba4f192e8538..783336c2e5ad 100644 --- a/crates/biome_js_parser/test_data/inline/ok/exponent_unary_parenthesized.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/exponent_unary_parenthesized.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(delete a.b) ** 2; +(void ident) ** 2; +(typeof ident) ** 2; +(-3) ** 2; +(+3) ** 2; +(~3) ** 2; +(!true) ** 2; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -151,7 +172,11 @@ JsModule { ], eof_token: EOF@105..106 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..106 0: (empty) 1: (empty) @@ -256,3 +281,5 @@ JsModule { 0: JS_NUMBER_LITERAL@103..104 "2" [] [] 1: SEMICOLON@104..105 ";" [] [] 4: EOF@105..106 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_as_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_as_identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_as_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_as_identifier.js diff --git a/crates/biome_js_parser/test_data/inline/ok/export_as_identifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/export_as_identifier.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/export_as_identifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/export_as_identifier.js.snap index 0c25006cbb9e..0b90fdef5510 100644 --- a/crates/biome_js_parser/test_data/inline/ok/export_as_identifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_as_identifier.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { as }; +export { as as as } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -46,7 +62,11 @@ JsModule { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..35 0: (empty) 1: (empty) @@ -82,3 +102,5 @@ JsModule { 3: R_CURLY@33..34 "}" [] [] 4: (empty) 4: EOF@34..35 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_class_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_class_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_class_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_class_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/export_class_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/export_class_clause.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/export_class_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/export_class_clause.js.snap index afd2d13584ea..e5b7429865d2 100644 --- a/crates/biome_js_parser/test_data/inline/ok/export_class_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_class_clause.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export class A {} +export class A extends B {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -50,7 +66,11 @@ JsModule { ], eof_token: EOF@45..46 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..46 0: (empty) 1: (empty) @@ -92,3 +112,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@44..44 9: R_CURLY@44..45 "}" [] [] 4: EOF@45..46 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_class_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_class_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_default_class_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_default_class_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_class_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_class_clause.js.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/ok/export_default_class_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/export_default_class_clause.js.snap index 2e02810fe8f2..98acd13b9c74 100644 --- a/crates/biome_js_parser/test_data/inline/ok/export_default_class_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_class_clause.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default class {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -26,7 +41,11 @@ JsModule { ], eof_token: EOF@23..24 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..24 0: (empty) 1: (empty) @@ -50,3 +69,5 @@ JsModule { 9: R_CURLY@22..23 "}" [] [] 2: (empty) 4: EOF@23..24 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_expression_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_expression_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_default_expression_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_default_expression_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_expression_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_expression_clause.js.snap similarity index 89% rename from crates/biome_js_parser/test_data/inline/ok/export_default_expression_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/export_default_expression_clause.js.snap index a1c6b8c2765b..85f48461d946 100644 --- a/crates/biome_js_parser/test_data/inline/ok/export_default_expression_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_expression_clause.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default a; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -19,7 +34,11 @@ JsModule { ], eof_token: EOF@17..18 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..18 0: (empty) 1: (empty) @@ -35,3 +54,5 @@ JsModule { 0: IDENT@15..16 "a" [] [] 2: SEMICOLON@16..17 ";" [] [] 4: EOF@17..18 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_function_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_function_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_default_function_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_default_function_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/export_default_function_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_function_clause.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/export_default_function_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/export_default_function_clause.js.snap index c26f8a01b55f..26c14102e22b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/export_default_function_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_default_function_clause.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export default function test(a, b) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -55,7 +70,11 @@ JsModule { ], eof_token: EOF@37..38 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..38 0: (empty) 1: (empty) @@ -100,3 +119,5 @@ JsModule { 3: R_CURLY@36..37 "}" [] [] 2: (empty) 4: EOF@37..38 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_from_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_from_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_from_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_from_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/export_from_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/export_from_clause.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/export_from_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/export_from_clause.js.snap index befde8aadaad..142ade6a13ca 100644 --- a/crates/biome_js_parser/test_data/inline/ok/export_from_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_from_clause.js.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { + default as a } from "b"; +export { default as a } from "b"; +export * from "a"; +export * as c from "b"; +export * as default from "b" +export * from "mod" assert { type: "json" } +export type * from "types"; +export type * as types from "types"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -180,7 +203,11 @@ JsModule { ], eof_token: EOF@252..253 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..253 0: (empty) 1: (empty) @@ -318,3 +345,5 @@ JsModule { 5: (empty) 6: SEMICOLON@251..252 ";" [] [] 4: EOF@252..253 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_function_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_function_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_function_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_function_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/export_function_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/export_function_clause.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/export_function_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/export_function_clause.js.snap index 7e204a47cab1..141410540011 100644 --- a/crates/biome_js_parser/test_data/inline/ok/export_function_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_function_clause.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export function test(a, b) {} +export function* test2(a, b) {} +export async function test3(a, b, ) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -142,7 +159,11 @@ JsModule { ], eof_token: EOF@100..101 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..101 0: (empty) 1: (empty) @@ -255,3 +276,5 @@ JsModule { 2: JS_STATEMENT_LIST@99..99 3: R_CURLY@99..100 "}" [] [] 4: EOF@100..101 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_named_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_named_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_named_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/export_named_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_clause.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/export_named_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/export_named_clause.js.snap index 91f6477d5a2d..fd130683c16b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/export_named_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_clause.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { a }; +export { a as z, b as "y", c as default } +export { as }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -86,7 +103,11 @@ JsModule { ], eof_token: EOF@70..71 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..71 0: (empty) 1: (empty) @@ -151,3 +172,5 @@ JsModule { 3: R_CURLY@68..69 "}" [] [] 4: SEMICOLON@69..70 ";" [] [] 4: EOF@70..71 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_named_from_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_from_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_named_from_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_named_from_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/export_named_from_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_from_clause.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/export_named_from_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/export_named_from_clause.js.snap index 531f700a45a9..ecce26706cbc 100644 --- a/crates/biome_js_parser/test_data/inline/ok/export_named_from_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_named_from_clause.js.snap @@ -1,3 +1,27 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export { a, default } from "mod"; +export { a as z, b as "y", c as default } from "mod" +export { as } from "mod"; +export { default as "b" } from "mod"; +export { "a" as b } from "mod"; +export { a } from "mod" assert { type: "json" } +export { "a" } from "./mod"; +export { + "a" +} from "./mod"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -258,7 +282,11 @@ JsModule { ], eof_token: EOF@293..294 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..294 0: (empty) 1: (empty) @@ -450,3 +478,5 @@ JsModule { 6: (empty) 7: SEMICOLON@292..293 ";" [] [] 4: EOF@293..294 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/export_variable_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/export_variable_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/export_variable_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/export_variable_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/export_variable_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/export_variable_clause.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/export_variable_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/export_variable_clause.js.snap index 9d0d28dbaf78..8a3d69a4d891 100644 --- a/crates/biome_js_parser/test_data/inline/ok/export_variable_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/export_variable_clause.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +export let a; +export const b = 3; +export var c, d, e = 3; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -92,7 +109,11 @@ JsModule { ], eof_token: EOF@57..58 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..58 0: (empty) 1: (empty) @@ -159,3 +180,5 @@ JsModule { 0: JS_NUMBER_LITERAL@55..56 "3" [] [] 1: SEMICOLON@56..57 ";" [] [] 4: EOF@57..58 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/for_await_async_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/for_await_async_identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/for_await_async_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/for_await_async_identifier.js diff --git a/crates/biome_js_parser/test_data/inline/ok/for_await_async_identifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/for_await_async_identifier.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/for_await_async_identifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/for_await_async_identifier.js.snap index 1d664db1b197..622fdd24302b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/for_await_async_identifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/for_await_async_identifier.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let async; +async function fn() { + for await (async of [7]); +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -66,7 +84,11 @@ JsModule { ], eof_token: EOF@62..63 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..63 0: (empty) 1: (empty) @@ -117,3 +139,5 @@ JsModule { 0: SEMICOLON@59..60 ";" [] [] 3: R_CURLY@60..62 "}" [Newline("\n")] [] 4: EOF@62..63 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.js b/crates/biome_js_parser/tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.js rename to crates/biome_js_parser/tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.rast b/crates/biome_js_parser/tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs.snap index ff8a3e9da69a..7d33989611e2 100644 --- a/crates/biome_js_parser/test_data/inline/ok/for_in_initializer_loose_mode.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/for_in_initializer_loose_mode.cjs.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +for (var i = 0 in []) {} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -38,7 +54,11 @@ JsScript { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..35 0: (empty) 1: (empty) @@ -69,3 +89,5 @@ JsScript { 1: JS_STATEMENT_LIST@33..33 2: R_CURLY@33..34 "}" [] [] 4: EOF@34..35 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/for_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/for_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/for_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/for_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/for_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/for_stmt.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/for_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/for_stmt.js.snap index 5b6457cdc726..b49ebd4d8f96 100644 --- a/crates/biome_js_parser/test_data/inline/ok/for_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/for_stmt.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for (let i = 5; i < 10; i++) {} +for (let { foo, bar } of {}) {} +for (foo in {}) {} +for (;;) {} +for (let foo of []) {} +for (let i = 5, j = 6; i < j; ++j) {} +for await (let a of []) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -249,7 +270,11 @@ JsModule { ], eof_token: EOF@182..183 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..183 0: (empty) 1: (empty) @@ -437,3 +462,5 @@ JsModule { 1: JS_STATEMENT_LIST@181..181 2: R_CURLY@181..182 "}" [] [] 4: EOF@182..183 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/for_with_in_in_parenthesized_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/for_with_in_in_parenthesized_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js diff --git a/crates/biome_js_parser/test_data/inline/ok/for_with_in_in_parenthesized_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/for_with_in_in_parenthesized_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js.snap index ff6cf3030c0c..6511ade4bf62 100644 --- a/crates/biome_js_parser/test_data/inline/ok/for_with_in_in_parenthesized_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/for_with_in_in_parenthesized_expression.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for((true,"selectionStart"in true);;) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -39,7 +54,11 @@ JsModule { ], eof_token: EOF@40..41 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..41 0: (empty) 1: (empty) @@ -71,3 +90,5 @@ JsModule { 1: JS_STATEMENT_LIST@39..39 2: R_CURLY@39..40 "}" [] [] 4: EOF@40..41 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_decl.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_decl.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_decl.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_decl.js diff --git a/crates/biome_js_parser/test_data/inline/ok/function_decl.rast b/crates/biome_js_parser/tests/js_test_suite/ok/function_decl.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/function_decl.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/function_decl.js.snap index 219cbc749011..0b111141af0d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/function_decl.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_decl.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo1() {} +function *foo2() {} +async function *foo3() {} +async function foo4() {} +function *foo5() { + yield foo; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -126,7 +147,11 @@ JsModule { ], eof_token: EOF@123..124 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..124 0: (empty) 1: (empty) @@ -227,3 +252,5 @@ JsModule { 1: SEMICOLON@120..121 ";" [] [] 3: R_CURLY@121..123 "}" [Newline("\n")] [] 4: EOF@123..124 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_declaration_script.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_declaration_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_declaration_script.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_declaration_script.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/function_declaration_script.rast b/crates/biome_js_parser/tests/js_test_suite/ok/function_declaration_script.cjs.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/function_declaration_script.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/function_declaration_script.cjs.snap index 3457fbbc2a36..4f2dc92c508f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/function_declaration_script.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_declaration_script.cjs.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function test(await) {} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +53,11 @@ JsScript { ], eof_token: EOF@33..34 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..34 0: (empty) 1: (empty) @@ -68,3 +88,5 @@ JsScript { 2: JS_STATEMENT_LIST@32..32 3: R_CURLY@32..33 "}" [] [] 4: EOF@33..34 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/function_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/function_expr.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/function_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/function_expr.js.snap index 7ce5077a67d4..623189b790fb 100644 --- a/crates/biome_js_parser/test_data/inline/ok/function_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_expr.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = function() {} +let b = function foo() {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -82,7 +98,11 @@ JsModule { ], eof_token: EOF@47..48 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -146,3 +166,5 @@ JsModule { 3: R_CURLY@46..47 "}" [] [] 1: (empty) 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_expression_id.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_expression_id.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_expression_id.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_expression_id.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/function_expression_id.rast b/crates/biome_js_parser/tests/js_test_suite/ok/function_expression_id.cjs.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/function_expression_id.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/function_expression_id.cjs.snap index f5db64bb13e5..e3a9b2dc0b86 100644 --- a/crates/biome_js_parser/test_data/inline/ok/function_expression_id.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_expression_id.cjs.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +(function await() {}); +(function yield() {}); +(async function yield() {}); +(function* await() {}) + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -118,7 +137,11 @@ JsScript { ], eof_token: EOF@107..108 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..108 0: (empty) 1: (empty) @@ -213,3 +236,5 @@ JsScript { 2: R_PAREN@106..107 ")" [] [] 1: (empty) 4: EOF@107..108 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_id.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_id.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_id.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_id.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/function_id.rast b/crates/biome_js_parser/tests/js_test_suite/ok/function_id.cjs.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/function_id.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/function_id.cjs.snap index 940a5612557c..44e1256e5322 100644 --- a/crates/biome_js_parser/test_data/inline/ok/function_id.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_id.cjs.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function test() {} +function await(test) {} +async function await(test) {} +function yield(test) {} +function* yield(test) {} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -151,7 +171,11 @@ JsScript { ], eof_token: EOF@131..132 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..132 0: (empty) 1: (empty) @@ -271,3 +295,5 @@ JsScript { 2: JS_STATEMENT_LIST@130..130 3: R_CURLY@130..131 "}" [] [] 4: EOF@131..132 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.js b/crates/biome_js_parser/tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.js rename to crates/biome_js_parser/tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.rast b/crates/biome_js_parser/tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs.snap index 6c59d0cc9d23..4131f66ccba8 100644 --- a/crates/biome_js_parser/test_data/inline/ok/function_in_if_or_labelled_stmt_loose_mode.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/function_in_if_or_labelled_stmt_loose_mode.cjs.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +label1: function a() {} +if (true) function b() {} else function c() {} +if (true) function d() {} +if (true) "test"; else function e() {} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -154,7 +173,11 @@ JsScript { ], eof_token: EOF@145..146 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..146 0: (empty) 1: (empty) @@ -277,3 +300,5 @@ JsScript { 2: JS_STATEMENT_LIST@144..144 3: R_CURLY@144..145 "}" [] [] 4: EOF@145..146 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/getter_class_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/getter_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/getter_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/getter_class_member.js diff --git a/crates/biome_js_parser/test_data/inline/ok/getter_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/getter_class_member.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/getter_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/getter_class_member.js.snap index 3a75236aab31..c995d0d853f8 100644 --- a/crates/biome_js_parser/test_data/inline/ok/getter_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/getter_class_member.js.snap @@ -1,3 +1,31 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Getters { + get foo() {} + get static() {} + static get bar() {} + get "baz"() {} + get ["a" + "b"]() {} + get 5() {} + get #private() {} +} +class NotGetters { + get() {} + async get() {} + static get() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -233,7 +261,11 @@ JsModule { ], eof_token: EOF@212..213 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..213 0: (empty) 1: (empty) @@ -421,3 +453,5 @@ JsModule { 3: R_CURLY@209..210 "}" [] [] 9: R_CURLY@210..212 "}" [Newline("\n")] [] 4: EOF@212..213 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/getter_object_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/getter_object_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/getter_object_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/getter_object_member.js diff --git a/crates/biome_js_parser/test_data/inline/ok/getter_object_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/getter_object_member.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/getter_object_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/getter_object_member.js.snap index be45c1fb332f..4e47bfa43f3e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/getter_object_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/getter_object_member.js.snap @@ -1,3 +1,34 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = { + get foo() { + return foo; + }, + get "bar"() { + return "bar"; + }, + get ["a" + "b"]() { + return "a" + "b" + }, + get 5() { + return 5; + }, + get() { + return "This is a method and not a getter"; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -172,7 +203,11 @@ JsModule { ], eof_token: EOF@225..226 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..226 0: (empty) 1: (empty) @@ -300,3 +335,5 @@ JsModule { 2: R_CURLY@223..225 "}" [Newline("\n")] [] 1: (empty) 4: EOF@225..226 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/grouping_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/grouping_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/grouping_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/grouping_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/grouping_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/grouping_expr.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/grouping_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/grouping_expr.js.snap index 6a8f12240899..fac5df842600 100644 --- a/crates/biome_js_parser/test_data/inline/ok/grouping_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/grouping_expr.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +((foo)) +(foo) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +53,11 @@ JsModule { ], eof_token: EOF@13..14 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..14 0: (empty) 1: (empty) @@ -65,3 +85,5 @@ JsModule { 2: R_PAREN@12..13 ")" [] [] 1: (empty) 4: EOF@13..14 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js diff --git a/crates/biome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast b/crates/biome_js_parser/tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js.snap index 4cdb2eeec2da..9d27b076d3ea 100644 --- a/crates/biome_js_parser/test_data/inline/ok/hoisted_declaration_in_single_statement_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/hoisted_declaration_in_single_statement_context.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) var a; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -31,7 +46,11 @@ JsModule { ], eof_token: EOF@16..17 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..17 0: (empty) 1: (empty) @@ -56,3 +75,5 @@ JsModule { 1: SEMICOLON@15..16 ";" [] [] 5: (empty) 4: EOF@16..17 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/identifier.js diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/identifier.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/identifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/identifier.js.snap index b78d2340f82a..ed675409db82 100644 --- a/crates/biome_js_parser/test_data/inline/ok/identifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/identifier.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo; +let accessor = 5; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -35,7 +51,11 @@ JsModule { ], eof_token: EOF@22..23 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..23 0: (empty) 1: (empty) @@ -61,3 +81,5 @@ JsModule { 0: JS_NUMBER_LITERAL@20..21 "5" [] [] 1: SEMICOLON@21..22 ";" [] [] 4: EOF@22..23 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier_loose_mode.js b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_loose_mode.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/identifier_loose_mode.js rename to crates/biome_js_parser/tests/js_test_suite/ok/identifier_loose_mode.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier_loose_mode.rast b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_loose_mode.cjs.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/ok/identifier_loose_mode.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/identifier_loose_mode.cjs.snap index 3e0b3b6a7190..733bbd331aa2 100644 --- a/crates/biome_js_parser/test_data/inline/ok/identifier_loose_mode.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_loose_mode.cjs.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +foo; +yield; +await; + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -30,7 +48,11 @@ JsScript { ], eof_token: EOF@28..29 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..29 0: (empty) 1: (empty) @@ -52,3 +74,5 @@ JsScript { 0: IDENT@21..27 "await" [Newline("\n")] [] 1: SEMICOLON@27..28 ";" [] [] 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier_reference.js b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_reference.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/identifier_reference.js rename to crates/biome_js_parser/tests/js_test_suite/ok/identifier_reference.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/identifier_reference.rast b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_reference.cjs.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/ok/identifier_reference.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/identifier_reference.cjs.snap index 3e0b3b6a7190..733bbd331aa2 100644 --- a/crates/biome_js_parser/test_data/inline/ok/identifier_reference.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/identifier_reference.cjs.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +foo; +yield; +await; + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -30,7 +48,11 @@ JsScript { ], eof_token: EOF@28..29 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..29 0: (empty) 1: (empty) @@ -52,3 +74,5 @@ JsScript { 0: IDENT@21..27 "await" [Newline("\n")] [] 1: SEMICOLON@27..28 ";" [] [] 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/if_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/if_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/if_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/if_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/if_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/if_stmt.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/if_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/if_stmt.js.snap index 49613dc24a68..fd78bf59f55b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/if_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/if_stmt.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) {} else {} +if (true) {} +if (true) false +if (bar) {} else if (true) {} else {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -95,7 +113,11 @@ JsModule { ], eof_token: EOF@87..88 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..88 0: (empty) 1: (empty) @@ -169,3 +191,5 @@ JsModule { 1: JS_STATEMENT_LIST@86..86 2: R_CURLY@86..87 "}" [] [] 4: EOF@87..88 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_as_as_as_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_as_as_identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_as_as_as_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_as_as_as_identifier.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_as_as_as_identifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_as_as_identifier.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/import_as_as_as_identifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_as_as_as_identifier.js.snap index 5dc1a7efe871..f03f82c1fae6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_as_as_as_identifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_as_as_identifier.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import { as as as } from "test"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -34,7 +49,11 @@ JsModule { ], eof_token: EOF@32..33 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..33 0: (empty) 1: (empty) @@ -61,3 +80,5 @@ JsModule { 4: (empty) 2: SEMICOLON@31..32 ";" [] [] 4: EOF@32..33 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_as_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_identifier.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_as_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_as_identifier.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_as_identifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_identifier.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/import_as_identifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_as_identifier.js.snap index abd11356bc90..1b47926bdb3b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_as_identifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_as_identifier.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import { as } from "test"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -30,7 +45,11 @@ JsModule { ], eof_token: EOF@26..27 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..27 0: (empty) 1: (empty) @@ -54,3 +73,5 @@ JsModule { 4: (empty) 2: SEMICOLON@25..26 ";" [] [] 4: EOF@26..27 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_assertion.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_assertion.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_assertion.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_assertion.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_assertion.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_assertion.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/import_assertion.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_assertion.js.snap index 1a633c69035b..ef7dc54a6568 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_assertion.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_assertion.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import "x" assert { type: "json" } +import "foo" assert { "type": "json" }; +import foo from "foo.json" assert { type: "json" }; +import {test} from "foo.json" assert { for: "for" } +import foo_json from "foo.json" assert { type: "json", hasOwnProperty: "true" }; +import "x" assert +{ type: "json" } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -166,7 +187,11 @@ JsModule { ], eof_token: EOF@294..295 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..295 0: (empty) 1: (empty) @@ -288,3 +313,5 @@ JsModule { 3: R_CURLY@293..294 "}" [] [] 2: (empty) 4: EOF@294..295 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_attribute.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_attribute.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_attribute.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_attribute.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_attribute.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_attribute.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/import_attribute.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_attribute.js.snap index a8db8ee4574a..7294f8d144b6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_attribute.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_attribute.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import "x" with { type: "json" } +import "foo" with { "type": "json" }; +import foo from "foo.json" with { type: "json" }; +import {test} from "foo.json" with { for: "for" } +import foo_json from "foo.json" with { type: "json", hasOwnProperty: "true" }; +import "x" with +{ type: "json" } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -166,7 +187,11 @@ JsModule { ], eof_token: EOF@282..283 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..283 0: (empty) 1: (empty) @@ -288,3 +313,5 @@ JsModule { 3: R_CURLY@281..282 "}" [] [] 2: (empty) 4: EOF@282..283 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_bare_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_bare_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_bare_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_bare_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_bare_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_bare_clause.js.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/ok/import_bare_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_bare_clause.js.snap index ec97ea07d0a3..fc1d41887358 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_bare_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_bare_clause.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import "test"; +import "no_semicolon" + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -26,7 +42,11 @@ JsModule { ], eof_token: EOF@36..37 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..37 0: (empty) 1: (empty) @@ -47,3 +67,5 @@ JsModule { 1: (empty) 2: (empty) 4: EOF@36..37 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_call.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_call.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_call.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_call.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_call.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_call.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/import_call.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_call.js.snap index 34a97d619a80..522699c2bb24 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_call.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_call.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import("foo") +import("foo", { assert: { type: 'json' } }) +import("foo", { with: { 'resolution-mode': 'import' } }) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -107,7 +124,11 @@ JsModule { ], eof_token: EOF@114..115 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..115 0: (empty) 1: (empty) @@ -182,3 +203,5 @@ JsModule { 2: R_PAREN@113..114 ")" [] [] 1: (empty) 4: EOF@114..115 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_decl.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_decl.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_decl.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_decl.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_decl.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_decl.js.snap similarity index 91% rename from crates/biome_js_parser/test_data/inline/ok/import_decl.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_decl.js.snap index 7b59b6d531a6..671b3ca7eb1b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_decl.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_decl.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import * as foo from "bla"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -25,7 +40,11 @@ JsModule { ], eof_token: EOF@27..28 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..28 0: (empty) 1: (empty) @@ -46,3 +65,5 @@ JsModule { 4: (empty) 2: SEMICOLON@26..27 ";" [] [] 4: EOF@27..28 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_default_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_default_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_default_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_default_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clause.js.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/ok/import_default_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_default_clause.js.snap index 256867c59fe5..d9a631d2b681 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_default_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clause.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import foo from "test"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -23,7 +38,11 @@ JsModule { ], eof_token: EOF@23..24 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..24 0: (empty) 1: (empty) @@ -42,3 +61,5 @@ JsModule { 4: (empty) 2: SEMICOLON@22..23 ";" [] [] 4: EOF@23..24 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_default_clauses.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clauses.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_default_clauses.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_default_clauses.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_default_clauses.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clauses.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/import_default_clauses.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_default_clauses.js.snap index 709a24cb7b7f..42e2edfec0dc 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_default_clauses.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_default_clauses.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import e, { f } from "b"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -35,7 +50,11 @@ JsModule { ], eof_token: EOF@25..26 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..26 0: (empty) 1: (empty) @@ -62,3 +81,5 @@ JsModule { 5: (empty) 2: SEMICOLON@24..25 ";" [] [] 4: EOF@25..26 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_meta.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_meta.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_meta.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_meta.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_meta.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_meta.js.snap similarity index 85% rename from crates/biome_js_parser/test_data/inline/ok/import_meta.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_meta.js.snap index ab9c1eb868f1..bd9373844a80 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_meta.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_meta.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import.meta + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -14,7 +29,11 @@ JsModule { ], eof_token: EOF@11..12 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..12 0: (empty) 1: (empty) @@ -27,3 +46,5 @@ JsModule { 2: META@7..11 "meta" [] [] 1: (empty) 4: EOF@11..12 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/import_named_clause.js b/crates/biome_js_parser/tests/js_test_suite/ok/import_named_clause.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/import_named_clause.js rename to crates/biome_js_parser/tests/js_test_suite/ok/import_named_clause.js diff --git a/crates/biome_js_parser/test_data/inline/ok/import_named_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/import_named_clause.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/import_named_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/import_named_clause.js.snap index 41242827a991..b097ee82391d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/import_named_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/import_named_clause.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import {} from "a"; +import { a, b, c, } from "b"; +import { f as x, default as w, "a-b-c" as y } from "b"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -112,7 +129,11 @@ JsModule { ], eof_token: EOF@105..106 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..106 0: (empty) 1: (empty) @@ -196,3 +217,5 @@ JsModule { 4: (empty) 2: SEMICOLON@104..105 ";" [] [] 4: EOF@105..106 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/in_expr_in_arguments.js b/crates/biome_js_parser/tests/js_test_suite/ok/in_expr_in_arguments.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/in_expr_in_arguments.js rename to crates/biome_js_parser/tests/js_test_suite/ok/in_expr_in_arguments.js diff --git a/crates/biome_js_parser/test_data/inline/ok/in_expr_in_arguments.rast b/crates/biome_js_parser/tests/js_test_suite/ok/in_expr_in_arguments.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/in_expr_in_arguments.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/in_expr_in_arguments.js.snap index fd7894462623..29ff1b434df0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/in_expr_in_arguments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/in_expr_in_arguments.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function foo() {} +for (foo("call" in foo);;) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -67,7 +83,11 @@ JsModule { ], eof_token: EOF@47..48 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -120,3 +140,5 @@ JsModule { 1: JS_STATEMENT_LIST@46..46 2: R_CURLY@46..47 "}" [] [] 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/issue_2790.ts b/crates/biome_js_parser/tests/js_test_suite/ok/issue_2790.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/issue_2790.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/issue_2790.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/issue_2790.rast b/crates/biome_js_parser/tests/js_test_suite/ok/issue_2790.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/issue_2790.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/issue_2790.ts.snap index e85e7bac8926..edae63abf76b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/issue_2790.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/issue_2790.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +var x: { + readonly [A in keyof B]?: any; +}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -59,7 +76,11 @@ JsModule { ], eof_token: EOF@44..45 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..45 0: (empty) 1: (empty) @@ -104,3 +125,5 @@ JsModule { 2: (empty) 1: SEMICOLON@43..44 ";" [] [] 4: EOF@44..45 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/js_class_property_member_modifiers.js b/crates/biome_js_parser/tests/js_test_suite/ok/js_class_property_member_modifiers.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/js_class_property_member_modifiers.js rename to crates/biome_js_parser/tests/js_test_suite/ok/js_class_property_member_modifiers.js diff --git a/crates/biome_js_parser/test_data/inline/ok/js_class_property_member_modifiers.rast b/crates/biome_js_parser/tests/js_test_suite/ok/js_class_property_member_modifiers.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/js_class_property_member_modifiers.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/js_class_property_member_modifiers.js.snap index 6f548575b1e2..41c975c307e1 100644 --- a/crates/biome_js_parser/test_data/inline/ok/js_class_property_member_modifiers.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/js_class_property_member_modifiers.js.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Test { + static a = 1; + accessor b = 1; + static accessor c = 1; +} +class Foo { + accessor + foo +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -111,7 +134,11 @@ JsModule { ], eof_token: EOF@114..115 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..115 0: (empty) 1: (empty) @@ -194,3 +221,5 @@ JsModule { 4: (empty) 9: R_CURLY@112..114 "}" [Newline("\n")] [] 4: EOF@114..115 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/js_parenthesized_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/js_parenthesized_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/js_parenthesized_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/js_parenthesized_expression.js diff --git a/crates/biome_js_parser/test_data/inline/ok/js_parenthesized_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/js_parenthesized_expression.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/js_parenthesized_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/js_parenthesized_expression.js.snap index 6a8f12240899..fac5df842600 100644 --- a/crates/biome_js_parser/test_data/inline/ok/js_parenthesized_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/js_parenthesized_expression.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +((foo)) +(foo) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +53,11 @@ JsModule { ], eof_token: EOF@13..14 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..14 0: (empty) 1: (empty) @@ -65,3 +85,5 @@ JsModule { 2: R_PAREN@12..13 ")" [] [] 1: (empty) 4: EOF@13..14 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/js_unary_expressions.js b/crates/biome_js_parser/tests/js_test_suite/ok/js_unary_expressions.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/js_unary_expressions.js rename to crates/biome_js_parser/tests/js_test_suite/ok/js_unary_expressions.js diff --git a/crates/biome_js_parser/test_data/inline/ok/js_unary_expressions.rast b/crates/biome_js_parser/tests/js_test_suite/ok/js_unary_expressions.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/js_unary_expressions.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/js_unary_expressions.js.snap index af116e4f6398..d2b934333d47 100644 --- a/crates/biome_js_parser/test_data/inline/ok/js_unary_expressions.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/js_unary_expressions.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +delete a['test']; +void a; +typeof a; ++1; +-1; +~1; +!true; +-a + -b + +a; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -116,7 +138,11 @@ JsModule { ], eof_token: EOF@68..69 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..69 0: (empty) 1: (empty) @@ -195,3 +221,5 @@ JsModule { 0: IDENT@66..67 "a" [] [] 1: SEMICOLON@67..68 ";" [] [] 4: EOF@68..69 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_any_name.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_any_name.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_any_name.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_any_name.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_any_name.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_any_name.jsx.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/jsx_any_name.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_any_name.jsx.snap index 6da2234985d2..06a4ccc59c70 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_any_name.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_any_name.jsx.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +; +; +; +; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -119,7 +138,11 @@ JsModule { ], eof_token: EOF@117..118 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..118 0: (empty) 1: (empty) @@ -207,3 +230,5 @@ JsModule { 5: R_ANGLE@115..116 ">" [] [] 1: SEMICOLON@116..117 ";" [] [] 4: EOF@117..118 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_arrow_exrp_in_alternate.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_arrow_exrp_in_alternate.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_arrow_exrp_in_alternate.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/jsx_arrow_exrp_in_alternate.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx.snap index 5fa1708dfe54..8238da1964ab 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_arrow_exrp_in_alternate.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_arrow_exrp_in_alternate.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +bar ? (foo) : ({() => {}}); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -75,7 +90,11 @@ JsModule { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..35 0: (empty) 1: (empty) @@ -132,3 +151,5 @@ JsModule { 2: R_PAREN@32..33 ")" [] [] 1: SEMICOLON@33..34 ";" [] [] 4: EOF@34..35 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_children_expression.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression.jsx.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/ok/jsx_children_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression.jsx.snap index 843484229bae..7c79b1a80f65 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression.jsx.snap @@ -1,3 +1,73 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let x; +let a; +let b; +let key; +let f = () => {}; +
+ {1} + {9007199254740991n} + {""} + {true} + {null} + {undefined} + {/a/} + {[]} + {x => console.log(x)} + {x = 1} + {await x} + {1 + 1} + {f()} + {a[b]} + {a?1:2} + {function f() {}} + {function () {}} + {a} + {import("a.js")} + {key in a} + {a instanceof Object} + {a && b} + {new f()} + {{}} + {(a)} + {a++} + {++a} + {a,b} + {a.b} + {super.a()} + {this} + {delete a.a} + {void a} + {typeof a} + {+a} + {-a} + {!a} + {~a} + {``} + {/* A JSX comment */} + {/* Multi + line + */} + {} +
+function *f() { + return
+ {yield a} +
; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -884,7 +954,11 @@ JsModule { ], eof_token: EOF@616..617 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..617 0: (empty) 1: (empty) @@ -1505,3 +1579,5 @@ JsModule { 2: SEMICOLON@613..614 ";" [] [] 3: R_CURLY@614..616 "}" [Newline("\n")] [] 4: EOF@616..617 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression_then_text.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression_then_text.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_children_expression_then_text.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression_then_text.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression_then_text.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression_then_text.jsx.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/jsx_children_expression_then_text.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression_then_text.jsx.snap index 4e1e600e070a..7f7131d6fe36 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_children_expression_then_text.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_expression_then_text.jsx.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx + + {/* comment */} + some + text + + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -43,7 +62,11 @@ JsModule { ], eof_token: EOF@54..55 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..55 0: (empty) 1: (empty) @@ -76,3 +99,5 @@ JsModule { 3: R_ANGLE@53..54 ">" [] [] 1: (empty) 4: EOF@54..55 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_spread.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_spread.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_children_spread.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_spread.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_children_spread.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_spread.jsx.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/jsx_children_spread.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_spread.jsx.snap index 84da262d1108..c02bc62481a6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_children_spread.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_children_spread.jsx.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
{...a}
; +
{...a}After
; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -81,7 +97,11 @@ JsModule { ], eof_token: EOF@42..43 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..43 0: (empty) 1: (empty) @@ -140,3 +160,5 @@ JsModule { 3: R_ANGLE@40..41 ">" [] [] 1: SEMICOLON@41..42 ";" [] [] 4: EOF@42..43 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_closing_token_trivia.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_closing_token_trivia.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_closing_token_trivia.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_closing_token_trivia.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_closing_token_trivia.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_closing_token_trivia.jsx.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/jsx_closing_token_trivia.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_closing_token_trivia.jsx.snap index de2b1b0a56cf..13641c8d94f7 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_closing_token_trivia.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_closing_token_trivia.jsx.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +< +/* some comment */ / open>; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -46,7 +63,11 @@ JsModule { ], eof_token: EOF@68..69 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..69 0: (empty) 1: (empty) @@ -82,3 +103,5 @@ JsModule { 3: R_ANGLE@66..67 ">" [] [] 1: SEMICOLON@67..68 ";" [] [] 4: EOF@68..69 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_as_statements.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_as_statements.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_as_statements.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_as_statements.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_as_statements.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_as_statements.jsx.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_as_statements.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_as_statements.jsx.snap index 99523f5f543e..cbac11c01793 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_as_statements.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_as_statements.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
+ +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -21,7 +36,11 @@ JsModule { ], eof_token: EOF@7..8 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..8 0: (empty) 1: (empty) @@ -39,3 +58,5 @@ JsModule { 5: R_ANGLE@6..7 ">" [] [] 1: (empty) 4: EOF@7..8 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_element.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_element.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_element.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_element.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_element.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_element.jsx.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_element.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_element.jsx.snap index 1fafc53cfac2..30bbb183949e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_element.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_element.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
/>; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -40,7 +55,11 @@ JsModule { ], eof_token: EOF@16..17 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..17 0: (empty) 1: (empty) @@ -71,3 +90,5 @@ JsModule { 5: R_ANGLE@14..15 ">" [] [] 1: SEMICOLON@15..16 ";" [] [] 4: EOF@16..17 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_expression.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_expression.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_expression.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_expression.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_expression.jsx.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_expression.jsx.snap index ab1f8d8ce2d1..fd9493139164 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_expression.jsx.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
; +
; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -80,7 +96,11 @@ JsModule { ], eof_token: EOF@49..50 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..50 0: (empty) 1: (empty) @@ -137,3 +157,5 @@ JsModule { 5: R_ANGLE@47..48 ">" [] [] 1: SEMICOLON@48..49 ";" [] [] 4: EOF@49..50 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_string_literal.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_string_literal.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_string_literal.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_string_literal.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx.snap index 29c2c280e8c5..12cba165505d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attribute_string_literal.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attribute_string_literal.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +
; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -33,7 +48,11 @@ JsModule { ], eof_token: EOF@15..16 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..16 0: (empty) 1: (empty) @@ -58,3 +77,5 @@ JsModule { 5: R_ANGLE@13..14 ">" [] [] 1: SEMICOLON@14..15 ";" [] [] 4: EOF@15..16 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attributes.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attributes.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attributes.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attributes.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attributes.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attributes.jsx.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_attributes.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attributes.jsx.snap index 2278c1d058ff..4225ee9699b2 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_attributes.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_attributes.jsx.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function f() { + return
>
; +} +
; +
; +
; +
; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -236,7 +258,11 @@ JsModule { ], eof_token: EOF@285..286 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..286 0: (empty) 1: (empty) @@ -400,3 +426,5 @@ JsModule { 5: R_ANGLE@283..284 ">" [] [] 1: SEMICOLON@284..285 ";" [] [] 4: EOF@285..286 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_children.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_children.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_children.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_children.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_children.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_children.jsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_children.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_children.jsx.snap index 9431406d5f9e..0f1bc8e08c12 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_children.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_children.jsx.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx + + + + + + + + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -131,7 +152,11 @@ JsModule { ], eof_token: EOF@67..68 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..68 0: (empty) 1: (empty) @@ -228,3 +253,5 @@ JsModule { 3: R_ANGLE@66..67 ">" [] [] 1: (empty) 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx.snap index 69d5985bd80e..15fc1bd113d4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_arrow_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_arrow_function.jsx.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +const f = () =>
; +const f = () => (
); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -112,7 +128,11 @@ JsModule { ], eof_token: EOF@59..60 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..60 0: (empty) 1: (empty) @@ -196,3 +216,5 @@ JsModule { 2: R_PAREN@57..58 ")" [] [] 1: SEMICOLON@58..59 ";" [] [] 4: EOF@59..60 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_return.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_return.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_on_return.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_return.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_open_close.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_return.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_open_close.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_return.jsx.snap index 288de54ddc09..666b11cafec9 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_open_close.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_on_return.jsx.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function f() { + return
+} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -54,7 +71,11 @@ JsModule { ], eof_token: EOF@39..40 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..40 0: (empty) 1: (empty) @@ -97,3 +118,5 @@ JsModule { 2: (empty) 3: R_CURLY@37..39 "}" [Newline("\n")] [] 4: EOF@39..40 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_open_close.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_open_close.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_open_close.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_open_close.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_return.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_open_close.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_on_return.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_open_close.jsx.snap index 288de54ddc09..666b11cafec9 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_on_return.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_open_close.jsx.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function f() { + return
+} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -54,7 +71,11 @@ JsModule { ], eof_token: EOF@39..40 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..40 0: (empty) 1: (empty) @@ -97,3 +118,5 @@ JsModule { 2: (empty) 3: R_CURLY@37..39 "}" [Newline("\n")] [] 4: EOF@39..40 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_self_close.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_self_close.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_self_close.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_self_close.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_element_self_close.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_self_close.jsx.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/jsx_element_self_close.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_self_close.jsx.snap index 255f91cdead3..dbfc66827b79 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_element_self_close.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_element_self_close.jsx.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function f() { + return
+} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -44,7 +61,11 @@ JsModule { ], eof_token: EOF@35..36 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..36 0: (empty) 1: (empty) @@ -80,3 +101,5 @@ JsModule { 2: (empty) 3: R_CURLY@33..35 "}" [Newline("\n")] [] 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_equal_content.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_equal_content.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_equal_content.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_equal_content.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_equal_content.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_equal_content.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/jsx_equal_content.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_equal_content.jsx.snap index 4639a5b571fd..8cbd013738e9 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_equal_content.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_equal_content.jsx.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +=; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -60,7 +76,11 @@ JsModule { ], eof_token: EOF@30..31 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..31 0: (empty) 1: (empty) @@ -105,3 +125,5 @@ JsModule { 3: R_ANGLE@28..29 ">" [] [] 1: SEMICOLON@29..30 ";" [] [] 4: EOF@30..31 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_fragments.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_fragments.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_fragments.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_fragments.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_fragments.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_fragments.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/jsx_fragments.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_fragments.jsx.snap index 993bfc84c8b4..1f6a34e17f03 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_fragments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_fragments.jsx.snap @@ -1,3 +1,27 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +<>; +<>abcd; +<> whitespace +; +< + /*comment */ + > + < + / +>; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -86,7 +110,11 @@ JsModule { ], eof_token: EOF@70..71 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..71 0: (empty) 1: (empty) @@ -147,3 +175,5 @@ JsModule { 2: R_ANGLE@67..69 ">" [Newline("\n")] [] 1: SEMICOLON@69..70 ";" [] [] 4: EOF@70..71 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_member_element_name.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_member_element_name.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_member_element_name.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_member_element_name.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_member_element_name.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_member_element_name.jsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/jsx_member_element_name.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_member_element_name.jsx.snap index 68da288b185e..47c72d0ba1b5 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_member_element_name.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_member_element_name.jsx.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +; +; +; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -129,7 +146,11 @@ JsModule { ], eof_token: EOF@52..53 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..53 0: (empty) 1: (empty) @@ -222,3 +243,5 @@ JsModule { 3: R_ANGLE@50..51 ">" [] [] 1: SEMICOLON@51..52 ";" [] [] 4: EOF@52..53 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_primary_expression.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_primary_expression.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_primary_expression.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_primary_expression.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_primary_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_primary_expression.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/jsx_primary_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_primary_expression.jsx.snap index 1a8f807d5148..066c082cc274 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_primary_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_primary_expression.jsx.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = abcd.c; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -56,7 +71,11 @@ JsModule { ], eof_token: EOF@28..29 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..29 0: (empty) 1: (empty) @@ -97,3 +116,5 @@ JsModule { 0: IDENT@26..27 "c" [] [] 1: SEMICOLON@27..28 ";" [] [] 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_spread_attribute.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_spread_attribute.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_spread_attribute.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_spread_attribute.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_spread_attribute.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_spread_attribute.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/jsx_spread_attribute.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_spread_attribute.jsx.snap index a62bac282fd6..0eb68e937bd0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_spread_attribute.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_spread_attribute.jsx.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let obj = {}; +; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -55,7 +71,11 @@ JsModule { ], eof_token: EOF@29..30 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..30 0: (empty) 1: (empty) @@ -96,3 +116,5 @@ JsModule { 5: R_ANGLE@27..28 ">" [] [] 1: SEMICOLON@28..29 ";" [] [] 4: EOF@29..30 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_text.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_text.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_text.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_text.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_text.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_text.jsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/jsx_text.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_text.jsx.snap index 2aefd006a8b5..b711378f3e45 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_text.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_text.jsx.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +test; + whitespace handling ; + multi + line + node +; +\u3333 // no error for invalid unicode escape + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -122,7 +143,11 @@ JsModule { ], eof_token: EOF@141..142 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..142 0: (empty) 1: (empty) @@ -209,3 +234,5 @@ JsModule { 3: R_ANGLE@101..141 ">" [] [Whitespace(" "), Comments("// no error for inval ...")] 1: (empty) 4: EOF@141..142 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_type_arguments.jsx b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_type_arguments.jsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/jsx_type_arguments.jsx rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_type_arguments.jsx diff --git a/crates/biome_js_parser/test_data/inline/ok/jsx_type_arguments.rast b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_type_arguments.jsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/jsx_type_arguments.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/jsx_type_arguments.jsx.snap index 9851592e2225..1436528c988e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/jsx_type_arguments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/jsx_type_arguments.jsx.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +// These may look like a valid arrows but are JSX +() =; +() =; +() =; +() =; +; +; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -211,7 +232,11 @@ JsModule { ], eof_token: EOF@176..177 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..177 0: (empty) 1: (empty) @@ -355,3 +380,5 @@ JsModule { 5: R_ANGLE@174..175 ">" [] [] 1: SEMICOLON@175..176 ";" [] [] 4: EOF@176..177 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/labeled_statement.js b/crates/biome_js_parser/tests/js_test_suite/ok/labeled_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/labeled_statement.js rename to crates/biome_js_parser/tests/js_test_suite/ok/labeled_statement.js diff --git a/crates/biome_js_parser/test_data/inline/ok/labeled_statement.rast b/crates/biome_js_parser/tests/js_test_suite/ok/labeled_statement.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/labeled_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/labeled_statement.js.snap index 8cd7d9200802..b2410ba3e314 100644 --- a/crates/biome_js_parser/test_data/inline/ok/labeled_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/labeled_statement.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +label1: 1 +label1: 1 +label2: 2 + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -42,7 +59,11 @@ JsModule { ], eof_token: EOF@29..30 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..30 0: (empty) 1: (empty) @@ -73,3 +94,5 @@ JsModule { 0: JS_NUMBER_LITERAL@28..29 "2" [] [] 1: (empty) 4: EOF@29..30 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/labelled_function_declaration.js b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_function_declaration.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/labelled_function_declaration.js rename to crates/biome_js_parser/tests/js_test_suite/ok/labelled_function_declaration.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/labelled_function_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_function_declaration.cjs.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/labelled_function_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/labelled_function_declaration.cjs.snap index 76309c6926d6..7a346696baff 100644 --- a/crates/biome_js_parser/test_data/inline/ok/labelled_function_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_function_declaration.cjs.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +label1: function a() {} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -33,7 +49,11 @@ JsScript { ], eof_token: EOF@33..34 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..34 0: (empty) 1: (empty) @@ -61,3 +81,5 @@ JsScript { 2: JS_STATEMENT_LIST@32..32 3: R_CURLY@32..33 "}" [] [] 4: EOF@33..34 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.js b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.js rename to crates/biome_js_parser/tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js diff --git a/crates/biome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.rast b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js.snap index a4c827628600..c49332f67643 100644 --- a/crates/biome_js_parser/test_data/inline/ok/labelled_statement_in_single_statement_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/labelled_statement_in_single_statement_context.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +if (true) label1: var a = 10; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -42,7 +57,11 @@ JsModule { ], eof_token: EOF@29..30 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..30 0: (empty) 1: (empty) @@ -74,3 +93,5 @@ JsModule { 1: SEMICOLON@28..29 ";" [] [] 5: (empty) 4: EOF@29..30 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/let_asi_rule.js b/crates/biome_js_parser/tests/js_test_suite/ok/let_asi_rule.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/let_asi_rule.js rename to crates/biome_js_parser/tests/js_test_suite/ok/let_asi_rule.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/let_asi_rule.rast b/crates/biome_js_parser/tests/js_test_suite/ok/let_asi_rule.cjs.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/let_asi_rule.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/let_asi_rule.cjs.snap index 0a4fff668575..beab2e5780a4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/let_asi_rule.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/let_asi_rule.cjs.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +let // NO ASI +x = 1; +for await (var x of []) let // ASI +x = 1; + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -70,7 +89,11 @@ JsScript { ], eof_token: EOF@72..73 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..73 0: (empty) 1: (empty) @@ -122,3 +145,5 @@ JsScript { 0: JS_NUMBER_LITERAL@70..71 "1" [] [] 1: SEMICOLON@71..72 ";" [] [] 4: EOF@72..73 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/literals.js b/crates/biome_js_parser/tests/js_test_suite/ok/literals.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/literals.js rename to crates/biome_js_parser/tests/js_test_suite/ok/literals.js diff --git a/crates/biome_js_parser/test_data/inline/ok/literals.rast b/crates/biome_js_parser/tests/js_test_suite/ok/literals.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/literals.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/literals.js.snap index 947496aec896..dbc370e132b3 100644 --- a/crates/biome_js_parser/test_data/inline/ok/literals.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/literals.js.snap @@ -1,3 +1,30 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +5 +true +false +5n +"foo" +'bar' +null +0, 0.0, 0n, 0e00 +"test\ +new-line"; +/^[يفمئامئ‍ئاسۆند]/i; //regex with unicode +/[\p{Control}--[\t\n]]/v; +/\’/; // regex with escaped non-ascii chars (issue #1941) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -96,7 +123,11 @@ JsModule { ], eof_token: EOF@211..212 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..212 0: (empty) 1: (empty) @@ -163,3 +194,5 @@ JsModule { 0: JS_REGEX_LITERAL@151..158 "/\\’/" [Newline("\n")] [] 1: SEMICOLON@158..211 ";" [] [Whitespace(" "), Comments("// regex with escaped ...")] 4: EOF@211..212 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/logical_expressions.js b/crates/biome_js_parser/tests/js_test_suite/ok/logical_expressions.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/logical_expressions.js rename to crates/biome_js_parser/tests/js_test_suite/ok/logical_expressions.js diff --git a/crates/biome_js_parser/test_data/inline/ok/logical_expressions.rast b/crates/biome_js_parser/tests/js_test_suite/ok/logical_expressions.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/logical_expressions.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/logical_expressions.js.snap index 3ad3f85fe531..54bc7c1468bc 100644 --- a/crates/biome_js_parser/test_data/inline/ok/logical_expressions.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/logical_expressions.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo ?? bar +a || b +a && b + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -54,7 +71,11 @@ JsModule { ], eof_token: EOF@24..25 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..25 0: (empty) 1: (empty) @@ -91,3 +112,5 @@ JsModule { 0: IDENT@23..24 "b" [] [] 1: (empty) 4: EOF@24..25 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/metavar.options.json b/crates/biome_js_parser/tests/js_test_suite/ok/metavar.options.json new file mode 100644 index 000000000000..494df296546f --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/metavar.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "gritMetavariables": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/ok/metavar.ts b/crates/biome_js_parser/tests/js_test_suite/ok/metavar.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/metavar.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/metavar.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/metavar.rast b/crates/biome_js_parser/tests/js_test_suite/ok/metavar.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/metavar.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/metavar.ts.snap index 57ed61f31eaa..7bdd883cb99e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/metavar.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/metavar.ts.snap @@ -1,3 +1,36 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import µdefaultImport from µsource; +import { µnamedImport, type µnamedType } from µsource; + +µstatement; + +function foo() { + µstatement; + const bar = µexpression; +} + +class Foo { + µclassMember; +} + +const { µkey: key } = { µkey: µvalue }; + +function µfunctionName() {} + +type µType = µOtherType; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -209,7 +242,11 @@ JsModule { ], eof_token: EOF@312..313 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..313 0: (empty) 1: (empty) @@ -362,3 +399,5 @@ JsModule { 0: GRIT_METAVARIABLE@300..311 "µOtherType" [] [] 5: SEMICOLON@311..312 ";" [] [] 4: EOF@312..313 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/method_class_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/method_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/method_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/method_class_member.js diff --git a/crates/biome_js_parser/test_data/inline/ok/method_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/method_class_member.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/method_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/method_class_member.js.snap index 6af73302f5da..6e3fa112d683 100644 --- a/crates/biome_js_parser/test_data/inline/ok/method_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/method_class_member.js.snap @@ -1,3 +1,47 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Test { + method() {} + async asyncMethod() {} + async* asyncGeneratorMethod() {} + * generatorMethod() {} + "foo"() {} + ["foo" + "bar"]() {} + 5() {} + #private() {} +} +class ContextualKeywords { + // Methods called static + static() {} + async static() {} + * static() {} + async* static() {} + declare() {} + get() {} // Method called get + set() {} // Method called set +} +class Static { + static method() {} + static async asyncMethod() {} + static async* asyncGeneratorMethod() {} + static * generatorMethod() {} + static static() {} + static async static() {} + static async* static() {} + static * static() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -600,7 +644,11 @@ JsModule { ], eof_token: EOF@624..625 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..625 0: (empty) 1: (empty) @@ -1081,3 +1129,5 @@ JsModule { 3: R_CURLY@621..622 "}" [] [] 9: R_CURLY@622..624 "}" [Newline("\n")] [] 4: EOF@624..625 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/module.js b/crates/biome_js_parser/tests/js_test_suite/ok/module.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/module.js rename to crates/biome_js_parser/tests/js_test_suite/ok/module.js diff --git a/crates/biome_js_parser/test_data/inline/ok/module.rast b/crates/biome_js_parser/tests/js_test_suite/ok/module.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/module.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/module.js.snap index 9f5eb380ff8f..bc5fce9ab72c 100644 --- a/crates/biome_js_parser/test_data/inline/ok/module.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/module.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +import a from "b"; +export { a }; +c(); +import { c } from "c"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -82,7 +100,11 @@ JsModule { ], eof_token: EOF@60..61 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..61 0: (empty) 1: (empty) @@ -143,3 +165,5 @@ JsModule { 4: (empty) 2: SEMICOLON@59..60 ";" [] [] 4: EOF@60..61 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/new_exprs.js b/crates/biome_js_parser/tests/js_test_suite/ok/new_exprs.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/new_exprs.js rename to crates/biome_js_parser/tests/js_test_suite/ok/new_exprs.js diff --git a/crates/biome_js_parser/test_data/inline/ok/new_exprs.rast b/crates/biome_js_parser/tests/js_test_suite/ok/new_exprs.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/new_exprs.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/new_exprs.js.snap index 10aacca8f00f..97f9a1e18f5d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/new_exprs.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/new_exprs.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +new Foo() +new foo; +new.target +new new new new Foo(); +new Foo(bar, baz, 6 + 6, foo[bar] + ((foo) => {}) * foo?.bar) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -179,7 +198,11 @@ JsModule { ], eof_token: EOF@114..115 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..115 0: (empty) 1: (empty) @@ -309,3 +332,5 @@ JsModule { 2: R_PAREN@113..114 ")" [] [] 1: (empty) 4: EOF@114..115 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_assignment_target.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_assignment_target.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_assignment_target.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/object_assignment_target.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_assignment_target.js.snap index 089dff1aebad..5ac0706dd305 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_assignment_target.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_assignment_target.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({} = {}); +({ bar, baz } = {}); +({ bar: [baz = "baz"], foo = "foo", ...rest } = {}); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -124,7 +141,11 @@ JsModule { ], eof_token: EOF@84..85 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..85 0: (empty) 1: (empty) @@ -214,3 +235,5 @@ JsModule { 2: R_PAREN@82..83 ")" [] [] 1: SEMICOLON@83..84 ";" [] [] 4: EOF@84..85 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/object_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr.js.snap index 17bf449c0b69..2e327afde979 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = {}; +let b = {foo,} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -59,7 +75,11 @@ JsModule { ], eof_token: EOF@26..27 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..27 0: (empty) 1: (empty) @@ -102,3 +122,5 @@ JsModule { 2: R_CURLY@25..26 "}" [] [] 1: (empty) 4: EOF@26..27 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_async_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_async_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_async_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_async_method.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_async_method.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_async_method.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_async_method.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_async_method.js.snap index afe2dbb40c55..7521e5bec0c7 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_async_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_async_method.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = { + async foo() {}, + async *foo() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -71,7 +89,11 @@ JsModule { ], eof_token: EOF@47..48 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -127,3 +149,5 @@ JsModule { 2: R_CURLY@45..47 "}" [Newline("\n")] [] 1: (empty) 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_generator_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_generator_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_generator_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_generator_method.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_generator_method.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_generator_method.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_generator_method.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_generator_method.js.snap index b542e4cbaa6b..9f4e1abb57d0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_generator_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_generator_method.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let b = { *foo() {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -50,7 +65,11 @@ JsModule { ], eof_token: EOF@21..22 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..22 0: (empty) 1: (empty) @@ -89,3 +108,5 @@ JsModule { 2: R_CURLY@20..21 "}" [] [] 1: (empty) 4: EOF@21..22 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_literal_prop.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_literal_prop.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_literal_prop.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_literal_prop.js.snap index 11169cbd9fab..24c4ab43a9ad 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_literal_prop.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_literal_prop.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let b = { a: true } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -39,7 +54,11 @@ JsModule { ], eof_token: EOF@19..20 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..20 0: (empty) 1: (empty) @@ -68,3 +87,5 @@ JsModule { 2: R_CURLY@18..19 "}" [] [] 1: (empty) 4: EOF@19..20 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_prop.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_prop.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_ident_prop.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_prop.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_prop.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_prop.js.snap similarity index 91% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_ident_prop.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_prop.js.snap index 57c1e8364bf4..0ed7cca6064f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_ident_prop.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_ident_prop.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({foo}) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -24,7 +39,11 @@ JsModule { ], eof_token: EOF@7..8 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..8 0: (empty) 1: (empty) @@ -43,3 +62,5 @@ JsModule { 2: R_PAREN@6..7 ")" [] [] 1: (empty) 4: EOF@7..8 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_method.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_method.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_method.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_method.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_method.js.snap index 8a217f403d48..81c48ff13642 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_method.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let b = { + foo() {}, + "bar"(a, b, c) {}, + ["foo" + "bar"](a) {}, + 5(...rest) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -172,7 +192,11 @@ JsModule { ], eof_token: EOF@85..86 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..86 0: (empty) 1: (empty) @@ -305,3 +329,5 @@ JsModule { 2: R_CURLY@83..85 "}" [Newline("\n")] [] 1: (empty) 4: EOF@85..86 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_spread_prop.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_spread_prop.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_spread_prop.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_spread_prop.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_expr_spread_prop.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_spread_prop.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/object_expr_spread_prop.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_expr_spread_prop.js.snap index dfa56e30794f..62eb956f7806 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_expr_spread_prop.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_expr_spread_prop.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = {...foo} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -38,7 +53,11 @@ JsModule { ], eof_token: EOF@16..17 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..17 0: (empty) 1: (empty) @@ -66,3 +85,5 @@ JsModule { 2: R_CURLY@15..16 "}" [] [] 1: (empty) 4: EOF@16..17 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_member_name.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_member_name.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_member_name.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_member_name.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_prop_name.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_member_name.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/object_prop_name.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_member_name.js.snap index b39e4102ae85..0fea340a876d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_prop_name.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_member_name.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = {"foo": foo, [6 + 6]: foo, bar: foo, 7: foo} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -87,7 +102,11 @@ JsModule { ], eof_token: EOF@52..53 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..53 0: (empty) 1: (empty) @@ -148,3 +167,5 @@ JsModule { 2: R_CURLY@51..52 "}" [] [] 1: (empty) 4: EOF@52..53 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_prop_in_rhs.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_in_rhs.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_prop_in_rhs.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_prop_in_rhs.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_prop_in_rhs.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_in_rhs.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/object_prop_in_rhs.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_prop_in_rhs.js.snap index 20b4321f3a91..1670ce03f670 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_prop_in_rhs.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_in_rhs.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ({ a: "x" in {} };;) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -43,7 +58,11 @@ JsModule { ], eof_token: EOF@27..28 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..28 0: (empty) 1: (empty) @@ -78,3 +97,5 @@ JsModule { 1: JS_STATEMENT_LIST@26..26 2: R_CURLY@26..27 "}" [] [] 4: EOF@27..28 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_prop_name.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_name.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_prop_name.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_prop_name.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_member_name.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_name.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/object_member_name.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_prop_name.js.snap index b39e4102ae85..0fea340a876d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_member_name.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_prop_name.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = {"foo": foo, [6 + 6]: foo, bar: foo, 7: foo} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -87,7 +102,11 @@ JsModule { ], eof_token: EOF@52..53 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..53 0: (empty) 1: (empty) @@ -148,3 +167,5 @@ JsModule { 2: R_CURLY@51..52 "}" [] [] 1: (empty) 4: EOF@52..53 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_property_binding.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_property_binding.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_property_binding.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_property_binding.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_property_binding.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_property_binding.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/object_property_binding.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_property_binding.js.snap index b89e1e1403c1..088af8dc91a4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_property_binding.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_property_binding.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { foo: bar } = {} +let { foo: bar_bar = baz } = {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -85,7 +101,11 @@ JsModule { ], eof_token: EOF@54..55 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..55 0: (empty) 1: (empty) @@ -146,3 +166,5 @@ JsModule { 2: R_CURLY@53..54 "}" [] [] 1: (empty) 4: EOF@54..55 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/object_shorthand_property.js b/crates/biome_js_parser/tests/js_test_suite/ok/object_shorthand_property.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/object_shorthand_property.js rename to crates/biome_js_parser/tests/js_test_suite/ok/object_shorthand_property.js diff --git a/crates/biome_js_parser/test_data/inline/ok/object_shorthand_property.rast b/crates/biome_js_parser/tests/js_test_suite/ok/object_shorthand_property.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/object_shorthand_property.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/object_shorthand_property.js.snap index b20a9fbae61f..74d194e498f3 100644 --- a/crates/biome_js_parser/test_data/inline/ok/object_shorthand_property.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/object_shorthand_property.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { a, b } = c +let { d = "default", e = call() } = c + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -105,7 +121,11 @@ JsModule { ], eof_token: EOF@54..55 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..55 0: (empty) 1: (empty) @@ -178,3 +198,5 @@ JsModule { 0: IDENT@53..54 "c" [] [] 1: (empty) 4: EOF@54..55 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/optional_chain_call_less_than.ts b/crates/biome_js_parser/tests/js_test_suite/ok/optional_chain_call_less_than.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/optional_chain_call_less_than.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/optional_chain_call_less_than.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/optional_chain_call_less_than.rast b/crates/biome_js_parser/tests/js_test_suite/ok/optional_chain_call_less_than.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/optional_chain_call_less_than.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/optional_chain_call_less_than.ts.snap index 39d1a2cb6260..aa4a5004f917 100644 --- a/crates/biome_js_parser/test_data/inline/ok/optional_chain_call_less_than.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/optional_chain_call_less_than.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +String(item)?.b < 0; +String(item)?.b {}; +(5 + 5); +({foo, bar, b: [f, ...baz]}) => {}; +(foo, ...bar) => {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -176,7 +195,11 @@ JsModule { ], eof_token: EOF@84..85 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..85 0: (empty) 1: (empty) @@ -308,3 +331,5 @@ JsModule { 3: R_CURLY@83..84 "}" [] [] 1: (empty) 4: EOF@84..85 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/parenthesized_sequence_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/parenthesized_sequence_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/parenthesized_sequence_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/parenthesized_sequence_expression.js diff --git a/crates/biome_js_parser/test_data/inline/ok/parenthesized_sequence_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/parenthesized_sequence_expression.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/parenthesized_sequence_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/parenthesized_sequence_expression.js.snap index b16ee6da4cd9..4956f3edd713 100644 --- a/crates/biome_js_parser/test_data/inline/ok/parenthesized_sequence_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/parenthesized_sequence_expression.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +(a, b); +(a, b, c); +(a, b, c, d, e, f); +(a, b, c, d, e, f) +(a, b, c) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -185,7 +204,11 @@ JsModule { ], eof_token: EOF@67..68 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..68 0: (empty) 1: (empty) @@ -307,3 +330,5 @@ JsModule { 2: R_PAREN@66..67 ")" [] [] 1: (empty) 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/pattern_with_default_in_keyword.js b/crates/biome_js_parser/tests/js_test_suite/ok/pattern_with_default_in_keyword.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/pattern_with_default_in_keyword.js rename to crates/biome_js_parser/tests/js_test_suite/ok/pattern_with_default_in_keyword.js diff --git a/crates/biome_js_parser/test_data/inline/ok/pattern_with_default_in_keyword.rast b/crates/biome_js_parser/tests/js_test_suite/ok/pattern_with_default_in_keyword.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/pattern_with_default_in_keyword.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/pattern_with_default_in_keyword.js.snap index 8cd18cc8745f..e51b148724fc 100644 --- a/crates/biome_js_parser/test_data/inline/ok/pattern_with_default_in_keyword.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/pattern_with_default_in_keyword.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for ([a = "a" in {}] in []) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -47,7 +62,11 @@ JsModule { ], eof_token: EOF@30..31 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..31 0: (empty) 1: (empty) @@ -84,3 +103,5 @@ JsModule { 1: JS_STATEMENT_LIST@29..29 2: R_CURLY@29..30 "}" [] [] 4: EOF@30..31 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/post_update_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/post_update_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/post_update_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/post_update_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/post_update_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/post_update_expr.js.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/ok/post_update_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/post_update_expr.js.snap index 5aa7a16032da..8a80c03b8d9f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/post_update_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/post_update_expr.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo++ +foo-- + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -24,7 +40,11 @@ JsModule { ], eof_token: EOF@11..12 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..12 0: (empty) 1: (empty) @@ -43,3 +63,5 @@ JsModule { 1: MINUS2@9..11 "--" [] [] 1: (empty) 4: EOF@11..12 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/postfix_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/postfix_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/postfix_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/postfix_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/postfix_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/postfix_expr.js.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/ok/postfix_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/postfix_expr.js.snap index 5aa7a16032da..8a80c03b8d9f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/postfix_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/postfix_expr.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo++ +foo-- + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -24,7 +40,11 @@ JsModule { ], eof_token: EOF@11..12 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..12 0: (empty) 1: (empty) @@ -43,3 +63,5 @@ JsModule { 1: MINUS2@9..11 "--" [] [] 1: (empty) 4: EOF@11..12 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/pre_update_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/pre_update_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/pre_update_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/pre_update_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/pre_update_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/pre_update_expr.js.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/ok/pre_update_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/pre_update_expr.js.snap index 55328921731f..6130e85e8deb 100644 --- a/crates/biome_js_parser/test_data/inline/ok/pre_update_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/pre_update_expr.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +++foo +--foo + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -24,7 +40,11 @@ JsModule { ], eof_token: EOF@11..12 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..12 0: (empty) 1: (empty) @@ -43,3 +63,5 @@ JsModule { 0: IDENT@8..11 "foo" [] [] 1: (empty) 4: EOF@11..12 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/private_name_presence_check.js b/crates/biome_js_parser/tests/js_test_suite/ok/private_name_presence_check.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/private_name_presence_check.js rename to crates/biome_js_parser/tests/js_test_suite/ok/private_name_presence_check.js diff --git a/crates/biome_js_parser/test_data/inline/ok/private_name_presence_check.rast b/crates/biome_js_parser/tests/js_test_suite/ok/private_name_presence_check.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/private_name_presence_check.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/private_name_presence_check.js.snap index d86f04cb31ed..15f2a2c8bb58 100644 --- a/crates/biome_js_parser/test_data/inline/ok/private_name_presence_check.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/private_name_presence_check.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + #prop; + test() { + #prop in this + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -67,7 +87,11 @@ JsModule { ], eof_token: EOF@49..50 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..50 0: (empty) 1: (empty) @@ -121,3 +145,5 @@ JsModule { 3: R_CURLY@44..47 "}" [Newline("\n"), Whitespace(" ")] [] 9: R_CURLY@47..49 "}" [Newline("\n")] [] 4: EOF@49..50 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/property_assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/ok/property_assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/property_assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/ok/property_assignment_target.js diff --git a/crates/biome_js_parser/test_data/inline/ok/property_assignment_target.rast b/crates/biome_js_parser/tests/js_test_suite/ok/property_assignment_target.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/property_assignment_target.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/property_assignment_target.js.snap index 963111819698..a37f8ada6851 100644 --- a/crates/biome_js_parser/test_data/inline/ok/property_assignment_target.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/property_assignment_target.js.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({x}= {}); +({x: y}= {}); +({x: y.test().z}= {}); +({x: ((z))}= {}); +({x: z["computed"]}= {}); +({x = "default"}= {}); +({x: y = "default"}= {}); +({0: y, [computed]: z} = {}); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -313,7 +335,11 @@ JsModule { ], eof_token: EOF@170..171 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..171 0: (empty) 1: (empty) @@ -536,3 +562,5 @@ JsModule { 2: R_PAREN@168..169 ")" [] [] 1: SEMICOLON@169..170 ";" [] [] 4: EOF@170..171 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/property_class_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/property_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/property_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/property_class_member.js diff --git a/crates/biome_js_parser/test_data/inline/ok/property_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/property_class_member.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/property_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/property_class_member.js.snap index ea9fbc519afd..9801e7afdb93 100644 --- a/crates/biome_js_parser/test_data/inline/ok/property_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/property_class_member.js.snap @@ -1,3 +1,31 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo { + property + declare; + initializedProperty = "a" + "a"; + 5 + ["a" + "b"] + static staticProperty + static staticInitializedProperty = 1 + #private + #privateInitialized = "a" + static #staticPrivate + static #staticPrivateInitializedProperty = 1 +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -179,7 +207,11 @@ JsModule { ], eof_token: EOF@261..262 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..262 0: (empty) 1: (empty) @@ -313,3 +345,5 @@ JsModule { 4: (empty) 9: R_CURLY@259..261 "}" [Newline("\n")] [] 4: EOF@261..262 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/reparse_await_as_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_await_as_identifier.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/reparse_await_as_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/reparse_await_as_identifier.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/reparse_await_as_identifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_await_as_identifier.cjs.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/reparse_await_as_identifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/reparse_await_as_identifier.cjs.snap index d7f44a734874..778257bde5e4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/reparse_await_as_identifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_await_as_identifier.cjs.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function test() { a = await; } +function test2() { return await; } + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -73,7 +90,11 @@ JsScript { ], eof_token: EOF@75..76 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..76 0: (empty) 1: (empty) @@ -129,3 +150,5 @@ JsScript { 2: SEMICOLON@72..74 ";" [] [Whitespace(" ")] 3: R_CURLY@74..75 "}" [] [] 4: EOF@75..76 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/reparse_yield_as_identifier.js b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_yield_as_identifier.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/reparse_yield_as_identifier.js rename to crates/biome_js_parser/tests/js_test_suite/ok/reparse_yield_as_identifier.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/reparse_yield_as_identifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_yield_as_identifier.cjs.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/reparse_yield_as_identifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/reparse_yield_as_identifier.cjs.snap index 2e920c2abdae..3e20f5302e1f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/reparse_yield_as_identifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/reparse_yield_as_identifier.cjs.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function foo() { yield *bar; } +function bar() { yield; } +function baz() { yield } + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -104,7 +122,11 @@ JsScript { ], eof_token: EOF@91..92 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..92 0: (empty) 1: (empty) @@ -182,3 +204,5 @@ JsScript { 1: (empty) 3: R_CURLY@90..91 "}" [] [] 4: EOF@91..92 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/rest_property_assignment_target.js b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_assignment_target.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/rest_property_assignment_target.js rename to crates/biome_js_parser/tests/js_test_suite/ok/rest_property_assignment_target.js diff --git a/crates/biome_js_parser/test_data/inline/ok/rest_property_assignment_target.rast b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_assignment_target.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/rest_property_assignment_target.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/rest_property_assignment_target.js.snap index 66611aa95327..60255fb690b7 100644 --- a/crates/biome_js_parser/test_data/inline/ok/rest_property_assignment_target.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_assignment_target.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +({ ...abcd } = a); +({ ...(abcd) } = a); +({ ...m.test } = c); +({ ...m[call()] } = c); +({ ...any.expression().b } = c); +({ b: { ...a } } = c); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -236,7 +256,11 @@ JsModule { ], eof_token: EOF@140..141 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..141 0: (empty) 1: (empty) @@ -398,3 +422,5 @@ JsModule { 2: R_PAREN@138..139 ")" [] [] 1: SEMICOLON@139..140 ";" [] [] 4: EOF@140..141 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/rest_property_binding.js b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_binding.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/rest_property_binding.js rename to crates/biome_js_parser/tests/js_test_suite/ok/rest_property_binding.js diff --git a/crates/biome_js_parser/test_data/inline/ok/rest_property_binding.rast b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_binding.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/rest_property_binding.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/rest_property_binding.js.snap index e3c9fb21a312..7a569d9f8233 100644 --- a/crates/biome_js_parser/test_data/inline/ok/rest_property_binding.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/rest_property_binding.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let { ...abcd } = a; +let { b: { ...a } } = c; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -83,7 +99,11 @@ JsModule { ], eof_token: EOF@45..46 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..46 0: (empty) 1: (empty) @@ -141,3 +161,5 @@ JsModule { 0: IDENT@43..44 "c" [] [] 1: SEMICOLON@44..45 ";" [] [] 4: EOF@45..46 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/return_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/return_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/return_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/return_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/return_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/return_stmt.js.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/return_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/return_stmt.js.snap index 0d2d5f242694..80382a52b405 100644 --- a/crates/biome_js_parser/test_data/inline/ok/return_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/return_stmt.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +() => { + return; + return foo; + return +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -46,7 +65,11 @@ JsModule { ], eof_token: EOF@42..43 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..43 0: (empty) 1: (empty) @@ -83,3 +106,5 @@ JsModule { 3: R_CURLY@40..42 "}" [Newline("\n")] [] 1: (empty) 4: EOF@42..43 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/scoped_declarations.js b/crates/biome_js_parser/tests/js_test_suite/ok/scoped_declarations.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/scoped_declarations.js rename to crates/biome_js_parser/tests/js_test_suite/ok/scoped_declarations.js diff --git a/crates/biome_js_parser/test_data/inline/ok/scoped_declarations.rast b/crates/biome_js_parser/tests/js_test_suite/ok/scoped_declarations.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/scoped_declarations.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/scoped_declarations.js.snap index 803e49640b12..60bf3757cf94 100644 --- a/crates/biome_js_parser/test_data/inline/ok/scoped_declarations.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/scoped_declarations.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = { + test() { + let a = "inner"; + } +}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -72,7 +91,11 @@ JsModule { ], eof_token: EOF@48..49 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..49 0: (empty) 1: (empty) @@ -125,3 +148,5 @@ JsModule { 2: R_CURLY@45..47 "}" [Newline("\n")] [] 1: SEMICOLON@47..48 ";" [] [] 4: EOF@48..49 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/semicolons.js b/crates/biome_js_parser/tests/js_test_suite/ok/semicolons.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/semicolons.js rename to crates/biome_js_parser/tests/js_test_suite/ok/semicolons.js diff --git a/crates/biome_js_parser/test_data/inline/ok/semicolons.rast b/crates/biome_js_parser/tests/js_test_suite/ok/semicolons.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/semicolons.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/semicolons.js.snap index 5a28b61399f9..a29da59f7d41 100644 --- a/crates/biome_js_parser/test_data/inline/ok/semicolons.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/semicolons.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let foo = bar; +let foo2 = b; +let foo3; +let foo4 +let foo5 +function foo6() { return true } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -129,7 +149,11 @@ JsModule { ], eof_token: EOF@88..89 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..89 0: (empty) 1: (empty) @@ -221,3 +245,5 @@ JsModule { 2: (empty) 3: R_CURLY@87..88 "}" [] [] 4: EOF@88..89 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/sequence_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/sequence_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/sequence_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/sequence_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/sequence_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/sequence_expr.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/sequence_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/sequence_expr.js.snap index 4dbf1d0ff30b..559beb7c6c44 100644 --- a/crates/biome_js_parser/test_data/inline/ok/sequence_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/sequence_expr.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +1, 2, 3, 4, 5 + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -36,7 +51,11 @@ JsModule { ], eof_token: EOF@13..14 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..14 0: (empty) 1: (empty) @@ -63,3 +82,5 @@ JsModule { 0: JS_NUMBER_LITERAL@12..13 "5" [] [] 1: (empty) 4: EOF@13..14 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/setter_class_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/setter_class_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/setter_class_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/setter_class_member.js diff --git a/crates/biome_js_parser/test_data/inline/ok/setter_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/setter_class_member.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/setter_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/setter_class_member.js.snap index 7234ca273225..56dde3bfa6a9 100644 --- a/crates/biome_js_parser/test_data/inline/ok/setter_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/setter_class_member.js.snap @@ -1,3 +1,34 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Setters { + set foo(a) {} + set bax(a,) {} + set static(a) {} + static set bar(a) {} + static set baz(a,) {} + set "baz"(a) {} + set ["a" + "b"](a) {} + set 5(a) {} + set 6(a,) {} + set #private(a) {} +} +class NotSetters { + set(a) {} + async set(a) {} + static set(a) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -405,7 +436,11 @@ JsModule { ], eof_token: EOF@278..279 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..279 0: (empty) 1: (empty) @@ -725,3 +760,5 @@ JsModule { 3: R_CURLY@275..276 "}" [] [] 9: R_CURLY@276..278 "}" [Newline("\n")] [] 4: EOF@278..279 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/setter_object_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/setter_object_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/setter_object_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/setter_object_member.js diff --git a/crates/biome_js_parser/test_data/inline/ok/setter_object_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/setter_object_member.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/setter_object_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/setter_object_member.js.snap index 758043cb7c81..d57470d27756 100644 --- a/crates/biome_js_parser/test_data/inline/ok/setter_object_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/setter_object_member.js.snap @@ -1,3 +1,32 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = { + set foo(value) { + }, + set a(value,) { + }, + set "bar"(value) { + }, + set ["a" + "b"](value) { + }, + set 5(value) { + }, + set() { + return "This is a method and not a setter"; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -193,7 +222,11 @@ JsModule { ], eof_token: EOF@186..187 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..187 0: (empty) 1: (empty) @@ -344,3 +377,5 @@ JsModule { 2: R_CURLY@184..186 "}" [Newline("\n")] [] 1: (empty) 4: EOF@186..187 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.js b/crates/biome_js_parser/tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.js rename to crates/biome_js_parser/tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js diff --git a/crates/biome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast b/crates/biome_js_parser/tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js.snap index d6dff41c16f1..17a1e1bde44d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/single_parameter_arrow_function_with_parameter_named_async.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/single_parameter_arrow_function_with_parameter_named_async.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let id = async => async; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -38,7 +53,11 @@ JsModule { ], eof_token: EOF@24..25 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..25 0: (empty) 1: (empty) @@ -67,3 +86,5 @@ JsModule { 0: IDENT@18..23 "async" [] [] 1: SEMICOLON@23..24 ";" [] [] 4: EOF@24..25 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/static_generator_constructor_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/static_generator_constructor_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/static_generator_constructor_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/static_generator_constructor_method.js diff --git a/crates/biome_js_parser/test_data/inline/ok/static_generator_constructor_method.rast b/crates/biome_js_parser/tests/js_test_suite/ok/static_generator_constructor_method.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/static_generator_constructor_method.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/static_generator_constructor_method.js.snap index 7202f6523e18..0267853f46bb 100644 --- a/crates/biome_js_parser/test_data/inline/ok/static_generator_constructor_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/static_generator_constructor_method.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + static async * constructor() {} + static * constructor() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -73,7 +91,11 @@ JsModule { ], eof_token: EOF@71..72 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..72 0: (empty) 1: (empty) @@ -132,3 +154,5 @@ JsModule { 3: R_CURLY@68..69 "}" [] [] 9: R_CURLY@69..71 "}" [Newline("\n")] [] 4: EOF@71..72 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/static_initialization_block_member.js b/crates/biome_js_parser/tests/js_test_suite/ok/static_initialization_block_member.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/static_initialization_block_member.js rename to crates/biome_js_parser/tests/js_test_suite/ok/static_initialization_block_member.js diff --git a/crates/biome_js_parser/test_data/inline/ok/static_initialization_block_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/static_initialization_block_member.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/static_initialization_block_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/static_initialization_block_member.js.snap index 9b4099c80559..1f5e6cdac074 100644 --- a/crates/biome_js_parser/test_data/inline/ok/static_initialization_block_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/static_initialization_block_member.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A { + static a; + static { + this.a = "test"; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -59,7 +79,11 @@ JsModule { ], eof_token: EOF@59..60 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..60 0: (empty) 1: (empty) @@ -104,3 +128,5 @@ JsModule { 3: R_CURLY@53..57 "}" [Newline("\n"), Whitespace(" ")] [] 9: R_CURLY@57..59 "}" [Newline("\n")] [] 4: EOF@59..60 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/static_member_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/static_member_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/static_member_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/static_member_expression.js diff --git a/crates/biome_js_parser/test_data/inline/ok/static_member_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/static_member_expression.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/static_member_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/static_member_expression.js.snap index 42411637f7f5..8d81bb82967e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/static_member_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/static_member_expression.js.snap @@ -1,3 +1,32 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo.bar +foo.await +foo.yield +foo.for +foo?.for +foo?.bar +class Test { + #bar + test(other) { + this.#bar; + this?.#bar; + other.#bar; + other?.#bar; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -204,7 +233,11 @@ JsModule { ], eof_token: EOF@159..160 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..160 0: (empty) 1: (empty) @@ -348,3 +381,5 @@ JsModule { 3: R_CURLY@153..157 "}" [Newline("\n"), Whitespace(" ")] [] 9: R_CURLY@157..159 "}" [Newline("\n")] [] 4: EOF@159..160 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/static_method.js b/crates/biome_js_parser/tests/js_test_suite/ok/static_method.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/static_method.js rename to crates/biome_js_parser/tests/js_test_suite/ok/static_method.js diff --git a/crates/biome_js_parser/test_data/inline/ok/static_method.rast b/crates/biome_js_parser/tests/js_test_suite/ok/static_method.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/static_method.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/static_method.js.snap index 1bfa14cec9ac..ada077620cd0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/static_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/static_method.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class foo { + static foo(bar) {} + static *foo() {} + static async foo() {} + static async *foo() {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -135,7 +155,11 @@ JsModule { ], eof_token: EOF@98..99 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..99 0: (empty) 1: (empty) @@ -241,3 +265,5 @@ JsModule { 3: R_CURLY@95..96 "}" [] [] 9: R_CURLY@96..98 "}" [Newline("\n")] [] 4: EOF@98..99 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/subscripts.js b/crates/biome_js_parser/tests/js_test_suite/ok/subscripts.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/subscripts.js rename to crates/biome_js_parser/tests/js_test_suite/ok/subscripts.js diff --git a/crates/biome_js_parser/test_data/inline/ok/subscripts.rast b/crates/biome_js_parser/tests/js_test_suite/ok/subscripts.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/subscripts.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/subscripts.js.snap index fc0c948ffe3a..92ee2273d23b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/subscripts.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/subscripts.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +foo`bar` +foo(bar)(baz)(baz)[bar] + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -87,7 +103,11 @@ JsModule { ], eof_token: EOF@32..33 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..33 0: (empty) 1: (empty) @@ -148,3 +168,5 @@ JsModule { 4: R_BRACK@31..32 "]" [] [] 1: (empty) 4: EOF@32..33 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/super_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/super_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/super_expression.js diff --git a/crates/biome_js_parser/test_data/inline/ok/super_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/super_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/super_expression.js.snap index e5f77522955b..9a4ade8d6bb6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/super_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression.js.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class Test extends B { + constructor() { + super(); + } + test() { + super.test(a, b); + super[1]; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -132,7 +155,11 @@ JsModule { ], eof_token: EOF@110..111 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..111 0: (empty) 1: (empty) @@ -230,3 +257,5 @@ JsModule { 3: R_CURLY@104..108 "}" [Newline("\n"), Whitespace(" ")] [] 9: R_CURLY@108..110 "}" [Newline("\n")] [] 4: EOF@110..111 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/super_expression_in_constructor_parameter_list.js b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/super_expression_in_constructor_parameter_list.js rename to crates/biome_js_parser/tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js diff --git a/crates/biome_js_parser/test_data/inline/ok/super_expression_in_constructor_parameter_list.rast b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/super_expression_in_constructor_parameter_list.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js.snap index b5f9d7a06836..535651c30280 100644 --- a/crates/biome_js_parser/test_data/inline/ok/super_expression_in_constructor_parameter_list.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/super_expression_in_constructor_parameter_list.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class A extends B { constructor(c = super()) {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -70,7 +85,11 @@ JsModule { ], eof_token: EOF@49..50 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..50 0: (empty) 1: (empty) @@ -124,3 +143,5 @@ JsModule { 3: R_CURLY@46..48 "}" [] [Whitespace(" ")] 9: R_CURLY@48..49 "}" [] [] 4: EOF@49..50 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/switch_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/switch_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/switch_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/switch_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/switch_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/switch_stmt.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/switch_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/switch_stmt.js.snap index e50112dfdf46..53f860e11514 100644 --- a/crates/biome_js_parser/test_data/inline/ok/switch_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/switch_stmt.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +switch (foo) { + case bar: + default: +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -35,7 +53,11 @@ JsModule { ], eof_token: EOF@37..38 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..38 0: (empty) 1: (empty) @@ -63,3 +85,5 @@ JsModule { 2: JS_STATEMENT_LIST@35..35 6: R_CURLY@35..37 "}" [Newline("\n")] [] 4: EOF@37..38 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/template_literal.js b/crates/biome_js_parser/tests/js_test_suite/ok/template_literal.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/template_literal.js rename to crates/biome_js_parser/tests/js_test_suite/ok/template_literal.js diff --git a/crates/biome_js_parser/test_data/inline/ok/template_literal.rast b/crates/biome_js_parser/tests/js_test_suite/ok/template_literal.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/template_literal.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/template_literal.js.snap index bcfd941b2c5d..2901ee427c25 100644 --- a/crates/biome_js_parser/test_data/inline/ok/template_literal.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/template_literal.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +let a = `foo ${bar}`; +let b = ``; +let c = `${foo}`; +let d = `foo`; +let e = `${{ a: "string" }}`; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -178,7 +197,11 @@ JsModule { ], eof_token: EOF@96..97 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..97 0: (empty) 1: (empty) @@ -304,3 +327,5 @@ JsModule { 4: BACKTICK@94..95 "`" [] [] 1: SEMICOLON@95..96 ";" [] [] 4: EOF@96..97 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/this_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/this_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/this_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/this_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/this_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/this_expr.js.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/ok/this_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/this_expr.js.snap index cfb5adf27de0..1641344a0ebb 100644 --- a/crates/biome_js_parser/test_data/inline/ok/this_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/this_expr.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +this +this.foo + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -24,7 +40,11 @@ JsModule { ], eof_token: EOF@13..14 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..14 0: (empty) 1: (empty) @@ -43,3 +63,5 @@ JsModule { 0: IDENT@10..13 "foo" [] [] 1: (empty) 4: EOF@13..14 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/throw_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/throw_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/throw_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/throw_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/throw_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/throw_stmt.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/throw_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/throw_stmt.js.snap index e000a1825bc9..047bf5a4b4f9 100644 --- a/crates/biome_js_parser/test_data/inline/ok/throw_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/throw_stmt.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +throw new Error("foo"); +throw "foo" + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -35,7 +51,11 @@ JsModule { ], eof_token: EOF@35..36 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..36 0: (empty) 1: (empty) @@ -62,3 +82,5 @@ JsModule { 0: JS_STRING_LITERAL@30..35 "\"foo\"" [] [] 2: (empty) 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/try_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/try_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/try_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/try_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/try_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/try_stmt.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/try_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/try_stmt.js.snap index 8537a8868696..c2b8a19b95f5 100644 --- a/crates/biome_js_parser/test_data/inline/ok/try_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/try_stmt.js.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +try {} catch {} +try {} catch (e) {} +try {} catch {} finally {} +try {} catch (e) {} finally {} +try {} finally {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -121,7 +140,11 @@ JsModule { ], eof_token: EOF@111..112 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..112 0: (empty) 1: (empty) @@ -215,3 +238,5 @@ JsModule { 1: JS_STATEMENT_LIST@110..110 2: R_CURLY@110..111 "}" [] [] 4: EOF@111..112 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_classes.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_classes.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_abstract_classes.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_classes.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_classes.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_classes.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_abstract_classes.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_classes.ts.snap index a1769ee6ef72..06db47c148c3 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_classes.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_classes.ts.snap @@ -1,3 +1,33 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A {} +abstract class ConcreteMembers { + name: string; + constructor(name: string) { this.name = name; } + display(): void { console.log(this.name); } + public get my_name() { return this.name; } + public set my_name(name) { this.name = name; } + #private_method() { } +} +abstract class AbstractMembers { + abstract name: string; + abstract display(); + abstract get my_name(); + abstract set my_name(val); + abstract set my_age(age,); +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -385,7 +415,11 @@ JsModule { ], eof_token: EOF@472..473 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..473 0: (empty) 1: (empty) @@ -668,3 +702,5 @@ JsModule { 7: SEMICOLON@469..470 ";" [] [] 9: R_CURLY@470..472 "}" [Newline("\n")] [] 4: EOF@472..473 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_property_can_be_optional.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_abstract_property_can_be_optional.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_property_can_be_optional.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/ts_abstract_property_can_be_optional.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts.snap index cf045f01e52a..0c5aa0adcca8 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_abstract_property_can_be_optional.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_abstract_property_can_be_optional.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +abstract class A { + abstract name?: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -41,7 +58,11 @@ JsModule { ], eof_token: EOF@49..50 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..50 0: (empty) 1: (empty) @@ -73,3 +94,5 @@ JsModule { 3: SEMICOLON@46..47 ";" [] [] 9: R_CURLY@47..49 "}" [Newline("\n")] [] 4: EOF@49..50 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts.snap index 9be5b1bdee7c..b158e68dd649 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_const_variable_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_const_variable_statement.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare const a, b, c, d = "test"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -54,7 +69,11 @@ JsModule { ], eof_token: EOF@34..35 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..35 0: (empty) 1: (empty) @@ -95,3 +114,5 @@ JsModule { 0: JS_STRING_LITERAL@27..33 "\"test\"" [] [] 1: SEMICOLON@33..34 ";" [] [] 4: EOF@34..35 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_enum_statement.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_enum_statement.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_enum_statement.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_enum_statement.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_enum_statement.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_enum_statement.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_enum_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_enum_statement.ts.snap index 3e114785ffe5..bfe0c9bf1022 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_enum_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_enum_statement.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare enum A { X, Y, Z } +declare const enum B { X, Y, Z } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -74,7 +90,11 @@ JsModule { ], eof_token: EOF@59..60 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..60 0: (empty) 1: (empty) @@ -129,3 +149,5 @@ JsModule { 1: (empty) 5: R_CURLY@58..59 "}" [] [] 4: EOF@59..60 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_function.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_function.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_function.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_function.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_function.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_function.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_function.ts.snap index ef3d8555e563..e2f625792c4c 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_function.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module a { + function test(): string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -41,7 +58,11 @@ JsModule { ], eof_token: EOF@47..48 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -73,3 +94,5 @@ JsModule { 6: SEMICOLON@44..45 ";" [] [] 2: R_CURLY@45..47 "}" [Newline("\n")] [] 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_interface.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_interface.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_interface.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_interface.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_interface.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_interface.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_interface.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_interface.ts.snap index 3c21779bd863..b08dff5881a0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_interface.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_interface.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare interface A { b: string, c: number } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -49,7 +64,11 @@ JsModule { ], eof_token: EOF@44..45 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..45 0: (empty) 1: (empty) @@ -87,3 +106,5 @@ JsModule { 4: (empty) 6: R_CURLY@43..44 "}" [] [] 4: EOF@44..45 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts.snap index 2b5f20cbf344..1a57c87f97b5 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_let_variable_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_let_variable_statement.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare let a, b, c, d; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -49,7 +64,11 @@ JsModule { ], eof_token: EOF@23..24 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..24 0: (empty) 1: (empty) @@ -87,3 +106,5 @@ JsModule { 2: (empty) 1: SEMICOLON@22..23 ";" [] [] 4: EOF@23..24 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_var_statement.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_var_statement.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_var_statement.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_var_statement.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_var_statement.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_var_statement.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_ambient_var_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_var_statement.ts.snap index 921e99ed1b5a..9d0ac44ee1a8 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_ambient_var_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_ambient_var_statement.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare var a, b, c; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -41,7 +56,11 @@ JsModule { ], eof_token: EOF@20..21 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..21 0: (empty) 1: (empty) @@ -73,3 +92,5 @@ JsModule { 2: (empty) 1: SEMICOLON@19..20 ";" [] [] 4: EOF@20..21 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_array_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_array_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_array_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_array_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_array_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_array_type.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_array_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_array_type.ts.snap index 8018f0403f6b..6c6b8de31aaa 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_array_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_array_type.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = string[]; +type B = { a: number } []; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -55,7 +71,11 @@ JsModule { ], eof_token: EOF@45..46 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..46 0: (empty) 1: (empty) @@ -98,3 +118,5 @@ JsModule { 2: R_BRACK@43..44 "]" [] [] 5: SEMICOLON@44..45 ";" [] [] 4: EOF@45..46 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_exrp_in_alternate.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_arrow_exrp_in_alternate.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_in_alternate.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/arrow_expr_in_alternate.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts.snap index 9c370a772485..69ca5bc6153d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/arrow_expr_in_alternate.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_exrp_in_alternate.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +a ? (b) : a => {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -42,7 +57,11 @@ JsModule { ], eof_token: EOF@18..19 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..19 0: (empty) 1: (empty) @@ -75,3 +94,5 @@ JsModule { 3: R_CURLY@16..17 "}" [] [] 1: SEMICOLON@17..18 ";" [] [] 4: EOF@18..19 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts.snap index 6edd1f7d1de6..8f65b1779d97 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_arrow_function_type_parameters.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_arrow_function_type_parameters.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = (a: A, b: B, c: C) => "hello"; +let b = async (a: A, b: B): Promise => "hello"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -242,7 +258,11 @@ JsModule { ], eof_token: EOF@128..129 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..129 0: (empty) 1: (empty) @@ -415,3 +435,5 @@ JsModule { 0: JS_STRING_LITERAL@120..127 "\"hello\"" [] [] 1: SEMICOLON@127..128 ";" [] [] 4: EOF@128..129 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_as_assignment.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_assignment.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_as_assignment.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_as_assignment.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_as_assignment.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_assignment.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_as_assignment.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_as_assignment.ts.snap index 210a8362d818..e523971190a6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_as_assignment.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_assignment.ts.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a: any; +type B = { a: A }; +(a as string) = "string"; +((a as any) as string) = null; +({ b: a as string } = { b: "test" }); +([ a as string ] = [ "test" ]); +for (a as string in []) {} +(a as B) = { a: "test" }; +( a) += 1 + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -303,7 +326,11 @@ JsModule { ], eof_token: EOF@239..240 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..240 0: (empty) 1: (empty) @@ -515,3 +542,5 @@ JsModule { 0: JS_NUMBER_LITERAL@238..239 "1" [] [] 1: (empty) 4: EOF@239..240 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_as_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_as_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_as_expression.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_as_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_expression.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_as_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_as_expression.ts.snap index 8530fb6e2da5..01658f259b37 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_as_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_as_expression.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let x: any = "string"; +let y = x as string; +let z = x as const; +let not_an_as_expression = x +as; +let precedence = "hello" as const + 3 as number as number; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -172,7 +192,11 @@ JsModule { ], eof_token: EOF@155..156 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..156 0: (empty) 1: (empty) @@ -288,3 +312,5 @@ JsModule { 0: NUMBER_KW@148..154 "number" [] [] 1: SEMICOLON@154..155 ";" [] [] 4: EOF@155..156 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts.snap index 1a4c548c6d9a..3203113ad228 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_call_expr_with_type_arguments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_expr_with_type_arguments.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a() {} +a(); +(() => { a }).a() +(() => a)(); +type A = T; +a<(arg: T) => number, number, string>(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -334,7 +354,11 @@ JsModule { ], eof_token: EOF@146..147 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..147 0: (empty) 1: (empty) @@ -576,3 +600,5 @@ JsModule { 2: R_PAREN@144..145 ")" [] [] 1: SEMICOLON@145..146 ";" [] [] 4: EOF@146..147 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_call_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_call_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_call_signature_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_call_signature_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_signature_member.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_call_signature_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_call_signature_member.ts.snap index f8dc98617455..3c48d0af2306 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_call_signature_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_call_signature_member.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { (): string; } +type B = { (a, b, c): number } +type C = { (a: A, b: B): number } +type D = { (a: A): number } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -249,7 +267,11 @@ JsModule { ], eof_token: EOF@132..133 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..133 0: (empty) 1: (empty) @@ -431,3 +453,5 @@ JsModule { 2: R_CURLY@131..132 "}" [] [] 5: (empty) 4: EOF@132..133 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_catch_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_catch_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_catch_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_catch_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_catch_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_catch_declaration.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_catch_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_catch_declaration.ts.snap index b1fde3853d6b..85e0913409b5 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_catch_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_catch_declaration.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +try {} catch (error: any) {} +try {} catch (error: unknown) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -64,7 +80,11 @@ JsModule { ], eof_token: EOF@61..62 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..62 0: (empty) 1: (empty) @@ -113,3 +133,5 @@ JsModule { 1: JS_STATEMENT_LIST@60..60 2: R_CURLY@60..61 "}" [] [] 4: EOF@61..62 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts.snap similarity index 89% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts.snap index 24f5cb0325d2..572772025185 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_class_named_abstract_is_valid_in_ts.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_named_abstract_is_valid_in_ts.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class abstract {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -20,7 +35,11 @@ JsModule { ], eof_token: EOF@17..18 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..18 0: (empty) 1: (empty) @@ -39,3 +58,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@16..16 9: R_CURLY@16..17 "}" [] [] 4: EOF@17..18 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_annotation.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_annotation.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_property_annotation.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_annotation.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_annotation.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_annotation.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_property_annotation.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_annotation.ts.snap index 4b174ede3cec..57caec509bdc 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_annotation.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_annotation.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + a: string; + b?: string = "test"; + c!: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -74,7 +93,11 @@ JsModule { ], eof_token: EOF@61..62 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..62 0: (empty) 1: (empty) @@ -130,3 +153,5 @@ JsModule { 4: SEMICOLON@58..59 ";" [] [] 9: R_CURLY@59..61 "}" [Newline("\n")] [] 4: EOF@61..62 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_member_modifiers.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_member_modifiers.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_property_member_modifiers.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_member_modifiers.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_member_modifiers.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_member_modifiers.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_property_member_modifiers.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_member_modifiers.ts.snap index 44130f1206a4..71c55e0aad75 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_class_property_member_modifiers.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_property_member_modifiers.ts.snap @@ -1,3 +1,34 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Base { + base1; +} +abstract class Test extends Base { + declare a: string; + private declare c: string; + declare private d: string; + declare private readonly e: string; + private readonly declare f: string; + declare private static readonly g: string; + private static readonly declare h: string; + protected readonly abstract i: string; + protected abstract readonly j: string; + protected override readonly base1: string; + private static accessor readonly k: string; + protected abstract accessor readonly l: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -331,7 +362,11 @@ JsModule { ], eof_token: EOF@552..553 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..553 0: (empty) 1: (empty) @@ -556,3 +591,5 @@ JsModule { 3: SEMICOLON@549..550 ";" [] [] 9: R_CURLY@550..552 "}" [Newline("\n")] [] 4: EOF@552..553 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_type_parameters.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_class_type_parameters.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_type_parameters.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_class_type_parameters.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_class_type_parameters.ts.snap index 238400f7d6e0..1fef962e20da 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_class_type_parameters.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_class_type_parameters.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class BuildError {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -51,7 +66,11 @@ JsModule { ], eof_token: EOF@28..29 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..29 0: (empty) 1: (empty) @@ -93,3 +112,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@27..27 9: R_CURLY@27..28 "}" [] [] 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_conditional_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_conditional_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type.ts.snap index d8c931656611..119dd047f956 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type.ts.snap @@ -1,3 +1,36 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = number; +type B = string extends number ? string : number; +type C = A extends (B extends A ? number : string) ? void : number; +type D = T extends [infer S extends string, ...unknown[]] ? S : never; +type E = T extends (infer U extends number ? U : T ) ? U : T +type F = T extends { [P in infer U extends keyof T ? 1 : 0]: 1; } ? 1 : 0; +type G = T extends [unknown, infer S extends string] ? S : never; +type H = A extends () => B extends C ? D : E ? F : G; +type J = T extends ((...a: any[]) => infer R extends string) ? R : never; +type Equals = A extends (x: B extends C ? D : E) => 0 ? F : G; +type Curry any)> = + (...args: Tools.Cast>>, any[]>) => + GapsOf> extends [any, ...any[]] + ? Curry<(...args: GapsOf> extends infer G ? Tools.Cast : never) => ReturnType> + : ReturnType; +interface GapsOfWorker { + 0: GapsOf extends infer G ? Tools.Cast : never, Tools.Next>; + 1: Tools.Concat, T2> extends infer D ? Tools.Cast : never>; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -1402,7 +1435,11 @@ JsModule { ], eof_token: EOF@1272..1273 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..1273 0: (empty) 1: (empty) @@ -2386,3 +2423,5 @@ JsModule { 4: SEMICOLON@1269..1270 ";" [] [] 6: R_CURLY@1270..1272 "}" [Newline("\n")] [] 4: EOF@1272..1273 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts.snap index 0da32f362981..7ce03a3c706d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_conditional_type_call_signature_lhs.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_conditional_type_call_signature_lhs.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type X = V extends (...args: any[]) => any ? (...args: Parameters) => void : Function; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -115,7 +130,11 @@ JsModule { ], eof_token: EOF@92..93 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..93 0: (empty) 1: (empty) @@ -198,3 +217,5 @@ JsModule { 1: (empty) 5: SEMICOLON@91..92 ";" [] [] 4: EOF@92..93 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_construct_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_construct_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_construct_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_construct_signature_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_construct_signature_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_construct_signature_member.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_construct_signature_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_construct_signature_member.ts.snap index cc5bce273d9f..7ae06f83f432 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_construct_signature_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_construct_signature_member.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { new (): string; } +type B = { new (a: string, b: number) } +type C = { new (a: A, b: B): string } +type D = { new (a: T, b: B): string } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -266,7 +284,11 @@ JsModule { ], eof_token: EOF@159..160 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..160 0: (empty) 1: (empty) @@ -460,3 +482,5 @@ JsModule { 2: R_CURLY@158..159 "}" [] [] 5: (empty) 4: EOF@159..160 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_constructor_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_constructor_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_constructor_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_constructor_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_constructor_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_constructor_type.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_constructor_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_constructor_type.ts.snap index d7ca2b062f54..f2865627f95c 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_constructor_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_constructor_type.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = new(a: string, b: number) => string; +type B = abstract new(a: string, b: number) => string; +type C = new(a: A, b: B) => string; +type D = abstract new(a: A, b: B) => string; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -274,7 +292,11 @@ JsModule { ], eof_token: EOF@193..194 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..194 0: (empty) 1: (empty) @@ -477,3 +499,5 @@ JsModule { 0: STRING_KW@186..192 "string" [] [] 5: SEMICOLON@192..193 ";" [] [] 4: EOF@193..194 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_const_initializer.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_const_initializer.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_const_initializer.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_const_initializer.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_const_initializer.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_const_initializer.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_const_initializer.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_const_initializer.ts.snap index 31608a48e0b0..d3df742e8b2e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_declare_const_initializer.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_const_initializer.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module test { const X; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -37,7 +52,11 @@ JsModule { ], eof_token: EOF@32..33 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..33 0: (empty) 1: (empty) @@ -65,3 +84,5 @@ JsModule { 1: SEMICOLON@29..31 ";" [] [Whitespace(" ")] 2: R_CURLY@31..32 "}" [] [] 4: EOF@32..33 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_function.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_function.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function.ts.snap index a2189b4e27ca..d27281789855 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare function test(a: A, b: B): R; +declare function test2({ a }?: { a: "string" }) +declare +function not_a_declaration() {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -187,7 +205,11 @@ JsModule { ], eof_token: EOF@134..135 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..135 0: (empty) 1: (empty) @@ -325,3 +347,5 @@ JsModule { 2: JS_STATEMENT_LIST@133..133 3: R_CURLY@133..134 "}" [] [] 4: EOF@134..135 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_declaration.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_declaration.ts.snap index 3aeb6a517873..6f22bb660697 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_declaration.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module 'x' { + export function test(option: any): void +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -60,7 +77,11 @@ JsModule { ], eof_token: EOF@64..65 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..65 0: (empty) 1: (empty) @@ -105,3 +126,5 @@ JsModule { 6: (empty) 2: R_CURLY@62..64 "}" [Newline("\n")] [] 4: EOF@64..65 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_default_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_default_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_default_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_default_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts.snap index 8c9e022b1db7..4887cab7ceae 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_declare_function_export_default_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_function_export_default_declaration.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module 'x' { + export default function(option: any): void +} +declare module 'y' { + export default function test(option: any): void +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -120,7 +140,11 @@ JsModule { ], eof_token: EOF@140..141 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..141 0: (empty) 1: (empty) @@ -208,3 +232,5 @@ JsModule { 2: (empty) 2: R_CURLY@138..140 "}" [Newline("\n")] [] 4: EOF@140..141 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_type_alias.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_type_alias.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_type_alias.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_type_alias.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_declare_type_alias.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_type_alias.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_declare_type_alias.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_type_alias.ts.snap index e4481078b5a3..32a4076e4a54 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_declare_type_alias.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_declare_type_alias.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare type A = string; +declare type B = string | number & { a: string, b: number } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -85,7 +101,11 @@ JsModule { ], eof_token: EOF@84..85 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..85 0: (empty) 1: (empty) @@ -148,3 +168,5 @@ JsModule { 2: R_CURLY@83..84 "}" [] [] 5: (empty) 4: EOF@84..85 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorate_computed_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorate_computed_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorate_computed_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorate_computed_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorate_computed_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorate_computed_member.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorate_computed_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorate_computed_member.ts.snap index 339748a8ab59..0b5f38c17f9c 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorate_computed_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorate_computed_member.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { +@test +['a']: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -48,7 +66,11 @@ JsModule { ], eof_token: EOF@35..36 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..36 0: (empty) 1: (empty) @@ -85,3 +107,5 @@ JsModule { 4: SEMICOLON@32..33 ";" [] [] 9: R_CURLY@33..35 "}" [Newline("\n")] [] 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorated_class_members.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorated_class_members.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorated_class_members.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorated_class_members.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorated_class_members.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorated_class_members.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorated_class_members.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorated_class_members.ts.snap index 92463de35f4c..43f2829fa450 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorated_class_members.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorated_class_members.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + @test prop: string; + @test method() {} + @test get getter() {} + @test set setter(a) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -134,7 +154,11 @@ JsModule { ], eof_token: EOF@105..106 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..106 0: (empty) 1: (empty) @@ -234,3 +258,5 @@ JsModule { 3: R_CURLY@102..103 "}" [] [] 9: R_CURLY@103..105 "}" [Newline("\n")] [] 4: EOF@105..106 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_assignment.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_assignment.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_assignment.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_assignment.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_assignment.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_assignment.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_assignment.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_assignment.ts.snap index 7d77c037ebb6..4f7f1f9a3a1a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_assignment.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_assignment.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +@test(--a) +class Test {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -45,7 +61,11 @@ JsModule { ], eof_token: EOF@24..25 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..25 0: (empty) 1: (empty) @@ -80,3 +100,5 @@ JsModule { 8: JS_CLASS_MEMBER_LIST@23..23 9: R_CURLY@23..24 "}" [] [] 4: EOF@24..25 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_call_expression_with_arrow.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_call_expression_with_arrow.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_call_expression_with_arrow.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_call_expression_with_arrow.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts.snap index 577edeec2b3e..4bc3bbd9b366 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_call_expression_with_arrow.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_call_expression_with_arrow.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export class Foo { + @Decorator((val) => val) + badField!: number +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -87,7 +105,11 @@ JsModule { ], eof_token: EOF@65..66 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..66 0: (empty) 1: (empty) @@ -152,3 +174,5 @@ JsModule { 4: (empty) 9: R_CURLY@63..65 "}" [Newline("\n")] [] 4: EOF@65..66 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.options.json b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.ts.snap index f42bc095bea3..b3a67bada7d0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_constructor.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_constructor.ts.snap @@ -1,3 +1,29 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class C { + constructor(@foo readonly x: number) {} +} +class CC { + constructor(@foo @dec(arg) readonly x: number) {} +} +class CC { + constructor(@foo @dec.method(arg) readonly x: number) {} +} +class CCC { + constructor(@foo @dec.method(arg) private readonly x: number) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -346,7 +372,11 @@ JsModule { ], eof_token: EOF@279..280 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..280 0: (empty) 1: (empty) @@ -588,3 +618,5 @@ JsModule { 3: R_CURLY@276..277 "}" [] [] 9: R_CURLY@277..279 "}" [Newline("\n")] [] 4: EOF@279..280 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.options.json b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.ts.snap index cef72941d84f..8864cc68cc4d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_method.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_method.ts.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + method(@dec x, second, @dec third = 'default') {} + method(@dec.fn() x, second, @dec.fn() third = 'default') {} + method(@dec() x, second, @dec() third = 'default') {} + static method(@dec x, second, @dec third = 'default') {} + static method(@dec.fn() x, second, @dec.fn() third = 'default') {} + static method(@dec() x, second, @dec() third = 'default') {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -579,7 +601,11 @@ JsModule { ], eof_token: EOF@384..385 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..385 0: (empty) 1: (empty) @@ -1000,3 +1026,5 @@ JsModule { 3: R_CURLY@381..382 "}" [] [] 9: R_CURLY@382..384 "}" [Newline("\n")] [] 4: EOF@384..385 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.options.json b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.ts.snap index 39f864144cf2..5b11519094a7 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_decorator_on_class_setter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_decorator_on_class_setter.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + set val(@dec x) {} + set val(@dec.fn() x) {} + set val(@dec() x) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -147,7 +166,11 @@ JsModule { ], eof_token: EOF@87..88 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..88 0: (empty) 1: (empty) @@ -259,3 +282,5 @@ JsModule { 3: R_CURLY@84..85 "}" [] [] 9: R_CURLY@85..87 "}" [Newline("\n")] [] 4: EOF@87..88 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_default_type_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_default_type_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_default_type_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_default_type_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_default_type_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_default_type_clause.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_default_type_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_default_type_clause.ts.snap index c172197fde79..e8b84a095809 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_default_type_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_default_type_clause.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = X; +type B = { a: X } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -103,7 +119,11 @@ JsModule { ], eof_token: EOF@75..76 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..76 0: (empty) 1: (empty) @@ -177,3 +197,5 @@ JsModule { 2: R_CURLY@74..75 "}" [] [] 5: (empty) 4: EOF@75..76 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_identifier.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_identifier.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_identifier.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_identifier.ts.snap index 9825ee22c9e2..feb1d0d53408 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_identifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_identifier.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare const a: { b: string } +export = a; +export = class {} +export = function () {} +export = 4 + 3 + a; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -131,7 +150,11 @@ JsModule { ], eof_token: EOF@104..105 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..105 0: (empty) 1: (empty) @@ -230,3 +253,5 @@ JsModule { 0: IDENT@102..103 "a" [] [] 2: SEMICOLON@103..104 ";" [] [] 4: EOF@104..105 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts.snap index 784a3d26131f..3ae151df4289 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_assignment_qualified_name.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_assignment_qualified_name.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare const a: { b: string } +export = a.b; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -66,7 +82,11 @@ JsModule { ], eof_token: EOF@44..45 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..45 0: (empty) 1: (empty) @@ -114,3 +134,5 @@ JsModule { 0: IDENT@42..43 "b" [] [] 2: SEMICOLON@43..44 ";" [] [] 4: EOF@44..45 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_declare.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_declare.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_declare.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_declare.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_declare.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_declare.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_declare.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_declare.ts.snap index eccf4898638c..bea12e8a50f4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_declare.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_declare.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export declare const a: string; +export declare interface A {} +export declare enum B {} +export declare type C = string; +export declare class D {} +export declare function e() + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -131,7 +151,11 @@ JsModule { ], eof_token: EOF@172..173 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..173 0: (empty) 1: (empty) @@ -232,3 +256,5 @@ JsModule { 5: (empty) 6: (empty) 4: EOF@172..173 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_function_overload.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_function_overload.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_default_function_overload.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_function_overload.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_function_overload.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_function_overload.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_default_function_overload.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_function_overload.ts.snap index b33cb5e75006..93dfead0b59f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_function_overload.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_function_overload.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default function test(a: string): string; +export default function test(a: string | undefined): string { return "hello" } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -115,7 +131,11 @@ JsModule { ], eof_token: EOF@127..128 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..128 0: (empty) 1: (empty) @@ -200,3 +220,5 @@ JsModule { 3: R_CURLY@126..127 "}" [] [] 2: (empty) 4: EOF@127..128 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_interface.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_interface.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_default_interface.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_interface.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_interface.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_interface.ts.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_default_interface.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_interface.ts.snap index 5db6f10fe648..6520430aa7dd 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_interface.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_interface.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default interface A { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -25,7 +40,11 @@ JsModule { ], eof_token: EOF@30..31 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..31 0: (empty) 1: (empty) @@ -47,3 +66,5 @@ JsModule { 6: R_CURLY@29..30 "}" [] [] 2: (empty) 4: EOF@30..31 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_multiple_interfaces.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_default_multiple_interfaces.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_multiple_interfaces.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_default_multiple_interfaces.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts.snap index f752101d9432..182b65c7ca29 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_default_multiple_interfaces.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_default_multiple_interfaces.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default interface A { a: string; } +export default interface B { a: string } +export default function test() {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -103,7 +120,11 @@ JsModule { ], eof_token: EOF@116..117 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..117 0: (empty) 1: (empty) @@ -183,3 +204,5 @@ JsModule { 3: R_CURLY@115..116 "}" [] [] 2: (empty) 4: EOF@116..117 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_enum_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_enum_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_enum_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_enum_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_enum_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_enum_declaration.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_enum_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_enum_declaration.ts.snap index 5700dc112211..6478a43b4302 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_enum_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_enum_declaration.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export enum A { X, Y } +export const enum B { X, Y } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -62,7 +78,11 @@ JsModule { ], eof_token: EOF@51..52 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..52 0: (empty) 1: (empty) @@ -109,3 +129,5 @@ JsModule { 1: (empty) 5: R_CURLY@50..51 "}" [] [] 4: EOF@51..52 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_function_overload.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_function_overload.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_function_overload.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_function_overload.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_function_overload.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_function_overload.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_function_overload.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_function_overload.ts.snap index 4d7e3dfdefee..2758391c5826 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_function_overload.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_function_overload.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export function test(a: string): string; +export function test(a: string | undefined): string { return "hello" } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -107,7 +123,11 @@ JsModule { ], eof_token: EOF@111..112 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..112 0: (empty) 1: (empty) @@ -186,3 +206,5 @@ JsModule { 2: (empty) 3: R_CURLY@110..111 "}" [] [] 4: EOF@111..112 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_interface_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_interface_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_interface_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_interface_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_interface_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_interface_declaration.ts.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_interface_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_interface_declaration.ts.snap index cea1b61a7d38..c2ac31311be7 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_interface_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_interface_declaration.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export interface A {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -21,7 +36,11 @@ JsModule { ], eof_token: EOF@21..22 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..22 0: (empty) 1: (empty) @@ -40,3 +59,5 @@ JsModule { 5: TS_TYPE_MEMBER_LIST@20..20 6: R_CURLY@20..21 "}" [] [] 4: EOF@21..22 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_from_specifier_with_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_named_from_specifier_with_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_from_specifier_with_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_named_from_specifier_with_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts.snap index 90395473772d..f02e511d996e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_from_specifier_with_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_from_specifier_with_type.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export { type A } from "a" +export { type } from "./type"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -54,7 +70,11 @@ JsModule { ], eof_token: EOF@57..58 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..58 0: (empty) 1: (empty) @@ -97,3 +117,5 @@ JsModule { 6: (empty) 7: SEMICOLON@56..57 ";" [] [] 4: EOF@57..58 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_type_specifier.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_type_specifier.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_named_type_specifier.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_type_specifier.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_type_specifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_type_specifier.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_named_type_specifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_type_specifier.ts.snap index 24ae45e5bdac..d8022abc85be 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_named_type_specifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_named_type_specifier.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export { type } +export { type type } +export { type as somethingElse } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -64,7 +81,11 @@ JsModule { ], eof_token: EOF@69..70 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..70 0: (empty) 1: (empty) @@ -113,3 +134,5 @@ JsModule { 3: R_CURLY@68..69 "}" [] [] 4: (empty) 4: EOF@69..70 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_namespace_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_namespace_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_namespace_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_namespace_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_namespace_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_namespace_clause.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_namespace_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_namespace_clause.ts.snap index d7086d411494..17359a321538 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_namespace_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_namespace_clause.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export function isPrime(x: number): boolean; +export as namespace mathLib; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -57,7 +73,11 @@ JsModule { ], eof_token: EOF@73..74 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..74 0: (empty) 1: (empty) @@ -101,3 +121,5 @@ JsModule { 0: IDENT@65..72 "mathLib" [] [] 3: SEMICOLON@72..73 ";" [] [] 4: EOF@73..74 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_type_named.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named.ts.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_type_named.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named.ts.snap index d0dee347244e..b6d3396f6df2 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = string; +export type { A }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -36,7 +52,11 @@ JsModule { ], eof_token: EOF@35..36 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..36 0: (empty) 1: (empty) @@ -65,3 +85,5 @@ JsModule { 3: R_CURLY@33..34 "}" [] [] 4: SEMICOLON@34..35 ";" [] [] 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named_from.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named_from.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_type_named_from.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named_from.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named_from.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named_from.ts.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_type_named_from.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named_from.ts.snap index fd4d940904c0..77fc1323949d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_named_from.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_named_from.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export type { A } from "a"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -30,7 +45,11 @@ JsModule { ], eof_token: EOF@27..28 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..28 0: (empty) 1: (empty) @@ -55,3 +74,5 @@ JsModule { 6: (empty) 7: SEMICOLON@26..27 ";" [] [] 4: EOF@27..28 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_specifier.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_specifier.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_type_specifier.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_specifier.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_specifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_specifier.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_export_type_specifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_specifier.ts.snap index 6003643411cc..c630dc67a1f1 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_export_type_specifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_export_type_specifier.ts.snap @@ -1,3 +1,27 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let as; +let type; +let a; +export { type }; +export { type as as }; +export { as as as }; +export { type as as as } +export { type type }; +export { type as }; +export { type a as aa }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -196,7 +220,11 @@ JsModule { ], eof_token: EOF@177..178 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..178 0: (empty) 1: (empty) @@ -339,3 +367,5 @@ JsModule { 3: R_CURLY@175..176 "}" [] [] 4: SEMICOLON@176..177 ";" [] [] 4: EOF@177..178 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_extends_generic_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_extends_generic_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_extends_generic_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_extends_generic_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_extends_generic_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_extends_generic_type.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_extends_generic_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_extends_generic_type.ts.snap index 1a846cab6882..c813b0a17511 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_extends_generic_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_extends_generic_type.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type IHasVisualizationModel = string; +class D extends C { + x = "string"; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -66,7 +84,11 @@ JsModule { ], eof_token: EOF@101..102 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..102 0: (empty) 1: (empty) @@ -116,3 +138,5 @@ JsModule { 4: SEMICOLON@98..99 ";" [] [] 9: R_CURLY@99..101 "}" [Newline("\n")] [] 4: EOF@101..102 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_external_module_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_external_module_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_external_module_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_external_module_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_external_module_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_external_module_declaration.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/ts_external_module_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_external_module_declaration.ts.snap index fb8cb734813d..34a1c989b60b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_external_module_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_external_module_declaration.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module "a"; +declare module "b" +declare module "import" {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -42,7 +59,11 @@ JsModule { ], eof_token: EOF@65..66 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..66 0: (empty) 1: (empty) @@ -74,3 +95,5 @@ JsModule { 1: JS_MODULE_ITEM_LIST@64..64 2: R_CURLY@64..65 "}" [] [] 4: EOF@65..66 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter.ts.snap index 63635a41a1ac..b5278dd8a258 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a(x) {} +function b({ x, y } = {}) {} +function c(x: string, y?: number, z: string = "test") {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -162,7 +179,11 @@ JsModule { ], eof_token: EOF@102..103 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..103 0: (empty) 1: (empty) @@ -285,3 +306,5 @@ JsModule { 2: JS_STATEMENT_LIST@101..101 3: R_CURLY@101..102 "}" [] [] 4: EOF@102..103 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.options.json b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.options.json new file mode 100644 index 000000000000..b7125f12b224 --- /dev/null +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.options.json @@ -0,0 +1,7 @@ +{ + "javascript": { + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } +} diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.ts.snap index d91fdc135fcb..785ec1fb8c9f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_formal_parameter_decorator.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_formal_parameter_decorator.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Foo { + constructor(@dec x) {} + method(@dec x) {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -98,7 +116,11 @@ JsModule { ], eof_token: EOF@60..61 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..61 0: (empty) 1: (empty) @@ -172,3 +194,5 @@ JsModule { 3: R_CURLY@57..58 "}" [] [] 9: R_CURLY@58..60 "}" [Newline("\n")] [] 4: EOF@60..61 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_overload.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_overload.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_function_overload.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_function_overload.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_overload.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_overload.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_function_overload.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_function_overload.ts.snap index 9c4b5f2574cd..4aa44c7874b5 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_function_overload.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_overload.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function test(a: string): void; +function test(a: string | undefined): void {} +function no_semi(a: string) +function no_semi(a: string) {} +async function async_overload(a: string) +async function async_overload(a: string) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -223,7 +243,11 @@ JsModule { ], eof_token: EOF@221..222 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..222 0: (empty) 1: (empty) @@ -389,3 +413,5 @@ JsModule { 2: JS_STATEMENT_LIST@220..220 3: R_CURLY@220..221 "}" [] [] 4: EOF@221..222 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_statement.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_statement.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_function_statement.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_function_statement.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_statement.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_statement.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_function_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_function_statement.ts.snap index 4917288ca3fa..33e7c042c899 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_function_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_statement.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function test(a: string, b?: number, c="default") {} +function test2(a: A, b: B, c: C) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -194,7 +210,11 @@ JsModule { ], eof_token: EOF@111..112 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..112 0: (empty) 1: (empty) @@ -338,3 +358,5 @@ JsModule { 2: JS_STATEMENT_LIST@110..110 3: R_CURLY@110..111 "}" [] [] 4: EOF@111..112 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_function_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_function_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_function_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_type.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_function_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_function_type.ts.snap index 794d443259d7..80ceabc1c6e6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_function_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_function_type.ts.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = () => string; +type B = (a: string) => string; +type C = (b = "test") => string; +type D = (c, d) => string +type E = ([a]) => string +type F = ({a}) => string +type G = (a: A, b: B) => string +type H = (a: any) => a is string; +type I = ({ a, b }?) => string; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -388,7 +411,11 @@ JsModule { ], eof_token: EOF@267..268 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..268 0: (empty) 1: (empty) @@ -673,3 +700,5 @@ JsModule { 0: STRING_KW@260..266 "string" [] [] 5: SEMICOLON@266..267 ";" [] [] 4: EOF@267..268 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_getter_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_getter_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_getter_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_getter_signature_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_getter_signature_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_getter_signature_member.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_getter_signature_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_getter_signature_member.ts.snap index 562c4bf27b5e..4488cddb15c3 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_getter_signature_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_getter_signature_member.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { get a(): number } +type B = { get a() } +// members that look like getters but aren't getters +type C = { get(): number } +type D = { get: number } +type E = { get } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -148,7 +168,11 @@ JsModule { ], eof_token: EOF@171..172 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..172 0: (empty) 1: (empty) @@ -260,3 +284,5 @@ JsModule { 2: R_CURLY@170..171 "}" [] [] 5: (empty) 4: EOF@171..172 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_global_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_global_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_global_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_global_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_declaration.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_global_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_global_declaration.ts.snap index 2de4e95dd2c3..920fabb50ad0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_global_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_declaration.ts.snap @@ -1,3 +1,29 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module "./test" { + global { + let VERSION: string; + } +} +declare module "foo" { + global + { } +} +declare global {} +declare global +{ } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -96,7 +122,11 @@ JsModule { ], eof_token: EOF@141..142 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..142 0: (empty) 1: (empty) @@ -165,3 +195,5 @@ JsModule { 1: JS_MODULE_ITEM_LIST@140..140 2: R_CURLY@140..141 "}" [] [] 4: EOF@141..142 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_global_variable.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_variable.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_global_variable.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_global_variable.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_global_variable.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_variable.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_global_variable.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_global_variable.ts.snap index 4156e5498644..98a139cbe1c6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_global_variable.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_global_variable.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let global; +global // not a global declaration +console.log("a"); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -57,7 +74,11 @@ JsModule { ], eof_token: EOF@64..65 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..65 0: (empty) 1: (empty) @@ -98,3 +119,5 @@ JsModule { 2: R_PAREN@62..63 ")" [] [] 1: SEMICOLON@63..64 ";" [] [] 4: EOF@64..65 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_clause_types.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_import_clause_types.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_clause_types.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_import_clause_types.ts.snap index 379f48b097a6..b30db8ac1a5b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_import_clause_types.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_clause_types.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import type from "./mod"; // not a type +import type foo from "./mod"; +import type * as foo2 from "./mod"; +import type { foo3 } from "mod"; +import type from from "./mod"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -100,7 +119,11 @@ JsModule { ], eof_token: EOF@169..170 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..170 0: (empty) 1: (empty) @@ -174,3 +197,5 @@ JsModule { 4: (empty) 2: SEMICOLON@168..169 ";" [] [] 4: EOF@169..170 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_equals_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_equals_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_import_equals_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_import_equals_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_equals_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_equals_declaration.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_import_equals_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_import_equals_declaration.ts.snap index 98634bd5217f..b91cca131945 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_import_equals_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_equals_declaration.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import x = require("./test"); +namespace a.b {} +import y = a; +import z = a.b; +import type A = require("./a"); +export import n = a; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -103,7 +123,11 @@ JsModule { ], eof_token: EOF@129..130 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..130 0: (empty) 1: (empty) @@ -182,3 +206,5 @@ JsModule { 0: IDENT@127..128 "a" [] [] 5: SEMICOLON@128..129 ";" [] [] 4: EOF@129..130 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_import_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_import_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_import_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_type.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_import_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_import_type.ts.snap index 60845a8cf015..ded15a17a9b1 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_import_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_import_type.ts.snap @@ -1,3 +1,27 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = typeof import("test"); +type B = import("test"); +type C = typeof import("test").a.b.c.d.e.f; +type D = import("test"); +type E = import("test").C; +type F = typeof import("test", { with: { "resolution-mode": "import" } }); +type G = import("test", { with: { "resolution-mode": "import" } }).TypeFromImport; +type H = import("test", { with: { "resolution-mode": "import" } }); +type I = import("test", { with: { "resolution-mode": "require" } }).C; +type J = typeof import("test", { with: { "resolution-mode": "require" } }).a.b.c.d.e.f; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -503,7 +527,11 @@ JsModule { ], eof_token: EOF@569..570 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..570 0: (empty) 1: (empty) @@ -860,3 +888,5 @@ JsModule { 4: (empty) 5: SEMICOLON@568..569 ";" [] [] 4: EOF@569..570 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member.ts.snap index 8dba650cfeae..3364533d81d6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + [a: number]: string; +} +class B { + [index: string]: { prop } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -94,7 +114,11 @@ JsModule { ], eof_token: EOF@78..79 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..79 0: (empty) 1: (empty) @@ -166,3 +190,5 @@ JsModule { 5: (empty) 9: R_CURLY@76..78 "}" [Newline("\n")] [] 4: EOF@78..79 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member_can_be_static.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member_can_be_static.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member_can_be_static.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member_can_be_static.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts.snap index a0e4981ad2b9..d1cf70e09eaf 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_class_member_can_be_static.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_class_member_can_be_static.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + static [a: number]: string; +} +class B { + static readonly [a: number]: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -93,7 +113,11 @@ JsModule { ], eof_token: EOF@96..97 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..97 0: (empty) 1: (empty) @@ -162,3 +186,5 @@ JsModule { 5: SEMICOLON@93..94 ";" [] [] 9: R_CURLY@94..96 "}" [Newline("\n")] [] 4: EOF@96..97 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_interface_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_interface_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_interface_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_interface_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_interface_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_interface_member.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_interface_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_interface_member.ts.snap index 23d0bb2ec5bd..1276e75f54b0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_interface_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_interface_member.ts.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A { + [a: number]: string; +} +interface B { + [index: string]: { prop } +} +interface C { + readonly [a: number]: string; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -123,7 +146,11 @@ JsModule { ], eof_token: EOF@136..137 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..137 0: (empty) 1: (empty) @@ -214,3 +241,5 @@ JsModule { 5: SEMICOLON@133..134 ";" [] [] 6: R_CURLY@134..136 "}" [Newline("\n")] [] 4: EOF@136..137 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_member.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_index_signature_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_member.ts.snap index e77db06de4be..20619a145e38 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_index_signature_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_index_signature_member.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { [a: number]: string } +type B = { readonly [a: number]: string } +// not an index signature +type C = { [a]: string } +type D = { readonly [a]: string } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -152,7 +171,11 @@ JsModule { ], eof_token: EOF@159..160 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..160 0: (empty) 1: (empty) @@ -263,3 +286,5 @@ JsModule { 2: R_CURLY@158..159 "}" [] [] 5: (empty) 4: EOF@159..160 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_indexed_access_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_indexed_access_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_indexed_access_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_indexed_access_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_indexed_access_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_indexed_access_type.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_indexed_access_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_indexed_access_type.ts.snap index 522b0f6c399f..0c41570d775b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_indexed_access_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_indexed_access_type.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = string[number]; +type B = string[number][number][number][]; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -62,7 +78,11 @@ JsModule { ], eof_token: EOF@67..68 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..68 0: (empty) 1: (empty) @@ -110,3 +130,5 @@ JsModule { 2: R_BRACK@65..66 "]" [] [] 5: SEMICOLON@66..67 ";" [] [] 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_infer_type_allowed.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_infer_type_allowed.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_infer_type_allowed.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_infer_type_allowed.ts.snap index 5511ba943583..64b2bd234f49 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_infer_type_allowed.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_infer_type_allowed.ts.snap @@ -1,3 +1,68 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type Args = F extends (...args: infer A) => void ? A : never; +type A = T extends import("test").C ? P : never +type A = T extends typeof Array ? P : never +type A = T extends { set(a: infer P): number } ? P : never +type A = T extends { get(): infer P } ? P : never +type A = T extends { method(this: infer P): number } ? P : never +type valid9 = T extends Array ? R : any; +type ContentBetweenBrackets = S extends `[${infer T}]` ? T : never; +type WithSelectors = S extends { getState: () => infer T } + ? S & { use: { [K in keyof T]: () => T[K] } } + : never; +type A = MyType extends (OtherType extends infer T ? infer U : InnerFalse) ? OuterTrue : OuterFalse +type Join = + T extends [] ? '' : + T extends [string | number | boolean | bigint] ? `${T[0]}` : + T extends [string | number | boolean | bigint, ...infer U] ? `${T[0]}${D}${Join}` : + string; +type MatchPair = S extends `[${infer A},${infer B}]` ? [A, B] : unknown; +type FirstTwoAndRest = S extends `${infer A}${infer B}${infer R}` ? [`${A}${B}`, R] : unknown; +type Trim = + S extends `${infer T} ` ? Trim : + S; +type Foo = T extends `*${infer S}*` ? S : never; +type Unpacked = T extends (infer U)[] ? U : + T extends (...args: any[]) => infer U ? U : + T extends Promise ? U : + T; +type ArgumentType any> = T extends (a: infer A) => any ? A : any; +type X3 = T extends { a: (x: infer U) => void, b: (x: infer U) => void } ? U : never; +type X1 = T extends { x: infer X, y: infer Y } ? [X, Y] : any; +type T62 = U extends (infer U)[] ? U : U; +type T63 = T extends ((infer A) extends infer B ? infer C : infer D) ? string : number; +type T75 = T extends T74 ? T70 | T72 | T74 : never; +type Jsonified = T extends string | number | boolean | null ? T + : T extends undefined | Function ? never + : T extends { toJSON(): infer R } ? R + : T extends object ? JsonifiedObject +: "what is this"; +type T1 = F1 extends (...args: (infer T)) => void ? T : never; +type T2 = F1 extends (args: [...(infer T)]) => void ? T : never; +type T3 = T extends IsNumber<(infer N)> ? true : false; +type T4 = F1 extends (...args: ((infer T))) => void ? T : never; +type T5 = F1 extends (args: [...((infer T))]) => void ? T : never; +type T6 = T extends IsNumber<((infer N))> ? true : false; +type T7 = F1 extends (...args: ((((infer T))))) => void ? T : never; +type T8 = F1 extends (args: [...((((infer T))))]) => void ? T : never; +type T9 = T extends IsNumber<((((infer N))))> ? true : false; +type Prepend = + ((head: E, ...args: T) => any) extends ((...args: infer U) => any) + ? U + : T; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -3056,7 +3121,11 @@ JsModule { ], eof_token: EOF@2836..2837 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..2837 0: (empty) 1: (empty) @@ -5225,3 +5294,5 @@ JsModule { 1: (empty) 5: SEMICOLON@2835..2836 ";" [] [] 4: EOF@2836..2837 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_inferred_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_inferred_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_inferred_type.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_inferred_type.ts.snap index 56e0081cc085..1c8826a22909 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_inferred_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_inferred_type.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = A extends infer B ? B : never; +type B = A extends { a: infer U; b: infer U} ? U : never; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -113,7 +129,11 @@ JsModule { ], eof_token: EOF@97..98 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..98 0: (empty) 1: (empty) @@ -197,3 +217,5 @@ JsModule { 0: NEVER_KW@91..96 "never" [] [] 5: SEMICOLON@96..97 ";" [] [] 4: EOF@97..98 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expression_property_access.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expression_property_access.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expression_property_access.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expression_property_access.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts.snap index 52e83d4193ea..8406078c37c8 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expression_property_access.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expression_property_access.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +f?.(c); +f?.[c]; +(f).c; +(f)?.c; +(f)?.[c]; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -175,7 +194,11 @@ JsModule { ], eof_token: EOF@55..56 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..56 0: (empty) 1: (empty) @@ -293,3 +316,5 @@ JsModule { 4: R_BRACK@53..54 "]" [] [] 1: SEMICOLON@54..55 ";" [] [] 4: EOF@55..56 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions.ts.snap index 8db2df271ac4..3d3cd773615e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions.ts.snap @@ -1,3 +1,43 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let f1 = fx; +let f2 = fx; +let f3 = fx['test']; +const a2 = f.g; // () => number +const a5 = f['g']; // () => number +const a7 = (f)['g']; +const a6 = f['g']; // type Error +const b2 = f?.(); +const b3 = f?.(); +const b4 = f?.(); // Type Error, expected no type arguments +const x1 = f +(true); +const x2 = f +true; +const x3 = f; +true; +(f); +(f)(); +(f)?.(); +(a?.f)(); +new (a)(); +f<() => T>?.(); +f?.<() => T>(); +f ? g : h; +[f]; +{ f } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -1005,7 +1045,11 @@ JsModule { ], eof_token: EOF@588..589 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..589 0: (empty) 1: (empty) @@ -1676,3 +1720,5 @@ JsModule { 1: (empty) 2: R_CURLY@587..588 "}" [] [] 4: EOF@588..589 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_1.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_1.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_1.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_1.ts.snap index 7dd611611a5d..55a6d759b164 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_1.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_1.ts.snap @@ -1,3 +1,71 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + constructor() { + f super(); + } +} +f``; +f(1); +f ?? 1; +f || 1; +f && 1; +f | 1; +f ^ 1; +f & 1; +f == f; +f != f; +f === f; +f !== f; +f <= f; +f instanceof f; +f in {}; +f as {}; +f satisfies {}; +f * f; +f / f; +f % f; +f ** f; +f < T > +f; +f < T > -f; +f < T > this; +f < T > null; +f < T > true; +f < T > false; +f < T > 1; +f < T > 123n; +f < T > []; +f < T > {}; +f < T > function test() {}; +f < T > class A {}; +f < T > new A(); +f / 1; +f < T > +1; +f < T > -1; +f < T > ~1; +f < T > !1; +f < T > someIdentifier; +f < T > delete a[field]; +f < T > typeof MyClass; +f < T > void a; +f <= 1; +f < T > (await 1); +f < T > import.meta; +f < T > import("123"); +a < b >> c; +f = h >>> 0 < j >>> 0; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -1611,7 +1679,11 @@ JsModule { ], eof_token: EOF@794..795 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..795 0: (empty) 1: (empty) @@ -2661,3 +2733,5 @@ JsModule { 0: JS_NUMBER_LITERAL@792..793 "0" [] [] 1: SEMICOLON@793..794 ";" [] [] 4: EOF@794..795 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts.snap index a4469ef0d2d3..e043a2c90b46 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_asi.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_asi.ts.snap @@ -1,3 +1,53 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +const x5 = f +let yy = 0; +const x6 = f +interface I {} +let x10 = f +this.bar() +let x11 = f +function bar() {} +let x12 = f +class C {} +let x13 = f +bar() +let x14 = f +void bar() +class C1 { + static specialFoo = f + static bar = 123 +} +class C2 { + public specialFoo = f + public bar = 123 +} +class C3 { + private specialFoo = f + private bar = 123 +} +class C4 { + protected specialFoo = f + protected bar = 123 +} +class C5 { + protected specialFoo = f + #bar = 123 +} +const Bar = Foo +const Baz = 123 + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -741,7 +791,11 @@ JsModule { ], eof_token: EOF@596..597 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..597 0: (empty) 1: (empty) @@ -1250,3 +1304,5 @@ JsModule { 0: JS_NUMBER_LITERAL@593..596 "123" [] [] 1: (empty) 4: EOF@596..597 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts.snap index dbb303989c0b..d97bfe2cf7d0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_instantiation_expressions_new_line.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_instantiation_expressions_new_line.ts.snap @@ -1,3 +1,111 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + constructor() { + f + super(); + } +} +function *f() { + const f = f + yield; +} +f +?? 1; +f +|| 1; +f +&& 1; +f +| 1; +f +^ 1; +f +& 1; +f +== f; +f +<= f; +f +!= f; +f +=== f; +f +!== f; +f +instanceof f; +f +in {}; +f +* f; +f +/ f; +f +% f; +f +** f; +f ++f; +f +-f; +f +this; +f +null; +f +true; +f +false; +f +1; +f +123n; +f +{}; +f +function test() {}; +f +class A {}; +f +new A(); +f +/ 1; +f ++1; +f +-1; +f +~1; +f +!1; +f +someIdentifier; +f +delete a[field]; +f +typeof MyClass; +f +void a; +f +<= 1; +f +(await 1); +f +import.meta; +f +import("123"); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -1593,7 +1701,11 @@ JsModule { ], eof_token: EOF@687..688 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..688 0: (empty) 1: (empty) @@ -2635,3 +2747,5 @@ JsModule { 2: R_PAREN@685..686 ")" [] [] 1: SEMICOLON@686..687 ";" [] [] 4: EOF@687..688 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_interface.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_interface.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_interface.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_interface.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_interface.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_interface.ts.snap index 973150ee25a2..b521d9d2282f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_interface.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A {} +interface B { prop: string, method(): string, [index: number]: string, new(): B } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -104,7 +120,11 @@ JsModule { ], eof_token: EOF@96..97 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..97 0: (empty) 1: (empty) @@ -183,3 +203,5 @@ JsModule { 4: (empty) 6: R_CURLY@95..96 "}" [] [] 4: EOF@96..97 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_interface_extends_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface_extends_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_interface_extends_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_interface_extends_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_interface_extends_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface_extends_clause.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_interface_extends_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_interface_extends_clause.ts.snap index a4117b26abe6..a4cee2d75f7a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_interface_extends_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_interface_extends_clause.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A { prop: Prop } +interface B extends A {} +interface C extends A, B {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -113,7 +130,11 @@ JsModule { ], eof_token: EOF@101..102 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..102 0: (empty) 1: (empty) @@ -195,3 +216,5 @@ JsModule { 5: TS_TYPE_MEMBER_LIST@100..100 6: R_CURLY@100..101 "}" [] [] 4: EOF@101..102 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_intersection_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_intersection_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_intersection_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_intersection_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_intersection_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_intersection_type.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_intersection_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_intersection_type.ts.snap index ab6b42e1fd2b..6e4ddf42fb4d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_intersection_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_intersection_type.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = string & number; +type B = & A & void & null; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -55,7 +71,11 @@ JsModule { ], eof_token: EOF@53..54 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..54 0: (empty) 1: (empty) @@ -97,3 +117,5 @@ JsModule { 0: NULL_KW@48..52 "null" [] [] 5: SEMICOLON@52..53 ";" [] [] 4: EOF@53..54 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_keyword_assignments.js b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keyword_assignments.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_keyword_assignments.js rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_keyword_assignments.js diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_keyword_assignments.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keyword_assignments.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_keyword_assignments.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_keyword_assignments.js.snap index 096ccff7f742..8bcfad589a6b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_keyword_assignments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keyword_assignments.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +declare = 1; +abstract = 2; +namespace = 3; +type = 4; +module = 5; +global = 6; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -78,7 +98,11 @@ JsModule { ], eof_token: EOF@75..76 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..76 0: (empty) 1: (empty) @@ -133,3 +157,5 @@ JsModule { 0: JS_NUMBER_LITERAL@73..74 "6" [] [] 1: SEMICOLON@74..75 ";" [] [] 4: EOF@75..76 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_keywords_assignments_script.js b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keywords_assignments_script.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_keywords_assignments_script.js rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_keywords_assignments_script.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_keywords_assignments_script.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keywords_assignments_script.cjs.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_keywords_assignments_script.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_keywords_assignments_script.cjs.snap index e73c514167a3..054079f90114 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_keywords_assignments_script.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_keywords_assignments_script.cjs.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +interface = 1; +private = 2; +protected = 3; +public = 4; +implements = 5; + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -66,7 +86,11 @@ JsScript { ], eof_token: EOF@80..81 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_SCRIPT@0..81 0: (empty) 1: (empty) @@ -113,3 +137,5 @@ JsScript { 0: JS_NUMBER_LITERAL@78..79 "5" [] [] 1: SEMICOLON@79..80 ";" [] [] 4: EOF@80..81 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_literal_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_literal_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_literal_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_literal_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_literal_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_literal_type.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_literal_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_literal_type.ts.snap index a9276cd3ecea..8755908adb64 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_literal_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_literal_type.ts.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = 5; +type B = -5; +type C = 5n; +type D = -5n; +type E = "abvcd"; +type F = true; +type G = false; +type H = null; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -106,7 +128,11 @@ JsModule { ], eof_token: EOF@115..116 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..116 0: (empty) 1: (empty) @@ -189,3 +215,5 @@ JsModule { 0: NULL_KW@110..114 "null" [] [] 5: SEMICOLON@114..115 ";" [] [] 4: EOF@115..116 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_mapped_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_mapped_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_mapped_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_mapped_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_mapped_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_mapped_type.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_mapped_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_mapped_type.ts.snap index e189e407546b..b597890d7d8a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_mapped_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_mapped_type.ts.snap @@ -1,3 +1,30 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { [test in "a" | "b"] } +type OptionsFlags = { + [Property in keyof Type]: boolean; +}; +type CreateMutable = { + -readonly [Property in keyof Type]: Type[Property]; +}; +type Concrete = { + [Property in keyof Type]-?: Type[Property] +}; +type Getters = { + [Property in keyof Type as `get${Capitalize}`]: () => Type[Property] +}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -341,7 +368,11 @@ JsModule { ], eof_token: EOF@375..376 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..376 0: (empty) 1: (empty) @@ -593,3 +624,5 @@ JsModule { 11: R_CURLY@372..374 "}" [Newline("\n")] [] 5: SEMICOLON@374..375 ";" [] [] 4: EOF@375..376 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_and_constructor_overload.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_and_constructor_overload.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_method_and_constructor_overload.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_method_and_constructor_overload.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_and_constructor_overload.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_and_constructor_overload.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_method_and_constructor_overload.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_method_and_constructor_overload.ts.snap index 2d7a18d173f4..3a0718d6e08f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_method_and_constructor_overload.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_and_constructor_overload.ts.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + constructor(); + constructor(a: String) // ASI + constructor(a?: String) {} + async method(): Promise; + method(a: String): Promise // ASI + async method(a?: String): Promise { return "test" } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -253,7 +275,11 @@ JsModule { ], eof_token: EOF@251..252 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..252 0: (empty) 1: (empty) @@ -436,3 +462,5 @@ JsModule { 3: R_CURLY@248..249 "}" [] [] 9: R_CURLY@249..251 "}" [Newline("\n")] [] 4: EOF@251..252 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_method_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_method_class_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_class_member.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_method_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_method_class_member.ts.snap index 7e8ab830d8b5..110de3550190 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_method_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_class_member.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test { + test(a: A, b: B): R {} +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -126,7 +143,11 @@ JsModule { ], eof_token: EOF@58..59 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..59 0: (empty) 1: (empty) @@ -221,3 +242,5 @@ JsModule { 3: R_CURLY@55..56 "}" [] [] 9: R_CURLY@56..58 "}" [Newline("\n")] [] 4: EOF@58..59 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_object_member_body.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_object_member_body.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_method_object_member_body.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_method_object_member_body.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_method_object_member_body.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_object_member_body.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_method_object_member_body.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_method_object_member_body.ts.snap index 574cfcdffc6c..5c11927f071d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_method_object_member_body.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_method_object_member_body.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +({ + x(maybeA: any): maybeA is A { return true }, + y(a: string): string { return "string"; }, + async *id(param: Promise): AsyncIterableIterator { yield await param }, +}) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -239,7 +258,11 @@ JsModule { ], eof_token: EOF@189..190 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..190 0: (empty) 1: (empty) @@ -408,3 +431,5 @@ JsModule { 2: R_PAREN@188..189 ")" [] [] 1: (empty) 4: EOF@189..190 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_module_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_module_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_module_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_module_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_module_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_module_declaration.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_module_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_module_declaration.ts.snap index 628265cf0488..ae7ba56cb477 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_module_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_module_declaration.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare module a {} +declare module a.b.c.d {} +declare module a.b { function test(): string } +module X {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -104,7 +122,11 @@ JsModule { ], eof_token: EOF@104..105 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..105 0: (empty) 1: (empty) @@ -180,3 +202,5 @@ JsModule { 1: JS_MODULE_ITEM_LIST@103..103 2: R_CURLY@103..104 "}" [] [] 4: EOF@104..105 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_named_import_specifier_with_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_named_import_specifier_with_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_named_import_specifier_with_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_named_import_specifier_with_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts.snap index 45b198d49c43..c570c822b840 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_named_import_specifier_with_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_named_import_specifier_with_type.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +import { type, type as } from "./mod"; +import { type as other } from "./mod" +import { type as as } from "./mod"; +import { type as as as } from "./mod" +import { type "test-abcd" as test } from "./mod"; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -149,7 +168,11 @@ JsModule { ], eof_token: EOF@200..201 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..201 0: (empty) 1: (empty) @@ -258,3 +281,5 @@ JsModule { 4: (empty) 2: SEMICOLON@199..200 ";" [] [] 4: EOF@200..201 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_namespace_declaration.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_namespace_declaration.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_namespace_declaration.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_namespace_declaration.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_namespace_declaration.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_namespace_declaration.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_namespace_declaration.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_namespace_declaration.ts.snap index cc198eac0beb..31ae37e48c6f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_namespace_declaration.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_namespace_declaration.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare namespace a {} +declare namespace a.b.c.d {} +declare namespace a.b { function test(): string } +namespace X { } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -104,7 +122,11 @@ JsModule { ], eof_token: EOF@117..118 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..118 0: (empty) 1: (empty) @@ -180,3 +202,5 @@ JsModule { 1: JS_MODULE_ITEM_LIST@116..116 2: R_CURLY@116..117 "}" [] [] 4: EOF@117..118 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_new_operator.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_operator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_new_operator.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_new_operator.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_new_operator.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_operator.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_new_operator.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_new_operator.ts.snap index 3d721171ba7c..93b71f0bf85d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_new_operator.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_operator.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +var c2 = new T; // Ok +var x1 = new SS(); // OK +var x3 = new SS(); // OK +var x4 = new SS; // OK + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -142,7 +160,11 @@ JsModule { ], eof_token: EOF@129..130 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..130 0: (empty) 1: (empty) @@ -241,3 +263,5 @@ JsModule { 3: (empty) 1: SEMICOLON@112..129 ";" [] [Whitespace(" "), Comments("// OK")] 4: EOF@129..130 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_with_type_arguments.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_new_with_type_arguments.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_with_type_arguments.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_new_with_type_arguments.ts.snap index f12101a56256..2b9d8690414a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_new_with_type_arguments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_new_with_type_arguments.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class Test {} +new Test(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -93,7 +109,11 @@ JsModule { ], eof_token: EOF@43..44 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..44 0: (empty) 1: (empty) @@ -164,3 +184,5 @@ JsModule { 2: R_PAREN@41..42 ")" [] [] 1: SEMICOLON@42..43 ";" [] [] 4: EOF@43..44 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assertion_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assertion_expression.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assertion_expression.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assertion_expression.ts.snap index 0ad969e41570..a964ae68e6e6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assertion_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assertion_expression.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = { b: {} }; +a!; +function test() {} +test()! + a.b.c!; +a!!!!!!; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -142,7 +162,11 @@ JsModule { ], eof_token: EOF@67..68 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..68 0: (empty) 1: (empty) @@ -243,3 +267,5 @@ JsModule { 1: BANG@65..66 "!" [] [] 1: SEMICOLON@66..67 ";" [] [] 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assignment.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assignment.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_non_null_assignment.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assignment.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assignment.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assignment.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_non_null_assignment.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assignment.ts.snap index e4283b6a4a29..2da2ce25707d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_non_null_assignment.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_non_null_assignment.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a; +a! &= 2; +let b = { a: null }; +b.a! &= 5 + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -93,7 +111,11 @@ JsModule { ], eof_token: EOF@46..47 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..47 0: (empty) 1: (empty) @@ -158,3 +180,5 @@ JsModule { 0: JS_NUMBER_LITERAL@45..46 "5" [] [] 1: (empty) 4: EOF@46..47 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_object_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_object_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_object_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_object_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_object_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_object_type.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_object_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_object_type.ts.snap index 8573de5b9061..67a77f6184a6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_object_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_object_type.ts.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { a: string, b: number }; +type B = { a: string; b: number }; +type C = { a: string, b: number; c: string }; +type D = { + a: string + b: number +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -192,7 +213,11 @@ JsModule { ], eof_token: EOF@150..151 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..151 0: (empty) 1: (empty) @@ -333,3 +358,5 @@ JsModule { 2: R_CURLY@148..150 "}" [Newline("\n")] [] 5: (empty) 4: EOF@150..151 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_optional_chain_call.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_chain_call.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_optional_chain_call.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_chain_call.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_optional_chain_call.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_chain_call.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_optional_chain_call.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_chain_call.ts.snap index 658ceb6858e4..432bcc21a041 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_optional_chain_call.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_chain_call.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +(() => {})?.(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -79,7 +94,11 @@ JsModule { ], eof_token: EOF@27..28 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..28 0: (empty) 1: (empty) @@ -140,3 +159,5 @@ JsModule { 2: R_PAREN@25..26 ")" [] [] 1: SEMICOLON@26..27 ";" [] [] 4: EOF@27..28 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_optional_method_class_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_method_class_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_optional_method_class_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_method_class_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_optional_method_class_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_method_class_member.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_optional_method_class_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_method_class_member.ts.snap index 897b117190ad..be9c3238a2e8 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_optional_method_class_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_optional_method_class_member.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { test?() {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -43,7 +58,11 @@ JsModule { ], eof_token: EOF@22..23 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..23 0: (empty) 1: (empty) @@ -80,3 +99,5 @@ JsModule { 3: R_CURLY@19..21 "}" [] [Whitespace(" ")] 9: R_CURLY@21..22 "}" [] [] 4: EOF@22..23 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_parameter_option_binding_pattern.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_parameter_option_binding_pattern.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_parameter_option_binding_pattern.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_parameter_option_binding_pattern.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts.snap index 4b5130716c95..053b88921546 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_parameter_option_binding_pattern.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parameter_option_binding_pattern.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare namespace A { + export class Ajv { + errorsText(errors?: string[] | null | undefined, { separator, dataVar }?: ErrorsTextOptions): string; + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -127,7 +146,11 @@ JsModule { ], eof_token: EOF@154..155 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..155 0: (empty) 1: (empty) @@ -221,3 +244,5 @@ JsModule { 9: R_CURLY@148..152 "}" [Newline("\n"), Whitespace(" ")] [] 2: R_CURLY@152..154 "}" [Newline("\n")] [] 4: EOF@154..155 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_parenthesized_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parenthesized_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_parenthesized_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_parenthesized_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_parenthesized_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parenthesized_type.ts.snap similarity index 90% rename from crates/biome_js_parser/test_data/inline/ok/ts_parenthesized_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_parenthesized_type.ts.snap index 7a85ce3d5065..1fa48f9dfe60 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_parenthesized_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_parenthesized_type.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = (string) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -22,7 +37,11 @@ JsModule { ], eof_token: EOF@17..18 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..18 0: (empty) 1: (empty) @@ -41,3 +60,5 @@ JsModule { 2: R_PAREN@16..17 ")" [] [] 5: (empty) 4: EOF@17..18 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_predefined_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_predefined_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_predefined_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_predefined_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_predefined_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_predefined_type.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_predefined_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_predefined_type.ts.snap index 0e779f2756c2..68e3e0dccf59 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_predefined_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_predefined_type.ts.snap @@ -1,3 +1,28 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = any +type B = number; +type C = object; +type D = boolean; +type E = bigint; +type F = string; +type G = symbol; +type H = void; +type I = undefined; +type J = null; +type K = never + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -138,7 +163,11 @@ JsModule { ], eof_token: EOF@180..181 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..181 0: (empty) 1: (empty) @@ -244,3 +273,5 @@ JsModule { 0: NEVER_KW@175..180 "never" [] [] 5: (empty) 4: EOF@180..181 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts.snap index f4bd3f0c1b8e..431fb28c1784 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_property_class_member_can_be_named_set_or_get.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_class_member_can_be_named_set_or_get.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class B { set: String; get: Number } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -55,7 +70,11 @@ JsModule { ], eof_token: EOF@36..37 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..37 0: (empty) 1: (empty) @@ -98,3 +117,5 @@ JsModule { 4: (empty) 9: R_CURLY@35..36 "}" [] [] 4: EOF@36..37 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_or_method_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_property_or_method_signature_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_or_method_signature_member.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_property_or_method_signature_member.ts.snap index 076d49985a0b..5942d9af52dc 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_property_or_method_signature_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_or_method_signature_member.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { a?: string; b?(): number } +type B = { a: string, b(): number } +type C = { m(a: string, b: number, c: string): any } +type D = { readonly: string, readonly a: number } +type E = { m(a: A, b: B): never } +type F = { m(a: A): never } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -385,7 +405,11 @@ JsModule { ], eof_token: EOF@253..254 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..254 0: (empty) 1: (empty) @@ -664,3 +688,5 @@ JsModule { 2: R_CURLY@252..253 "}" [] [] 5: (empty) 4: EOF@253..254 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_property_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_property_parameter.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_property_parameter.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_parameter.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_property_parameter.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_property_parameter.ts.snap index 3a1e34c8fa54..38cce395eebe 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_property_parameter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_property_parameter.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { constructor(private x, protected y, public z) {} } +class B { constructor(readonly w, private readonly x, protected readonly y, public readonly z) {} } +class C { constructor(private x: string, readonly y?, z = "default", ...rest) {} } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -302,7 +319,11 @@ JsModule { ], eof_token: EOF@243..244 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..244 0: (empty) 1: (empty) @@ -525,3 +546,5 @@ JsModule { 3: R_CURLY@240..242 "}" [] [Whitespace(" ")] 9: R_CURLY@242..243 "}" [] [] 4: EOF@243..244 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_readonly_property_initializer_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_readonly_property_initializer_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_readonly_property_initializer_ambient_context.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_readonly_property_initializer_ambient_context.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts.snap index 84ea57a3d423..640f06019f89 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_readonly_property_initializer_ambient_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_readonly_property_initializer_ambient_context.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class A { readonly prop = "test"; } +class B { declare readonly prop = "test"; } +declare class A { private readonly prop = "test"; } +class B { declare private readonly prop = "test"; } +declare class A { static readonly prop = "test"; } +class B { declare static readonly prop = "test"; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -234,7 +254,11 @@ JsModule { ], eof_token: EOF@293..294 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..294 0: (empty) 1: (empty) @@ -405,3 +429,5 @@ JsModule { 4: SEMICOLON@290..292 ";" [] [Whitespace(" ")] 9: R_CURLY@292..293 "}" [] [] 4: EOF@293..294 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_reference_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_reference_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_reference_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_reference_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_reference_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_reference_type.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_reference_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_reference_type.ts.snap index d18bbdadee0e..85659a44fae4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_reference_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_reference_type.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = object; +type B = string; +type C = A; +type D = B.a; +type E = D.c.b.a; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -99,7 +118,11 @@ JsModule { ], eof_token: EOF@77..78 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..78 0: (empty) 1: (empty) @@ -173,3 +196,5 @@ JsModule { 1: (empty) 5: SEMICOLON@76..77 ";" [] [] 4: EOF@77..78 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_annotation.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_annotation.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_return_type_annotation.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_annotation.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_annotation.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_annotation.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_return_type_annotation.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_annotation.ts.snap index 7f613cede4dc..1d821eda4988 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_annotation.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_annotation.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = (a) => a is string; +type B = { test(a): a is string } +type C = { (a): a is string } +const a = { test(x): x is string { return typeof x === "string" } } +class D { test(x): x is string { return typeof x === "string"; } } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -300,7 +319,11 @@ JsModule { ], eof_token: EOF@227..228 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..228 0: (empty) 1: (empty) @@ -517,3 +540,5 @@ JsModule { 3: R_CURLY@224..226 "}" [] [Whitespace(" ")] 9: R_CURLY@226..227 "}" [] [] 4: EOF@227..228 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_asi.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_asi.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_return_type_asi.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_asi.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_asi.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_asi.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_return_type_asi.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_asi.ts.snap index b336c0792dbc..531090a547df 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_return_type_asi.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_return_type_asi.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface I { + foo(test: string): I + is(): boolean; + bar(test: string): I + asserts(): boolean; +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -130,7 +150,11 @@ JsModule { ], eof_token: EOF@96..97 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..97 0: (empty) 1: (empty) @@ -226,3 +250,5 @@ JsModule { 5: SEMICOLON@93..94 ";" [] [] 6: R_CURLY@94..96 "}" [Newline("\n")] [] 4: EOF@96..97 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_assignment.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_assignment.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_satisfies_assignment.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_assignment.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_assignment.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_assignment.ts.snap index d3e5cb7805ec..8bb506daeba4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_assignment.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_assignment.ts.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a: any; +type B = { a: A }; +(a satisfies string) = "string"; +((a satisfies any) satisfies string) = null; +({ b: a satisfies string } = { b: "test" }); +([ a satisfies string ] = [ "test" ]); +for (a satisfies string in []) {} +(a satisfies B) = { a: "test" }; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -280,7 +302,11 @@ JsModule { ], eof_token: EOF@270..271 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..271 0: (empty) 1: (empty) @@ -476,3 +502,5 @@ JsModule { 2: R_CURLY@268..269 "}" [] [] 1: SEMICOLON@269..270 ";" [] [] 4: EOF@270..271 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_satisfies_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_expression.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_expression.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_satisfies_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_expression.ts.snap index c17f3fda15f3..939e76bf15de 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_satisfies_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_satisfies_expression.ts.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +interface A { + a: string +}; +let x = { a: 'test' } satisfies A; +let y = { a: 'test', b: 'test' } satisfies A; +const z = undefined satisfies 1; +let not_a_satisfies_expression = undefined +satisfies; +let precedence = "hello" satisfies string + 3 satisfies number satisfies number; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -235,7 +258,11 @@ JsModule { ], eof_token: EOF@278..279 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..279 0: (empty) 1: (empty) @@ -396,3 +423,5 @@ JsModule { 0: NUMBER_KW@271..277 "number" [] [] 1: SEMICOLON@277..278 ";" [] [] 4: EOF@278..279 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_setter_signature_member.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_setter_signature_member.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_setter_signature_member.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_setter_signature_member.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_setter_signature_member.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_setter_signature_member.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_setter_signature_member.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_setter_signature_member.ts.snap index 850a0a28f36f..2aaf5b43c4b3 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_setter_signature_member.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_setter_signature_member.ts.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { set a(b: number) } +type B = { set a(b) } +// members that look like setters but aren't setters +type C = { set(a) } +type D = { set: number } +type E = { set } +type F = { set(b: number,) } +type G = {set a(b,)} +type H = {set(a, ) } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -290,7 +313,11 @@ JsModule { ], eof_token: EOF@237..238 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..238 0: (empty) 1: (empty) @@ -509,3 +536,5 @@ JsModule { 2: R_CURLY@236..237 "}" [] [] 5: (empty) 4: EOF@237..238 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_tagged_template_literal.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tagged_template_literal.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_tagged_template_literal.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_tagged_template_literal.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_tagged_template_literal.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tagged_template_literal.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_tagged_template_literal.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_tagged_template_literal.ts.snap index 096a403bdaba..c31c3155a776 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_tagged_template_literal.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tagged_template_literal.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +html`abcd` +html`abcd`._string + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -84,7 +100,11 @@ JsModule { ], eof_token: EOF@41..42 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..42 0: (empty) 1: (empty) @@ -143,3 +163,5 @@ JsModule { 0: IDENT@34..41 "_string" [] [] 1: (empty) 4: EOF@41..42 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_template_literal_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_template_literal_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_template_literal_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_template_literal_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_template_literal_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_template_literal_type.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_template_literal_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_template_literal_type.ts.snap index c817915525fd..517f2e044442 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_template_literal_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_template_literal_type.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = `abcd` +type B = `a${A}` +type C = `c${X}` + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -98,7 +115,11 @@ JsModule { ], eof_token: EOF@67..68 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..68 0: (empty) 1: (empty) @@ -170,3 +191,5 @@ JsModule { 2: BACKTICK@66..67 "`" [] [] 5: (empty) 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_this_parameter.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_parameter.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_this_parameter.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_this_parameter.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_this_parameter.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_parameter.ts.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_this_parameter.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_this_parameter.ts.snap index 3981d132a8f8..5a119751f2a9 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_this_parameter.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_parameter.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +function a(this) {} +function b(this: string) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -63,7 +79,11 @@ JsModule { ], eof_token: EOF@47..48 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..48 0: (empty) 1: (empty) @@ -113,3 +133,5 @@ JsModule { 2: JS_STATEMENT_LIST@46..46 3: R_CURLY@46..47 "}" [] [] 4: EOF@47..48 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_this_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_this_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_this_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_this_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_type.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_this_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_this_type.ts.snap index a38208a681a0..1d5caf24b4d4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_this_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_this_type.ts.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +class A { + method() { + type A = this; + } + predicate(): this is string { + return typeof this === "string" + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -106,7 +128,11 @@ JsModule { ], eof_token: EOF@135..136 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..136 0: (empty) 1: (empty) @@ -188,3 +214,5 @@ JsModule { 3: R_CURLY@127..133 "}" [Newline("\n"), Whitespace(" ")] [] 9: R_CURLY@133..135 "}" [Newline("\n")] [] 4: EOF@135..136 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_tuple_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tuple_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_tuple_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_tuple_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_tuple_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tuple_type.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_tuple_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_tuple_type.ts.snap index 1f94f0f97414..9a80f0619616 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_tuple_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_tuple_type.ts.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = [string, number, any] +type B = [a: string, b: number, c: any] +type C = [a: string, b: number, ...c: any[]] +type D = [a?: string] +type E = [...string[]] +type F = [string?] + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -208,7 +228,11 @@ JsModule { ], eof_token: EOF@179..180 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..180 0: (empty) 1: (empty) @@ -363,3 +387,5 @@ JsModule { 2: R_BRACK@178..179 "]" [] [] 5: (empty) 4: EOF@179..180 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_left_shift.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_left_shift.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_left_shift.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_left_shift.ts.snap index 34898894824f..748b34f48a74 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_left_shift.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_left_shift.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = T; +type B = A<(c: C) => undefined>; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -97,7 +113,11 @@ JsModule { ], eof_token: EOF@50..51 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..51 0: (empty) 1: (empty) @@ -168,3 +188,5 @@ JsModule { 2: R_ANGLE@48..49 ">" [] [] 5: SEMICOLON@49..50 ";" [] [] 4: EOF@50..51 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_like_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_like_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_like_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_like_expression.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_like_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_like_expression.ts.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_like_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_like_expression.ts.snap index de3aacba23b2..06f03fb40458 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_arguments_like_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_arguments_like_expression.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +0 < (0 >= 1); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -28,7 +43,11 @@ JsModule { ], eof_token: EOF@13..14 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..14 0: (empty) 1: (empty) @@ -50,3 +69,5 @@ JsModule { 2: R_PAREN@11..12 ")" [] [] 1: SEMICOLON@12..13 ";" [] [] 4: EOF@13..14 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_assertion.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_assertion.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion.ts.snap index b64bc10f1cbb..2ca3bb28aacf 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = b; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -36,7 +51,11 @@ JsModule { ], eof_token: EOF@18..19 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..19 0: (empty) 1: (empty) @@ -63,3 +82,5 @@ JsModule { 0: IDENT@16..17 "b" [] [] 1: SEMICOLON@17..18 ";" [] [] 4: EOF@18..19 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_assertion_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion_expression.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion_expression.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_assertion_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion_expression.ts.snap index 0688d3081053..9a44593740a7 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_assertion_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_assertion_expression.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let x = "hello"; +let y = x; +var d = ({ name: "foo", message: "bar" }); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -124,7 +141,11 @@ JsModule { ], eof_token: EOF@93..94 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..94 0: (empty) 1: (empty) @@ -211,3 +232,5 @@ JsModule { 2: R_PAREN@91..92 ")" [] [] 1: SEMICOLON@92..93 ";" [] [] 4: EOF@93..94 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_constraint_clause.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_constraint_clause.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_constraint_clause.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_constraint_clause.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_constraint_clause.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_constraint_clause.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_constraint_clause.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_constraint_clause.ts.snap index 577bde6eda1d..1cff6ea4ca6b 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_constraint_clause.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_constraint_clause.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = X; +type B = { a: X } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -98,7 +114,11 @@ JsModule { ], eof_token: EOF@74..75 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..75 0: (empty) 1: (empty) @@ -169,3 +189,5 @@ JsModule { 2: R_CURLY@73..74 "}" [] [] 5: (empty) 4: EOF@74..75 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_instantiation_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_instantiation_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_instantiation_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_instantiation_expression.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_instantiation_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_instantiation_expression.ts.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_instantiation_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_instantiation_expression.ts.snap index c99947ec60ad..93df461eb79e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_instantiation_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_instantiation_expression.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type StringBox = Box; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -29,7 +44,11 @@ JsModule { ], eof_token: EOF@29..30 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..30 0: (empty) 1: (empty) @@ -52,3 +71,5 @@ JsModule { 2: R_ANGLE@27..28 ">" [] [] 5: SEMICOLON@28..29 ";" [] [] 4: EOF@29..30 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_operator.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_operator.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_operator.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_operator.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_operator.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_operator.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_operator.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_operator.ts.snap index d3df2784c826..61d38b343c86 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_operator.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_operator.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { x: string, y: number }; +type B = keyof A; +type C = readonly string[]; +const d: unique symbol = Symbol(); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -126,7 +144,11 @@ JsModule { ], eof_token: EOF@115..116 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..116 0: (empty) 1: (empty) @@ -218,3 +240,5 @@ JsModule { 2: R_PAREN@113..114 ")" [] [] 1: SEMICOLON@114..115 ";" [] [] 4: EOF@115..116 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_parameters.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_parameters.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_parameters.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_parameters.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_parameters.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_parameters.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_parameters.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_parameters.ts.snap index bd1217a1a84e..71c18a2bf4f4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_parameters.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_parameters.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = { x: X, y: Y, z: Z } +type A<> = {} +interface A<> {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -165,7 +182,11 @@ JsModule { ], eof_token: EOF@126..127 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..127 0: (empty) 1: (empty) @@ -286,3 +307,5 @@ JsModule { 5: TS_TYPE_MEMBER_LIST@125..125 6: R_CURLY@125..126 "}" [] [] 4: EOF@126..127 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_predicate.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_predicate.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_predicate.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_predicate.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_predicate.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_predicate.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_predicate.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_predicate.ts.snap index 1c9f65e59d01..ab1fddac4a3e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_predicate.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_predicate.ts.snap @@ -1,3 +1,22 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = (a) => a is string; +type B = (a) => asserts a is string; +type C = (a) => asserts a; +type asserts = string; +type D = () => asserts; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -154,7 +173,11 @@ JsModule { ], eof_token: EOF@139..140 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..140 0: (empty) 1: (empty) @@ -270,3 +293,5 @@ JsModule { 1: (empty) 5: SEMICOLON@138..139 ";" [] [] 4: EOF@139..140 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_variable.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable.ts.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_variable.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable.ts.snap index c57f416e50ca..87114089bf9f 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable.ts.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let type; +type = getFlowTypeInConstructor(symbol, getDeclaringConstructor(symbol)!); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -75,7 +91,11 @@ JsModule { ], eof_token: EOF@84..85 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..85 0: (empty) 1: (empty) @@ -128,3 +148,5 @@ JsModule { 2: R_PAREN@82..83 ")" [] [] 1: SEMICOLON@83..84 ";" [] [] 4: EOF@84..85 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable_annotation.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable_annotation.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_variable_annotation.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable_annotation.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable_annotation.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable_annotation.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_type_variable_annotation.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable_annotation.ts.snap index 4a1f4211b785..238779614f71 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_type_variable_annotation.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_type_variable_annotation.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a: string = "test", b!: number; +let a // ASI +!function test() {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -91,7 +108,11 @@ JsModule { ], eof_token: EOF@68..69 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..69 0: (empty) 1: (empty) @@ -158,3 +179,5 @@ JsModule { 3: R_CURLY@67..68 "}" [] [] 1: (empty) 4: EOF@68..69 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_typeof_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_typeof_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type.ts.snap index c0e149776a4a..8239c1c536eb 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type.ts.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = "test"; +type B = typeof a; +type T21 = typeof Array; +type A = InstanceType>; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -118,7 +136,11 @@ JsModule { ], eof_token: EOF@110..111 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..111 0: (empty) 1: (empty) @@ -203,3 +225,5 @@ JsModule { 2: R_ANGLE@108..109 ">" [] [] 5: SEMICOLON@109..110 ";" [] [] 4: EOF@110..111 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type2.tsx b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type2.tsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_typeof_type2.tsx rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type2.tsx diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type2.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type2.tsx.snap similarity index 95% rename from crates/biome_js_parser/test_data/inline/ok/ts_typeof_type2.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type2.tsx.snap index a34111392102..e75465e502d6 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_typeof_type2.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_typeof_type2.tsx.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```tsx +type X = typeof Array +
a
; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -51,7 +67,11 @@ JsModule { ], eof_token: EOF@35..36 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..36 0: (empty) 1: (empty) @@ -90,3 +110,5 @@ JsModule { 3: R_ANGLE@33..34 ">" [] [] 1: SEMICOLON@34..35 ";" [] [] 4: EOF@35..36 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_union_type.ts b/crates/biome_js_parser/tests/js_test_suite/ok/ts_union_type.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/ts_union_type.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_union_type.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/ts_union_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/ts_union_type.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/ts_union_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/ts_union_type.ts.snap index 6787b0d3baf5..39c8f3d7847c 100644 --- a/crates/biome_js_parser/test_data/inline/ok/ts_union_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/ts_union_type.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type A = string | number; +type B = | A | void | null; +type C = A & C | C; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -94,7 +111,11 @@ JsModule { ], eof_token: EOF@73..74 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..74 0: (empty) 1: (empty) @@ -163,3 +184,5 @@ JsModule { 1: (empty) 5: SEMICOLON@72..73 ";" [] [] 4: EOF@73..74 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/tsx_element_generics_type.tsx b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_element_generics_type.tsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/tsx_element_generics_type.tsx rename to crates/biome_js_parser/tests/js_test_suite/ok/tsx_element_generics_type.tsx diff --git a/crates/biome_js_parser/test_data/inline/ok/tsx_element_generics_type.rast b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_element_generics_type.tsx.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/tsx_element_generics_type.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/tsx_element_generics_type.tsx.snap index a53d64d5b011..c8a5654d1d46 100644 --- a/crates/biome_js_parser/test_data/inline/ok/tsx_element_generics_type.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_element_generics_type.tsx.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```tsx +; + />; +>; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -77,7 +94,11 @@ JsModule { ], eof_token: EOF@61..62 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..62 0: (empty) 1: (empty) @@ -134,3 +155,5 @@ JsModule { 3: R_ANGLE@59..60 ">" [] [] 1: SEMICOLON@60..61 ";" [] [] 4: EOF@61..62 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/tsx_type_arguments.tsx b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_type_arguments.tsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/tsx_type_arguments.tsx rename to crates/biome_js_parser/tests/js_test_suite/ok/tsx_type_arguments.tsx diff --git a/crates/biome_js_parser/test_data/inline/ok/tsx_type_arguments.rast b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_type_arguments.tsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/tsx_type_arguments.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/tsx_type_arguments.tsx.snap index 0b4bf787949b..499308e2c3e0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/tsx_type_arguments.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/tsx_type_arguments.tsx.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```tsx +// These are valid type arguments +() => {}; +() => {}; +
() => {}; +() => {}; +() => {}; +>() => {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -251,7 +272,11 @@ JsModule { ], eof_token: EOF@152..153 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..153 0: (empty) 1: (empty) @@ -439,3 +464,5 @@ JsModule { 3: R_CURLY@150..151 "}" [] [] 1: SEMICOLON@151..152 ";" [] [] 4: EOF@152..153 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/type_arguments_like_expression.js b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_like_expression.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/type_arguments_like_expression.js rename to crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_like_expression.js diff --git a/crates/biome_js_parser/test_data/inline/ok/type_arguments_like_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_like_expression.js.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/type_arguments_like_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_like_expression.js.snap index 0d0eb81ed0d3..9422cc6b5635 100644 --- a/crates/biome_js_parser/test_data/inline/ok/type_arguments_like_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_like_expression.js.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +((0)<5>(6)) + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -36,7 +51,11 @@ JsModule { ], eof_token: EOF@11..12 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..12 0: (empty) 1: (empty) @@ -64,3 +83,5 @@ JsModule { 2: R_PAREN@10..11 ")" [] [] 1: (empty) 4: EOF@11..12 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/type_arguments_no_recovery.ts b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_no_recovery.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/type_arguments_no_recovery.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_no_recovery.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/type_arguments_no_recovery.rast b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_no_recovery.ts.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/type_arguments_no_recovery.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_no_recovery.ts.snap index e7da13c020d5..3ff86b0a974e 100644 --- a/crates/biome_js_parser/test_data/inline/ok/type_arguments_no_recovery.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/type_arguments_no_recovery.ts.snap @@ -1,3 +1,26 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +for (let i = 0 ; i < 3; ++i) { + verify.completions({ + marker: `${i + 1}`, + exact: [ + { name: "foo", replacementSpan: test.ranges()[i] }, + { name: "bar", replacementSpan: test.ranges()[i] }, + ] + }); +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -232,7 +255,11 @@ JsModule { ], eof_token: EOF@248..249 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..249 0: (empty) 1: (empty) @@ -395,3 +422,5 @@ JsModule { 1: SEMICOLON@245..246 ";" [] [] 2: R_CURLY@246..248 "}" [Newline("\n")] [] 4: EOF@248..249 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/type_assertion_primary_expression.ts b/crates/biome_js_parser/tests/js_test_suite/ok/type_assertion_primary_expression.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/type_assertion_primary_expression.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/type_assertion_primary_expression.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/type_assertion_primary_expression.rast b/crates/biome_js_parser/tests/js_test_suite/ok/type_assertion_primary_expression.ts.snap similarity index 94% rename from crates/biome_js_parser/test_data/inline/ok/type_assertion_primary_expression.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/type_assertion_primary_expression.ts.snap index b3e1012ad88a..7a6fb1ba1a3a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/type_assertion_primary_expression.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/type_assertion_primary_expression.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +let a = undefined; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -36,7 +51,11 @@ JsModule { ], eof_token: EOF@26..27 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..27 0: (empty) 1: (empty) @@ -63,3 +82,5 @@ JsModule { 0: IDENT@16..25 "undefined" [] [] 1: SEMICOLON@25..26 ";" [] [] 4: EOF@26..27 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier.ts b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier.rast b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier.ts.snap similarity index 99% rename from crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier.ts.snap index 36f02e0fdb6a..8de2f9bd1755 100644 --- a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier.ts.snap @@ -1,3 +1,67 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +type Foo = {} +class Foo {} +class Foo {} +export default class Foo {} +class Foo {} +interface Foo {} +interface Foo {} +declare class Foo {} +declare class Foo {} +declare interface Foo {} +declare interface Foo {} +function a() {} +function b() {} +function c() {} +declare function d(); +() => {}; +() => {}; +(function () {}); +(function () {}); +(function () {}); +class A {} +class B {} +class C {} +class D {} +class E {} +class F {} +(class {}); +(class {}); +(class {}); +(class {}); +(class {}); +class _ { + method() {} + method() {} + method() {} +} +declare module a { + function test(): T; +} +const obj = { + a(b: any): b is T { return true; } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -1749,7 +1813,11 @@ JsModule { ], eof_token: EOF@1214..1215 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..1215 0: (empty) 1: (empty) @@ -3021,3 +3089,5 @@ JsModule { 2: R_CURLY@1212..1214 "}" [Newline("\n")] [] 1: (empty) 4: EOF@1214..1215 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.tsx b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.tsx rename to crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx diff --git a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.rast b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx.snap index 6d6c82ba16c2..aa421125c7b5 100644 --- a/crates/biome_js_parser/test_data/inline/ok/type_parameter_modifier_tsx.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/type_parameter_modifier_tsx.tsx.snap @@ -1,3 +1,25 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```tsx +; +; +; +; +; +; +; +; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -325,7 +347,11 @@ JsModule { ], eof_token: EOF@171..172 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..172 0: (empty) 1: (empty) @@ -550,3 +576,5 @@ JsModule { 3: R_ANGLE@169..170 ">" [] [] 1: SEMICOLON@170..171 ";" [] [] 4: EOF@171..172 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_enum.ts b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_enum.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/typescript_enum.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/typescript_enum.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_enum.rast b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_enum.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/typescript_enum.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/typescript_enum.ts.snap index 42bdc51923c5..e47bd46effe1 100644 --- a/crates/biome_js_parser/test_data/inline/ok/typescript_enum.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_enum.ts.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +enum A {} +enum B { a, b, c } +const enum C { A = 1, B = A * 2, ["A"] = 3, } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -106,7 +123,11 @@ JsModule { ], eof_token: EOF@74..75 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..75 0: (empty) 1: (empty) @@ -183,3 +204,5 @@ JsModule { 5: COMMA@71..73 "," [] [Whitespace(" ")] 5: R_CURLY@73..74 "}" [] [] 4: EOF@74..75 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_export_default_abstract_class_case.ts b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/typescript_export_default_abstract_class_case.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_export_default_abstract_class_case.rast b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts.snap similarity index 92% rename from crates/biome_js_parser/test_data/inline/ok/typescript_export_default_abstract_class_case.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts.snap index 2bc38719adcc..0202f8f9b603 100644 --- a/crates/biome_js_parser/test_data/inline/ok/typescript_export_default_abstract_class_case.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_export_default_abstract_class_case.ts.snap @@ -1,3 +1,18 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +export default abstract class {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -26,7 +41,11 @@ JsModule { ], eof_token: EOF@32..33 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..33 0: (empty) 1: (empty) @@ -50,3 +69,5 @@ JsModule { 9: R_CURLY@31..32 "}" [] [] 2: (empty) 4: EOF@32..33 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.ts b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.ts rename to crates/biome_js_parser/tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts diff --git a/crates/biome_js_parser/test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.rast b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts.snap index 9555ccbce9e9..41c7f605bd68 100644 --- a/crates/biome_js_parser/test_data/inline/ok/typescript_members_can_have_no_body_in_ambient_context.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/typescript_members_can_have_no_body_in_ambient_context.ts.snap @@ -1,3 +1,31 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```ts +declare class Test { + constructor(); + name(); + get test(): string; + set test(v); +} +declare namespace n { + class Test { + constructor() + name() + get test(): string + set test(v) + } +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -182,7 +210,11 @@ JsModule { ], eof_token: EOF@231..232 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..232 0: (empty) 1: (empty) @@ -325,3 +357,5 @@ JsModule { 9: R_CURLY@222..229 "}" [Newline("\n"), Whitespace(" ")] [] 2: R_CURLY@229..231 "}" [Newline("\n")] [] 4: EOF@231..232 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/unary_delete.js b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/unary_delete.js rename to crates/biome_js_parser/tests/js_test_suite/ok/unary_delete.js diff --git a/crates/biome_js_parser/test_data/inline/ok/unary_delete.rast b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/unary_delete.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/unary_delete.js.snap index 3cb0b7158a87..d440b6427c1a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/unary_delete.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete.js.snap @@ -1,3 +1,42 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +delete obj.key; +delete (obj).key; +delete obj.#member.key; +delete (obj.#member).key; +delete func().#member.key; +delete (func().#member).key; +delete obj?.#member.key; +delete (obj?.#member).key; +delete obj?.inner.#member.key; +delete (obj?.inner.#member).key; +delete obj[key]; +delete (obj)[key]; +delete obj.#member[key]; +delete (obj.#member)[key]; +delete func().#member[key]; +delete (func().#member)[key]; +delete obj?.#member[key]; +delete (obj?.#member)[key]; +delete obj?.inner.#member[key]; +delete (obj?.inner.#member)[key]; +delete (obj.#key, obj.key); +delete (#key in obj); +delete (obj.key); +delete (console.log(1)); +delete (() => {}); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -738,7 +777,11 @@ JsModule { ], eof_token: EOF@633..634 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..634 0: (empty) 1: (empty) @@ -1246,3 +1289,5 @@ JsModule { 2: R_PAREN@631..632 ")" [] [] 1: SEMICOLON@632..633 ";" [] [] 4: EOF@633..634 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/unary_delete_nested.js b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete_nested.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/unary_delete_nested.js rename to crates/biome_js_parser/tests/js_test_suite/ok/unary_delete_nested.js diff --git a/crates/biome_js_parser/test_data/inline/ok/unary_delete_nested.rast b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete_nested.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/unary_delete_nested.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/unary_delete_nested.js.snap index 6b3c1a050582..05b1663c04a0 100644 --- a/crates/biome_js_parser/test_data/inline/ok/unary_delete_nested.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/unary_delete_nested.js.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +class TestClass { #member = true; method() { delete func(this.#member) } } +class TestClass { #member = true; method() { delete [this.#member] } } +class TestClass { #member = true; method() { delete { key: this.#member } } } +class TestClass { #member = true; method() { delete (() => { this.#member; }) } } +class TestClass { #member = true; method() { delete (param => { this.#member; }) } } +class TestClass { #member = true; method() { delete (async () => { this.#member; }) } } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -526,7 +546,11 @@ JsModule { ], eof_token: EOF@478..479 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..479 0: (empty) 1: (empty) @@ -922,3 +946,5 @@ JsModule { 3: R_CURLY@475..477 "}" [] [Whitespace(" ")] 9: R_CURLY@477..478 "}" [] [] 4: EOF@478..479 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/using_declaration_statement.js b/crates/biome_js_parser/tests/js_test_suite/ok/using_declaration_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/using_declaration_statement.js rename to crates/biome_js_parser/tests/js_test_suite/ok/using_declaration_statement.js diff --git a/crates/biome_js_parser/test_data/inline/ok/using_declaration_statement.rast b/crates/biome_js_parser/tests/js_test_suite/ok/using_declaration_statement.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/using_declaration_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/using_declaration_statement.js.snap index 36c640634203..6d0f6ba3cfd7 100644 --- a/crates/biome_js_parser/test_data/inline/ok/using_declaration_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/using_declaration_statement.js.snap @@ -1,3 +1,32 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +using a = b; +using c = d, e = _; +using [g] = h; +using [j] += k; +await using l = m; +await +using p = q; +await using[r]; +await using ([s] = t); +await (using [u] = v); +using w = {}; +using x = null; +using y = undefined; +using z = (foo, bar); + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -359,7 +388,11 @@ JsModule { ], eof_token: EOF@235..236 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..236 0: (empty) 1: (empty) @@ -598,3 +631,5 @@ JsModule { 2: R_PAREN@233..234 ")" [] [] 1: SEMICOLON@234..235 ";" [] [] 4: EOF@235..236 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.js b/crates/biome_js_parser/tests/js_test_suite/ok/using_declarations_inside_for_statement.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.js rename to crates/biome_js_parser/tests/js_test_suite/ok/using_declarations_inside_for_statement.js diff --git a/crates/biome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.rast b/crates/biome_js_parser/tests/js_test_suite/ok/using_declarations_inside_for_statement.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/using_declarations_inside_for_statement.js.snap index 61125cf7ed08..1cf0aaea8dd8 100644 --- a/crates/biome_js_parser/test_data/inline/ok/using_declarations_inside_for_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/using_declarations_inside_for_statement.js.snap @@ -1,3 +1,21 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +for (using x of y) {}; +for await (using x of y) {}; +for (await using x of y) {}; +for await (await using x of y) {}; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -130,7 +148,11 @@ JsModule { ], eof_token: EOF@115..116 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..116 0: (empty) 1: (empty) @@ -229,3 +251,5 @@ JsModule { 7: JS_EMPTY_STATEMENT@114..115 0: SEMICOLON@114..115 ";" [] [] 4: EOF@115..116 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/var_decl.js b/crates/biome_js_parser/tests/js_test_suite/ok/var_decl.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/var_decl.js rename to crates/biome_js_parser/tests/js_test_suite/ok/var_decl.js diff --git a/crates/biome_js_parser/test_data/inline/ok/var_decl.rast b/crates/biome_js_parser/tests/js_test_suite/ok/var_decl.js.snap similarity index 98% rename from crates/biome_js_parser/test_data/inline/ok/var_decl.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/var_decl.js.snap index 1233d513f741..4c6c78fead70 100644 --- a/crates/biome_js_parser/test_data/inline/ok/var_decl.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/var_decl.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +var a = 5; +let { foo, bar } = 5; +let bar2, foo2; +const b = 5; +const { foo5: [bar11], baz6 } = {}; +let foo6 = "lorem", bar7 = "ipsum", third8 = "value", fourth = 6; +var q, w, e, r, t; + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -269,7 +290,11 @@ JsModule { ], eof_token: EOF@182..183 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..183 0: (empty) 1: (empty) @@ -458,3 +483,5 @@ JsModule { 2: (empty) 1: SEMICOLON@181..182 ";" [] [] 4: EOF@182..183 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/while_stmt.js b/crates/biome_js_parser/tests/js_test_suite/ok/while_stmt.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/while_stmt.js rename to crates/biome_js_parser/tests/js_test_suite/ok/while_stmt.js diff --git a/crates/biome_js_parser/test_data/inline/ok/while_stmt.rast b/crates/biome_js_parser/tests/js_test_suite/ok/while_stmt.js.snap similarity index 93% rename from crates/biome_js_parser/test_data/inline/ok/while_stmt.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/while_stmt.js.snap index 9450d0b74378..69ccbfe25ee4 100644 --- a/crates/biome_js_parser/test_data/inline/ok/while_stmt.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/while_stmt.js.snap @@ -1,3 +1,19 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +while (true) {} +while (5) {} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -32,7 +48,11 @@ JsModule { ], eof_token: EOF@28..29 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..29 0: (empty) 1: (empty) @@ -59,3 +79,5 @@ JsModule { 1: JS_STATEMENT_LIST@27..27 2: R_CURLY@27..28 "}" [] [] 4: EOF@28..29 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/with_statement.js b/crates/biome_js_parser/tests/js_test_suite/ok/with_statement.cjs similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/with_statement.js rename to crates/biome_js_parser/tests/js_test_suite/ok/with_statement.cjs diff --git a/crates/biome_js_parser/test_data/inline/ok/with_statement.rast b/crates/biome_js_parser/tests/js_test_suite/ok/with_statement.cjs.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/with_statement.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/with_statement.cjs.snap index 344d4c3cc293..26cf622d215a 100644 --- a/crates/biome_js_parser/test_data/inline/ok/with_statement.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/with_statement.cjs.snap @@ -1,3 +1,23 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```cjs +// SCRIPT +function f(x, o) { + with (o) { + console.log(x); + } +} + +``` + + +## AST + +``` JsScript { bom_token: missing (optional), interpreter_token: missing (optional), @@ -93,7 +113,11 @@ JsScript { ], eof_token: EOF@67..68 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_SCRIPT@0..68 0: (empty) 1: (empty) @@ -162,3 +186,5 @@ JsScript { 2: R_CURLY@61..65 "}" [Newline("\n"), Whitespace(" ")] [] 3: R_CURLY@65..67 "}" [Newline("\n")] [] 4: EOF@67..68 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/yield_expr.js b/crates/biome_js_parser/tests/js_test_suite/ok/yield_expr.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/yield_expr.js rename to crates/biome_js_parser/tests/js_test_suite/ok/yield_expr.js diff --git a/crates/biome_js_parser/test_data/inline/ok/yield_expr.rast b/crates/biome_js_parser/tests/js_test_suite/ok/yield_expr.js.snap similarity index 96% rename from crates/biome_js_parser/test_data/inline/ok/yield_expr.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/yield_expr.js.snap index 6b1bd5b5b464..41e2951d6fe3 100644 --- a/crates/biome_js_parser/test_data/inline/ok/yield_expr.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/yield_expr.js.snap @@ -1,3 +1,24 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function *foo() { + yield foo; + yield* foo; + yield; + yield + yield +} + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -77,7 +98,11 @@ JsModule { ], eof_token: EOF@66..67 "" [Newline("\n")] [], } +``` +## CST + +``` 0: JS_MODULE@0..67 0: (empty) 1: (empty) @@ -134,3 +159,5 @@ JsModule { 1: (empty) 3: R_CURLY@64..66 "}" [Newline("\n")] [] 4: EOF@66..67 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/test_data/inline/ok/yield_in_generator_function.js b/crates/biome_js_parser/tests/js_test_suite/ok/yield_in_generator_function.js similarity index 100% rename from crates/biome_js_parser/test_data/inline/ok/yield_in_generator_function.js rename to crates/biome_js_parser/tests/js_test_suite/ok/yield_in_generator_function.js diff --git a/crates/biome_js_parser/test_data/inline/ok/yield_in_generator_function.rast b/crates/biome_js_parser/tests/js_test_suite/ok/yield_in_generator_function.js.snap similarity index 97% rename from crates/biome_js_parser/test_data/inline/ok/yield_in_generator_function.rast rename to crates/biome_js_parser/tests/js_test_suite/ok/yield_in_generator_function.js.snap index 779baf5e50ca..19ea2f7f559d 100644 --- a/crates/biome_js_parser/test_data/inline/ok/yield_in_generator_function.rast +++ b/crates/biome_js_parser/tests/js_test_suite/ok/yield_in_generator_function.js.snap @@ -1,3 +1,20 @@ +--- +source: crates/biome_js_parser/tests/spec_test.rs +expression: snapshot +--- +## Input + +```jsx +function* foo() { yield 10; } +function* foo() { yield *bar; } +function* foo() { yield; } + +``` + + +## AST + +``` JsModule { bom_token: missing (optional), interpreter_token: missing (optional), @@ -105,7 +122,11 @@ JsModule { ], eof_token: EOF@88..89 "" [Newline("\n")] [], } +``` + +## CST +``` 0: JS_MODULE@0..89 0: (empty) 1: (empty) @@ -185,3 +206,5 @@ JsModule { 1: SEMICOLON@85..87 ";" [] [Whitespace(" ")] 3: R_CURLY@87..88 "}" [] [] 4: EOF@88..89 "" [Newline("\n")] [] + +``` diff --git a/crates/biome_js_parser/tests/spec_test.rs b/crates/biome_js_parser/tests/spec_test.rs new file mode 100644 index 000000000000..87772e2e7f4f --- /dev/null +++ b/crates/biome_js_parser/tests/spec_test.rs @@ -0,0 +1,189 @@ +use biome_configuration::PartialConfiguration; +use biome_console::fmt::{Formatter, Termcolor}; +use biome_console::markup; +use biome_deserialize::json::deserialize_from_str; +use biome_diagnostics::display::PrintDiagnostic; +use biome_diagnostics::DiagnosticExt; +use biome_diagnostics::{print_diagnostic_to_string, termcolor}; +use biome_fs::BiomePath; +use biome_js_parser::{parse, JsParserOptions}; +use biome_js_syntax::JsFileSource; +use biome_rowan::SyntaxKind; +use biome_service::settings::Settings; +use biome_test_utils::has_bogus_nodes_or_empty_slots; +use std::fmt::Write; +use std::fs; +use std::path::Path; + +#[derive(Copy, Clone)] +pub enum ExpectedOutcome { + Pass, + Fail, + Undefined, +} + +pub fn run(test_case: &str, _snapshot_name: &str, test_directory: &str, outcome_str: &str) { + let outcome = match outcome_str { + "ok" => ExpectedOutcome::Pass, + "error" => ExpectedOutcome::Fail, + "undefined" => ExpectedOutcome::Undefined, + _ => panic!("Invalid expected outcome {outcome_str}"), + }; + + let test_case_path = Path::new(test_case); + + let file_name = test_case_path + .file_name() + .expect("Expected test to have a file name") + .to_str() + .expect("File name to be valid UTF8"); + + let content = fs::read_to_string(test_case_path) + .expect("Expected test path to be a readable file in UTF8 encoding"); + + let mut options = JsParserOptions::default(); + + let options_path = Path::new(test_case_path).with_extension("options.json"); + + if options_path.exists() { + let mut options_path = BiomePath::new(&options_path); + + let mut settings = Settings::default(); + // SAFETY: we checked its existence already, we assume we have rights to read it + let (test_options, diagnostics) = deserialize_from_str::( + options_path.get_buffer_from_file().as_str(), + ) + .consume(); + + settings + .merge_with_configuration(test_options.unwrap_or_default(), None, None, &[]) + .unwrap(); + + let settings = settings.languages.javascript.parser; + + if settings.parse_class_parameter_decorators { + options = options.with_parse_class_parameter_decorators(); + } + + if settings.grit_metavariables { + options = options.with_metavariables(); + } + + if !diagnostics.is_empty() { + for diagnostic in diagnostics { + println!("{:?}", print_diagnostic_to_string(&diagnostic)); + } + + panic!("Configuration is invalid"); + } + } + + let file_source = JsFileSource::try_from(test_case_path).unwrap_or_default(); + + let extension = file_source.file_extension(); + let parsed = parse(&content, file_source, options); + let formatted_ast = format!("{:#?}", parsed.tree()); + + let mut snapshot = String::new(); + writeln!(snapshot, "\n## Input\n\n```{extension}\n{content}\n```\n\n").unwrap(); + + writeln!( + snapshot, + r#"## AST + +``` +{formatted_ast} +``` + +## CST + +``` +{:#?} +``` +"#, + parsed.syntax() + ) + .unwrap(); + + let diagnostics = parsed.diagnostics(); + if !diagnostics.is_empty() { + let mut diagnostics_buffer = termcolor::Buffer::no_color(); + + let termcolor = &mut Termcolor(&mut diagnostics_buffer); + let mut formatter = Formatter::new(termcolor); + + for diagnostic in diagnostics { + let error = diagnostic + .clone() + .with_file_path(file_name) + .with_file_source_code(&content); + + formatter + .write_markup(markup! { + {PrintDiagnostic::verbose(&error)} + }) + .expect("failed to emit diagnostic"); + } + + let formatted_diagnostics = + std::str::from_utf8(diagnostics_buffer.as_slice()).expect("non utf8 in error buffer"); + + if matches!(outcome, ExpectedOutcome::Pass) { + panic!("Expected no errors to be present in a test case that is expected to pass but the following diagnostics are present:\n{formatted_diagnostics}") + } + + writeln!(snapshot, "## Diagnostics\n\n```").unwrap(); + snapshot.write_str(formatted_diagnostics).unwrap(); + + writeln!(snapshot, "```\n").unwrap(); + } + + match outcome { + ExpectedOutcome::Pass => { + let missing_required = formatted_ast.contains("missing (required)"); + if missing_required + || parsed + .syntax() + .descendants() + .any(|node| node.kind().is_bogus()) + { + panic!("Parsed tree of a 'OK' test case should not contain any missing required children or bogus nodes: \n {formatted_ast:#?} \n\n {formatted_ast}"); + } + + let syntax = parsed.syntax(); + if has_bogus_nodes_or_empty_slots(&syntax) { + panic!("modified tree has bogus nodes or empty slots:\n{syntax:#?} \n\n {syntax}") + } + } + ExpectedOutcome::Fail => { + if parsed.diagnostics().is_empty() { + panic!("Failing test must have diagnostics"); + } + } + _ => {} + } + + insta::with_settings!({ + prepend_module_to_snapshot => false, + snapshot_path => &test_directory, + }, { + insta::assert_snapshot!(file_name, snapshot); + }); +} + +#[ignore] +#[test] +pub fn quick_test() { + let code = r#" +function name() { + return "string"; +} + "#; + + let root = parse(code, JsFileSource::default(), JsParserOptions::default()); + let syntax = root.syntax(); + dbg!(&syntax, root.diagnostics(), root.has_errors()); + if has_bogus_nodes_or_empty_slots(&syntax) { + panic!("modified tree has bogus nodes or empty slots:\n{syntax:#?} \n\n {syntax}") + } +} diff --git a/crates/biome_js_parser/tests/spec_tests.rs b/crates/biome_js_parser/tests/spec_tests.rs new file mode 100644 index 000000000000..c2eaca65e123 --- /dev/null +++ b/crates/biome_js_parser/tests/spec_tests.rs @@ -0,0 +1,10 @@ +#![allow(non_snake_case)] + +mod spec_test; + +mod ok { + tests_macros::gen_tests! {"tests/js_test_suite/ok/**/*.{js,cjs,mjs,jsx,ts,tsx,d.ts}", crate::spec_test::run, "ok"} +} +mod err { + tests_macros::gen_tests! {"tests/js_test_suite/error/**/*.{js,cjs,mjs,jsx,ts,tsx,d.ts}", crate::spec_test::run, "error"} +} diff --git a/crates/biome_service/src/file_handlers/javascript.rs b/crates/biome_service/src/file_handlers/javascript.rs index bb8f441f4564..5fb6774ef077 100644 --- a/crates/biome_service/src/file_handlers/javascript.rs +++ b/crates/biome_service/src/file_handlers/javascript.rs @@ -73,6 +73,7 @@ pub struct JsFormatterSettings { #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] pub struct JsParserSettings { pub parse_class_parameter_decorators: bool, + pub grit_metavariables: bool, } #[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] diff --git a/crates/biome_service/src/settings.rs b/crates/biome_service/src/settings.rs index 77089af01bcb..43c2ca3144e3 100644 --- a/crates/biome_service/src/settings.rs +++ b/crates/biome_service/src/settings.rs @@ -589,6 +589,7 @@ impl From for LanguageSettings { language_setting.formatter.indent_style = formatter.indent_style.map(Into::into); language_setting.parser.parse_class_parameter_decorators = javascript.parser.unsafe_parameter_decorators_enabled; + language_setting.parser.grit_metavariables = javascript.parser.grit_metavariables; language_setting.globals = Some(javascript.globals.into_index_set()); language_setting.environment = javascript.jsx_runtime.into();