I downloaded the contents of a webpage and attempted to format it with deno fmt and produced a panic. I then attempted to format the file with prettier which had no issues. I whittled the contents of the page down to see which part was causing the panic, and found that I can reliably reproduce with the following very simple html file contents:
As Code
<html>
<body>
<script>
/* some multi-line comment
with function below it */
someFunc();
</script>
</body>
</html>
As Screenshot
Notably, if I do any of the following:
Remove the someFunc(); line
Remove the multi-line comment
Put the contents of the comment all onto one line
then no panic is produced.
Version: Deno 2.0.3
Output of RUST_BACKTRACE=1 deno fmt page.html
============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.
Platform: linux x86_64
Version: 2.0.3
Args: ["deno", "fmt", "page.html"]
thread 'tokio-runtime-worker' panicked at cli/tools/fmt.rs:792:11:
Formatting not stable. Bailed after 5 tries. This indicates a bug in the formatter where it formats the file (<redacted>/page.html) differently each time. As a temporary workaround you can ignore this file.
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: tokio::runtime::task::raw::poll
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
I downloaded the contents of a webpage and attempted to format it with
deno fmt
and produced a panic. I then attempted to format the file withprettier
which had no issues. I whittled the contents of the page down to see which part was causing the panic, and found that I can reliably reproduce with the following very simple html file contents:As Code
As Screenshot
Notably, if I do any of the following:
someFunc();
linethen no panic is produced.
Version: Deno 2.0.3
Output of
RUST_BACKTRACE=1 deno fmt page.html