diff --git a/Cargo.lock b/Cargo.lock index fec331a26fcc32..4c98c5a926a67f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4021,8 +4021,7 @@ dependencies = [ [[package]] name = "dprint-plugin-typescript" version = "0.96.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90733c56ab425fc299c25ad81a5924bfc3c0050f25d865da742a6987b1255927" +source = "git+https://github.com/divybot/dprint-plugin-typescript?rev=7b7b2a2df15b02e7bba2b9bc32f011961b002cc2#7b7b2a2df15b02e7bba2b9bc32f011961b002cc2" dependencies = [ "anyhow", "capacity_builder", diff --git a/Cargo.toml b/Cargo.toml index eb79a9acd8f1ad..6adaa038e68706 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -610,3 +610,9 @@ opt-level = 3 opt-level = 3 [profile.release.package.twox-hash] opt-level = 3 + +[patch.crates-io] +# Temporary until dprint/dprint-plugin-typescript#796 is released, which fixes +# unstable JSX formatting for
 elements that contain comments. Tracks
+# denoland/deno#20403.
+dprint-plugin-typescript = { git = "https://github.com/divybot/dprint-plugin-typescript", rev = "7b7b2a2df15b02e7bba2b9bc32f011961b002cc2" }
diff --git a/tests/specs/fmt/jsx_pre_with_comment/__test__.jsonc b/tests/specs/fmt/jsx_pre_with_comment/__test__.jsonc
new file mode 100644
index 00000000000000..351a55bba0e195
--- /dev/null
+++ b/tests/specs/fmt/jsx_pre_with_comment/__test__.jsonc
@@ -0,0 +1,10 @@
+{
+  "tempDir": true,
+  "tests": {
+    "stdin": {
+      "args": "fmt --ext=tsx -",
+      "input": "import { ErrorPageProps } from \"$fresh/server.ts\";\n\nexport default function ErrorPage500(props: ErrorPageProps) {\n  return (\n    
\n      {props.url}\n      {/* {props.url} */}\n    
\n );\n}\n", + "output": "expected.out" + } + } +} diff --git a/tests/specs/fmt/jsx_pre_with_comment/expected.out b/tests/specs/fmt/jsx_pre_with_comment/expected.out new file mode 100644 index 00000000000000..2c6e93624bd721 --- /dev/null +++ b/tests/specs/fmt/jsx_pre_with_comment/expected.out @@ -0,0 +1,10 @@ +import { ErrorPageProps } from "$fresh/server.ts"; + +export default function ErrorPage500(props: ErrorPageProps) { + return ( +
+      {props.url}
+      {/* {props.url} */}
+    
+ ); +}