diff --git a/crates/rome_formatter_test/src/prettier/package-lock.json b/crates/rome_formatter_test/src/prettier/package-lock.json new file mode 100644 index 00000000000..48c754deb60 --- /dev/null +++ b/crates/rome_formatter_test/src/prettier/package-lock.json @@ -0,0 +1,52 @@ +{ + "name": "prettier-tests", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "prettier-tests", + "dependencies": { + "prettier": "2.8.4" + }, + "devDependencies": { + "@types/prettier": "^2.7.1" + }, + "engines": { + "pnpm": "^7.0.0" + } + }, + "node_modules/@types/prettier": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", + "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", + "dev": true + }, + "node_modules/prettier": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + } + }, + "dependencies": { + "@types/prettier": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", + "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", + "dev": true + }, + "prettier": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==" + } + } +} diff --git a/crates/rome_formatter_test/src/prettier/package.json b/crates/rome_formatter_test/src/prettier/package.json index 57f907698a9..518f1fb6642 100644 --- a/crates/rome_formatter_test/src/prettier/package.json +++ b/crates/rome_formatter_test/src/prettier/package.json @@ -4,7 +4,7 @@ "start": "node prepare_tests" }, "dependencies": { - "prettier": "2.8.1" + "prettier": "2.8.4" }, "devDependencies": { "@types/prettier": "^2.7.1" diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrays/holes-in-args.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrays/holes-in-args.js.snap index 184b7259355..41a3bf38977 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrays/holes-in-args.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrays/holes-in-args.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/arrays/holes-in-args.js +assertion_line: 212 +info: js/arrays/holes-in-args.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrays/issue-10159.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrays/issue-10159.js.snap index c4b374a3a38..e4a7ced0b2f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrays/issue-10159.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrays/issue-10159.js.snap @@ -1,5 +1,6 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 info: js/arrays/issue-10159.js --- diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-negative.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-negative.js.snap index 72835bbf8a4..8ed5830e083 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-negative.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-negative.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/arrays/numbers-negative.js +assertion_line: 212 +info: js/arrays/numbers-negative.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-with-holes.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-with-holes.js.snap index 0455725b094..593ea5e8b9a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-with-holes.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-with-holes.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/arrays/numbers-with-holes.js +assertion_line: 212 +info: js/arrays/numbers-with-holes.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-with-tricky-comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-with-tricky-comments.js.snap index 7c97b34ea83..835f46c8134 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-with-tricky-comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrays/numbers-with-tricky-comments.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/arrays/numbers-with-tricky-comments.js +assertion_line: 212 +info: js/arrays/numbers-with-tricky-comments.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrows-bind/arrows-bind.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrows-bind/arrows-bind.js.snap index c3f8c130994..025322a9cf5 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrows-bind/arrows-bind.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrows-bind/arrows-bind.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/arrows-bind/arrows-bind.js +assertion_line: 212 +info: js/arrows-bind/arrows-bind.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/arrow_function_expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/arrow_function_expression.js.snap index eaf767b6f7e..27fb7118aff 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/arrow_function_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/arrow_function_expression.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/arrows/arrow_function_expression.js +assertion_line: 212 +info: js/arrows/arrow_function_expression.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/curried.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/curried.js.snap index 53ebbfcb093..dab8bfdec03 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/curried.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/curried.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/arrows/curried.js +assertion_line: 212 +info: js/arrows/curried.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/currying-2.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/currying-2.js.snap index b24a595d38c..2fb0cce2732 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/currying-2.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/currying-2.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/arrows/currying-2.js +assertion_line: 212 +info: js/arrows/currying-2.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/issue-1389-curry.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/issue-1389-curry.js.snap index 72968fae06a..f45b310152f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/issue-1389-curry.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/issue-1389-curry.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/arrows/issue-1389-curry.js +assertion_line: 212 +info: js/arrows/issue-1389-curry.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/newline-before-arrow/newline-before-arrow.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/newline-before-arrow/newline-before-arrow.js.snap index 83b159b7f6d..ba92b61346f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/arrows/newline-before-arrow/newline-before-arrow.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/arrows/newline-before-arrow/newline-before-arrow.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/arrows/newline-before-arrow/newline-before-arrow.js +assertion_line: 212 +info: js/arrows/newline-before-arrow/newline-before-arrow.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/async-do-expressions/async-do-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/async-do-expressions/async-do-expressions.js.snap index 02fc76c1984..acc5a6fd977 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/async-do-expressions/async-do-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/async-do-expressions/async-do-expressions.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/async-do-expressions/async-do-expressions.js +assertion_line: 212 +info: js/async-do-expressions/async-do-expressions.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/async-do-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/async-do-expressions.js.snap index 1d62e1effc8..fa1f8defa43 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/async-do-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/async-do-expressions.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/async-do-expressions.js +assertion_line: 212 +info: js/babel-plugins/async-do-expressions.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decimal.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decimal.js.snap index 8e880a63c13..3cbd1ad1099 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decimal.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/decimal.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/decimal.js +assertion_line: 212 +info: js/babel-plugins/decimal.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/do-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/do-expressions.js.snap index e014e08f077..c2e1634c6fd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/do-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/do-expressions.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/do-expressions.js +assertion_line: 212 +info: js/babel-plugins/do-expressions.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/export-default-from.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/export-default-from.js.snap index d360854656b..cf8e7059fb2 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/export-default-from.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/export-default-from.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/export-default-from.js +assertion_line: 212 +info: js/babel-plugins/export-default-from.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/function-bind.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/function-bind.js.snap index ccdf6e03a3a..4de35616588 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/function-bind.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/function-bind.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/function-bind.js +assertion_line: 212 +info: js/babel-plugins/function-bind.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/module-blocks.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/module-blocks.js.snap index 2b460eba68c..e8a369e87a9 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/module-blocks.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/module-blocks.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/module-blocks.js +assertion_line: 212 +info: js/babel-plugins/module-blocks.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/partial-application.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/partial-application.js.snap index bdf757e4cf2..fd6a168e88a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/partial-application.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/partial-application.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/partial-application.js +assertion_line: 212 +info: js/babel-plugins/partial-application.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-fsharp.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-fsharp.js.snap index d6b62f9816d..2f6c26c8afc 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-fsharp.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-fsharp.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/pipeline-operator-fsharp.js +assertion_line: 212 +info: js/babel-plugins/pipeline-operator-fsharp.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-hack.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-hack.js.snap index 473c5c2a110..78ae955a7ac 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-hack.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-hack.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/pipeline-operator-hack.js +assertion_line: 212 +info: js/babel-plugins/pipeline-operator-hack.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-minimal.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-minimal.js.snap index 972184b5cc0..5da13b835c2 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-minimal.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/pipeline-operator-minimal.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/pipeline-operator-minimal.js +assertion_line: 212 +info: js/babel-plugins/pipeline-operator-minimal.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-record.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-record.js.snap index 4cbc075fa90..c8479912f94 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-record.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-record.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/record-tuple-record.js +assertion_line: 212 +info: js/babel-plugins/record-tuple-record.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-tuple.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-tuple.js.snap index f9c34436edd..facbc1dab98 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-tuple.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/record-tuple-tuple.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/record-tuple-tuple.js +assertion_line: 212 +info: js/babel-plugins/record-tuple-tuple.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/throw-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/throw-expressions.js.snap index 2d1d74952c4..acc95e72585 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/throw-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/throw-expressions.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/throw-expressions.js +assertion_line: 212 +info: js/babel-plugins/throw-expressions.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/v8intrinsic.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/v8intrinsic.js.snap index 28003003820..1f2e0ec2ba1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/v8intrinsic.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/v8intrinsic.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/babel-plugins/v8intrinsic.js +assertion_line: 212 +info: js/babel-plugins/v8intrinsic.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/await.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/await.js.snap index 02308198298..caca53c8718 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/await.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/await.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/bind-expressions/await.js +assertion_line: 212 +info: js/bind-expressions/await.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/bind_parens.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/bind_parens.js.snap index 752b7e37876..f43a2e0e61c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/bind_parens.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/bind_parens.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/bind-expressions/bind_parens.js +assertion_line: 212 +info: js/bind-expressions/bind_parens.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/long_name_method.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/long_name_method.js.snap index 0b753e2d899..d99c85374d1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/long_name_method.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/long_name_method.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/bind-expressions/long_name_method.js +assertion_line: 212 +info: js/bind-expressions/long_name_method.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/method_chain.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/method_chain.js.snap index b5727a0df3d..78f99772580 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/method_chain.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/method_chain.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/bind-expressions/method_chain.js +assertion_line: 212 +info: js/bind-expressions/method_chain.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/short_name_method.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/short_name_method.js.snap index 6c7e3819ce2..a189df6e609 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/short_name_method.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/short_name_method.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/bind-expressions/short_name_method.js +assertion_line: 212 +info: js/bind-expressions/short_name_method.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/unary.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/unary.js.snap index 94dc0931fa6..ad48cb74620 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/unary.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/bind-expressions/unary.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/bind-expressions/unary.js +assertion_line: 212 +info: js/bind-expressions/unary.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/binary.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/binary.js.prettier-snap index bb1f42343fc..f60f9c8f7e7 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/classes/binary.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/classes/binary.js.prettier-snap @@ -1,4 +1,4 @@ -(class {} + 1); -(class a {} + 1); -(class extends b {} + 1); -(class a extends b {} + 1); +(class {}) + 1; +(class a {}) + 1; +(class extends b {}) + 1; +(class a extends b {}) + 1; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/binary.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/binary.js.snap deleted file mode 100644 index e46d97aaf31..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/classes/binary.js.snap +++ /dev/null @@ -1,43 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/classes/binary.js ---- - -# Input - -```js -(class {}) + 1; -(class a {}) + 1; -(class extends b {}) + 1; -(class a extends b {}) + 1; - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,4 +1,4 @@ --(class {} + 1); --(class a {} + 1); --(class extends b {} + 1); --(class a extends b {} + 1); -+(class {}) + 1; -+(class a {}) + 1; -+(class extends b {}) + 1; -+(class a extends b {}) + 1; -``` - -# Output - -```js -(class {}) + 1; -(class a {}) + 1; -(class extends b {}) + 1; -(class a extends b {}) + 1; -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/call.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/call.js.prettier-snap index 8857d646c34..d530fa29116 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/classes/call.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/classes/call.js.prettier-snap @@ -1 +1 @@ -(class {}(class {})); +(class {})(class {}); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/call.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/call.js.snap deleted file mode 100644 index 2b4c79c10ce..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/classes/call.js.snap +++ /dev/null @@ -1,31 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/classes/call.js ---- - -# Input - -```js -(class {})(class {}); - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1 +1 @@ --(class {}(class {})); -+(class {})(class {}); -``` - -# Output - -```js -(class {})(class {}); -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/computed.js b/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/computed.js new file mode 100644 index 00000000000..99f1b61806c --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/computed.js @@ -0,0 +1,9 @@ +class B { + [get]; + foo() {} +} + +class C { + [set]; + foo(v) {} +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/computed.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/computed.js.prettier-snap new file mode 100644 index 00000000000..99f1b61806c --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/computed.js.prettier-snap @@ -0,0 +1,9 @@ +class B { + [get]; + foo() {} +} + +class C { + [set]; + foo(v) {} +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/private.js b/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/private.js new file mode 100644 index 00000000000..d5b55c76d3c --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/private.js @@ -0,0 +1,14 @@ +class A { + #static; + foo() {} +} + +class B { + #get; + foo() {} +} + +class C { + #set; + foo(v) {} +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/private.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/private.js.prettier-snap new file mode 100644 index 00000000000..d5b55c76d3c --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/classes/keyword-property/private.js.prettier-snap @@ -0,0 +1,14 @@ +class A { + #static; + foo() {} +} + +class B { + #get; + foo() {} +} + +class C { + #set; + foo(v) {} +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/member.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/member.js.prettier-snap index 00a812b23e1..128236eba65 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/classes/member.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/classes/member.js.prettier-snap @@ -1,2 +1,2 @@ -(class {}[1]); -(class {}.a); +(class {})[1]; +(class {}).a; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/member.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/member.js.snap deleted file mode 100644 index f9d22e73904..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/classes/member.js.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/classes/member.js ---- - -# Input - -```js -(class {})[1]; -(class {}).a; - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,2 +1,2 @@ --(class {}[1]); --(class {}.a); -+(class {})[1]; -+(class {}).a; -``` - -# Output - -```js -(class {})[1]; -(class {}).a; -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/ternary.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/ternary.js.prettier-snap index ca2662e4dc2..3d672705606 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/classes/ternary.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/classes/ternary.js.prettier-snap @@ -1 +1 @@ -if (1) (class {} ? 1 : 2); +if (1) (class {}) ? 1 : 2; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/ternary.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/ternary.js.snap deleted file mode 100644 index 316ce89a118..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/classes/ternary.js.snap +++ /dev/null @@ -1,31 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/classes/ternary.js ---- - -# Input - -```js -if (1) (class {}) ? 1 : 2; - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1 +1 @@ --if (1) (class {} ? 1 : 2); -+if (1) (class {}) ? 1 : 2; -``` - -# Output - -```js -if (1) (class {}) ? 1 : 2; -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/satisfies.js b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/satisfies.js new file mode 100644 index 00000000000..791fc7e47ac --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/satisfies.js @@ -0,0 +1,3 @@ +module.exports = /** @satisfies {Record} */ ({ + hello: 1337, +}); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/satisfies.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/satisfies.js.prettier-snap new file mode 100644 index 00000000000..791fc7e47ac --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/satisfies.js.prettier-snap @@ -0,0 +1,3 @@ +module.exports = /** @satisfies {Record} */ ({ + hello: 1337, +}); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/satisfies.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/satisfies.js.snap new file mode 100644 index 00000000000..968ad5d638f --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/satisfies.js.snap @@ -0,0 +1,38 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: js/comments-closure-typecast/satisfies.js +--- + +# Input + +```js +module.exports = /** @satisfies {Record} */ ({ + hello: 1337, +}); + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -1,3 +1,3 @@ +-module.exports = /** @satisfies {Record} */ ({ ++module.exports = /** @satisfies {Record} */ { + hello: 1337, +-}); ++}; +``` + +# Output + +```js +module.exports = /** @satisfies {Record} */ { + hello: 1337, +}; +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/styled-components.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/styled-components.js.snap index 51ec60616a0..6f24ce598d3 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/styled-components.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/styled-components.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/comments-closure-typecast/styled-components.js +assertion_line: 212 +info: js/comments-closure-typecast/styled-components.js --- # Input @@ -65,3 +65,4 @@ top: ${(p) => p.overlap === "next" && 0}; 2: /** @type {import('styled-components').ThemedStyledFunction<'div',null,{overlap: boolean}>} */ ``` + diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments-pipeline-own-line/pipeline_own_line.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments-pipeline-own-line/pipeline_own_line.js.snap index dfbaa78d95b..bcaf4c3e922 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments-pipeline-own-line/pipeline_own_line.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments-pipeline-own-line/pipeline_own_line.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/comments-pipeline-own-line/pipeline_own_line.js +assertion_line: 212 +info: js/comments-pipeline-own-line/pipeline_own_line.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments/break-continue-statements.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/break-continue-statements.js.snap index 2199e04d9a1..fa5447102cd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/break-continue-statements.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/break-continue-statements.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/comments/break-continue-statements.js +assertion_line: 212 +info: js/comments/break-continue-statements.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments/export.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/export.js.snap index 4f1e0751d08..5a18e54e7ce 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/export.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/export.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/comments/export.js +assertion_line: 212 +info: js/comments/export.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments/html-like/comment.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/html-like/comment.js.snap index 73a9bcb57b7..b3fe7e82fa6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/html-like/comment.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/html-like/comment.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/comments/html-like/comment.js +assertion_line: 212 +info: js/comments/html-like/comment.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments/jsx.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/jsx.js.snap index 1db7266fe24..1f518dfbfb7 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/jsx.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/jsx.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/comments/jsx.js +assertion_line: 212 +info: js/comments/jsx.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments/multi-comments-on-same-line.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/multi-comments-on-same-line.js.snap index 6705235161e..b06408dc1b8 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/multi-comments-on-same-line.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/multi-comments-on-same-line.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/comments/multi-comments-on-same-line.js +assertion_line: 212 +info: js/comments/multi-comments-on-same-line.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments/return-statement.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/return-statement.js.snap index b82071ff3ce..c4869ef28bb 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/return-statement.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/return-statement.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/comments/return-statement.js +assertion_line: 212 +info: js/comments/return-statement.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments/tagged-template-literal.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/tagged-template-literal.js.snap index 30b90b8f915..b485156ebcc 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/tagged-template-literal.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/tagged-template-literal.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/comments/tagged-template-literal.js +assertion_line: 212 +info: js/comments/tagged-template-literal.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments/trailing_space.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/trailing_space.js.snap index 1e4c761f14c..7f12afdf728 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/trailing_space.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/trailing_space.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/comments/trailing_space.js +assertion_line: 212 +info: js/comments/trailing_space.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js index 84d735742d6..d6cdc984d1c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js +++ b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js @@ -86,6 +86,7 @@ test comment comment comment + A newline will be added after this comment, unfortunately – but it can be removed manually, see next statement. */ test ? foo @@ -95,6 +96,23 @@ test */ bar; + +// It is at least possible to delete the extra newline that was +// unfortunately added before the second condition above: +test ? + foo :/* comment + comment + comment + comment + */ +test ? + foo : + /* comment + comment + comment + */ + bar; + test ? foo : /* comment */ diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js.prettier-snap index e86d2a7ca83..74da7828ed9 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js.prettier-snap @@ -86,6 +86,7 @@ test comment comment comment + A newline will be added after this comment, unfortunately – but it can be removed manually, see next statement. */ test ? foo @@ -95,6 +96,22 @@ test */ bar; +// It is at least possible to delete the extra newline that was +// unfortunately added before the second condition above: +test + ? foo /* comment + comment + comment + comment + */ + : test + ? foo + : /* comment + comment + comment + */ + bar; + test ? foo : /* comment */ bar; test diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js.snap new file mode 100644 index 00000000000..36a2f817701 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/comments.js.snap @@ -0,0 +1,293 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: js/conditional/comments.js +--- + +# Input + +```js +var inspect = 4 === util.inspect.length + ? // node <= 0.8.x + (function(v, colors) { + return util.inspect(v, void 0, void 0, colors); + }) + : // node > 0.8.x + (function(v, colors) { + return util.inspect(v, { colors: colors }); + }); + +var inspect = 4 === util.inspect.length + ? // node <= 0.8.x + (function(v, colors) { + return util.inspect(v, void 0, void 0, colors); + }) + : // node > 0.8.x + (function(v, colors) { + return util.inspect(v, { colors: colors }); + }); + +const extractTextPluginOptions = shouldUseRelativeAssetPaths + // Making sure that the publicPath goes back to to build folder. + ? { publicPath: Array(cssFilename.split('/').length).join('../') } : + {}; + +const extractTextPluginOptions2 = shouldUseRelativeAssetPaths + ? // Making sure that the publicPath goes back to to build folder. + { publicPath: Array(cssFilename.split("/").length).join("../") } + : {}; + +const extractTextPluginOptions3 = shouldUseRelativeAssetPaths // Making sure that the publicPath goes back to to build folder. + ? { publicPath: Array(cssFilename.split("/").length).join("../") } + : {}; + +const { configureStore } = process.env.NODE_ENV === "production" + ? require("./configureProdStore") // a + : require("./configureDevStore"); // b + +test /* comment + comment + comment +*/ + ? foo + : bar; + +test + ? /* comment + comment + comment + comment + */ + foo + : bar; + +test + ? /* comment + comment + comment + comment + */ + foo + : test + ? /* comment + comment + comment */ + foo + : bar; + +test + ? /* comment */ + foo + : bar; + +test + ? foo + : /* comment + comment + comment + comment + */ + bar; + +test + ? foo + : /* comment + comment + comment + comment + A newline will be added after this comment, unfortunately – but it can be removed manually, see next statement. + */ + test + ? foo + : /* comment + comment + comment + */ + bar; + + +// It is at least possible to delete the extra newline that was +// unfortunately added before the second condition above: +test ? + foo :/* comment + comment + comment + comment + */ +test ? + foo : + /* comment + comment + comment + */ + bar; + +test + ? foo + : /* comment */ + bar; + +test ? test /* c +c */? foo : bar : bar; + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -99,12 +99,13 @@ + // It is at least possible to delete the extra newline that was + // unfortunately added before the second condition above: + test +- ? foo /* comment ++ ? foo ++ : /* comment + comment + comment + comment + */ +- : test ++ test + ? foo + : /* comment + comment +``` + +# Output + +```js +var inspect = + 4 === util.inspect.length + ? // node <= 0.8.x + function (v, colors) { + return util.inspect(v, void 0, void 0, colors); + } + : // node > 0.8.x + function (v, colors) { + return util.inspect(v, { colors: colors }); + }; + +var inspect = + 4 === util.inspect.length + ? // node <= 0.8.x + function (v, colors) { + return util.inspect(v, void 0, void 0, colors); + } + : // node > 0.8.x + function (v, colors) { + return util.inspect(v, { colors: colors }); + }; + +const extractTextPluginOptions = shouldUseRelativeAssetPaths + ? // Making sure that the publicPath goes back to to build folder. + { publicPath: Array(cssFilename.split("/").length).join("../") } + : {}; + +const extractTextPluginOptions2 = shouldUseRelativeAssetPaths + ? // Making sure that the publicPath goes back to to build folder. + { publicPath: Array(cssFilename.split("/").length).join("../") } + : {}; + +const extractTextPluginOptions3 = shouldUseRelativeAssetPaths // Making sure that the publicPath goes back to to build folder. + ? { publicPath: Array(cssFilename.split("/").length).join("../") } + : {}; + +const { configureStore } = + process.env.NODE_ENV === "production" + ? require("./configureProdStore") // a + : require("./configureDevStore"); // b + +test /* comment + comment + comment +*/ + ? foo + : bar; + +test + ? /* comment + comment + comment + comment + */ + foo + : bar; + +test + ? /* comment + comment + comment + comment + */ + foo + : test + ? /* comment + comment + comment */ + foo + : bar; + +test ? /* comment */ foo : bar; + +test + ? foo + : /* comment + comment + comment + comment + */ + bar; + +test + ? foo + : /* comment + comment + comment + comment + A newline will be added after this comment, unfortunately – but it can be removed manually, see next statement. + */ + test + ? foo + : /* comment + comment + comment + */ + bar; + +// It is at least possible to delete the extra newline that was +// unfortunately added before the second condition above: +test + ? foo + : /* comment + comment + comment + comment + */ + test + ? foo + : /* comment + comment + comment + */ + bar; + +test ? foo : /* comment */ bar; + +test + ? test /* c +c */ + ? foo + : bar + : bar; +``` + +# Lines exceeding max width of 80 characters +``` + 33: const extractTextPluginOptions3 = shouldUseRelativeAssetPaths // Making sure that the publicPath goes back to to build folder. + 89: A newline will be added after this comment, unfortunately – but it can be removed manually, see next statement. +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-examples.js b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-examples.js new file mode 100644 index 00000000000..8c319faf941 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-examples.js @@ -0,0 +1,138 @@ +// from https://gist.github.com/rattrayalex/dacbf5838571a47f22d0ae1f8b960268 +// Input and output should match (for 2-space indent formatting). +// TypeScript is here: prettier/tests/format/typescript/conditional-types/new-ternary-spec.ts +// EXAMPLES +// mostly taken from https://github.com/prettier/prettier/issues/9561 + +const message = + i % 3 === 0 && i % 5 === 0 ? "fizzbuzz" + : i % 3 === 0 ? "fizz" + : i % 5 === 0 ? "buzz" + : String(i); + +const paymentMessageShort = + state == "success" ? "Payment completed successfully" + : state == "processing" ? "Payment processing" + : state == "invalid_cvc" ? "There was an issue with your CVC number" + : state == "invalid_expiry" ? "Expiry must be sometime in the past." + : "There was an issue with the payment. Please contact support."; + +const paymentMessageWithABreak = + state == "success" ? "Payment completed successfully" + : state == "processing" ? "Payment processing" + : state == "invalid_cvc" ? + "There was an issue with your CVC number, and you need to take a prompt action on it." + : state == "invalid_expiry" ? "Expiry must be sometime in the past." + : "There was an issue with the payment. Please contact support."; + +const typeofExample = + definition.encode ? + definition.encode( + typeof row[field] !== "undefined" ? row[field] + : typeof definition.default !== "undefined" ? definition.default + : null + ) + : typeof row[field] !== "undefined" ? row[field] + : typeof definition.default !== "undefined" ? definition.default + : null + +// (the following is semantically equivalent to the above, but written in a more-confusing style – it'd be hard to grok no matter the formatting) +const typeofExampleFlipped = + definition.encode ? + definition.encode( + typeof row[field] === "undefined" ? + typeof definition.default === "undefined" ? null + : definition.default + : row[field] + ) + : typeof row[field] === "undefined" ? + typeof definition.default === "undefined" ? null + : definition.default + : row[field]; + + +// JSX Examples: + +const typicalLongConsequentWithNullAlternate = ( +
+ {children && !isEmptyChildren(children) ? + + : null} +
+); + +const reactRouterExampleJSX = ( +
+ {children && !isEmptyChildren(children) ? + children + : props.match ? + component ? React.createElement(component, props) + : render ? render(props) + : null + : null} +
+); + +const reactRouterExampleNonJSX = + children && !isEmptyChildren(children) ? children + : props.match ? + component ? React.createElement(component, props) + : render ? render(props) + : null + : null; + +inJSXExpressionContainer.withLongConditionals.example = ( +
+ {( + isACat() && + (someReallyLongCondition || + moreInThisLongCondition) + ) ? + someReallyLargeExpression + .toMakeMeowNoise() + .willCauseParens() + : ( + someReallyLongCondition || + moreInThisLongCondition + ) ? + bark() + : someReallyLargeExpression + .toMakeMeowNoise() + .willCauseParens() + } +
+); + +inJSXExpressionContainer.withLoops.orBooleans.example = ( +
+ {items ? + items.map((item) => ( + item.display ? + + : + )) + : null} + + {showTheStuff && ( + foo ? + + : + )} +
+); + +inJSXExpressionContainer.withNullConditional = ( +
+ {isACat() ? null : } + {isACat() && (someReallyLongCondition || moreInThisLongCondition) ? null : ( + + )} + {isACat() && (someReallyLongCondition || moreInThisLongCondition || evenMoreInThisExtraLongConditional) ? null : ( + + )} +
+); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-examples.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-examples.js.prettier-snap new file mode 100644 index 00000000000..559fdb7c9a8 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-examples.js.prettier-snap @@ -0,0 +1,150 @@ +// from https://gist.github.com/rattrayalex/dacbf5838571a47f22d0ae1f8b960268 +// Input and output should match (for 2-space indent formatting). +// TypeScript is here: prettier/tests/format/typescript/conditional-types/new-ternary-spec.ts +// EXAMPLES +// mostly taken from https://github.com/prettier/prettier/issues/9561 + +const message = + i % 3 === 0 && i % 5 === 0 + ? "fizzbuzz" + : i % 3 === 0 + ? "fizz" + : i % 5 === 0 + ? "buzz" + : String(i); + +const paymentMessageShort = + state == "success" + ? "Payment completed successfully" + : state == "processing" + ? "Payment processing" + : state == "invalid_cvc" + ? "There was an issue with your CVC number" + : state == "invalid_expiry" + ? "Expiry must be sometime in the past." + : "There was an issue with the payment. Please contact support."; + +const paymentMessageWithABreak = + state == "success" + ? "Payment completed successfully" + : state == "processing" + ? "Payment processing" + : state == "invalid_cvc" + ? "There was an issue with your CVC number, and you need to take a prompt action on it." + : state == "invalid_expiry" + ? "Expiry must be sometime in the past." + : "There was an issue with the payment. Please contact support."; + +const typeofExample = definition.encode + ? definition.encode( + typeof row[field] !== "undefined" + ? row[field] + : typeof definition.default !== "undefined" + ? definition.default + : null, + ) + : typeof row[field] !== "undefined" + ? row[field] + : typeof definition.default !== "undefined" + ? definition.default + : null; + +// (the following is semantically equivalent to the above, but written in a more-confusing style – it'd be hard to grok no matter the formatting) +const typeofExampleFlipped = definition.encode + ? definition.encode( + typeof row[field] === "undefined" + ? typeof definition.default === "undefined" + ? null + : definition.default + : row[field], + ) + : typeof row[field] === "undefined" + ? typeof definition.default === "undefined" + ? null + : definition.default + : row[field]; + +// JSX Examples: + +const typicalLongConsequentWithNullAlternate = ( +
+ {children && !isEmptyChildren(children) ? ( + + ) : null} +
+); + +const reactRouterExampleJSX = ( +
+ {children && !isEmptyChildren(children) + ? children + : props.match + ? component + ? React.createElement(component, props) + : render + ? render(props) + : null + : null} +
+); + +const reactRouterExampleNonJSX = + children && !isEmptyChildren(children) + ? children + : props.match + ? component + ? React.createElement(component, props) + : render + ? render(props) + : null + : null; + +inJSXExpressionContainer.withLongConditionals.example = ( +
+ {isACat() && (someReallyLongCondition || moreInThisLongCondition) + ? someReallyLargeExpression.toMakeMeowNoise().willCauseParens() + : someReallyLongCondition || moreInThisLongCondition + ? bark() + : someReallyLargeExpression.toMakeMeowNoise().willCauseParens()} +
+); + +inJSXExpressionContainer.withLoops.orBooleans.example = ( +
+ {items + ? items.map((item) => + item.display ? ( + + ) : ( + + ), + ) + : null} + + {showTheStuff && + (foo ? ( + + ) : ( + + ))} +
+); + +inJSXExpressionContainer.withNullConditional = ( +
+ {isACat() ? null : } + {isACat() && (someReallyLongCondition || moreInThisLongCondition) ? null : ( + + )} + {isACat() && + (someReallyLongCondition || + moreInThisLongCondition || + evenMoreInThisExtraLongConditional) ? null : ( + + )} +
+); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-spec.js b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-spec.js new file mode 100644 index 00000000000..74e7a362ac2 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-spec.js @@ -0,0 +1,189 @@ +// from https://gist.github.com/rattrayalex/dacbf5838571a47f22d0ae1f8b960268 +// Input and output should match (for 2-space indent formatting). +// TypeScript is here: prettier/tests/format/typescript/conditional-types/new-ternary-spec.ts + +// remain on one line if possible: +const short = isLoud() ? makeNoise() : silent(); + +// next, put everything after the = +const lessShort = + isLoudReallyLoud() ? makeNoiseReallyLoudly.omgSoLoud() : silent(); + +// next, indent the consequent: +const andIndented = isLoudReallyReallyReallyReallyLoud() ? + makeNoiseReallyReallyReallyReallyReallyLoudly.omgSoLoud() + : silent(); + +// unless the consequent is short (less than ten characters long): +const shortSoCase = isLoudReallyReallyReallyReallyLoud() ? silent() + : makeNoiseReallyReallyReallyReallyReallyLoudly.omgSoLoud(); + +// if chained, always break and put after the = +const chainedShort = + isCat() ? meow() + : isDog() ? bark() + : silent(); + +// when a consequent breaks in a chain: +const chainedWithLongConsequent = + isCat() ? + someReallyLargeExpression + .thatWouldCauseALineBreak() + .willCauseAnIndentButNotParens() + : isDog() ? bark() + : silent(); + +// nested ternary in consequent always breaks: +const chainedWithTernaryConsequent = + isCat() ? + aNestedCondition ? theResult() + : theAlternate() + : isDog() ? bark() + : silent(); + +// consequent and terminal alternate break: +const consequentAndTerminalAlternateBreak = + isCat() ? + someReallyLargeExpression + .thatWouldCauseALineBreak() + .willCauseAnIndentButNotParens() + : isDog() ? bark() + : someReallyLargeExpression + .thatWouldCauseALineBreak() + .willCauseAnIndentButNotParens(); + +// multiline conditions and consequents/alternates: +const multilineConditionsConsequentsAndAlternates = + ( + isAnAdorableKittyCat() && + (someReallyLongCondition || moreInThisLongCondition) + ) ? + someReallyLargeExpression + .thatWouldCauseALineBreak() + .willCauseAnIndentButNotParens() + : ( + isNotAnAdorableKittyCat() && + (someReallyLongCondition || moreInThisLongCondition) + ) ? + bark() + : shortCondition() ? shortConsequent() + : someReallyLargeExpression + .thatWouldCauseALineBreak() + .willCauseAnIndentButNotParens(); + +// illustrating case of mostly short conditionals +const mostlyShort = + x === 1 ? "one" + : x === 2 ? "two" + : x === 3 ? "three" + : ( + x === 5 && + y === 7 && + someOtherThing.thatIsSoLong.thatItBreaksTheTestCondition() + ) ? + "four" + : x === 6 ? "six" + : "idk"; + +// long conditional, short consequent/alternate, not chained - do indent after ? +const longConditional = ( + bifornCringerMoshedPerplexSawder === 2 / askTrovenaBeenaDependsRowans && + glimseGlyphsHazardNoopsTieTie >= + averredBathersBoxroomBuggyNurl().anodyneCondosMalateOverateRetinol() + ) ? + "foo" + : "bar"; + +// long conditional, short consequent/alternate, chained +// (break on short consequents iff in chained ternary and its conditional broke) +const longConditionalChained = + ( + bifornCringerMoshedPerplexSawder === 2 / askTrovenaBeenaDependsRowans && + glimseGlyphsHazardNoopsTieTie >= + averredBathersBoxroomBuggyNurl().anodyneCondosMalateOverateRetinol() + ) ? + "foo" + : anotherCondition ? "bar" + : "baz"; + +// As a function parameter, don't add an extra indent: +definition.encode( + typeof row[field] !== "undefined" ? row[field] + : typeof definition.default !== "undefined" ? definition.default + : null, + typeof row[field] === "undefined" ? + typeof definition.default === "undefined" ? null + : definition.default + : row[field] +); + +// In a return, break and over-indent: +const inReturn = () => { + if (short) { + return foo ? 1 : 2; + } + return typeof row[aVeryLongFieldName] !== "undefined" ? + row[aVeryLongFieldName] + : null; +}; + +// Remove current JSX Mode, and replace it with this algorithm: +// When a ternary's parent is a JSXExpressionContainer which is not in a JSXAttribute, +// force the consequent to break, +// and if the alternate breaks, +// add a newline before the closing curly brace. +// Special case when the consequent is `null`: +// do not add a line before or after it, +// and wrap the alternate in parens. + +const someJSX = ( +
+ Typical jsx case: + {showFoo ? + + : } + Nested, and with a non-jsx consequent is the same: + {component ? + React.createElement(component, props) + : render ? +
{render(props)}
+ :
Nothing is here
} + As is a non-jsx consequent: + {showTheJSXElement ? +
the stuff
+ : renderOtherStuff()} + But if the alternate breaks, add a newline before the closing curly brace: + {showTheThing || pleaseShowTheThing ? + + : + } + When the consequent is `null` and the alternate breaks, + hug it with parens to match boolean behavior: + {!thing ? null : ( + + )} +
+); + +ternaryWithJSXElements.hasNoSpecialCasing = + component ?
{React.createElement(component, props)}
+ : render ?
{render(props)}
+ :
Nothing is here
; + +jsxExpressionContainer.inJSXAttribute.hasNoSpecialCasing = ( + : } + withJSXBroken={ + isRed || isSomeOtherLongCondition.thatBreaksTheLine() ? + + : + } + /> +); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-spec.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-spec.js.prettier-snap new file mode 100644 index 00000000000..3778b25b9fd --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/new-ternary-spec.js.prettier-snap @@ -0,0 +1,192 @@ +// from https://gist.github.com/rattrayalex/dacbf5838571a47f22d0ae1f8b960268 +// Input and output should match (for 2-space indent formatting). +// TypeScript is here: prettier/tests/format/typescript/conditional-types/new-ternary-spec.ts + +// remain on one line if possible: +const short = isLoud() ? makeNoise() : silent(); + +// next, put everything after the = +const lessShort = isLoudReallyLoud() + ? makeNoiseReallyLoudly.omgSoLoud() + : silent(); + +// next, indent the consequent: +const andIndented = isLoudReallyReallyReallyReallyLoud() + ? makeNoiseReallyReallyReallyReallyReallyLoudly.omgSoLoud() + : silent(); + +// unless the consequent is short (less than ten characters long): +const shortSoCase = isLoudReallyReallyReallyReallyLoud() + ? silent() + : makeNoiseReallyReallyReallyReallyReallyLoudly.omgSoLoud(); + +// if chained, always break and put after the = +const chainedShort = isCat() ? meow() : isDog() ? bark() : silent(); + +// when a consequent breaks in a chain: +const chainedWithLongConsequent = isCat() + ? someReallyLargeExpression + .thatWouldCauseALineBreak() + .willCauseAnIndentButNotParens() + : isDog() + ? bark() + : silent(); + +// nested ternary in consequent always breaks: +const chainedWithTernaryConsequent = isCat() + ? aNestedCondition + ? theResult() + : theAlternate() + : isDog() + ? bark() + : silent(); + +// consequent and terminal alternate break: +const consequentAndTerminalAlternateBreak = isCat() + ? someReallyLargeExpression + .thatWouldCauseALineBreak() + .willCauseAnIndentButNotParens() + : isDog() + ? bark() + : someReallyLargeExpression + .thatWouldCauseALineBreak() + .willCauseAnIndentButNotParens(); + +// multiline conditions and consequents/alternates: +const multilineConditionsConsequentsAndAlternates = + isAnAdorableKittyCat() && (someReallyLongCondition || moreInThisLongCondition) + ? someReallyLargeExpression + .thatWouldCauseALineBreak() + .willCauseAnIndentButNotParens() + : isNotAnAdorableKittyCat() && + (someReallyLongCondition || moreInThisLongCondition) + ? bark() + : shortCondition() + ? shortConsequent() + : someReallyLargeExpression + .thatWouldCauseALineBreak() + .willCauseAnIndentButNotParens(); + +// illustrating case of mostly short conditionals +const mostlyShort = + x === 1 + ? "one" + : x === 2 + ? "two" + : x === 3 + ? "three" + : x === 5 && + y === 7 && + someOtherThing.thatIsSoLong.thatItBreaksTheTestCondition() + ? "four" + : x === 6 + ? "six" + : "idk"; + +// long conditional, short consequent/alternate, not chained - do indent after ? +const longConditional = + bifornCringerMoshedPerplexSawder === 2 / askTrovenaBeenaDependsRowans && + glimseGlyphsHazardNoopsTieTie >= + averredBathersBoxroomBuggyNurl().anodyneCondosMalateOverateRetinol() + ? "foo" + : "bar"; + +// long conditional, short consequent/alternate, chained +// (break on short consequents iff in chained ternary and its conditional broke) +const longConditionalChained = + bifornCringerMoshedPerplexSawder === 2 / askTrovenaBeenaDependsRowans && + glimseGlyphsHazardNoopsTieTie >= + averredBathersBoxroomBuggyNurl().anodyneCondosMalateOverateRetinol() + ? "foo" + : anotherCondition + ? "bar" + : "baz"; + +// As a function parameter, don't add an extra indent: +definition.encode( + typeof row[field] !== "undefined" + ? row[field] + : typeof definition.default !== "undefined" + ? definition.default + : null, + typeof row[field] === "undefined" + ? typeof definition.default === "undefined" + ? null + : definition.default + : row[field], +); + +// In a return, break and over-indent: +const inReturn = () => { + if (short) { + return foo ? 1 : 2; + } + return typeof row[aVeryLongFieldName] !== "undefined" + ? row[aVeryLongFieldName] + : null; +}; + +// Remove current JSX Mode, and replace it with this algorithm: +// When a ternary's parent is a JSXExpressionContainer which is not in a JSXAttribute, +// force the consequent to break, +// and if the alternate breaks, +// add a newline before the closing curly brace. +// Special case when the consequent is `null`: +// do not add a line before or after it, +// and wrap the alternate in parens. + +const someJSX = ( +
+ Typical jsx case: + {showFoo ? : } + Nested, and with a non-jsx consequent is the same: + {component ? ( + React.createElement(component, props) + ) : render ? ( +
{render(props)}
+ ) : ( +
Nothing is here
+ )} + As is a non-jsx consequent: + {showTheJSXElement ?
the stuff
: renderOtherStuff()} + But if the alternate breaks, add a newline before the closing curly brace: + {showTheThing || pleaseShowTheThing ? ( + + ) : ( + + )} + When the consequent is `null` and the alternate breaks, hug it with parens + to match boolean behavior: + {!thing ? null : ( + + )} +
+); + +ternaryWithJSXElements.hasNoSpecialCasing = component ? ( +
{React.createElement(component, props)}
+) : render ? ( +
{render(props)}
+) : ( +
Nothing is here
+); + +jsxExpressionContainer.inJSXAttribute.hasNoSpecialCasing = ( + : } + withJSXBroken={ + isRed || isSomeOtherLongCondition.thatBreaksTheLine() ? ( + + ) : ( + + ) + } + /> +); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/postfix-ternary-regressions.js b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/postfix-ternary-regressions.js new file mode 100644 index 00000000000..3d1f9ce7ecd --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/postfix-ternary-regressions.js @@ -0,0 +1,150 @@ + +// concatened string in consequent should be visually distinguishable from alternate +// … or maybe this is okay, because the colon is enough? +const avatar = has_ordered ? + 'https://marmelab.com/posters/avatar/longer-word-that-breaks-consequent-' + + numberOfCustomers + + '.jpeg' + : undefined; + +// Similarly, in the alternate: +const redirectUrl = pathName ? + pathName + : nextPathName + nextSearch || + defaultAuthParams.afterLoginUrl.makeThisLongerSoItBreaks; + +// And another, more pathological case of the above: +const isEmpty = obj => + obj instanceof Date ? + false + : obj === '' || + obj === null || + obj === undefined || + obj === somethingThatIsLonger || + shallowEqual(obj, {}); + + +// Again, this case is a bit hard to distinguish the alternate. +const eventsFromOrders = + orderIds && orders ? + orderIds.map(id => ({ + type: 'order', + date: orders[id].date, + data: orders[id], + })) + : []; + +// Kinda weird to have dedents to the level of "return" in a function. +function foo() { + return !linkTo ? + false + : typeof linkTo === 'function' + ? linkTo(record, reference) + : linkToRecord(rootPath, sourceId, linkTo_as_string); +} +function foo2() { + return React.isValidElement(emptyText) + ? React.cloneElement(emptyText) + : emptyText === '' + ? ' ' // em space, forces the display of an empty line of normal height + : translate(emptyText, { _: emptyText }); +} + +// Function call ideally wouldnt break break +const matchingReferencesError = isMatchingReferencesError( + matchingReferences +) + ? translate(matchingReferences.error, { + _: matchingReferences.error, + }) + : null; + +// This one is kinda confusing any way you slice it… +const obj = { + error: + matchingReferencesError && + (!input.value || + (input.value && + selectedReferencesDataStatus === REFERENCES_STATUS_EMPTY)) + ? translate('ra.input.references.all_missing', { + _: 'ra.input.references.all_missing', + }) + : null, +} + +// I think we should indent after the inner || on this, and do better wtih the parens around the && +const obj2 = { + warning: + matchingReferencesError || + (input.value && selectedReferencesDataStatus !== REFERENCES_STATUS_READY) + ? matchingReferencesError || + translate('ra.input.references.many_missing', { + _: 'ra.input.references.many_missing', + }) + : null, +} + +// The boolean conditions in the test should look cohesive. +const selectedReferencesDataStatus = + !isEmpty(value) && typeof value === 'string' && !pattern.test(value) + ? getMessage(message, { pattern }, value, values) + : undefined + + +// Would be nice if these two nested ternaries didn't look like a single one. +resolveRedirectTo( + redirectTo, + basePath, + payload + ? payload.id || (payload.data ? payload.data.id : null) + : requestPayload + ? requestPayload.id + : null, + payload && payload.data + ? payload.data + : requestPayload && requestPayload.data + ? requestPayload.data + : null +) + +const delayedDataProvider = new Proxy(restProvider, { + get: (target, name, self) => + name === 'then' ? // as we await for the dataProvider, JS calls then on it. We must trap that call or else the dataProvider will be called with the then method + self + : ( + (resource, params) => + new Promise(resolve => + setTimeout( + () => + resolve( + restProvider[name](resource, params) + ), + 500 + ) + ) + ), +}); + +function foo4() { + return !match || match.length < 5 ? line : ( + match[1] + match[2] + match[3] + match[4] + ) +} + +function foo5() { + return !match || match.length < 5 ? foo(line) : ( + match[1] + match[2] + match[3] + match[4] + ) +} + +function foo6() { + return !match || match.length < 5 ? linethatisverylongandbreaksthelinehooray : ( + match[1] + match[2] + match[3] + match[4] + ) +} + +function foo7() { + return !match || match.length < 5 ? linethatisverylongandbreaksthelinehoorayjustabitlonger : ( + match[1] + match[2] + match[3] + match[4] + ) +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/postfix-ternary-regressions.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/postfix-ternary-regressions.js.prettier-snap new file mode 100644 index 00000000000..bb287a0a6da --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/postfix-ternary-regressions.js.prettier-snap @@ -0,0 +1,139 @@ +// concatened string in consequent should be visually distinguishable from alternate +// … or maybe this is okay, because the colon is enough? +const avatar = has_ordered + ? "https://marmelab.com/posters/avatar/longer-word-that-breaks-consequent-" + + numberOfCustomers + + ".jpeg" + : undefined; + +// Similarly, in the alternate: +const redirectUrl = pathName + ? pathName + : nextPathName + nextSearch || + defaultAuthParams.afterLoginUrl.makeThisLongerSoItBreaks; + +// And another, more pathological case of the above: +const isEmpty = (obj) => + obj instanceof Date + ? false + : obj === "" || + obj === null || + obj === undefined || + obj === somethingThatIsLonger || + shallowEqual(obj, {}); + +// Again, this case is a bit hard to distinguish the alternate. +const eventsFromOrders = + orderIds && orders + ? orderIds.map((id) => ({ + type: "order", + date: orders[id].date, + data: orders[id], + })) + : []; + +// Kinda weird to have dedents to the level of "return" in a function. +function foo() { + return !linkTo + ? false + : typeof linkTo === "function" + ? linkTo(record, reference) + : linkToRecord(rootPath, sourceId, linkTo_as_string); +} +function foo2() { + return React.isValidElement(emptyText) + ? React.cloneElement(emptyText) + : emptyText === "" + ? " " // em space, forces the display of an empty line of normal height + : translate(emptyText, { _: emptyText }); +} + +// Function call ideally wouldnt break break +const matchingReferencesError = isMatchingReferencesError(matchingReferences) + ? translate(matchingReferences.error, { + _: matchingReferences.error, + }) + : null; + +// This one is kinda confusing any way you slice it… +const obj = { + error: + matchingReferencesError && + (!input.value || + (input.value && selectedReferencesDataStatus === REFERENCES_STATUS_EMPTY)) + ? translate("ra.input.references.all_missing", { + _: "ra.input.references.all_missing", + }) + : null, +}; + +// I think we should indent after the inner || on this, and do better wtih the parens around the && +const obj2 = { + warning: + matchingReferencesError || + (input.value && selectedReferencesDataStatus !== REFERENCES_STATUS_READY) + ? matchingReferencesError || + translate("ra.input.references.many_missing", { + _: "ra.input.references.many_missing", + }) + : null, +}; + +// The boolean conditions in the test should look cohesive. +const selectedReferencesDataStatus = + !isEmpty(value) && typeof value === "string" && !pattern.test(value) + ? getMessage(message, { pattern }, value, values) + : undefined; + +// Would be nice if these two nested ternaries didn't look like a single one. +resolveRedirectTo( + redirectTo, + basePath, + payload + ? payload.id || (payload.data ? payload.data.id : null) + : requestPayload + ? requestPayload.id + : null, + payload && payload.data + ? payload.data + : requestPayload && requestPayload.data + ? requestPayload.data + : null, +); + +const delayedDataProvider = new Proxy(restProvider, { + get: (target, name, self) => + name === "then" // as we await for the dataProvider, JS calls then on it. We must trap that call or else the dataProvider will be called with the then method + ? self + : (resource, params) => + new Promise((resolve) => + setTimeout( + () => resolve(restProvider[name](resource, params)), + 500, + ), + ), +}); + +function foo4() { + return !match || match.length < 5 + ? line + : match[1] + match[2] + match[3] + match[4]; +} + +function foo5() { + return !match || match.length < 5 + ? foo(line) + : match[1] + match[2] + match[3] + match[4]; +} + +function foo6() { + return !match || match.length < 5 + ? linethatisverylongandbreaksthelinehooray + : match[1] + match[2] + match[3] + match[4]; +} + +function foo7() { + return !match || match.length < 5 + ? linethatisverylongandbreaksthelinehoorayjustabitlonger + : match[1] + match[2] + match[3] + match[4]; +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/conditional/postfix-ternary-regressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/postfix-ternary-regressions.js.snap new file mode 100644 index 00000000000..3d9ca828a6d --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/conditional/postfix-ternary-regressions.js.snap @@ -0,0 +1,335 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: js/conditional/postfix-ternary-regressions.js +--- + +# Input + +```js + +// concatened string in consequent should be visually distinguishable from alternate +// … or maybe this is okay, because the colon is enough? +const avatar = has_ordered ? + 'https://marmelab.com/posters/avatar/longer-word-that-breaks-consequent-' + + numberOfCustomers + + '.jpeg' + : undefined; + +// Similarly, in the alternate: +const redirectUrl = pathName ? + pathName + : nextPathName + nextSearch || + defaultAuthParams.afterLoginUrl.makeThisLongerSoItBreaks; + +// And another, more pathological case of the above: +const isEmpty = obj => + obj instanceof Date ? + false + : obj === '' || + obj === null || + obj === undefined || + obj === somethingThatIsLonger || + shallowEqual(obj, {}); + + +// Again, this case is a bit hard to distinguish the alternate. +const eventsFromOrders = + orderIds && orders ? + orderIds.map(id => ({ + type: 'order', + date: orders[id].date, + data: orders[id], + })) + : []; + +// Kinda weird to have dedents to the level of "return" in a function. +function foo() { + return !linkTo ? + false + : typeof linkTo === 'function' + ? linkTo(record, reference) + : linkToRecord(rootPath, sourceId, linkTo_as_string); +} +function foo2() { + return React.isValidElement(emptyText) + ? React.cloneElement(emptyText) + : emptyText === '' + ? ' ' // em space, forces the display of an empty line of normal height + : translate(emptyText, { _: emptyText }); +} + +// Function call ideally wouldnt break break +const matchingReferencesError = isMatchingReferencesError( + matchingReferences +) + ? translate(matchingReferences.error, { + _: matchingReferences.error, + }) + : null; + +// This one is kinda confusing any way you slice it… +const obj = { + error: + matchingReferencesError && + (!input.value || + (input.value && + selectedReferencesDataStatus === REFERENCES_STATUS_EMPTY)) + ? translate('ra.input.references.all_missing', { + _: 'ra.input.references.all_missing', + }) + : null, +} + +// I think we should indent after the inner || on this, and do better wtih the parens around the && +const obj2 = { + warning: + matchingReferencesError || + (input.value && selectedReferencesDataStatus !== REFERENCES_STATUS_READY) + ? matchingReferencesError || + translate('ra.input.references.many_missing', { + _: 'ra.input.references.many_missing', + }) + : null, +} + +// The boolean conditions in the test should look cohesive. +const selectedReferencesDataStatus = + !isEmpty(value) && typeof value === 'string' && !pattern.test(value) + ? getMessage(message, { pattern }, value, values) + : undefined + + +// Would be nice if these two nested ternaries didn't look like a single one. +resolveRedirectTo( + redirectTo, + basePath, + payload + ? payload.id || (payload.data ? payload.data.id : null) + : requestPayload + ? requestPayload.id + : null, + payload && payload.data + ? payload.data + : requestPayload && requestPayload.data + ? requestPayload.data + : null +) + +const delayedDataProvider = new Proxy(restProvider, { + get: (target, name, self) => + name === 'then' ? // as we await for the dataProvider, JS calls then on it. We must trap that call or else the dataProvider will be called with the then method + self + : ( + (resource, params) => + new Promise(resolve => + setTimeout( + () => + resolve( + restProvider[name](resource, params) + ), + 500 + ) + ) + ), +}); + +function foo4() { + return !match || match.length < 5 ? line : ( + match[1] + match[2] + match[3] + match[4] + ) +} + +function foo5() { + return !match || match.length < 5 ? foo(line) : ( + match[1] + match[2] + match[3] + match[4] + ) +} + +function foo6() { + return !match || match.length < 5 ? linethatisverylongandbreaksthelinehooray : ( + match[1] + match[2] + match[3] + match[4] + ) +} + +function foo7() { + return !match || match.length < 5 ? linethatisverylongandbreaksthelinehoorayjustabitlonger : ( + match[1] + match[2] + match[3] + match[4] + ) +} + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -103,8 +103,9 @@ + + const delayedDataProvider = new Proxy(restProvider, { + get: (target, name, self) => +- name === "then" // as we await for the dataProvider, JS calls then on it. We must trap that call or else the dataProvider will be called with the then method +- ? self ++ name === "then" ++ ? // as we await for the dataProvider, JS calls then on it. We must trap that call or else the dataProvider will be called with the then method ++ self + : (resource, params) => + new Promise((resolve) => + setTimeout( +``` + +# Output + +```js +// concatened string in consequent should be visually distinguishable from alternate +// … or maybe this is okay, because the colon is enough? +const avatar = has_ordered + ? "https://marmelab.com/posters/avatar/longer-word-that-breaks-consequent-" + + numberOfCustomers + + ".jpeg" + : undefined; + +// Similarly, in the alternate: +const redirectUrl = pathName + ? pathName + : nextPathName + nextSearch || + defaultAuthParams.afterLoginUrl.makeThisLongerSoItBreaks; + +// And another, more pathological case of the above: +const isEmpty = (obj) => + obj instanceof Date + ? false + : obj === "" || + obj === null || + obj === undefined || + obj === somethingThatIsLonger || + shallowEqual(obj, {}); + +// Again, this case is a bit hard to distinguish the alternate. +const eventsFromOrders = + orderIds && orders + ? orderIds.map((id) => ({ + type: "order", + date: orders[id].date, + data: orders[id], + })) + : []; + +// Kinda weird to have dedents to the level of "return" in a function. +function foo() { + return !linkTo + ? false + : typeof linkTo === "function" + ? linkTo(record, reference) + : linkToRecord(rootPath, sourceId, linkTo_as_string); +} +function foo2() { + return React.isValidElement(emptyText) + ? React.cloneElement(emptyText) + : emptyText === "" + ? " " // em space, forces the display of an empty line of normal height + : translate(emptyText, { _: emptyText }); +} + +// Function call ideally wouldnt break break +const matchingReferencesError = isMatchingReferencesError(matchingReferences) + ? translate(matchingReferences.error, { + _: matchingReferences.error, + }) + : null; + +// This one is kinda confusing any way you slice it… +const obj = { + error: + matchingReferencesError && + (!input.value || + (input.value && selectedReferencesDataStatus === REFERENCES_STATUS_EMPTY)) + ? translate("ra.input.references.all_missing", { + _: "ra.input.references.all_missing", + }) + : null, +}; + +// I think we should indent after the inner || on this, and do better wtih the parens around the && +const obj2 = { + warning: + matchingReferencesError || + (input.value && selectedReferencesDataStatus !== REFERENCES_STATUS_READY) + ? matchingReferencesError || + translate("ra.input.references.many_missing", { + _: "ra.input.references.many_missing", + }) + : null, +}; + +// The boolean conditions in the test should look cohesive. +const selectedReferencesDataStatus = + !isEmpty(value) && typeof value === "string" && !pattern.test(value) + ? getMessage(message, { pattern }, value, values) + : undefined; + +// Would be nice if these two nested ternaries didn't look like a single one. +resolveRedirectTo( + redirectTo, + basePath, + payload + ? payload.id || (payload.data ? payload.data.id : null) + : requestPayload + ? requestPayload.id + : null, + payload && payload.data + ? payload.data + : requestPayload && requestPayload.data + ? requestPayload.data + : null, +); + +const delayedDataProvider = new Proxy(restProvider, { + get: (target, name, self) => + name === "then" + ? // as we await for the dataProvider, JS calls then on it. We must trap that call or else the dataProvider will be called with the then method + self + : (resource, params) => + new Promise((resolve) => + setTimeout( + () => resolve(restProvider[name](resource, params)), + 500, + ), + ), +}); + +function foo4() { + return !match || match.length < 5 + ? line + : match[1] + match[2] + match[3] + match[4]; +} + +function foo5() { + return !match || match.length < 5 + ? foo(line) + : match[1] + match[2] + match[3] + match[4]; +} + +function foo6() { + return !match || match.length < 5 + ? linethatisverylongandbreaksthelinehooray + : match[1] + match[2] + match[3] + match[4]; +} + +function foo7() { + return !match || match.length < 5 + ? linethatisverylongandbreaksthelinehoorayjustabitlonger + : match[1] + match[2] + match[3] + match[4]; +} +``` + +# Lines exceeding max width of 80 characters +``` + 1: // concatened string in consequent should be visually distinguishable from alternate + 70: // I think we should indent after the inner || on this, and do better wtih the parens around the && + 107: ? // as we await for the dataProvider, JS calls then on it. We must trap that call or else the dataProvider will be called with the then method +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/comments.js b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/comments.js new file mode 100644 index 00000000000..73640ec2a1a --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/comments.js @@ -0,0 +1,5 @@ +class A { + @dec() + // comment + accessor b; +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/comments.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/comments.js.prettier-snap new file mode 100644 index 00000000000..73640ec2a1a --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/comments.js.prettier-snap @@ -0,0 +1,5 @@ +class A { + @dec() + // comment + accessor b; +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/computed-with-newline.js b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/computed-with-newline.js deleted file mode 100644 index a067c2ad5c2..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/computed-with-newline.js +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - accessor - ["bar"]; -} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/computed-with-newline.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/computed-with-newline.js.prettier-snap deleted file mode 100644 index 814c379ca5e..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/computed-with-newline.js.prettier-snap +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - accessor; - ["bar"]; -} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-with-newline.js b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-with-newline.js deleted file mode 100644 index e297f3f665b..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-with-newline.js +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - static accessor - bar; -} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-with-newline.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-with-newline.js.prettier-snap deleted file mode 100644 index dedfc09a835..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/static-with-newline.js.prettier-snap +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - static accessor; - bar; -} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-newline.js b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-newline.js deleted file mode 100644 index 30bf86a73fd..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-newline.js +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - accessor - bar; -} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-newline.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-newline.js.prettier-snap deleted file mode 100644 index 6c9e87ea201..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-auto-accessors/with-newline.js.prettier-snap +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - accessor; - bar; -} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-comments/comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-comments/comments.js.snap index 68e368ae83a..7eab2e508bd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorator-comments/comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorator-comments/comments.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorator-comments/comments.js +assertion_line: 212 +info: js/decorator-comments/comments.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators-export/after_export.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators-export/after_export.js.snap index f67c732ab8a..88aee256886 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators-export/after_export.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators-export/after_export.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators-export/after_export.js +assertion_line: 212 +info: js/decorators-export/after_export.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/arguments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/arguments.js.snap index f5315fb0922..d853d42c2c5 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/arguments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/arguments.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/class-expression/arguments.js +assertion_line: 212 +info: js/decorators/class-expression/arguments.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/class-expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/class-expression.js.snap index a5bcb803e1a..876ff408dfd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/class-expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/class-expression.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/class-expression/class-expression.js +assertion_line: 212 +info: js/decorators/class-expression/class-expression.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.prettier-snap index 19e230f0f10..48b242e544f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.prettier-snap @@ -1,8 +1,8 @@ -(( +( @deco class Foo {} -).name); -(( +).name; +( @deco class {} -).name); +).name; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.snap index 753b27fb29b..ab43ca6e37c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/member-expression.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/class-expression/member-expression.js +assertion_line: 212 +info: js/decorators/class-expression/member-expression.js --- # Input @@ -19,18 +19,16 @@ info: --- Prettier +++ Rome @@ -1,8 +1,6 @@ --(( + ( - @deco - class Foo {} --).name); --(( -- @deco -- class {} --).name); -+( +-).name; +@deco class Foo {} +).name -+( + ( +- @deco +- class {} +-).name; +@deco class {} +).name ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/super-class.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/super-class.js.snap index 55b9a2c1bd3..de958f2d526 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/super-class.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/class-expression/super-class.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/class-expression/super-class.js +assertion_line: 212 +info: js/decorators/class-expression/super-class.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/classes.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/classes.js.snap index 1e30fa344d2..b2c6c63c508 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/classes.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/classes.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/classes.js +assertion_line: 212 +info: js/decorators/classes.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/comments.js.snap index cb719593a14..23fe2f2fc57 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/comments.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/comments.js +assertion_line: 212 +info: js/decorators/comments.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/member-expression.js b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/member-expression.js new file mode 100644 index 00000000000..05baf20bc8d --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/member-expression.js @@ -0,0 +1,50 @@ +[ + class { + @(decorators[0]) + method() {} + }, + class { + @decorators[0] + method() {} + }, + class { + @(decorators?.[0]) + method() {} + }, + class { + @(decorators.at(0)) + method() {} + }, + class { + @(decorators?.at(0)) + method() {} + }, + class { + @(decorators.first) + method() {} + }, + class { + @(decorators?.first) + method() {} + }, + class { + @(decorators[first]) + method() {} + }, + class { + @decorators[first] + method() {} + }, + class { + @(decorators["first"]) + method() {} + }, + @(decorators[first]) + class { + method() {} + }, + @(decorators[0]) + class { + method() {} + }, +] diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/member-expression.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/member-expression.js.prettier-snap new file mode 100644 index 00000000000..6d45269fac7 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/member-expression.js.prettier-snap @@ -0,0 +1,54 @@ +[ + class { + @decorators[0] + method() {} + }, + class { + @decorators [0]; + method() {} + }, + class { + @(decorators?.[0]) + method() {} + }, + class { + @decorators.at(0) + method() {} + }, + class { + @(decorators?.at(0)) + method() {} + }, + class { + @decorators.first + method() {} + }, + class { + @(decorators?.first) + method() {} + }, + class { + @decorators[first] + method() {} + }, + class { + @decorators [first]; + method() {} + }, + class { + @decorators["first"] + method() {} + }, + ( + @decorators[first] + class { + method() {} + } + ), + ( + @decorators[0] + class { + method() {} + } + ), +]; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/member-expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/member-expression.js.snap new file mode 100644 index 00000000000..4e40530cead --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/member-expression.js.snap @@ -0,0 +1,293 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: js/decorators/member-expression.js +--- + +# Input + +```js +[ + class { + @(decorators[0]) + method() {} + }, + class { + @decorators[0] + method() {} + }, + class { + @(decorators?.[0]) + method() {} + }, + class { + @(decorators.at(0)) + method() {} + }, + class { + @(decorators?.at(0)) + method() {} + }, + class { + @(decorators.first) + method() {} + }, + class { + @(decorators?.first) + method() {} + }, + class { + @(decorators[first]) + method() {} + }, + class { + @decorators[first] + method() {} + }, + class { + @(decorators["first"]) + method() {} + }, + @(decorators[first]) + class { + method() {} + }, + @(decorators[0]) + class { + method() {} + }, +] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -1,10 +1,10 @@ + [ + class { +- @decorators[0] ++ @(decorators[0]) + method() {} + }, + class { +- @decorators [0]; ++ @decorators[0] + method() {} + }, + class { +@@ -12,7 +12,7 @@ + method() {} + }, + class { +- @decorators.at(0) ++ @(decorators.at(0)) + method() {} + }, + class { +@@ -20,7 +20,7 @@ + method() {} + }, + class { +- @decorators.first ++ @(decorators.first) + method() {} + }, + class { +@@ -28,27 +28,23 @@ + method() {} + }, + class { ++ @(decorators[first]) ++ method() {} ++ }, ++ class { + @decorators[first] + method() {} + }, + class { +- @decorators [first]; ++ @(decorators["first"]) ++ method() {} ++ }, ++ @(decorators[first]) ++ class { + method() {} + }, ++ @(decorators[0]) + class { +- @decorators["first"] + method() {} + }, +- ( +- @decorators[first] +- class { +- method() {} +- } +- ), +- ( +- @decorators[0] +- class { +- method() {} +- } +- ), +-]; ++] +``` + +# Output + +```js +[ + class { + @(decorators[0]) + method() {} + }, + class { + @decorators[0] + method() {} + }, + class { + @(decorators?.[0]) + method() {} + }, + class { + @(decorators.at(0)) + method() {} + }, + class { + @(decorators?.at(0)) + method() {} + }, + class { + @(decorators.first) + method() {} + }, + class { + @(decorators?.first) + method() {} + }, + class { + @(decorators[first]) + method() {} + }, + class { + @decorators[first] + method() {} + }, + class { + @(decorators["first"]) + method() {} + }, + @(decorators[first]) + class { + method() {} + }, + @(decorators[0]) + class { + method() {} + }, +] +``` + +# Errors +``` +member-expression.js:42:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a property, an expression, or a method but instead found '@' + + 40 │ method() {} + 41 │ }, + > 42 │ @(decorators[first]) + │ ^ + 43 │ class { + 44 │ method() {} + + i Expected a property, an expression, or a method here + + 40 │ method() {} + 41 │ }, + > 42 │ @(decorators[first]) + │ ^ + 43 │ class { + 44 │ method() {} + +member-expression.js:42:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `(` + + 40 │ method() {} + 41 │ }, + > 42 │ @(decorators[first]) + │ ^ + 43 │ class { + 44 │ method() {} + + i Remove ( + +member-expression.js:43:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `class` + + 41 │ }, + 42 │ @(decorators[first]) + > 43 │ class { + │ ^^^^^ + 44 │ method() {} + 45 │ }, + + i Remove class + +member-expression.js:46:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a property, an expression, or a method but instead found '@' + + 44 │ method() {} + 45 │ }, + > 46 │ @(decorators[0]) + │ ^ + 47 │ class { + 48 │ method() {} + + i Expected a property, an expression, or a method here + + 44 │ method() {} + 45 │ }, + > 46 │ @(decorators[0]) + │ ^ + 47 │ class { + 48 │ method() {} + +member-expression.js:46:4 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `(` + + 44 │ method() {} + 45 │ }, + > 46 │ @(decorators[0]) + │ ^ + 47 │ class { + 48 │ method() {} + + i Remove ( + +member-expression.js:47:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `,` but instead found `class` + + 45 │ }, + 46 │ @(decorators[0]) + > 47 │ class { + │ ^^^^^ + 48 │ method() {} + 49 │ }, + + i Remove class + + +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/methods.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/methods.js.snap index c8cf9fb324b..6a0cbac1c91 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/methods.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/methods.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/methods.js +assertion_line: 212 +info: js/decorators/methods.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/mobx.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/mobx.js.snap index 9d1bb2b2721..8eab3624afe 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/mobx.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/mobx.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/mobx.js +assertion_line: 212 +info: js/decorators/mobx.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiline.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiline.js.snap index 43be0bbdcb3..f28956047f3 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiline.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiline.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/multiline.js +assertion_line: 212 +info: js/decorators/multiline.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiple.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiple.js.snap index 13398dfe56f..5bd983f4c76 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiple.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/multiple.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/multiple.js +assertion_line: 212 +info: js/decorators/multiple.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/redux.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/redux.js.snap index 90a0eeef5e2..942f048b1a8 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/decorators/redux.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/decorators/redux.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/decorators/redux.js +assertion_line: 212 +info: js/decorators/redux.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/arrow-params.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/arrow-params.js.snap index 4f484ced4ab..30600fcfa79 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/arrow-params.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/arrow-params.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/destructuring-private-fields/arrow-params.js +assertion_line: 212 +info: js/destructuring-private-fields/arrow-params.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/async-arrow-params.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/async-arrow-params.js.snap index 2ae80d069e9..29d3168c3a0 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/async-arrow-params.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/async-arrow-params.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/destructuring-private-fields/async-arrow-params.js +assertion_line: 212 +info: js/destructuring-private-fields/async-arrow-params.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/nested-bindings.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/nested-bindings.js.snap index 565ab20bb64..c00166c46a6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/nested-bindings.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/nested-bindings.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/destructuring-private-fields/nested-bindings.js +assertion_line: 212 +info: js/destructuring-private-fields/nested-bindings.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/valid-multiple-bindings.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/valid-multiple-bindings.js.snap index 88a9e793bb5..5c60ee3706e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/valid-multiple-bindings.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring-private-fields/valid-multiple-bindings.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/destructuring-private-fields/valid-multiple-bindings.js +assertion_line: 212 +info: js/destructuring-private-fields/valid-multiple-bindings.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring/destructuring.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring/destructuring.js.snap index 9505b749ff7..fafe7602e93 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/destructuring/destructuring.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/destructuring/destructuring.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/destructuring/destructuring.js +assertion_line: 212 +info: js/destructuring/destructuring.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/do/call-arguments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/do/call-arguments.js.snap index adab2a638c8..99d89d101b6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/do/call-arguments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/do/call-arguments.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/do/call-arguments.js +assertion_line: 212 +info: js/do/call-arguments.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.prettier-snap index 1bb5b102088..01179b75859 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.prettier-snap @@ -36,7 +36,7 @@ function foo() { } (do {}); -(do {} + 1); +(do {}) + 1; 1 + do {}; () => do {}; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.snap index 3acd454d4f4..57e5fa7ada7 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/do/do.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/do/do.js +assertion_line: 212 +info: js/do/do.js --- # Input @@ -132,7 +132,7 @@ function foo() { } -(do {}); --(do {} + 1); +-(do {}) + 1; -1 + do {}; -() => do {}; +( diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/binary_and_template.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/binary_and_template.js.snap index 143b4a686d5..6f7d63d1ad9 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/binary_and_template.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/binary_and_template.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/export-default/binary_and_template.js +assertion_line: 212 +info: js/export-default/binary_and_template.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/body.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/body.js.snap index 324b6061553..aaff6c9d82d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/body.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/body.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/export-default/body.js +assertion_line: 212 +info: js/export-default/body.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/class_instance.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/class_instance.js.snap index 1efa41d8a62..b4866a2a02b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/class_instance.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/class_instance.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/export-default/class_instance.js +assertion_line: 212 +info: js/export-default/class_instance.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/escaped/default-escaped.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/escaped/default-escaped.js.snap index 95b8f578c92..1a9522f7fd6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/escaped/default-escaped.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/escaped/default-escaped.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/export-default/escaped/default-escaped.js +assertion_line: 212 +info: js/export-default/escaped/default-escaped.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/function_tostring.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/function_tostring.js.snap index b21e794af22..be33b07bd3b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/export-default/function_tostring.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/export-default/function_tostring.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/export-default/function_tostring.js +assertion_line: 212 +info: js/export-default/function_tostring.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/export-extension/export.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/export-extension/export.js.snap index 40d3aecd325..3d8ff9289fd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/export-extension/export.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/export-extension/export.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/export-extension/export.js +assertion_line: 212 +info: js/export-extension/export.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/export/blank-line-between-specifiers.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/export/blank-line-between-specifiers.js.snap index 1af73298210..8f5e058b5a3 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/export/blank-line-between-specifiers.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/export/blank-line-between-specifiers.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/export/blank-line-between-specifiers.js +assertion_line: 212 +info: js/export/blank-line-between-specifiers.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/exports/test.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/exports/test.js.snap index 7da424f1e6b..f2672b8e00b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/exports/test.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/exports/test.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/exports/test.js +assertion_line: 212 +info: js/exports/test.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/for/continue-and-break-comment-1.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/for/continue-and-break-comment-1.js.snap index 679773903f9..3abde7abdf3 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/for/continue-and-break-comment-1.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/for/continue-and-break-comment-1.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/for/continue-and-break-comment-1.js +assertion_line: 212 +info: js/for/continue-and-break-comment-1.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/for/continue-and-break-comment-without-blocks.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/for/continue-and-break-comment-without-blocks.js.snap index dd22f829e70..0e7adf90edb 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/for/continue-and-break-comment-without-blocks.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/for/continue-and-break-comment-without-blocks.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/for/continue-and-break-comment-without-blocks.js +assertion_line: 212 +info: js/for/continue-and-break-comment-without-blocks.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/function/function_expression.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/function/function_expression.js.prettier-snap index 20caa543ea4..278b90ff44a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/function/function_expression.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/function/function_expression.js.prettier-snap @@ -1,4 +1,4 @@ -(function () {}.length); +(function () {}).length; typeof function () {}; export default (function () {})(); (function () {})()``; @@ -6,6 +6,6 @@ export default (function () {})(); new (function () {})(); (function () {}); a = function f() {} || b; -(function () {} && a); +(function () {}) && a; a + function () {}; new (function () {})(); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/function/function_expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/function/function_expression.js.snap deleted file mode 100644 index 5be2b42509d..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/function/function_expression.js.snap +++ /dev/null @@ -1,62 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/function/function_expression.js ---- - -# Input - -```js -(function() {}).length -typeof (function() {}); -export default (function() {})(); -(function() {})()``; -(function() {})``; -new (function() {}); -(function() {}); -a = function f() {} || b; -(function() {} && a); -a + function() {}; -new function() {}; - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -1,4 +1,4 @@ --(function () {}.length); -+(function () {}).length; - typeof function () {}; - export default (function () {})(); - (function () {})()``; -@@ -6,6 +6,6 @@ - new (function () {})(); - (function () {}); - a = function f() {} || b; --(function () {} && a); -+(function () {}) && a; - a + function () {}; - new (function () {})(); -``` - -# Output - -```js -(function () {}).length; -typeof function () {}; -export default (function () {})(); -(function () {})()``; -(function () {})``; -new (function () {})(); -(function () {}); -a = function f() {} || b; -(function () {}) && a; -a + function () {}; -new (function () {})(); -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/await.js b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/await.js new file mode 100644 index 00000000000..af916b3ce95 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/await.js @@ -0,0 +1,6 @@ +async function a() { + for await((let) of foo); + for await((let).a of foo); + for await((let)[a] of foo); + for await((let)()[a] of foo); +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/await.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/await.js.prettier-snap new file mode 100644 index 00000000000..c101905a535 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/await.js.prettier-snap @@ -0,0 +1,6 @@ +async function a() { + for await ((let) of foo); + for await ((let).a of foo); + for await ((let)[a] of foo); + for await ((let)()[a] of foo); +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/let.js b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/let.js new file mode 100644 index 00000000000..ae49197b822 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/let.js @@ -0,0 +1,13 @@ +for ((let) of foo); +for (foo of let); +for (foo of let.a); +for (foo of let[a]); +for ((let.a) of foo); +for ((let[a]) of foo); +for ((let)().a of foo); +for (letFoo of foo); + +for ((let.a) in foo); +for ((let[a]) in foo); + +for (let of of let); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/let.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/let.js.prettier-snap new file mode 100644 index 00000000000..d5420351de4 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/let.js.prettier-snap @@ -0,0 +1,13 @@ +for ((let) of foo); +for (foo of let); +for (foo of let.a); +for (foo of let[a]); +for ((let).a of foo); +for ((let)[a] of foo); +for ((let)().a of foo); +for (letFoo of foo); + +for (let.a in foo); +for ((let)[a] in foo); + +for (let of of let); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/let.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/let.js.snap new file mode 100644 index 00000000000..2786ca9cf0b --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/for-of/let.js.snap @@ -0,0 +1,178 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: js/identifier/for-of/let.js +--- + +# Input + +```js +for ((let) of foo); +for (foo of let); +for (foo of let.a); +for (foo of let[a]); +for ((let.a) of foo); +for ((let[a]) of foo); +for ((let)().a of foo); +for (letFoo of foo); + +for ((let.a) in foo); +for ((let[a]) in foo); + +for (let of of let); + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -2,12 +2,12 @@ + for (foo of let); + for (foo of let.a); + for (foo of let[a]); +-for ((let).a of foo); +-for ((let)[a] of foo); ++for (let.a of foo); ++for (let[a] of foo); + for ((let)().a of foo); + for (letFoo of foo); + + for (let.a in foo); +-for ((let)[a] in foo); ++for (let[a] in foo); + + for (let of of let); +``` + +# Output + +```js +for ((let) of foo); +for (foo of let); +for (foo of let.a); +for (foo of let[a]); +for (let.a of foo); +for (let[a] of foo); +for ((let)().a of foo); +for (letFoo of foo); + +for (let.a in foo); +for (let[a] in foo); + +for (let of of let); +``` + +# Errors +``` +let.js:1:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + > 1 │ for ((let) of foo); + │ ^^^ + 2 │ for (foo of let); + 3 │ for (foo of let.a); + +let.js:2:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 1 │ for ((let) of foo); + > 2 │ for (foo of let); + │ ^^^ + 3 │ for (foo of let.a); + 4 │ for (foo of let[a]); + +let.js:3:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 1 │ for ((let) of foo); + 2 │ for (foo of let); + > 3 │ for (foo of let.a); + │ ^^^ + 4 │ for (foo of let[a]); + 5 │ for ((let.a) of foo); + +let.js:4:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 2 │ for (foo of let); + 3 │ for (foo of let.a); + > 4 │ for (foo of let[a]); + │ ^^^ + 5 │ for ((let.a) of foo); + 6 │ for ((let[a]) of foo); + +let.js:5:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 3 │ for (foo of let.a); + 4 │ for (foo of let[a]); + > 5 │ for ((let.a) of foo); + │ ^^^ + 6 │ for ((let[a]) of foo); + 7 │ for ((let)().a of foo); + +let.js:6:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 4 │ for (foo of let[a]); + 5 │ for ((let.a) of foo); + > 6 │ for ((let[a]) of foo); + │ ^^^ + 7 │ for ((let)().a of foo); + 8 │ for (letFoo of foo); + +let.js:7:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 5 │ for ((let.a) of foo); + 6 │ for ((let[a]) of foo); + > 7 │ for ((let)().a of foo); + │ ^^^ + 8 │ for (letFoo of foo); + 9 │ + +let.js:10:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 8 │ for (letFoo of foo); + 9 │ + > 10 │ for ((let.a) in foo); + │ ^^^ + 11 │ for ((let[a]) in foo); + 12 │ + +let.js:11:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 10 │ for ((let.a) in foo); + > 11 │ for ((let[a]) in foo); + │ ^^^ + 12 │ + 13 │ for (let of of let); + +let.js:13:16 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 11 │ for ((let[a]) in foo); + 12 │ + > 13 │ for (let of of let); + │ ^^^ + 14 │ + + +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/const.js b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/const.js new file mode 100644 index 00000000000..8fa111711c3 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/const.js @@ -0,0 +1 @@ +const [a = ((let)[0] = 1)] = 2; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/const.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/const.js.prettier-snap new file mode 100644 index 00000000000..3c6ee1a540a --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/const.js.prettier-snap @@ -0,0 +1 @@ +const [a = (let[0] = 1)] = 2; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/const.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/const.js.snap new file mode 100644 index 00000000000..c25636f1f9c --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/const.js.snap @@ -0,0 +1,44 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: js/identifier/parentheses/const.js +--- + +# Input + +```js +const [a = ((let)[0] = 1)] = 2; + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -1 +1 @@ +-const [a = (let[0] = 1)] = 2; ++const [a = ((let)[0] = 1)] = 2; +``` + +# Output + +```js +const [a = ((let)[0] = 1)] = 2; +``` + +# Errors +``` +const.js:1:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + > 1 │ const [a = ((let)[0] = 1)] = 2; + │ ^^^ + 2 │ + + +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/let.js b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/let.js new file mode 100644 index 00000000000..2f0cc8a37b9 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/let.js @@ -0,0 +1,103 @@ +let.a = 1; + +let.a[0] = 1; + +(let[a] = 1); + +(let[a].b.c.e = 1); + +foo[let[a]] = 1; + +(let)[let[a]] = 1; + +(let[a] ??= 1); + +foo = let[a]; + +let()[a] = 1; + +foo(let)[a] = 1; + +foo(let[a])[a] = 1; + +(let[0] = 1); + +(let["a"] = 1); + +let = 1; + +var let = 1; + +[let[a]] = 1; + +({a: let[a]} = 1); + +alert(let[0] = 1); + +(let[0] = 1) || 2; + +((let[0] = 1), 2); + +((let[0] = 1) ? a : b); + +if (let[0] = 1); + +while (let[0] = 1); + +do{} while (let[0] = 1); + +var a = (let[0] = 1); + +(let[0] = 1) instanceof a; + +void (let[0] = 1); + +(let[0] = 1)(); + +new (let[0] = 1)(); + +((let)[0] = 1)``; + +((let)[0] = 1).toString; + +((let)[0] = 1)?.toString; + +[...(let[0] = 1)]; + +foo = () => (let[0] = 1); + +function * foo() {yield (let[0] = 1)} + +async function foo() {await (let[0] = 1)} + +function foo() {return (let[0] = 1)} + +while (true) (let[0] = 1); + +throw (let[0] = 1); + +({foo: (let[0] = 1)}); + +[(let[0] = 1)]; + +for ((let[0] = 1);;); +for ((let)[0] in {}); +for ((let)[0] of []); + +switch (let[0] = 1) {} + +switch (foo) { + case let[0] = 1: +} + +with (let[0] = 1); + +(let[x]).foo(); + +let.let[x].foo(); + +a = let[x].foo(); + +(let)[2]; + +a[1] + (let[2] = 2); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/let.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/let.js.prettier-snap new file mode 100644 index 00000000000..8e4a10ff146 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/let.js.prettier-snap @@ -0,0 +1,110 @@ +let.a = 1; + +let.a[0] = 1; + +(let)[a] = 1; + +(let)[a].b.c.e = 1; + +foo[let[a]] = 1; + +(let)[let[a]] = 1; + +(let)[a] ??= 1; + +foo = let[a]; + +let()[a] = 1; + +foo(let)[a] = 1; + +foo(let[a])[a] = 1; + +(let)[0] = 1; + +(let)["a"] = 1; + +let = 1; + +var let = 1; + +[let[a]] = 1; + +({ a: let[a] } = 1); + +alert((let[0] = 1)); + +((let)[0] = 1) || 2; + +((let)[0] = 1), 2; + +((let)[0] = 1) ? a : b; + +if ((let[0] = 1)); + +while ((let[0] = 1)); + +do {} while ((let[0] = 1)); + +var a = (let[0] = 1); + +((let)[0] = 1) instanceof a; + +void (let[0] = 1); + +((let)[0] = 1)(); + +new (let[0] = 1)(); + +((let)[0] = 1)``; + +((let)[0] = 1).toString; + +((let)[0] = 1)?.toString; + +[...(let[0] = 1)]; + +foo = () => (let[0] = 1); + +function* foo() { + yield (let[0] = 1); +} + +async function foo() { + await (let[0] = 1); +} + +function foo() { + return (let[0] = 1); +} + +while (true) (let)[0] = 1; + +throw (let[0] = 1); + +({ foo: (let[0] = 1) }); + +[(let[0] = 1)]; + +for ((let)[0] = 1; ; ); +for ((let)[0] in {}); +for ((let)[0] of []); + +switch ((let[0] = 1)) { +} + +switch (foo) { + case (let[0] = 1): +} + +with ((let[0] = 1)); + +(let)[x].foo(); + +let.let[x].foo(); + +a = let[x].foo(); + +(let)[2]; + +a[1] + (let[2] = 2); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/let.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/let.js.snap new file mode 100644 index 00000000000..b4679342e3a --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/js/identifier/parentheses/let.js.snap @@ -0,0 +1,923 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: js/identifier/parentheses/let.js +--- + +# Input + +```js +let.a = 1; + +let.a[0] = 1; + +(let[a] = 1); + +(let[a].b.c.e = 1); + +foo[let[a]] = 1; + +(let)[let[a]] = 1; + +(let[a] ??= 1); + +foo = let[a]; + +let()[a] = 1; + +foo(let)[a] = 1; + +foo(let[a])[a] = 1; + +(let[0] = 1); + +(let["a"] = 1); + +let = 1; + +var let = 1; + +[let[a]] = 1; + +({a: let[a]} = 1); + +alert(let[0] = 1); + +(let[0] = 1) || 2; + +((let[0] = 1), 2); + +((let[0] = 1) ? a : b); + +if (let[0] = 1); + +while (let[0] = 1); + +do{} while (let[0] = 1); + +var a = (let[0] = 1); + +(let[0] = 1) instanceof a; + +void (let[0] = 1); + +(let[0] = 1)(); + +new (let[0] = 1)(); + +((let)[0] = 1)``; + +((let)[0] = 1).toString; + +((let)[0] = 1)?.toString; + +[...(let[0] = 1)]; + +foo = () => (let[0] = 1); + +function * foo() {yield (let[0] = 1)} + +async function foo() {await (let[0] = 1)} + +function foo() {return (let[0] = 1)} + +while (true) (let[0] = 1); + +throw (let[0] = 1); + +({foo: (let[0] = 1)}); + +[(let[0] = 1)]; + +for ((let[0] = 1);;); +for ((let)[0] in {}); +for ((let)[0] of []); + +switch (let[0] = 1) {} + +switch (foo) { + case let[0] = 1: +} + +with (let[0] = 1); + +(let[x]).foo(); + +let.let[x].foo(); + +a = let[x].foo(); + +(let)[2]; + +a[1] + (let[2] = 2); + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -2,15 +2,15 @@ + + let.a[0] = 1; + +-(let)[a] = 1; ++let[a] = 1; + +-(let)[a].b.c.e = 1; ++let[a].b.c.e = 1; + + foo[let[a]] = 1; + + (let)[let[a]] = 1; + +-(let)[a] ??= 1; ++let[a] ??= 1; + + foo = let[a]; + +@@ -20,9 +20,9 @@ + + foo(let[a])[a] = 1; + +-(let)[0] = 1; ++let[0] = 1; + +-(let)["a"] = 1; ++let["a"] = 1; + + let = 1; + +@@ -34,11 +34,11 @@ + + alert((let[0] = 1)); + +-((let)[0] = 1) || 2; ++(let[0] = 1) || 2; + +-((let)[0] = 1), 2; ++(let[0] = 1), 2; + +-((let)[0] = 1) ? a : b; ++(let[0] = 1) ? a : b; + + if ((let[0] = 1)); + +@@ -48,11 +48,11 @@ + + var a = (let[0] = 1); + +-((let)[0] = 1) instanceof a; ++(let[0] = 1) instanceof a; + + void (let[0] = 1); + +-((let)[0] = 1)(); ++(let[0] = 1)(); + + new (let[0] = 1)(); + +@@ -78,7 +78,7 @@ + return (let[0] = 1); + } + +-while (true) (let)[0] = 1; ++while (true) let[0] = 1; + + throw (let[0] = 1); + +@@ -86,7 +86,7 @@ + + [(let[0] = 1)]; + +-for ((let)[0] = 1; ; ); ++for (let[0] = 1; ; ); + for ((let)[0] in {}); + for ((let)[0] of []); + +@@ -97,9 +97,9 @@ + case (let[0] = 1): + } + +-with ((let[0] = 1)); ++with (let[0] = 1); + +-(let)[x].foo(); ++let[x].foo(); + + let.let[x].foo(); + +``` + +# Output + +```js +let.a = 1; + +let.a[0] = 1; + +let[a] = 1; + +let[a].b.c.e = 1; + +foo[let[a]] = 1; + +(let)[let[a]] = 1; + +let[a] ??= 1; + +foo = let[a]; + +let()[a] = 1; + +foo(let)[a] = 1; + +foo(let[a])[a] = 1; + +let[0] = 1; + +let["a"] = 1; + +let = 1; + +var let = 1; + +[let[a]] = 1; + +({ a: let[a] } = 1); + +alert((let[0] = 1)); + +(let[0] = 1) || 2; + +(let[0] = 1), 2; + +(let[0] = 1) ? a : b; + +if ((let[0] = 1)); + +while ((let[0] = 1)); + +do {} while ((let[0] = 1)); + +var a = (let[0] = 1); + +(let[0] = 1) instanceof a; + +void (let[0] = 1); + +(let[0] = 1)(); + +new (let[0] = 1)(); + +((let)[0] = 1)``; + +((let)[0] = 1).toString; + +((let)[0] = 1)?.toString; + +[...(let[0] = 1)]; + +foo = () => (let[0] = 1); + +function* foo() { + yield (let[0] = 1); +} + +async function foo() { + await (let[0] = 1); +} + +function foo() { + return (let[0] = 1); +} + +while (true) let[0] = 1; + +throw (let[0] = 1); + +({ foo: (let[0] = 1) }); + +[(let[0] = 1)]; + +for (let[0] = 1; ; ); +for ((let)[0] in {}); +for ((let)[0] of []); + +switch ((let[0] = 1)) { +} + +switch (foo) { + case (let[0] = 1): +} + +with (let[0] = 1); + +let[x].foo(); + +let.let[x].foo(); + +a = let[x].foo(); + +(let)[2]; + +a[1] + (let[2] = 2); +``` + +# Errors +``` +let.js:1:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + > 1 │ let.a = 1; + │ ^^^ + 2 │ + 3 │ let.a[0] = 1; + +let.js:3:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 1 │ let.a = 1; + 2 │ + > 3 │ let.a[0] = 1; + │ ^^^ + 4 │ + 5 │ (let[a] = 1); + +let.js:5:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 3 │ let.a[0] = 1; + 4 │ + > 5 │ (let[a] = 1); + │ ^^^ + 6 │ + 7 │ (let[a].b.c.e = 1); + +let.js:7:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 5 │ (let[a] = 1); + 6 │ + > 7 │ (let[a].b.c.e = 1); + │ ^^^ + 8 │ + 9 │ foo[let[a]] = 1; + +let.js:9:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 7 │ (let[a].b.c.e = 1); + 8 │ + > 9 │ foo[let[a]] = 1; + │ ^^^ + 10 │ + 11 │ (let)[let[a]] = 1; + +let.js:11:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 9 │ foo[let[a]] = 1; + 10 │ + > 11 │ (let)[let[a]] = 1; + │ ^^^ + 12 │ + 13 │ (let[a] ??= 1); + +let.js:11:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 9 │ foo[let[a]] = 1; + 10 │ + > 11 │ (let)[let[a]] = 1; + │ ^^^ + 12 │ + 13 │ (let[a] ??= 1); + +let.js:13:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 11 │ (let)[let[a]] = 1; + 12 │ + > 13 │ (let[a] ??= 1); + │ ^^^ + 14 │ + 15 │ foo = let[a]; + +let.js:15:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 13 │ (let[a] ??= 1); + 14 │ + > 15 │ foo = let[a]; + │ ^^^ + 16 │ + 17 │ let()[a] = 1; + +let.js:17:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 15 │ foo = let[a]; + 16 │ + > 17 │ let()[a] = 1; + │ ^^^ + 18 │ + 19 │ foo(let)[a] = 1; + +let.js:19:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 17 │ let()[a] = 1; + 18 │ + > 19 │ foo(let)[a] = 1; + │ ^^^ + 20 │ + 21 │ foo(let[a])[a] = 1; + +let.js:21:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 19 │ foo(let)[a] = 1; + 20 │ + > 21 │ foo(let[a])[a] = 1; + │ ^^^ + 22 │ + 23 │ (let[0] = 1); + +let.js:23:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 21 │ foo(let[a])[a] = 1; + 22 │ + > 23 │ (let[0] = 1); + │ ^^^ + 24 │ + 25 │ (let["a"] = 1); + +let.js:25:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 23 │ (let[0] = 1); + 24 │ + > 25 │ (let["a"] = 1); + │ ^^^ + 26 │ + 27 │ let = 1; + +let.js:27:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 25 │ (let["a"] = 1); + 26 │ + > 27 │ let = 1; + │ ^^^ + 28 │ + 29 │ var let = 1; + +let.js:29:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 27 │ let = 1; + 28 │ + > 29 │ var let = 1; + │ ^^^ + 30 │ + 31 │ [let[a]] = 1; + +let.js:31:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 29 │ var let = 1; + 30 │ + > 31 │ [let[a]] = 1; + │ ^^^ + 32 │ + 33 │ ({a: let[a]} = 1); + +let.js:33:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 31 │ [let[a]] = 1; + 32 │ + > 33 │ ({a: let[a]} = 1); + │ ^^^ + 34 │ + 35 │ alert(let[0] = 1); + +let.js:35:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 33 │ ({a: let[a]} = 1); + 34 │ + > 35 │ alert(let[0] = 1); + │ ^^^ + 36 │ + 37 │ (let[0] = 1) || 2; + +let.js:37:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 35 │ alert(let[0] = 1); + 36 │ + > 37 │ (let[0] = 1) || 2; + │ ^^^ + 38 │ + 39 │ ((let[0] = 1), 2); + +let.js:39:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 37 │ (let[0] = 1) || 2; + 38 │ + > 39 │ ((let[0] = 1), 2); + │ ^^^ + 40 │ + 41 │ ((let[0] = 1) ? a : b); + +let.js:41:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 39 │ ((let[0] = 1), 2); + 40 │ + > 41 │ ((let[0] = 1) ? a : b); + │ ^^^ + 42 │ + 43 │ if (let[0] = 1); + +let.js:43:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 41 │ ((let[0] = 1) ? a : b); + 42 │ + > 43 │ if (let[0] = 1); + │ ^^^ + 44 │ + 45 │ while (let[0] = 1); + +let.js:45:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 43 │ if (let[0] = 1); + 44 │ + > 45 │ while (let[0] = 1); + │ ^^^ + 46 │ + 47 │ do{} while (let[0] = 1); + +let.js:47:13 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 45 │ while (let[0] = 1); + 46 │ + > 47 │ do{} while (let[0] = 1); + │ ^^^ + 48 │ + 49 │ var a = (let[0] = 1); + +let.js:49:10 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 47 │ do{} while (let[0] = 1); + 48 │ + > 49 │ var a = (let[0] = 1); + │ ^^^ + 50 │ + 51 │ (let[0] = 1) instanceof a; + +let.js:51:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 49 │ var a = (let[0] = 1); + 50 │ + > 51 │ (let[0] = 1) instanceof a; + │ ^^^ + 52 │ + 53 │ void (let[0] = 1); + +let.js:53:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 51 │ (let[0] = 1) instanceof a; + 52 │ + > 53 │ void (let[0] = 1); + │ ^^^ + 54 │ + 55 │ (let[0] = 1)(); + +let.js:55:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 53 │ void (let[0] = 1); + 54 │ + > 55 │ (let[0] = 1)(); + │ ^^^ + 56 │ + 57 │ new (let[0] = 1)(); + +let.js:57:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 55 │ (let[0] = 1)(); + 56 │ + > 57 │ new (let[0] = 1)(); + │ ^^^ + 58 │ + 59 │ ((let)[0] = 1)``; + +let.js:59:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 57 │ new (let[0] = 1)(); + 58 │ + > 59 │ ((let)[0] = 1)``; + │ ^^^ + 60 │ + 61 │ ((let)[0] = 1).toString; + +let.js:61:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 59 │ ((let)[0] = 1)``; + 60 │ + > 61 │ ((let)[0] = 1).toString; + │ ^^^ + 62 │ + 63 │ ((let)[0] = 1)?.toString; + +let.js:63:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 61 │ ((let)[0] = 1).toString; + 62 │ + > 63 │ ((let)[0] = 1)?.toString; + │ ^^^ + 64 │ + 65 │ [...(let[0] = 1)]; + +let.js:65:6 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 63 │ ((let)[0] = 1)?.toString; + 64 │ + > 65 │ [...(let[0] = 1)]; + │ ^^^ + 66 │ + 67 │ foo = () => (let[0] = 1); + +let.js:67:14 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 65 │ [...(let[0] = 1)]; + 66 │ + > 67 │ foo = () => (let[0] = 1); + │ ^^^ + 68 │ + 69 │ function * foo() {yield (let[0] = 1)} + +let.js:69:26 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 67 │ foo = () => (let[0] = 1); + 68 │ + > 69 │ function * foo() {yield (let[0] = 1)} + │ ^^^ + 70 │ + 71 │ async function foo() {await (let[0] = 1)} + +let.js:71:30 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 69 │ function * foo() {yield (let[0] = 1)} + 70 │ + > 71 │ async function foo() {await (let[0] = 1)} + │ ^^^ + 72 │ + 73 │ function foo() {return (let[0] = 1)} + +let.js:73:25 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 71 │ async function foo() {await (let[0] = 1)} + 72 │ + > 73 │ function foo() {return (let[0] = 1)} + │ ^^^ + 74 │ + 75 │ while (true) (let[0] = 1); + +let.js:75:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 73 │ function foo() {return (let[0] = 1)} + 74 │ + > 75 │ while (true) (let[0] = 1); + │ ^^^ + 76 │ + 77 │ throw (let[0] = 1); + +let.js:77:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 75 │ while (true) (let[0] = 1); + 76 │ + > 77 │ throw (let[0] = 1); + │ ^^^ + 78 │ + 79 │ ({foo: (let[0] = 1)}); + +let.js:79:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 77 │ throw (let[0] = 1); + 78 │ + > 79 │ ({foo: (let[0] = 1)}); + │ ^^^ + 80 │ + 81 │ [(let[0] = 1)]; + +let.js:81:3 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 79 │ ({foo: (let[0] = 1)}); + 80 │ + > 81 │ [(let[0] = 1)]; + │ ^^^ + 82 │ + 83 │ for ((let[0] = 1);;); + +let.js:83:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 81 │ [(let[0] = 1)]; + 82 │ + > 83 │ for ((let[0] = 1);;); + │ ^^^ + 84 │ for ((let)[0] in {}); + 85 │ for ((let)[0] of []); + +let.js:84:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 83 │ for ((let[0] = 1);;); + > 84 │ for ((let)[0] in {}); + │ ^^^ + 85 │ for ((let)[0] of []); + 86 │ + +let.js:85:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 83 │ for ((let[0] = 1);;); + 84 │ for ((let)[0] in {}); + > 85 │ for ((let)[0] of []); + │ ^^^ + 86 │ + 87 │ switch (let[0] = 1) {} + +let.js:87:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 85 │ for ((let)[0] of []); + 86 │ + > 87 │ switch (let[0] = 1) {} + │ ^^^ + 88 │ + 89 │ switch (foo) { + +let.js:90:8 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 89 │ switch (foo) { + > 90 │ case let[0] = 1: + │ ^^^ + 91 │ } + 92 │ + +let.js:93:7 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 91 │ } + 92 │ + > 93 │ with (let[0] = 1); + │ ^^^ + 94 │ + 95 │ (let[x]).foo(); + +let.js:93:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × `with` statements are not allowed in strict mode + + 91 │ } + 92 │ + > 93 │ with (let[0] = 1); + │ ^^^^^^^^^^^^^^^^^^ + 94 │ + 95 │ (let[x]).foo(); + +let.js:95:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 93 │ with (let[0] = 1); + 94 │ + > 95 │ (let[x]).foo(); + │ ^^^ + 96 │ + 97 │ let.let[x].foo(); + +let.js:97:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 95 │ (let[x]).foo(); + 96 │ + > 97 │ let.let[x].foo(); + │ ^^^ + 98 │ + 99 │ a = let[x].foo(); + +let.js:99:5 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 97 │ let.let[x].foo(); + 98 │ + > 99 │ a = let[x].foo(); + │ ^^^ + 100 │ + 101 │ (let)[2]; + +let.js:101:2 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 99 │ a = let[x].foo(); + 100 │ + > 101 │ (let)[2]; + │ ^^^ + 102 │ + 103 │ a[1] + (let[2] = 2); + +let.js:103:9 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Illegal use of reserved keyword `let` as an identifier in strict mode + + 101 │ (let)[2]; + 102 │ + > 103 │ a[1] + (let[2] = 2); + │ ^^^ + 104 │ + + +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/import-assertions/bracket-spacing/empty.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/import-assertions/bracket-spacing/empty.js.snap index 7b3df90eab5..614e7d8b91d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/import-assertions/bracket-spacing/empty.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/import-assertions/bracket-spacing/empty.js.snap @@ -1,5 +1,6 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 info: js/import-assertions/bracket-spacing/empty.js --- diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/import-assertions/empty.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/import-assertions/empty.js.snap index 6ed789791a3..452c08c10a8 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/import-assertions/empty.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/import-assertions/empty.js.snap @@ -1,5 +1,6 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 info: js/import-assertions/empty.js --- diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/dangling-comment-in-arrow-function.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/dangling-comment-in-arrow-function.js.snap index 6615c2605e3..c209e2b42d8 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/dangling-comment-in-arrow-function.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/dangling-comment-in-arrow-function.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/last-argument-expansion/dangling-comment-in-arrow-function.js +assertion_line: 212 +info: js/last-argument-expansion/dangling-comment-in-arrow-function.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/13018.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/13018.js.snap index 2b9d6feb490..65e012d4346 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/13018.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/13018.js.snap @@ -1,5 +1,6 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 info: js/method-chain/13018.js --- diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-11298.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-11298.js.snap index 483728543b4..6e9220c8720 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-11298.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-11298.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/method-chain/issue-11298.js +assertion_line: 212 +info: js/method-chain/issue-11298.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-4125.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-4125.js.snap index c4057c4c2f7..47e7425e4db 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-4125.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-4125.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/method-chain/issue-4125.js +assertion_line: 212 +info: js/method-chain/issue-4125.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/test.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/test.js.prettier-snap index 11ec226b101..81fea87e173 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/test.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/test.js.prettier-snap @@ -3,5 +3,5 @@ method() ["abc"]((x) => x) [abc]((x) => x); -({}.a().b()); -({}.a().b()); +({}).a().b(); +({}).a().b(); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/test.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/test.js.snap deleted file mode 100644 index 6ccb00cceea..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/test.js.snap +++ /dev/null @@ -1,47 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/method-chain/test.js ---- - -# Input - -```js -method().then(x => x) - ["abc"](x => x) - [abc](x => x); - -({}.a().b()); -({}).a().b(); - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -3,5 +3,5 @@ - ["abc"]((x) => x) - [abc]((x) => x); - --({}.a().b()); --({}.a().b()); -+({}).a().b(); -+({}).a().b(); -``` - -# Output - -```js -method() - .then((x) => x) - ["abc"]((x) => x) - [abc]((x) => x); - -({}).a().b(); -({}).a().b(); -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/comments.js.snap index 5421350a4c4..1790bb22584 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/comments.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/module-blocks/comments.js +assertion_line: 212 +info: js/module-blocks/comments.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/module-blocks.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/module-blocks.js.snap index 7722aad0bb2..be779ccc63c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/module-blocks.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/module-blocks.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/module-blocks/module-blocks.js +assertion_line: 212 +info: js/module-blocks/module-blocks.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/range.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/range.js.snap index d4c4b0e3143..edd6412f423 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/range.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/range.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/module-blocks/range.js +assertion_line: 212 +info: js/module-blocks/range.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/worker.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/worker.js.snap index cc83d056080..a67ccdb2d78 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/worker.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/module-blocks/worker.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/module-blocks/worker.js +assertion_line: 212 +info: js/module-blocks/worker.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-comments/comment-inside.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-comments/comment-inside.js.snap index c95ee21a10c..2c9f139b780 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-comments/comment-inside.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-comments/comment-inside.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-comments/comment-inside.js +assertion_line: 212 +info: js/multiparser-comments/comment-inside.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/colons-after-substitutions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/colons-after-substitutions.js.snap index a5cf54c6ac0..fa46904b9b5 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/colons-after-substitutions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/colons-after-substitutions.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-css/colons-after-substitutions.js +assertion_line: 212 +info: js/multiparser-css/colons-after-substitutions.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/colons-after-substitutions2.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/colons-after-substitutions2.js.snap index a35083ee3a5..008293d9e72 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/colons-after-substitutions2.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/colons-after-substitutions2.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-css/colons-after-substitutions2.js +assertion_line: 212 +info: js/multiparser-css/colons-after-substitutions2.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-11797.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-11797.js.snap index d952c8b8bcf..e2668589849 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-11797.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-11797.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-css/issue-11797.js +assertion_line: 212 +info: js/multiparser-css/issue-11797.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-2883.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-2883.js.snap index 51e9f9b62d8..1c1a1e1dfc5 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-2883.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-2883.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-css/issue-2883.js +assertion_line: 212 +info: js/multiparser-css/issue-2883.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-5961.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-5961.js.snap index d4c6cdb98ed..7e24ed3da9c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-5961.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-5961.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-css/issue-5961.js +assertion_line: 212 +info: js/multiparser-css/issue-5961.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-9072.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-9072.js.snap index b637742a698..ea8e329274c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-9072.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/issue-9072.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-css/issue-9072.js +assertion_line: 212 +info: js/multiparser-css/issue-9072.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/styled-components-multiple-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/styled-components-multiple-expressions.js.snap index 5673024e92d..c379245fe44 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/styled-components-multiple-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/styled-components-multiple-expressions.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-css/styled-components-multiple-expressions.js +assertion_line: 212 +info: js/multiparser-css/styled-components-multiple-expressions.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/styled-components.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/styled-components.js.snap index cce1ead7e94..559bee6afac 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/styled-components.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/styled-components.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-css/styled-components.js +assertion_line: 212 +info: js/multiparser-css/styled-components.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/url.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/url.js.snap index c8574f8f771..be53ee86734 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/url.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/url.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-css/url.js +assertion_line: 212 +info: js/multiparser-css/url.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/var.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/var.js.snap index 3ff2dcce2eb..dba2e0e996b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/var.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-css/var.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-css/var.js +assertion_line: 212 +info: js/multiparser-css/var.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/comment-tag.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/comment-tag.js.snap index b0276cf097b..dbf69a795e0 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/comment-tag.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/comment-tag.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-graphql/comment-tag.js +assertion_line: 212 +info: js/multiparser-graphql/comment-tag.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/escape.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/escape.js.snap index 4d6a3564be1..c8f41eef445 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/escape.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/escape.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-graphql/escape.js +assertion_line: 212 +info: js/multiparser-graphql/escape.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/expressions.js.snap index 7fba5aaeef2..f9332b52dfb 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/expressions.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-graphql/expressions.js +assertion_line: 212 +info: js/multiparser-graphql/expressions.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql-tag.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql-tag.js.snap index 6e1b68c9c67..5033d4bc9f3 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql-tag.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql-tag.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-graphql/graphql-tag.js +assertion_line: 212 +info: js/multiparser-graphql/graphql-tag.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql.js.snap index c1f55dc2e12..d8609f43d06 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-graphql/graphql.js +assertion_line: 212 +info: js/multiparser-graphql/graphql.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/react-relay.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/react-relay.js.snap index ccb9273e733..6931d4b1d87 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/react-relay.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/react-relay.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-graphql/react-relay.js +assertion_line: 212 +info: js/multiparser-graphql/react-relay.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/html-template-literals.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/html-template-literals.js.snap index 331f9321047..9610ab371b1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/html-template-literals.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/html-template-literals.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-html/html-template-literals.js +assertion_line: 212 +info: js/multiparser-html/html-template-literals.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/issue-10691.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/issue-10691.js.snap index 047a1fa1766..01eff7b8717 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/issue-10691.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/issue-10691.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-html/issue-10691.js +assertion_line: 212 +info: js/multiparser-html/issue-10691.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/lit-html.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/lit-html.js.snap index 882ccc2249d..aecc8b16b6c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/lit-html.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/lit-html.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-html/lit-html.js +assertion_line: 212 +info: js/multiparser-html/lit-html.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-text/text.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-text/text.js.snap index ec059cec599..4bf178ce1a7 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-text/text.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-text/text.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/multiparser-text/text.js +assertion_line: 212 +info: js/multiparser-text/text.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/no-semi-babylon-extensions/no-semi.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/no-semi-babylon-extensions/no-semi.js.snap index 8f21cd2bfc4..ebfd832db16 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/no-semi-babylon-extensions/no-semi.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/no-semi-babylon-extensions/no-semi.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/no-semi-babylon-extensions/no-semi.js +assertion_line: 212 +info: js/no-semi-babylon-extensions/no-semi.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/no-semi/no-semi.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/no-semi/no-semi.js.prettier-snap index 0fa41d819fa..a54d7b8d34d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/no-semi/no-semi.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/no-semi/no-semi.js.prettier-snap @@ -17,9 +17,9 @@ x; x; (() => {})(); x; -({ a: 1 }.entries()); +({ a: 1 }).entries(); x; -({ a: 1 }.entries()); +({ a: 1 }).entries(); x; ; x; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/no-semi/no-semi.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/no-semi/no-semi.js.snap deleted file mode 100644 index 52241c8aa02..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/no-semi/no-semi.js.snap +++ /dev/null @@ -1,209 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/no-semi/no-semi.js ---- - -# Input - -```js - -// with preexisting semi - -x; [1, 2, 3].forEach(fn) -x; [a, b, ...c] = [1, 2] -x; /r/i.test('r') -x; +1 -x; - 1 -x; ('h' + 'i').repeat(10) -x; (1, 2) -x; (() => {})() -x; ({ a: 1 }).entries() -x; ({ a: 1 }).entries() -x; -x; `string` -x; (x, y) => x - -// doesn't have to be preceded by a semicolon - -class X {} [1, 2, 3].forEach(fn) - - -// don't semicolon if it doesn't start statement - -if (true) (() => {})() - - -// check indentation - -if (true) { - x; (() => {})() -} - -// check statement clauses - -do break; while (false) -if (true) do break; while (false) - -if (true) 1; else 2 -for (;;) ; -for (x of y) ; - -debugger - -// check that it doesn't break non-ASI - -1 -- 1 - -1 -+ 1 - -1 -/ 1 - -arr -[0] - -fn -(x) - -!1 - -1 -< 1 - -tag -`string` - -x; x => x - -x; (a || b).c++ - -x; ++(a || b).c - -while (false) - (function(){}()) - -aReallyLongLine012345678901234567890123456789012345678901234567890123456789 * - (b + c) - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -17,9 +17,9 @@ - x; - (() => {})(); - x; --({ a: 1 }.entries()); -+({ a: 1 }).entries(); - x; --({ a: 1 }.entries()); -+({ a: 1 }).entries(); - x; - ; - x; -``` - -# Output - -```js -// with preexisting semi - -x; -[1, 2, 3].forEach(fn); -x; -[a, b, ...c] = [1, 2]; -x; -/r/i.test("r"); -x; -+1; -x; --1; -x; -("h" + "i").repeat(10); -x; -1, 2; -x; -(() => {})(); -x; -({ a: 1 }).entries(); -x; -({ a: 1 }).entries(); -x; -; -x; -`string`; -x; -(x, y) => x; - -// doesn't have to be preceded by a semicolon - -class X {} -[1, 2, 3].forEach(fn); - -// don't semicolon if it doesn't start statement - -if (true) (() => {})(); - -// check indentation - -if (true) { - x; - (() => {})(); -} - -// check statement clauses - -do break; -while (false); -if (true) - do break; - while (false); - -if (true) 1; -else 2; -for (;;); -for (x of y); - -debugger; - -// check that it doesn't break non-ASI - -1 - 1; - -1 + 1; - -1 / 1; - -arr[0]; - -fn(x); - -!1; - -1 < 1; - -tag`string`; - -x; -(x) => x; - -x; -(a || b).c++; - -x; -++(a || b).c; - -while (false) (function () {})(); - -aReallyLongLine012345678901234567890123456789012345678901234567890123456789 * - (b + c); -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/objects/assignment-expression/object-property.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/objects/assignment-expression/object-property.js.snap index 2f9e4a83950..aa922671022 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/objects/assignment-expression/object-property.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/objects/assignment-expression/object-property.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/objects/assignment-expression/object-property.js +assertion_line: 212 +info: js/objects/assignment-expression/object-property.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.prettier-snap index 85dee504a48..e6027fc4fc6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.prettier-snap @@ -1,10 +1,10 @@ () => ({}``); -({}``); +({})``; a = () => ({}.x); -({} && a, b); -({}::b, 0); -({}::b()``[""].c++ && 0 ? 0 : 0, 0); -({}(), 0); +({}) && a, b; +({})::b, 0; +({})::b()``[""].c++ && 0 ? 0 : 0, 0; +({})(), 0; ({} = 0); ({} = 0), 1; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap index 9c66011996b..9c41dae43cd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/objects/expression.js +assertion_line: 212 +info: js/objects/expression.js --- # Input @@ -40,26 +40,22 @@ const a3 = { ```diff --- Prettier +++ Rome -@@ -1,10 +1,12 @@ +@@ -1,9 +1,11 @@ -() => ({}``); --({}``); --a = () => ({}.x); --({} && a, b); --({}::b, 0); --({}::b()``[""].c++ && 0 ? 0 : 0, 0); --({}(), 0); +() => ({})``; -+({})``; + ({})``; +-a = () => ({}.x); +a = () => ({}).x; -+({}) && a, b; + ({}) && a, b; +-({})::b, 0; +-({})::b()``[""].c++ && 0 ? 0 : 0, 0; +({} +::b, 0) +({} +::b()``[''].c++ && 0 ? 0 : 0, 0) -+({})(), 0; + ({})(), 0; ({} = 0); ({} = 0), 1; - ``` # Output diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/optional-chaining/chaining.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/optional-chaining/chaining.js.prettier-snap index e4308218b12..e2db57b91dc 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/optional-chaining/chaining.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/optional-chaining/chaining.js.prettier-snap @@ -79,8 +79,8 @@ a = () => ({}?.b() && a); (x) => ({}?.().b); (x) => ({}?.b()); (x) => ({}?.b.b); -({}?.a().b()); -({ a: 1 }?.entries()); +({})?.a().b(); +({ a: 1 })?.entries(); new (foo?.bar)(); new (foo?.bar())(); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/optional-chaining/chaining.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/optional-chaining/chaining.js.snap index 381f9a075ee..e17679c35bd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/optional-chaining/chaining.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/optional-chaining/chaining.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/optional-chaining/chaining.js +assertion_line: 212 +info: js/optional-chaining/chaining.js --- # Input @@ -142,7 +142,7 @@ new (foo?.())(); a?.[b ? c : d]; -@@ -59,28 +59,28 @@ +@@ -59,26 +59,26 @@ (function () {})?.(); (() => f)?.(); (() => f)?.x; @@ -167,8 +167,6 @@ new (foo?.())(); -(x) => ({}?.().b); -(x) => ({}?.b()); -(x) => ({}?.b.b); --({}?.a().b()); --({ a: 1 }?.entries()); +let f = () => ({})?.(); +let g = () => ({})?.b; +a = () => ({})?.() && a; @@ -182,11 +180,9 @@ new (foo?.())(); +(x) => ({})?.().b; +(x) => ({})?.b(); +(x) => ({})?.b.b; -+({})?.a().b(); -+({ a: 1 })?.entries(); + ({})?.a().b(); + ({ a: 1 })?.entries(); - new (foo?.bar)(); - new (foo?.bar())(); ``` # Output diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/partial-application/test.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/partial-application/test.js.snap index 8a9ab49c18c..afabc7d351b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/partial-application/test.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/partial-application/test.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/partial-application/test.js +assertion_line: 212 +info: js/partial-application/test.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/block-comments.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/block-comments.js.snap index 0ee28fc6671..9549212d509 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/block-comments.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/block-comments.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/pipeline-operator/block-comments.js +assertion_line: 212 +info: js/pipeline-operator/block-comments.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/fsharp_style_pipeline_operator.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/fsharp_style_pipeline_operator.js.snap index e3f65ba4b8b..c0f77f5bd54 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/fsharp_style_pipeline_operator.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/fsharp_style_pipeline_operator.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/pipeline-operator/fsharp_style_pipeline_operator.js +assertion_line: 212 +info: js/pipeline-operator/fsharp_style_pipeline_operator.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/hack_pipeline_operator.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/hack_pipeline_operator.js.snap index a524ea9a7d9..b419dd81cbb 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/hack_pipeline_operator.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/hack_pipeline_operator.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/pipeline-operator/hack_pipeline_operator.js +assertion_line: 212 +info: js/pipeline-operator/hack_pipeline_operator.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/minimal_pipeline_operator.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/minimal_pipeline_operator.js.snap index d33519ccebc..38a21a2a497 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/minimal_pipeline_operator.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/pipeline-operator/minimal_pipeline_operator.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/pipeline-operator/minimal_pipeline_operator.js +assertion_line: 212 +info: js/pipeline-operator/minimal_pipeline_operator.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/quote-props/objects.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/quote-props/objects.js.snap index 838490b2b2f..40d19a39a8e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/quote-props/objects.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/quote-props/objects.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/quote-props/objects.js +assertion_line: 212 +info: js/quote-props/objects.js --- # Input @@ -283,3 +283,4 @@ Object.entries({ 85: 1e+100: "1e+100", // 1e+100 – this one is identical, but would be inconsistent to quote. ``` + diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/quotes/objects.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/quotes/objects.js.snap index f25121a06f4..b357288fdda 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/quotes/objects.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/quotes/objects.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/quotes/objects.js +assertion_line: 212 +info: js/quotes/objects.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/array.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/array.js.snap index 44e0a6ca63d..6626b564903 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/array.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/array.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/array.js +assertion_line: 212 +info: js/range/array.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary-2.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary-2.js.snap index 46d99c562ef..a108f3d0b63 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary-2.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary-2.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/boundary-2.js +assertion_line: 212 +info: js/range/boundary-2.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary-3.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary-3.js.snap index c2a349c57d5..59949a5cfae 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary-3.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary-3.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/boundary-3.js +assertion_line: 212 +info: js/range/boundary-3.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary.js.snap index c6df2391b93..4b660a8b047 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/boundary.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/boundary.js +assertion_line: 212 +info: js/range/boundary.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/class-declaration.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/class-declaration.js.snap index 2f71ef5fec5..d8f6548c0f2 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/class-declaration.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/class-declaration.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/class-declaration.js +assertion_line: 212 +info: js/range/class-declaration.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/different-levels.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/different-levels.js.snap index 8edbd396ce3..2caf3595a53 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/different-levels.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/different-levels.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/different-levels.js +assertion_line: 212 +info: js/range/different-levels.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/directive.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/directive.js.snap index 7e978187318..328a492a211 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/directive.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/directive.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/directive.js +assertion_line: 212 +info: js/range/directive.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/function-body.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/function-body.js.snap index 5aafa21b5e0..232ceeffe29 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/function-body.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/function-body.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/function-body.js +assertion_line: 212 +info: js/range/function-body.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/ignore-indentation.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/ignore-indentation.js.snap index fac978dce3b..81fb2ff8e4e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/ignore-indentation.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/ignore-indentation.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/ignore-indentation.js +assertion_line: 212 +info: js/range/ignore-indentation.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/issue-7082.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/issue-7082.js.snap index e389ad26c71..d27f2713172 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/issue-7082.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/issue-7082.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/issue-7082.js +assertion_line: 212 +info: js/range/issue-7082.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export1.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export1.js.snap index f7fea2f8a2e..a399fe57f81 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export1.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export1.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/module-export1.js +assertion_line: 212 +info: js/range/module-export1.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export2.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export2.js.snap index 9b200e07330..bbdfa7b2ee7 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export2.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export2.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/module-export2.js +assertion_line: 212 +info: js/range/module-export2.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export3.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export3.js.snap index 22862c4f0e2..d6e1c17a870 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export3.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/module-export3.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/module-export3.js +assertion_line: 212 +info: js/range/module-export3.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/module-import.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/module-import.js.snap index 5e5edc900d2..76ca2962edf 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/module-import.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/module-import.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/module-import.js +assertion_line: 212 +info: js/range/module-import.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/multiple-statements.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/multiple-statements.js.snap index 588cfddb5b6..f0e7b2b31f0 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/multiple-statements.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/multiple-statements.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/multiple-statements.js +assertion_line: 212 +info: js/range/multiple-statements.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/multiple-statements2.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/multiple-statements2.js.snap index 3a1c52270bb..e51f31be3d7 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/multiple-statements2.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/multiple-statements2.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/multiple-statements2.js +assertion_line: 212 +info: js/range/multiple-statements2.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/nested2.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/nested2.js.snap index dcaf93dff85..5ae3e1546e7 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/nested2.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/nested2.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/nested2.js +assertion_line: 212 +info: js/range/nested2.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/nested3.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/nested3.js.snap index 0152ed7b502..77d2fd056b9 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/nested3.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/nested3.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/nested3.js +assertion_line: 212 +info: js/range/nested3.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/object-expression2.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/object-expression2.js.snap index e773425c4e5..6035fca6439 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/object-expression2.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/object-expression2.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/object-expression2.js +assertion_line: 212 +info: js/range/object-expression2.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/range-end.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/range-end.js.snap index f5bb21f34ae..78190766a7e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/range-end.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/range-end.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/range-end.js +assertion_line: 212 +info: js/range/range-end.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/range-start.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/range-start.js.snap index e42c73c9b32..13e336c584d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/range-start.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/range-start.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/range-start.js +assertion_line: 212 +info: js/range/range-start.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/range.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/range.js.snap index 40211ad81a3..70c2840d869 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/range.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/range.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/range.js +assertion_line: 212 +info: js/range/range.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/range/start-equals-end.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/range/start-equals-end.js.snap index 6b89ae005ec..73a8f312d54 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/range/start-equals-end.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/range/start-equals-end.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/range/start-equals-end.js +assertion_line: 212 +info: js/range/start-equals-end.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/computed.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/computed.js.snap index 4329c01eb9c..295e21f238f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/computed.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/computed.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/record/computed.js +assertion_line: 212 +info: js/record/computed.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/destructuring.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/destructuring.js.snap index 410a6032cb0..53e242758a3 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/destructuring.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/destructuring.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/record/destructuring.js +assertion_line: 212 +info: js/record/destructuring.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/record.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/record.js.snap index 08d8a0199bc..6bd65f4df1e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/record.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/record.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/record/record.js +assertion_line: 212 +info: js/record/record.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/shorthand.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/shorthand.js.snap index bbfc92e6dd6..862ba48df3d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/shorthand.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/shorthand.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/record/shorthand.js +assertion_line: 212 +info: js/record/shorthand.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/spread.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/spread.js.snap index fc5f0120e6d..d1812e92bf6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/spread.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/spread.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/record/spread.js +assertion_line: 212 +info: js/record/spread.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/record/syntax.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/record/syntax.js.snap index b2c63354196..5511332e5be 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/record/syntax.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/record/syntax.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/record/syntax.js +assertion_line: 212 +info: js/record/syntax.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/rest/trailing-commas.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/rest/trailing-commas.js.snap index b4cb4a1ff2d..bdde77eb0b0 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/rest/trailing-commas.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/rest/trailing-commas.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/rest/trailing-commas.js +assertion_line: 212 +info: js/rest/trailing-commas.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/return-outside-function/return-outside-function.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/return-outside-function/return-outside-function.js.snap index 30c8f4a4d7a..a8fabeaf061 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/return-outside-function/return-outside-function.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/return-outside-function/return-outside-function.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/return-outside-function/return-outside-function.js +assertion_line: 212 +info: js/return-outside-function/return-outside-function.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-if.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-if.js.snap index 166011af6f8..9c3d56fbede 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-if.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-if.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/sloppy-mode/function-declaration-in-if.js +assertion_line: 212 +info: js/sloppy-mode/function-declaration-in-if.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-while.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-while.js.snap index 36ad2e6fb33..791ce15c5f1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-while.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/sloppy-mode/function-declaration-in-while.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/sloppy-mode/function-declaration-in-while.js +assertion_line: 212 +info: js/sloppy-mode/function-declaration-in-while.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/css-prop.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/css-prop.js.snap index 65904283a4e..3d4e12761ae 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/css-prop.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/css-prop.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/template-literals/css-prop.js +assertion_line: 212 +info: js/template-literals/css-prop.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-components-with-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-components-with-expressions.js.snap index 7f991179679..4ef0a0f1e9b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-components-with-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-components-with-expressions.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/template-literals/styled-components-with-expressions.js +assertion_line: 212 +info: js/template-literals/styled-components-with-expressions.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-jsx-with-expressions.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-jsx-with-expressions.js.snap index 86f645886f8..5d12177fcdc 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-jsx-with-expressions.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-jsx-with-expressions.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/template-literals/styled-jsx-with-expressions.js +assertion_line: 212 +info: js/template-literals/styled-jsx-with-expressions.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-jsx.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-jsx.js.snap index 4470e0b7af4..299f0cccd06 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-jsx.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/template-literals/styled-jsx.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/template-literals/styled-jsx.js +assertion_line: 212 +info: js/template-literals/styled-jsx.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/template/parenthesis.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/template/parenthesis.js.prettier-snap index 12d0593746c..f66afbe10e8 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/template/parenthesis.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/template/parenthesis.js.prettier-snap @@ -16,7 +16,7 @@ async function f() { b()``; // "ClassExpression" -(class {}``); +(class {})``; // "ConditionalExpression" (b ? c : d)``; @@ -34,7 +34,7 @@ b.c``; new B()``; // "ObjectExpression" -({}``); +({})``; // "SequenceExpression" (b, c)``; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/template/parenthesis.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/template/parenthesis.js.snap deleted file mode 100644 index 59b3624fa2c..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/js/template/parenthesis.js.snap +++ /dev/null @@ -1,152 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/template/parenthesis.js ---- - -# Input - -```js -// "ArrowFunctionExpression" -(() => {})``; - -// "AssignmentExpression" -(b = c)``; - -// "AwaitExpression" -async function f() { - (await b)``; -} - -// "BinaryExpression" -(b + c)``; - -// "CallExpression" -b()``; - -// "ClassExpression" -(class {})``; - -// "ConditionalExpression" -(b ? c : d)``; - -// "FunctionExpression" -(function() {})``; - -// "LogicalExpression" -(b || c)``; - -// "MemberExpression" -b.c``; - -// "NewExpression" -(new B())``; - -// "ObjectExpression" -({})``; - -// "SequenceExpression" -(b, c)``; - -// "TaggedTemplateExpression" -(``)``; - -// "UnaryExpression" -(void b)``; - -// "UpdateExpression" -(++b)``; - -// "YieldExpression" -function* d() { - (yield 1)``; -} - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -16,7 +16,7 @@ - b()``; - - // "ClassExpression" --(class {}``); -+(class {})``; - - // "ConditionalExpression" - (b ? c : d)``; -@@ -34,7 +34,7 @@ - new B()``; - - // "ObjectExpression" --({}``); -+({})``; - - // "SequenceExpression" - (b, c)``; -``` - -# Output - -```js -// "ArrowFunctionExpression" -(() => {})``; - -// "AssignmentExpression" -(b = c)``; - -// "AwaitExpression" -async function f() { - (await b)``; -} - -// "BinaryExpression" -(b + c)``; - -// "CallExpression" -b()``; - -// "ClassExpression" -(class {})``; - -// "ConditionalExpression" -(b ? c : d)``; - -// "FunctionExpression" -(function () {})``; - -// "LogicalExpression" -(b || c)``; - -// "MemberExpression" -b.c``; - -// "NewExpression" -new B()``; - -// "ObjectExpression" -({})``; - -// "SequenceExpression" -(b, c)``; - -// "TaggedTemplateExpression" -````; - -// "UnaryExpression" -(void b)``; - -// "UpdateExpression" -(++b)``; - -// "YieldExpression" -function* d() { - (yield 1)``; -} -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js index a87c7289e4d..527237c7c44 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js +++ b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js @@ -2,7 +2,8 @@ fn( bifornCringerMoshedPerplexSawder, askTrovenaBeenaDependsRowans, glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl && - anodyneCondosMalateOverateRetinol - ? annularCooeedSplicesWalksWayWay - : kochabCooieGameOnOboleUnweave + anodyneCondosMalateOverateRetinol + ? annularCooeedSplicesWalksWayWay + : kochabCooieGameOnOboleUnweave ); +// TODO(rattrayalex): try to indent consequent/alternate here. diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js.prettier-snap index 31bc69281cd..950bca4865b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js.prettier-snap @@ -6,3 +6,4 @@ fn( ? annularCooeedSplicesWalksWayWay : kochabCooieGameOnOboleUnweave, ); +// TODO(rattrayalex): try to indent consequent/alternate here. diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js.snap index 091cb4f4eef..8b57f08c232 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/func-call.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/ternaries/func-call.js +assertion_line: 212 +info: js/ternaries/func-call.js --- # Input @@ -11,10 +11,11 @@ fn( bifornCringerMoshedPerplexSawder, askTrovenaBeenaDependsRowans, glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl && - anodyneCondosMalateOverateRetinol - ? annularCooeedSplicesWalksWayWay - : kochabCooieGameOnOboleUnweave + anodyneCondosMalateOverateRetinol + ? annularCooeedSplicesWalksWayWay + : kochabCooieGameOnOboleUnweave ); +// TODO(rattrayalex): try to indent consequent/alternate here. ``` @@ -46,6 +47,7 @@ fn( ? annularCooeedSplicesWalksWayWay : kochabCooieGameOnOboleUnweave, ); +// TODO(rattrayalex): try to indent consequent/alternate here. ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/indent-after-paren.js b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/indent-after-paren.js index f4c0bdbf934..eacc4a6fa59 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/indent-after-paren.js +++ b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/indent-after-paren.js @@ -199,6 +199,7 @@ bifornCringerMoshedPerplexSawder = kochabCooieGameOnOboleUnweave === Math.PI ? averredBathersBoxroomBuggyNurl : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo)); +// TODO(rattrayalex): try to fix this case bifornCringerMoshedPerplexSawder = ( glimseGlyphsHazardNoopsTieTie === 0 && diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/indent-after-paren.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/indent-after-paren.js.prettier-snap index 3c1bd1a7aee..559187737e2 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/indent-after-paren.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/indent-after-paren.js.prettier-snap @@ -249,6 +249,7 @@ bifornCringerMoshedPerplexSawder = kochabCooieGameOnOboleUnweave === Math.PI ? averredBathersBoxroomBuggyNurl : anodyneCondosMalateOverateRetinol)(Fooooooooooo.Fooooooooooo); +// TODO(rattrayalex): try to fix this case bifornCringerMoshedPerplexSawder = ( glimseGlyphsHazardNoopsTieTie === 0 && diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/nested.js b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/nested.js index bfc1cba444b..ce77c67505c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/nested.js +++ b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/nested.js @@ -93,3 +93,32 @@ a } ? line : softline + +const config = { + onFailure: onFailure !== undefined ? onFailure : ( + error => { + notify( + typeof error === 'string' ? + error + : error.message || 'ra.notification.http_error', + 'warning', + { + _: + typeof error === 'string' ? error + : error && error.message ? error.message + : undefined, + } + ); + refresh(); + } + ) +} + +showNotification( + typeof error === 'string' ? error : error.message || body, + level || 'warning', + { + messageArgs, + undoable: false, + } +) \ No newline at end of file diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/nested.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/nested.js.prettier-snap index cf8e87a6e62..b6453c171a4 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/nested.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/ternaries/nested.js.prettier-snap @@ -94,3 +94,35 @@ a } ? line : softline; + +const config = { + onFailure: + onFailure !== undefined + ? onFailure + : (error) => { + notify( + typeof error === "string" + ? error + : error.message || "ra.notification.http_error", + "warning", + { + _: + typeof error === "string" + ? error + : error && error.message + ? error.message + : undefined, + }, + ); + refresh(); + }, +}; + +showNotification( + typeof error === "string" ? error : error.message || body, + level || "warning", + { + messageArgs, + undoable: false, + }, +); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/test-declarations/angularjs_inject.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/test-declarations/angularjs_inject.js.snap index b0673533ac3..30a1a75e132 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/test-declarations/angularjs_inject.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/test-declarations/angularjs_inject.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/test-declarations/angularjs_inject.js +assertion_line: 212 +info: js/test-declarations/angularjs_inject.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/test-declarations/test_declarations.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/test-declarations/test_declarations.js.snap index 43177e36755..c63b5757f25 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/test-declarations/test_declarations.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/test-declarations/test_declarations.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/test-declarations/test_declarations.js +assertion_line: 212 +info: js/test-declarations/test_declarations.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/throw_expressions/throw_expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/throw_expressions/throw_expression.js.snap index 03eb2748758..7a640d341c9 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/throw_expressions/throw_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/throw_expressions/throw_expression.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/throw_expressions/throw_expression.js +assertion_line: 212 +info: js/throw_expressions/throw_expression.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/destructuring.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/destructuring.js.snap index 1edf96bc616..c069554da6d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/destructuring.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/destructuring.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/tuple/destructuring.js +assertion_line: 212 +info: js/tuple/destructuring.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/syntax.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/syntax.js.snap index 324b541cd8a..40f9948d9e1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/syntax.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/syntax.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/tuple/syntax.js +assertion_line: 212 +info: js/tuple/syntax.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple-trailing-comma.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple-trailing-comma.js.snap index 99de25ceb52..aab6f5377a4 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple-trailing-comma.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple-trailing-comma.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/tuple/tuple-trailing-comma.js +assertion_line: 212 +info: js/tuple/tuple-trailing-comma.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple.js.snap index 425c5020391..a83af256a12 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/tuple/tuple.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/tuple/tuple.js +assertion_line: 212 +info: js/tuple/tuple.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/v8_intrinsic/intrinsic_call.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/v8_intrinsic/intrinsic_call.js.snap index 88964feece3..af6da8cc2e2 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/v8_intrinsic/intrinsic_call.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/v8_intrinsic/intrinsic_call.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/v8_intrinsic/intrinsic_call.js +assertion_line: 212 +info: js/v8_intrinsic/intrinsic_call.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/with/indent.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/with/indent.js.snap index b03de9653f4..a5de52b3584 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/with/indent.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/with/indent.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: js/with/indent.js +assertion_line: 212 +info: js/with/indent.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-attributes.js b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-attributes.js new file mode 100644 index 00000000000..4b3565c387e --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-attributes.js @@ -0,0 +1,30 @@ +
; + +
; + +
; + +
; + +
; + +
; diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-attributes.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-attributes.js.prettier-snap new file mode 100644 index 00000000000..124d0d773b6 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-attributes.js.prettier-snap @@ -0,0 +1,13 @@ +
; + +
; + +
; + +
; + +
; + +
; // comment diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-attributes.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-attributes.js.snap new file mode 100644 index 00000000000..4ea42697d50 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-attributes.js.snap @@ -0,0 +1,87 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: jsx/comments/in-attributes.js +--- + +# Input + +```js +
; + +
; + +
; + +
; + +
; + +
; + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -3,11 +3,13 @@ +
; + +-
; ++
; + +
; + +
; + +-
; // comment ++
; +``` + +# Output + +```js +
; + +
; + +
; + +
; + +
; + +
; +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-end-tag.js b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-end-tag.js new file mode 100644 index 00000000000..6c0cb6efe47 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-end-tag.js @@ -0,0 +1,49 @@ +/* =========== before slash =========== */ +; +; + +<>; +<>; + +/* =========== after slash =========== */ +; +; + +<>; +<>; + +/* =========== after name =========== */ +; +; + + +/* =========== block =========== */ +; +<>; + +/* =========== multiple =========== */ +; +; +; + +<>; +<>; +<>; \ No newline at end of file diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-end-tag.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-end-tag.js.prettier-snap new file mode 100644 index 00000000000..b68262b0959 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-end-tag.js.prettier-snap @@ -0,0 +1,57 @@ +/* =========== before slash =========== */ +; +; + +<>; +<>; + +/* =========== after slash =========== */ +; +; + +<>; +<>; + +/* =========== after name =========== */ +; // line +; + +/* =========== block =========== */ +; +<>; + +/* =========== multiple =========== */ +; +; +; + +<>; +<>; +<>; diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-end-tag.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-end-tag.js.snap new file mode 100644 index 00000000000..b1e147d0e83 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/comments/in-end-tag.js.snap @@ -0,0 +1,142 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: jsx/comments/in-end-tag.js +--- + +# Input + +```js +/* =========== before slash =========== */ +; +; + +<>; +<>; + +/* =========== after slash =========== */ +; +; + +<>; +<>; + +/* =========== after name =========== */ +; +; + + +/* =========== block =========== */ +; +<>; + +/* =========== multiple =========== */ +; +; +; + +<>; +<>; +<>; +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -25,7 +25,8 @@ + <>; + + /* =========== after name =========== */ +-; // line ++; + ; + + /* =========== block =========== */ +``` + +# Output + +```js +/* =========== before slash =========== */ +; +; + +<>; +<>; + +/* =========== after slash =========== */ +; +; + +<>; +<>; + +/* =========== after name =========== */ +; +; + +/* =========== block =========== */ +; +<>; + +/* =========== multiple =========== */ +; +; +; + +<>; +<>; +<>; +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/do/do.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/do/do.js.snap index 182035925ce..a7797cdf9a6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/do/do.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/do/do.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: jsx/do/do.js +assertion_line: 212 +info: jsx/do/do.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/fbt/test.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/fbt/test.js.snap index 04d8a9d37a7..f1ca8a1661a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/fbt/test.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/fbt/test.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: jsx/fbt/test.js +assertion_line: 212 +info: jsx/fbt/test.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/await.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/await.js.snap index 7d73f1bcf51..e12cf4bf95f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/await.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/await.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: jsx/jsx/await.js +assertion_line: 212 +info: jsx/jsx/await.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/conditional-expression.js b/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/conditional-expression.js index 3283d9c6a94..703ce4d9553 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/conditional-expression.js +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/conditional-expression.js @@ -84,6 +84,13 @@ jsxModeFromElementBreaking ? ( {a ? "a" : b ? "b" : "c"} ; +// This chain of ConditionalExpressions prints in JSX mode because the parent of +// the outermost ConditionalExpression is a JSXExpressionContainer. It is +// breaking. +
+ {thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo ? "a" : b ? "b" : "c"} +
; + // This chain of ConditionalExpressions prints in JSX mode because there is a // JSX element somewhere in the chain. It is non-breaking. cable ? "satellite" : isPublic ? "affairs" : network ? : "dun"; diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/conditional-expression.js.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/conditional-expression.js.prettier-snap index 38a2e2a15b2..7c554dad8f1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/conditional-expression.js.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/conditional-expression.js.prettier-snap @@ -88,6 +88,17 @@ jsxModeFromElementBreaking ? ( // non-breaking.
{a ? "a" : b ? "b" : "c"}
; +// This chain of ConditionalExpressions prints in JSX mode because the parent of +// the outermost ConditionalExpression is a JSXExpressionContainer. It is +// breaking. +
+ {thisIsASongAboutYourPoorSickPenguinHeHasAFeverAndHisToesAreBlueButIfISingToYourPoorSickPenguinHeWillFeelBetterInADayOrTwo + ? "a" + : b + ? "b" + : "c"} +
; + // This chain of ConditionalExpressions prints in JSX mode because there is a // JSX element somewhere in the chain. It is non-breaking. cable ? "satellite" : isPublic ? "affairs" : network ? : "dun"; diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/quotes.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/quotes.js.snap index a3bc2610e9b..1d03d293c25 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/quotes.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/jsx/quotes.js.snap @@ -1,5 +1,6 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 info: jsx/jsx/quotes.js --- diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/newlines/test.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/newlines/test.js.snap index bcc5dde5d3c..52ec6f6799f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/newlines/test.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/newlines/test.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: jsx/newlines/test.js +assertion_line: 212 +info: jsx/newlines/test.js --- # Input @@ -191,3 +191,4 @@ regression_extra_newline_2 = ( 45: ``` + diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/spread/attribute.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/spread/attribute.js.snap index 80ac998cb5b..a9c6edf7069 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/spread/attribute.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/spread/attribute.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: jsx/spread/attribute.js +assertion_line: 212 +info: jsx/spread/attribute.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/spread/child.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/spread/child.js.snap index 495b8cf114d..4df711ddcbd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/spread/child.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/spread/child.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: jsx/spread/child.js +assertion_line: 212 +info: jsx/spread/child.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/template/styled-components.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/template/styled-components.js.snap index 39180e43d76..3e5ac3b24f3 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/template/styled-components.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/template/styled-components.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: jsx/template/styled-components.js +assertion_line: 212 +info: jsx/template/styled-components.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/jsx/text-wrap/test.js.snap b/crates/rome_js_formatter/tests/specs/prettier/jsx/text-wrap/test.js.snap index 1cc64285e5a..5d309014dd4 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/jsx/text-wrap/test.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/jsx/text-wrap/test.js.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: jsx/text-wrap/test.js +assertion_line: 212 +info: jsx/text-wrap/test.js --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/angular-component-examples/test.component.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/angular-component-examples/test.component.ts.snap index 4eec6f13fe8..0c2f12fd8ba 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/angular-component-examples/test.component.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/angular-component-examples/test.component.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/angular-component-examples/test.component.ts +assertion_line: 212 +info: typescript/angular-component-examples/test.component.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/arrow/comments.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/arrow/comments.ts.snap index 7990898fcb9..77df85a8f32 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/arrow/comments.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/arrow/comments.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/arrow/comments.ts +assertion_line: 212 +info: typescript/arrow/comments.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/as/as.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/as/as.ts.prettier-snap index babdb151211..e4e8d1608fe 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/as/as.ts.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/as/as.ts.prettier-snap @@ -17,14 +17,14 @@ export default class Column extends (RcTable.Column as React.ComponentClass< >) {} export const MobxTypedForm = class extends (Form as { new (): any }) {}; export abstract class MobxTypedForm1 extends (Form as { new (): any }) {} -({} as {}); +({}) as {}; function* g() { const test = (yield "foo") as number; } async function g1() { const test = (await "foo") as number; } -({} as X); +({}) as X; () => ({} as X); const state = JSON.stringify({ next: window.location.href, diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/as/as.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/as/as.ts.snap index e8aad0b834d..111dd71f6ee 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/as/as.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/as/as.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/as/as.ts +assertion_line: 212 +info: typescript/as/as.ts --- # Input @@ -56,21 +56,11 @@ const iter2 = createIterator(self.controller, child, self.tag as SyncFunctionCom ```diff --- Prettier +++ Rome -@@ -17,15 +17,15 @@ - >) {} - export const MobxTypedForm = class extends (Form as { new (): any }) {}; - export abstract class MobxTypedForm1 extends (Form as { new (): any }) {} --({} as {}); -+({}) as {}; - function* g() { - const test = (yield "foo") as number; - } - async function g1() { +@@ -25,7 +25,7 @@ const test = (await "foo") as number; } --({} as X); + ({}) as X; -() => ({} as X); -+({}) as X; +() => ({}) as X; const state = JSON.stringify({ next: window.location.href, @@ -155,3 +145,4 @@ const iter2 = createIterator( 53: thisIsAReallyReallyReallyReallyReallyReallyReallyReallyReallyLongIdentifier as [ ``` + diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/as/export_default_as.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/as/export_default_as.ts.snap index f604e89950a..d2d5165e2eb 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/as/export_default_as.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/as/export_default_as.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/as/export_default_as.ts +assertion_line: 212 +info: typescript/as/export_default_as.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/assert/index.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/assert/index.ts.snap index 59249d55b66..2e26fc70d19 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/assert/index.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/assert/index.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/assert/index.ts +assertion_line: 212 +info: typescript/assert/index.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/assignment/issue-5370.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/assignment/issue-5370.ts.snap index e50ea15852a..61e9bc406f5 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/assignment/issue-5370.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/assignment/issue-5370.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/assignment/issue-5370.ts +assertion_line: 212 +info: typescript/assignment/issue-5370.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/constructor.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/constructor.ts.snap index ee99348cda9..4211761b1fb 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/constructor.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/constructor.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/class/constructor.ts +assertion_line: 212 +info: typescript/class/constructor.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/duplicates-access-modifier.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/duplicates-access-modifier.ts.snap index e290cbf5928..667a2f5e8a5 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/duplicates-access-modifier.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/duplicates-access-modifier.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/class/duplicates-access-modifier.ts +assertion_line: 212 +info: typescript/class/duplicates-access-modifier.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/empty-method-body.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/empty-method-body.ts.snap index ff50a970a83..fba5f68b731 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/empty-method-body.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/empty-method-body.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/class/empty-method-body.ts +assertion_line: 212 +info: typescript/class/empty-method-body.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/methods.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/methods.ts.snap index 81761707c9c..2e21fbfb840 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/methods.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/methods.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/class/methods.ts +assertion_line: 212 +info: typescript/class/methods.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/quoted-property.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/quoted-property.ts.snap index 09190ac733a..2742b2510e1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/class/quoted-property.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/class/quoted-property.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/class/quoted-property.ts +assertion_line: 212 +info: typescript/class/quoted-property.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/declare_function.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/declare_function.ts.snap index 7365a97a2cb..8a7ee574ed2 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/declare_function.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/declare_function.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/comments/declare_function.ts +assertion_line: 212 +info: typescript/comments/declare_function.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/mapped_types.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/mapped_types.ts.snap index 9e775b07c59..12457ef3184 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/mapped_types.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/mapped_types.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/comments/mapped_types.ts +assertion_line: 212 +info: typescript/comments/mapped_types.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/method_types.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/method_types.ts.snap index 4dc58756249..910fe6d214e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/method_types.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/method_types.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/comments/method_types.ts +assertion_line: 212 +info: typescript/comments/method_types.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/type-parameters.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/type-parameters.ts.snap index 0efe260ea11..52edb6c666f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/type-parameters.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/comments/type-parameters.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/comments/type-parameters.ts +assertion_line: 212 +info: typescript/comments/type-parameters.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/castParentheses.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/castParentheses.ts.snap index df22f02ce6e..647ea6cce6e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/castParentheses.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/castParentheses.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/compiler/castParentheses.ts +assertion_line: 212 +info: typescript/compiler/castParentheses.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/commentInNamespaceDeclarationWithIdentifierPathName.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/commentInNamespaceDeclarationWithIdentifierPathName.ts.snap index 22b53f3c365..8792d42cb82 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/commentInNamespaceDeclarationWithIdentifierPathName.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/commentInNamespaceDeclarationWithIdentifierPathName.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/compiler/commentInNamespaceDeclarationWithIdentifierPathName.ts +assertion_line: 212 +info: typescript/compiler/commentInNamespaceDeclarationWithIdentifierPathName.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/decrementAndIncrementOperators.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/decrementAndIncrementOperators.ts.snap index 5d40c938f77..a261d82373b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/decrementAndIncrementOperators.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/decrementAndIncrementOperators.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/compiler/decrementAndIncrementOperators.ts +assertion_line: 212 +info: typescript/compiler/decrementAndIncrementOperators.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/downlevelLetConst1.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/downlevelLetConst1.ts.snap index 886937116ec..5b0c3c81344 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/downlevelLetConst1.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/downlevelLetConst1.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/compiler/downlevelLetConst1.ts +assertion_line: 212 +info: typescript/compiler/downlevelLetConst1.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/errorOnInitializerInInterfaceProperty.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/errorOnInitializerInInterfaceProperty.ts.snap index 0d806501737..03ed06c2eb2 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/errorOnInitializerInInterfaceProperty.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/compiler/errorOnInitializerInInterfaceProperty.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/compiler/errorOnInitializerInInterfaceProperty.ts +assertion_line: 212 +info: typescript/compiler/errorOnInitializerInInterfaceProperty.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/issue-13275.ts b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/issue-13275.ts deleted file mode 100644 index de1ccb2859a..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/issue-13275.ts +++ /dev/null @@ -1 +0,0 @@ -type Foo = T extends ((...a: any[]) => infer R extends string) ? R : never; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/issue-13275.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/issue-13275.ts.prettier-snap deleted file mode 100644 index de1ccb2859a..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/issue-13275.ts.prettier-snap +++ /dev/null @@ -1 +0,0 @@ -type Foo = T extends ((...a: any[]) => infer R extends string) ? R : never; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/new-ternary-spec.ts b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/new-ternary-spec.ts new file mode 100644 index 00000000000..972d3e9352b --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/new-ternary-spec.ts @@ -0,0 +1,36 @@ +// TypeScript has the same behavior, including a line break after =, but no parens around "conditional": +type KnownKeys = + { + [K in keyof T]: string extends K ? never + : number extends K ? never + : K; + } extends { [_ in keyof T]: infer U } ? + {} extends U ? never + : U + : never; + +type KnownKeysWithLongExtends = + { + [K in keyof T]: string extends K ? never + : number extends K ? never + : K; + } extends { + [_ in keyof T]: SomeReallyLongThingThatBreaksTheLine + } ? U + : never; + +// TypeScript examples: +type TypeName = + T extends string ? "string" + : T extends number ? "number" + : T extends boolean ? "boolean" + : T extends undefined ? "undefined" + : T extends Function ? "function" + : "object"; + +type Unpacked = + T extends (infer U)[] ? U + : T extends (...args: any[]) => infer U ? + SomeReallyLongThingThatBreaksTheLine + : T extends Promise ? U + : T; \ No newline at end of file diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/new-ternary-spec.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/new-ternary-spec.ts.prettier-snap new file mode 100644 index 00000000000..243656601b2 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/new-ternary-spec.ts.prettier-snap @@ -0,0 +1,37 @@ +// TypeScript has the same behavior, including a line break after =, but no parens around "conditional": +type KnownKeys = { + [K in keyof T]: string extends K ? never : number extends K ? never : K; +} extends { [_ in keyof T]: infer U } + ? {} extends U + ? never + : U + : never; + +type KnownKeysWithLongExtends = { + [K in keyof T]: string extends K ? never : number extends K ? never : K; +} extends { + [_ in keyof T]: SomeReallyLongThingThatBreaksTheLine; +} + ? U + : never; + +// TypeScript examples: +type TypeName = T extends string + ? "string" + : T extends number + ? "number" + : T extends boolean + ? "boolean" + : T extends undefined + ? "undefined" + : T extends Function + ? "function" + : "object"; + +type Unpacked = T extends (infer U)[] + ? U + : T extends (...args: any[]) => infer U + ? SomeReallyLongThingThatBreaksTheLine + : T extends Promise + ? U + : T; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/parentheses.ts b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/parentheses.ts new file mode 100644 index 00000000000..ea27b671056 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/parentheses.ts @@ -0,0 +1,20 @@ +// #13275 +type Foo = T extends ((...a: any[]) => infer R extends string) ? R : never; +type Foo = T extends (new (...a: any[]) => infer R extends string) ? R : never; + +// #14275 +type Test = T extends (( + token: TSESTree.Token +) => token is infer U extends TSESTree.Token) + ? U + : TSESTree.Token; +type Test = T extends (( + token: TSESTree.Token +) => asserts token is infer U extends TSESTree.Token) + ? U + : TSESTree.Token; +type Test = T extends (new ( + token: TSESTree.Token +) => token is infer U extends TSESTree.Token) + ? U + : TSESTree.Token; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/parentheses.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/parentheses.ts.prettier-snap new file mode 100644 index 00000000000..b7579fd9b46 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/parentheses.ts.prettier-snap @@ -0,0 +1,22 @@ +// #13275 +type Foo = T extends ((...a: any[]) => infer R extends string) ? R : never; +type Foo = T extends (new (...a: any[]) => infer R extends string) + ? R + : never; + +// #14275 +type Test = T extends (( + token: TSESTree.Token, +) => token is infer U extends TSESTree.Token) + ? U + : TSESTree.Token; +type Test = T extends (( + token: TSESTree.Token, +) => asserts token is infer U extends TSESTree.Token) + ? U + : TSESTree.Token; +type Test = T extends (new ( + token: TSESTree.Token, +) => token is infer U extends TSESTree.Token) + ? U + : TSESTree.Token; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/parentheses.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/parentheses.ts.snap new file mode 100644 index 00000000000..66b528cd7ab --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conditional-types/parentheses.ts.snap @@ -0,0 +1,168 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: typescript/conditional-types/parentheses.ts +--- + +# Input + +```ts +// #13275 +type Foo = T extends ((...a: any[]) => infer R extends string) ? R : never; +type Foo = T extends (new (...a: any[]) => infer R extends string) ? R : never; + +// #14275 +type Test = T extends (( + token: TSESTree.Token +) => token is infer U extends TSESTree.Token) + ? U + : TSESTree.Token; +type Test = T extends (( + token: TSESTree.Token +) => asserts token is infer U extends TSESTree.Token) + ? U + : TSESTree.Token; +type Test = T extends (new ( + token: TSESTree.Token +) => token is infer U extends TSESTree.Token) + ? U + : TSESTree.Token; + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -1,22 +1,25 @@ + // #13275 + type Foo = T extends ((...a: any[]) => infer R extends string) ? R : never; +-type Foo = T extends (new (...a: any[]) => infer R extends string) ++type Foo = T extends (new ( ++ ...a: any[] ++) => infer R extends string) + ? R + : never; + + // #14275 +-type Test = T extends (( ++type Test = T extends ( + token: TSESTree.Token, +-) => token is infer U extends TSESTree.Token) ++) => token is infer U extends TSESTree.Token + ? U + : TSESTree.Token; +-type Test = T extends (( ++type Test = T extends ( + token: TSESTree.Token, +-) => asserts token is infer U extends TSESTree.Token) ++) => asserts token is infer U extends TSESTree.Token + ? U + : TSESTree.Token; + type Test = T extends (new ( +- token: TSESTree.Token, +-) => token is infer U extends TSESTree.Token) ++ token: TSESTree.Token ++) => token is infer U extends TSESTree.Token ++) + ? U +- : TSESTree.Token; ++ : TSESTree.Token +``` + +# Output + +```ts +// #13275 +type Foo = T extends ((...a: any[]) => infer R extends string) ? R : never; +type Foo = T extends (new ( + ...a: any[] +) => infer R extends string) + ? R + : never; + +// #14275 +type Test = T extends ( + token: TSESTree.Token, +) => token is infer U extends TSESTree.Token + ? U + : TSESTree.Token; +type Test = T extends ( + token: TSESTree.Token, +) => asserts token is infer U extends TSESTree.Token + ? U + : TSESTree.Token; +type Test = T extends (new ( + token: TSESTree.Token +) => token is infer U extends TSESTree.Token +) + ? U + : TSESTree.Token +``` + +# Errors +``` +parentheses.ts:18:12 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `)` but instead found `is` + + 16 │ type Test = T extends (new ( + 17 │ token: TSESTree.Token + > 18 │ ) => token is infer U extends TSESTree.Token) + │ ^^ + 19 │ ? U + 20 │ : TSESTree.Token; + + i Remove is + +parentheses.ts:18:15 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected `:` but instead found `infer` + + 16 │ type Test = T extends (new ( + 17 │ token: TSESTree.Token + > 18 │ ) => token is infer U extends TSESTree.Token) + │ ^^^^^ + 19 │ ? U + 20 │ : TSESTree.Token; + + i Remove infer + +parentheses.ts:18:45 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × Expected a semicolon or an implicit semicolon after a statement, but found none + + 16 │ type Test = T extends (new ( + 17 │ token: TSESTree.Token + > 18 │ ) => token is infer U extends TSESTree.Token) + │ ^ + 19 │ ? U + 20 │ : TSESTree.Token; + + i An explicit or implicit semicolon is expected here... + + 16 │ type Test = T extends (new ( + 17 │ token: TSESTree.Token + > 18 │ ) => token is infer U extends TSESTree.Token) + │ ^ + 19 │ ? U + 20 │ : TSESTree.Token; + + i ...Which is required to end this statement + + 14 │ ? U + 15 │ : TSESTree.Token; + > 16 │ type Test = T extends (new ( + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + > 17 │ token: TSESTree.Token + > 18 │ ) => token is infer U extends TSESTree.Token) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 19 │ ? U + 20 │ : TSESTree.Token; + + +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts.snap index 6f3ed5b265b..c1e192075cf 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts +assertion_line: 212 +info: typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts.snap index 026a932751a..c5ecac433a0 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts +assertion_line: 212 +info: typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMixedWithModifiers.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts.snap index fcb5fee9ce0..58a1e5ab96a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts +assertion_line: 212 +info: typescript/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractProperties.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts.snap index 1165c749479..e44e43c6532 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts +assertion_line: 212 +info: typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyInConstructorParameters.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts.snap index ccb980b18e0..1bab14ad531 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts +assertion_line: 212 +info: typescript/conformance/classes/constructorDeclarations/constructorParameters/readonlyReadonly.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/es6/templates/templateStringWithEmbeddedTypeAssertionOnAdditionES6.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/es6/templates/templateStringWithEmbeddedTypeAssertionOnAdditionES6.ts.snap index 1f3d27b0112..9442892a123 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/es6/templates/templateStringWithEmbeddedTypeAssertionOnAdditionES6.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/es6/templates/templateStringWithEmbeddedTypeAssertionOnAdditionES6.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/es6/templates/templateStringWithEmbeddedTypeAssertionOnAdditionES6.ts +assertion_line: 212 +info: typescript/conformance/es6/templates/templateStringWithEmbeddedTypeAssertionOnAdditionES6.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts.snap index 5892a18cca7..8d0c317a959 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts +assertion_line: 212 +info: typescript/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/abstractKeyword/abstractKeyword.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/abstractKeyword/abstractKeyword.ts.snap index 80114f45fee..5673cabe6a2 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/abstractKeyword/abstractKeyword.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/abstractKeyword/abstractKeyword.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/abstractKeyword/abstractKeyword.ts +assertion_line: 212 +info: typescript/conformance/types/abstractKeyword/abstractKeyword.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/parameterProperty/parameterProperty.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/parameterProperty/parameterProperty.ts.snap index 00e4a056b15..a7fe8647cbd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/parameterProperty/parameterProperty.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/parameterProperty/parameterProperty.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/parameterProperty/parameterProperty.ts +assertion_line: 212 +info: typescript/conformance/types/parameterProperty/parameterProperty.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/contextualTypeWithTuple.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/contextualTypeWithTuple.ts.snap index 03197d69cc7..dd31a6cd80a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/contextualTypeWithTuple.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/contextualTypeWithTuple.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/tuple/contextualTypeWithTuple.ts +assertion_line: 212 +info: typescript/conformance/types/tuple/contextualTypeWithTuple.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/indexerWithTuple.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/indexerWithTuple.ts.snap index b72d722d14d..e70b49bdea7 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/indexerWithTuple.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/indexerWithTuple.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/tuple/indexerWithTuple.ts +assertion_line: 212 +info: typescript/conformance/types/tuple/indexerWithTuple.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/typeInferenceWithTupleType.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/typeInferenceWithTupleType.ts.snap index db9f65b3456..4d3994bff1d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/typeInferenceWithTupleType.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/tuple/typeInferenceWithTupleType.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/tuple/typeInferenceWithTupleType.ts +assertion_line: 212 +info: typescript/conformance/types/tuple/typeInferenceWithTupleType.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures.ts.snap index de7a84c16e1..d35864a998d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/union/unionTypeCallSignatures.ts +assertion_line: 212 +info: typescript/conformance/types/union/unionTypeCallSignatures.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures3.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures3.ts.snap index 29e31fe30ac..e4e747c8b05 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures3.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures3.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/union/unionTypeCallSignatures3.ts +assertion_line: 212 +info: typescript/conformance/types/union/unionTypeCallSignatures3.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures4.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures4.ts.snap index bbfe866edb0..53cf0ed6edc 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures4.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeCallSignatures4.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/union/unionTypeCallSignatures4.ts +assertion_line: 212 +info: typescript/conformance/types/union/unionTypeCallSignatures4.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeConstructSignatures.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeConstructSignatures.ts.snap index cacdc9c280a..5770084645f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeConstructSignatures.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeConstructSignatures.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/union/unionTypeConstructSignatures.ts +assertion_line: 212 +info: typescript/conformance/types/union/unionTypeConstructSignatures.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeEquivalence.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeEquivalence.ts.snap index 6456ba6d244..fe7b15cb69d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeEquivalence.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeEquivalence.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/union/unionTypeEquivalence.ts +assertion_line: 212 +info: typescript/conformance/types/union/unionTypeEquivalence.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeFromArrayLiteral.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeFromArrayLiteral.ts.snap index 329f6921cb3..92f6646ab7d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeFromArrayLiteral.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeFromArrayLiteral.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/union/unionTypeFromArrayLiteral.ts +assertion_line: 212 +info: typescript/conformance/types/union/unionTypeFromArrayLiteral.ts --- # Input @@ -91,3 +91,4 @@ var arr9 = [e, f]; // (E|F)[] 9: var arr4Tuple: [number, string] = [3, "three", "hello"]; // [number, string, string] ``` + diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeIndexSignature.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeIndexSignature.ts.snap index 9255585a3fd..19de463e8ab 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeIndexSignature.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/conformance/types/union/unionTypeIndexSignature.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/conformance/types/union/unionTypeIndexSignature.ts +assertion_line: 212 +info: typescript/conformance/types/union/unionTypeIndexSignature.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/custom/abstract/abstractProperties.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/custom/abstract/abstractProperties.ts.snap index cce462e7507..078399dae92 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/custom/abstract/abstractProperties.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/custom/abstract/abstractProperties.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/custom/abstract/abstractProperties.ts +assertion_line: 212 +info: typescript/custom/abstract/abstractProperties.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/declare_function_with_body.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/declare_function_with_body.ts.snap index 9785971fbd4..67bf3d5f42c 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/declare_function_with_body.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/declare_function_with_body.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/declare/declare_function_with_body.ts +assertion_line: 212 +info: typescript/declare/declare_function_with_body.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/trailing-comma/function-rest-trailing-comma.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/trailing-comma/function-rest-trailing-comma.ts.snap index 775c4074918..547293897bd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/trailing-comma/function-rest-trailing-comma.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/declare/trailing-comma/function-rest-trailing-comma.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/declare/trailing-comma/function-rest-trailing-comma.ts +assertion_line: 212 +info: typescript/declare/trailing-comma/function-rest-trailing-comma.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorator-auto-accessors/decorator-auto-accessors-type-annotations.ts b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorator-auto-accessors/decorator-auto-accessors-type-annotations.ts new file mode 100644 index 00000000000..2099b517a0f --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorator-auto-accessors/decorator-auto-accessors-type-annotations.ts @@ -0,0 +1,8 @@ +abstract class Foo { + accessor prop: number = 1; + static accessor prop2: number = 1; + accessor #prop3: number = 1; + accessor [prop4]: number = 1; + private accessor prop5: number = 1; + abstract accessor prop6: number; +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorator-auto-accessors/decorator-auto-accessors-type-annotations.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorator-auto-accessors/decorator-auto-accessors-type-annotations.ts.prettier-snap new file mode 100644 index 00000000000..2099b517a0f --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorator-auto-accessors/decorator-auto-accessors-type-annotations.ts.prettier-snap @@ -0,0 +1,8 @@ +abstract class Foo { + accessor prop: number = 1; + static accessor prop2: number = 1; + accessor #prop3: number = 1; + accessor [prop4]: number = 1; + private accessor prop5: number = 1; + abstract accessor prop6: number; +} diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators-ts/angular.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators-ts/angular.ts.snap index e923c21886c..cdfbb4d457a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators-ts/angular.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators-ts/angular.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/decorators-ts/angular.ts +assertion_line: 212 +info: typescript/decorators-ts/angular.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators-ts/typeorm.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators-ts/typeorm.ts.snap index 386372ffdab..1ae8d75c204 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators-ts/typeorm.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators-ts/typeorm.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/decorators-ts/typeorm.ts +assertion_line: 212 +info: typescript/decorators-ts/typeorm.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators-comments.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators-comments.ts.snap index 95740634b43..7beb6c6d6c5 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators-comments.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators-comments.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/decorators/decorators-comments.ts +assertion_line: 212 +info: typescript/decorators/decorators-comments.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators.ts.snap index ba2d63c1515..497abbc6917 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/decorators.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/decorators/decorators.ts +assertion_line: 212 +info: typescript/decorators/decorators.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/inline-decorators.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/inline-decorators.ts.snap index f7f0b4661ff..7aff2795a72 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/inline-decorators.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/decorators/inline-decorators.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/decorators/inline-decorators.ts +assertion_line: 212 +info: typescript/decorators/inline-decorators.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/definite.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/definite.ts.snap index 2d299fbeb9a..fa08ce14482 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/definite.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/definite.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/definite/definite.ts +assertion_line: 212 +info: typescript/definite/definite.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/without-annotation.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/without-annotation.ts.snap index a0ca6fd55ca..2b499fe9f40 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/without-annotation.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/definite/without-annotation.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/definite/without-annotation.ts +assertion_line: 212 +info: typescript/definite/without-annotation.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/generic.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/generic.ts.snap index 8d4c49d4d60..a9f025b2804 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/generic.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/generic.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/error-recovery/generic.ts +assertion_line: 212 +info: typescript/error-recovery/generic.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/index-signature.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/index-signature.ts.snap index cdbf98b8534..9912061b776 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/index-signature.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/index-signature.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/error-recovery/index-signature.ts +assertion_line: 212 +info: typescript/error-recovery/index-signature.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/jsdoc_only_types.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/jsdoc_only_types.ts.snap index 17790f318ec..be87cd7533e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/jsdoc_only_types.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/error-recovery/jsdoc_only_types.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/error-recovery/jsdoc_only_types.ts +assertion_line: 212 +info: typescript/error-recovery/jsdoc_only_types.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/export-default/function_as.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/export-default/function_as.ts.snap index daf22bc7c2b..b9342b4dcb9 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/export-default/function_as.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/export-default/function_as.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/export-default/function_as.ts +assertion_line: 212 +info: typescript/export-default/function_as.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/generic/ungrouped-parameters.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/generic/ungrouped-parameters.ts.snap index 1cf3d3a895d..3da109f536f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/generic/ungrouped-parameters.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/generic/ungrouped-parameters.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/generic/ungrouped-parameters.ts +assertion_line: 212 +info: typescript/generic/ungrouped-parameters.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/import-export/type-modifier.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/import-export/type-modifier.ts.snap index 84be0135d3c..4ba32ee2f67 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/import-export/type-modifier.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/import-export/type-modifier.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/import-export/type-modifier.ts +assertion_line: 212 +info: typescript/import-export/type-modifier.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/interface/abstract.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/interface/abstract.ts.snap index 40dcc95346a..992bedf2906 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/interface/abstract.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/interface/abstract.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/interface/abstract.ts +assertion_line: 212 +info: typescript/interface/abstract.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/interface2/break.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/interface2/break.ts.snap index eb3e0439cb3..7bcb614d612 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/interface2/break.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/interface2/break.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/interface2/break.ts +assertion_line: 212 +info: typescript/interface2/break.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/keywords.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/keywords.ts.snap index 72c9c377aba..6c019cc64ec 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/keywords.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/keywords.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/keywords/keywords.ts +assertion_line: 212 +info: typescript/keywords/keywords.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/module.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/module.ts.snap index 2ff002d7cb7..6c7c46173db 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/module.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/keywords/module.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/keywords/module.ts +assertion_line: 212 +info: typescript/keywords/module.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/mapped-type/issue-11098.ts b/crates/rome_js_formatter/tests/specs/prettier/typescript/mapped-type/issue-11098.ts new file mode 100644 index 00000000000..2024b8eaf49 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/mapped-type/issue-11098.ts @@ -0,0 +1,51 @@ +type Type = { + // comment + readonly [T in number]; +}; + +type Type = { + // comment1 + // comment2 + readonly [T in number]; +}; + +type Type = { + // comment + +readonly [T in number]; +}; + +type Type = { + // comment + -readonly [T in number]; +}; + +type Type = { + // comment + + readonly [T in number]; +}; + +type Type = { + // comment + +readonly [T in number]; +}; + +type Type = { + // comment + readonly [T in number]; +}; + +type Type = { + // comment + [T in number]; +}; + +type Type = { + readonly + // comment + [T in number]; +}; + +type Type = { + readonly // foo + /* bar */ [T in number]; +}; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/mapped-type/issue-11098.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/mapped-type/issue-11098.ts.prettier-snap new file mode 100644 index 00000000000..a1d574e62f1 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/mapped-type/issue-11098.ts.prettier-snap @@ -0,0 +1,50 @@ +type Type = { + // comment + readonly [T in number]; +}; + +type Type = { + // comment1 + // comment2 + readonly [T in number]; +}; + +type Type = { + // comment + +readonly [T in number]; +}; + +type Type = { + // comment + -readonly [T in number]; +}; + +type Type = { + // comment + +readonly [T in number]; +}; + +type Type = { + // comment + +readonly [T in number]; +}; + +type Type = { + // comment + readonly [T in number]; +}; + +type Type = { + // comment + [T in number]; +}; + +type Type = { + // comment + readonly [T in number]; +}; + +type Type = { + // foo + /* bar */ readonly [T in number]; +}; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/mapped-type/issue-11098.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/mapped-type/issue-11098.ts.snap new file mode 100644 index 00000000000..54fd6d9d4d6 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/mapped-type/issue-11098.ts.snap @@ -0,0 +1,143 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: typescript/mapped-type/issue-11098.ts +--- + +# Input + +```ts +type Type = { + // comment + readonly [T in number]; +}; + +type Type = { + // comment1 + // comment2 + readonly [T in number]; +}; + +type Type = { + // comment + +readonly [T in number]; +}; + +type Type = { + // comment + -readonly [T in number]; +}; + +type Type = { + // comment + + readonly [T in number]; +}; + +type Type = { + // comment + +readonly [T in number]; +}; + +type Type = { + // comment + readonly [T in number]; +}; + +type Type = { + // comment + [T in number]; +}; + +type Type = { + readonly + // comment + [T in number]; +}; + +type Type = { + readonly // foo + /* bar */ [T in number]; +}; + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -40,11 +40,11 @@ + }; + + type Type = { +- // comment +- readonly [T in number]; ++ readonly // comment ++ [T in number]; + }; + + type Type = { +- // foo +- /* bar */ readonly [T in number]; ++ readonly // foo ++ /* bar */ [T in number]; + }; +``` + +# Output + +```ts +type Type = { + // comment + readonly [T in number]; +}; + +type Type = { + // comment1 + // comment2 + readonly [T in number]; +}; + +type Type = { + // comment + +readonly [T in number]; +}; + +type Type = { + // comment + -readonly [T in number]; +}; + +type Type = { + // comment + +readonly [T in number]; +}; + +type Type = { + // comment + +readonly [T in number]; +}; + +type Type = { + // comment + readonly [T in number]; +}; + +type Type = { + // comment + [T in number]; +}; + +type Type = { + readonly // comment + [T in number]; +}; + +type Type = { + readonly // foo + /* bar */ [T in number]; +}; +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/multiparser-css/issue-6259.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/multiparser-css/issue-6259.ts.snap index 18c27891a99..9b22e0c1377 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/multiparser-css/issue-6259.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/multiparser-css/issue-6259.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/multiparser-css/issue-6259.ts +assertion_line: 212 +info: typescript/multiparser-css/issue-6259.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/braces.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/braces.ts.prettier-snap index 280fb577d67..b21664c1907 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/braces.ts.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/braces.ts.prettier-snap @@ -10,8 +10,8 @@ const f = ((a) => { log(a); })!; -if (a) ({ a, ...b }.a()!.c()); +if (a) ({ a, ...b }).a()!.c(); -(function () {}!()); +(function () {})!(); class a extends ({}!) {} diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/braces.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/braces.ts.snap index 68979d715fe..f4d7f6ff8d3 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/braces.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/braces.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/non-null/braces.ts +assertion_line: 212 +info: typescript/non-null/braces.ts --- # Input @@ -31,7 +31,7 @@ class a extends ({}!) {} ```diff --- Prettier +++ Rome -@@ -2,16 +2,16 @@ +@@ -2,9 +2,9 @@ ({ a: 42, b: 42, @@ -43,15 +43,6 @@ class a extends ({}!) {} const f = ((a) => { log(a); - })!; - --if (a) ({ a, ...b }.a()!.c()); -+if (a) ({ a, ...b }).a()!.c(); - --(function () {}!()); -+(function () {})!(); - - class a extends ({}!) {} ``` # Output diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/optional-chain.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/optional-chain.ts.snap index df62fe82248..ee7fd869573 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/optional-chain.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/non-null/optional-chain.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/non-null/optional-chain.ts +assertion_line: 212 +info: typescript/non-null/optional-chain.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/prettier-ignore/mapped-types.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/prettier-ignore/mapped-types.ts.snap index 6fe309b73fd..b807c3f1123 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/prettier-ignore/mapped-types.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/prettier-ignore/mapped-types.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/prettier-ignore/mapped-types.ts +assertion_line: 212 +info: typescript/prettier-ignore/mapped-types.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/range/export-assignment.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/range/export-assignment.ts.snap index 66627f7dc50..ac96e4fde90 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/range/export-assignment.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/range/export-assignment.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/range/export-assignment.ts +assertion_line: 212 +info: typescript/range/export-assignment.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/basic.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/basic.ts.prettier-snap index 7a2f29b67d0..8e370bea314 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/basic.ts.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/basic.ts.prettier-snap @@ -17,7 +17,7 @@ let obj: { f(s: string): void } & Record = { g(s) {}, } satisfies { g(s: string): void } & Record; -({ f(x) {} } satisfies { f(s: string): void }); +({ f(x) {} }) satisfies { f(s: string): void }; const car = { start() {}, diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/basic.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/basic.ts.snap deleted file mode 100644 index e12e2502a0f..00000000000 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/basic.ts.snap +++ /dev/null @@ -1,95 +0,0 @@ ---- -source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/satisfies-operators/basic.ts ---- - -# Input - -```ts -const t1 = { a: 1 } satisfies I1; -const t2 = { a: 1, b: 1 } satisfies I1; -const t3 = { } satisfies I1; -const t4: T1 = { a: "a" } satisfies T1; -const t5 = (m => m.substring(0)) satisfies T2; -const t6 = [1, 2] satisfies [number, number]; -let t7 = { a: 'test' } satisfies A; -let t8 = { a: 'test', b: 'test' } satisfies A; - -const p = { - isEven: n => n % 2 === 0, - isOdd: n => n % 2 === 1 -} satisfies Predicates; - -let obj: { f(s: string): void } & Record = { - f(s) { }, - g(s) { } -} satisfies { g(s: string): void } & Record; - -({ f(x) { } }) satisfies { f(s: string): void }; - -const car = { - start() { }, - move(d) { - // d should be number - }, - stop() { } -} satisfies Movable & Record; - -var v = undefined satisfies 1; - -``` - - -# Prettier differences - -```diff ---- Prettier -+++ Rome -@@ -17,7 +17,7 @@ - g(s) {}, - } satisfies { g(s: string): void } & Record; - --({ f(x) {} } satisfies { f(s: string): void }); -+({ f(x) {} }) satisfies { f(s: string): void }; - - const car = { - start() {}, -``` - -# Output - -```ts -const t1 = { a: 1 } satisfies I1; -const t2 = { a: 1, b: 1 } satisfies I1; -const t3 = {} satisfies I1; -const t4: T1 = { a: "a" } satisfies T1; -const t5 = ((m) => m.substring(0)) satisfies T2; -const t6 = [1, 2] satisfies [number, number]; -let t7 = { a: "test" } satisfies A; -let t8 = { a: "test", b: "test" } satisfies A; - -const p = { - isEven: (n) => n % 2 === 0, - isOdd: (n) => n % 2 === 1, -} satisfies Predicates; - -let obj: { f(s: string): void } & Record = { - f(s) {}, - g(s) {}, -} satisfies { g(s: string): void } & Record; - -({ f(x) {} }) satisfies { f(s: string): void }; - -const car = { - start() {}, - move(d) { - // d should be number - }, - stop() {}, -} satisfies Movable & Record; - -var v = undefined satisfies 1; -``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/comments-unstable.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/comments-unstable.ts.prettier-snap index 28cd18570ad..e1105a0a4e7 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/comments-unstable.ts.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/comments-unstable.ts.prettier-snap @@ -2,5 +2,4 @@ const t1 = { prop1: 1, prop2: 2, prop3: 3, -} satisfies // Comment -Record; +} satisfies Record; // Comment diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/comments-unstable.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/comments-unstable.ts.snap index 2d3776008f0..4ab12aee9ee 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/comments-unstable.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/comments-unstable.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/satisfies-operators/comments-unstable.ts +assertion_line: 212 +info: typescript/satisfies-operators/comments-unstable.ts --- # Input @@ -23,12 +23,11 @@ Record; ```diff --- Prettier +++ Rome -@@ -2,5 +2,6 @@ +@@ -2,4 +2,6 @@ prop1: 1, prop2: 2, prop3: 3, --} satisfies // Comment --Record; +-} satisfies Record; // Comment +} satisfies + // Comment + Record; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/export-default-as.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/export-default-as.ts.snap index b903b11712d..2338e227a59 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/export-default-as.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/export-default-as.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/satisfies-operators/export-default-as.ts +assertion_line: 212 +info: typescript/satisfies-operators/export-default-as.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/satisfies.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/satisfies.ts.prettier-snap index 7a3ffd4944f..c38ca45bc87 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/satisfies.ts.prettier-snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/satisfies.ts.prettier-snap @@ -1,5 +1,5 @@ -({} satisfies {}); -({} satisfies X); +({}) satisfies {}; +({}) satisfies X; () => ({} satisfies X); this.isTabActionBar((e.target || e.srcElement) satisfies HTMLElement); diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/satisfies.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/satisfies.ts.snap index 30c7d6338a9..0d964d8ffbe 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/satisfies.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/satisfies-operators/satisfies.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/satisfies-operators/satisfies.ts +assertion_line: 212 +info: typescript/satisfies-operators/satisfies.ts --- # Input @@ -39,11 +39,9 @@ foo as unknown satisfies Bar; --- Prettier +++ Rome @@ -1,6 +1,6 @@ --({} satisfies {}); --({} satisfies X); + ({}) satisfies {}; + ({}) satisfies X; -() => ({} satisfies X); -+({}) satisfies {}; -+({}) satisfies X; +() => ({}) satisfies X; this.isTabActionBar((e.target || e.srcElement) satisfies HTMLElement); diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/test-declarations/test_declarations.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/test-declarations/test_declarations.ts.snap index 50efb6f1e78..0a11b0f6d37 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/test-declarations/test_declarations.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/test-declarations/test_declarations.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/test-declarations/test_declarations.ts +assertion_line: 212 +info: typescript/test-declarations/test_declarations.ts --- # Input @@ -43,3 +43,4 @@ test("does something really long and complicated so I have to write a very long 1: test("does something really long and complicated so I have to write a very long name for the test", < ``` + diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/arrow-functions.tsx.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/arrow-functions.tsx.snap index 7fd330c718f..629c7886680 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/arrow-functions.tsx.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/arrow-functions.tsx.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/trailing-comma/arrow-functions.tsx +assertion_line: 212 +info: typescript/trailing-comma/arrow-functions.tsx --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/trailing.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/trailing.ts.snap index fc88f275ad6..a11e3e37db8 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/trailing.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/trailing.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/trailing-comma/trailing.ts +assertion_line: 212 +info: typescript/trailing-comma/trailing.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/type-parameters-vs-arguments.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/type-parameters-vs-arguments.ts.snap index 0ca9a890b1c..afc8ecc9f76 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/type-parameters-vs-arguments.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/trailing-comma/type-parameters-vs-arguments.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/trailing-comma/type-parameters-vs-arguments.ts +assertion_line: 212 +info: typescript/trailing-comma/type-parameters-vs-arguments.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/tsx/type-parameters.tsx.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/tsx/type-parameters.tsx.snap index ee1c4baff80..49e983b8ca1 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/tsx/type-parameters.tsx.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/tsx/type-parameters.tsx.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/tsx/type-parameters.tsx +assertion_line: 212 +info: typescript/tsx/type-parameters.tsx --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/type-arguments-bit-shift-left-like/1.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/type-arguments-bit-shift-left-like/1.ts.snap index dac130f3aa8..73a9a99876a 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/type-arguments-bit-shift-left-like/1.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/type-arguments-bit-shift-left-like/1.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/type-arguments-bit-shift-left-like/1.ts +assertion_line: 212 +info: typescript/type-arguments-bit-shift-left-like/1.ts --- # Input diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/typeof/typeof.ts b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeof/typeof.ts new file mode 100644 index 00000000000..accada3df35 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeof/typeof.ts @@ -0,0 +1,4 @@ +a as (typeof node.children)[number] +a as (typeof node.children)[] +a as ((typeof node.children)[number])[] +a as number[(typeof node.children)] diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/typeof/typeof.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeof/typeof.ts.prettier-snap new file mode 100644 index 00000000000..2485962408d --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeof/typeof.ts.prettier-snap @@ -0,0 +1,4 @@ +a as (typeof node.children)[number]; +a as (typeof node.children)[]; +a as (typeof node.children)[number][]; +a as number[typeof node.children]; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/typeof/typeof.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeof/typeof.ts.snap new file mode 100644 index 00000000000..349cf052c5f --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeof/typeof.ts.snap @@ -0,0 +1,42 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: typescript/typeof/typeof.ts +--- + +# Input + +```ts +a as (typeof node.children)[number] +a as (typeof node.children)[] +a as ((typeof node.children)[number])[] +a as number[(typeof node.children)] + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -1,4 +1,4 @@ +-a as (typeof node.children)[number]; +-a as (typeof node.children)[]; +-a as (typeof node.children)[number][]; ++a as typeof node.children[number]; ++a as typeof node.children[]; ++a as typeof node.children[number][]; + a as number[typeof node.children]; +``` + +# Output + +```ts +a as typeof node.children[number]; +a as typeof node.children[]; +a as typeof node.children[number][]; +a as number[typeof node.children]; +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts new file mode 100644 index 00000000000..de3013df4f9 --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts @@ -0,0 +1,11 @@ +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = + arg => null; + +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx = + arg => null; + + +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx< + // comment +> = + arg => null; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts.prettier-snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts.prettier-snap new file mode 100644 index 00000000000..24415b6ca4d --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts.prettier-snap @@ -0,0 +1,10 @@ +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = ( + arg, +) => null; + +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx = + (arg) => null; + +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx< + // comment +> = (arg) => null; diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts.snap new file mode 100644 index 00000000000..12f710f452d --- /dev/null +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts.snap @@ -0,0 +1,129 @@ +--- +source: crates/rome_formatter_test/src/snapshot_builder.rs +assertion_line: 212 +info: typescript/typeparams/empty-parameters-with-arrow-function/issue-13817.ts +--- + +# Input + +```ts +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = + arg => null; + +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx = + arg => null; + + +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx< + // comment +> = + arg => null; + +``` + + +# Prettier differences + +```diff +--- Prettier ++++ Rome +@@ -1,10 +1,10 @@ +-const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = ( +- arg, +-) => null; ++const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = ++ arg => null; + + const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx = +- (arg) => null; ++ arg => null; + + const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx< + // comment +-> = (arg) => null; ++> = ++ arg => null; +``` + +# Output + +```ts +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = + arg => null; + +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx = + arg => null; + +const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx< + // comment +> = + arg => null; +``` + +# Errors +``` +issue-13817.ts:1:74 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a type parameter but instead found '>' + + > 1 │ const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = + │ ^ + 2 │ arg => null; + 3 │ + + i Expected a type parameter here + + > 1 │ const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx<> = + │ ^ + 2 │ arg => null; + 3 │ + +issue-13817.ts:4:87 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a type parameter but instead found '>' + + 2 │ arg => null; + 3 │ + > 4 │ const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx = + │ ^ + 5 │ arg => null; + 6 │ + + i Expected a type parameter here + + 2 │ arg => null; + 3 │ + > 4 │ const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx = + │ ^ + 5 │ arg => null; + 6 │ + +issue-13817.ts:10:1 parse ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + × expected a type parameter but instead found '>' + + 8 │ const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx< + 9 │ // comment + > 10 │ > = + │ ^ + 11 │ arg => null; + 12 │ + + i Expected a type parameter here + + 8 │ const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx< + 9 │ // comment + > 10 │ > = + │ ^ + 11 │ arg => null; + 12 │ + + +``` + +# Lines exceeding max width of 80 characters +``` + 4: const xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxxxx = +``` + + diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/print-width-120/issue-7542.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/print-width-120/issue-7542.ts.snap index e941e6de436..6e6833c69ef 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/print-width-120/issue-7542.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/typeparams/print-width-120/issue-7542.ts.snap @@ -1,7 +1,7 @@ --- source: crates/rome_formatter_test/src/snapshot_builder.rs -info: - test_file: typescript/typeparams/print-width-120/issue-7542.ts +assertion_line: 212 +info: typescript/typeparams/print-width-120/issue-7542.ts --- # Input