biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
https://biomejs.dev
Apache License 2.0
12.58k stars 395 forks source link

πŸ› Big pack of js/ts files that crashes biome #342

Open qarmin opened 9 months ago

qarmin commented 9 months ago

Environment information

CLI:
  Version:                      0.0.0
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           unset
  JS_RUNTIME_NAME:              unset
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       unset

Workspace:
  Open Documents:               0

Discovering running Biome servers...

What happened?

Copy of issue https://github.com/rome/tools/issues/4323

I still see multiple crashes(even in playground) when linting files(probably mostly invalid)

biome lint file.js

cause this crashes

Message: assertion failed: start <= end
  Γ— processing panicked: begin <= end (1 <= 0) when slicing `/---`
Message: byte index 1 is not a char boundary; it is inside 'Ð' (bytes 0..2) of `Ð    expo`
Message: byte index 1 is out of bounds of ``

Files - https://github.com/rome/tools/files/12458119/Broken.zip

Screenshot from 2023-09-20 09-29-53

Expected result

No crashes

Code of Conduct

Conaclos commented 1 month ago

The reported error is now fixed. However, some files produce other internal errors. I opened #3120.

qarmin commented 1 week ago

Problematic files 30.06.2024 - Broken.zip

internal error: entered unreachable code
begin <= end (1 <= 0) when slicing `"`
The parser is no longer progressing. Stuck at ']' R_BRACK:10..11
internal error: entered unreachable code: Missing switch clause.
Expected a declaration as guaranteed by is_at_ts_declare_statement

crash locations

crates/biome_js_syntax/src/static_value.rs:66:33
crates/biome_parser/src/lib.rs:535:9
crates/biome_js_parser/src/syntax/typescript/statement.rs:244:14
crates/biome_js_analyze/src/lint/suspicious/no_fallthrough_switch_clause.rs:157:33
crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs:582:13
crates/biome_diagnostics/src/display/frame.rs:242:57