denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
95.98k stars 5.31k forks source link

Panicking when formatting postcss in a Svelte file #25818

Open BlowaterNostr opened 3 weeks ago

BlowaterNostr commented 3 weeks ago
============================================================
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 aarch64
Version: 1.46.2
Args: ["deno", "fmt", "--unstable-component"]

thread 'tokio-runtime-worker' panicked at cli/tools/fmt.rs:754:11:
Formatting not stable. Bailed after 5 tries. This indicates a bug in the formatter where it formats the file (a svelte file) differently each time. As a temporary workaround you can ignore this file.
stack backtrace:
   0:     0xaaaab55d3d84 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h18d7a2571106fbf4
   1:     0xaaaab56008b0 - core::fmt::write::hbfa73a7a5186286a
   2:     0xaaaab55cdcb8 - std::io::Write::write_fmt::h5bae5422b72e7351
   3:     0xaaaab55d3bcc - std::sys_common::backtrace::print::h2a658d0148ab667e
   4:     0xaaaab55d5664 - std::panicking::default_hook::{{closure}}::h1495412aefb2bb36
   5:     0xaaaab55d52cc - std::panicking::default_hook::he773715f5fd59c50
   6:     0xaaaab59f8d88 - deno::setup_panic_hook::{{closure}}::hb079677555441aba
   7:     0xaaaab55d5c24 - std::panicking::rust_panic_with_hook::h32dd7f185783ae19
   8:     0xaaaab55d59ec - std::panicking::begin_panic_handler::{{closure}}::h6e3724fa5e927a4e
   9:     0xaaaab55d4264 - std::sys_common::backtrace::__rust_end_short_backtrace::h877ff9009acc9a78
  10:     0xaaaab55d5760 - rust_begin_unwind
  11:     0xaaaab55fdb94 - core::panicking::panic_fmt::hcb4d02f688afee88
  12:     0xaaaab5794eac - tokio::runtime::task::raw::poll::hb38b3ef78ccb32a5
  13:     0xaaaab71b0714 - std::sys_common::backtrace::__rust_begin_short_backtrace::hbf33c25a1e8912c5
  14:     0xaaaab71b2cec - core::ops::function::FnOnce::call_once{{vtable.shim}}::hdcabae7d0223c3f4
  15:     0xaaaab55dc418 - std::sys::pal::unix::thread::Thread::new::thread_start::haf793f2025a74235
  16:     0xffffac87ee58 - <unknown>
  17:     0xffffac8e7f9c - <unknown>
  18:                0x0 - <unknown>

First, huge thanks to the deno team for implementing a fast formatter for the rest of the JavaScript ecosystem. It's 100X faster than eslint.

It's fine for deno fmt to ignore postcss if that's not not planned to work. But the formatter should skip the postcss section and continue to the rest of the project.

satyarohith commented 3 weeks ago

@BlowaterNostr, deno fmt ~doesn't support formatting svelte files~ (it does https://docs.deno.com/runtime/reference/cli/formatter/) but panic is a bug in this case. We should have better error message.

lucacasonato commented 3 weeks ago

@satyarohith It does support it with --unstable-component.

lucacasonato commented 3 weeks ago

@BlowaterNostr Can you please include the source file that you are trying to format? Without that we can not fix this issue.