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.44k stars 394 forks source link

🐛 Parser is no longer progressing #3284

Open ugistelmokaitis opened 1 week ago

ugistelmokaitis commented 1 week ago

Environment information

> npx @biomejs/biome check --write .

This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue:

Source Location: /Users/runner/work/biome/biome/crates/biome_parser/src/lib.rs:535:9
Thread Name: biome::worker_5
Message: The parser is no longer progressing. Stuck at ')' R_PAREN:236..237

Biome encountered an unexpected error

This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue:

Source Location: /Users/runner/work/biome/biome/crates/biome_parser/src/lib.rs:535:9
Thread Name: biome::worker_6
Message: The parser is no longer progressing. Stuck at ')' R_PAREN:4196..4197

./src/styles/minHeight/minHeight.module.css internalError/panic  INTERNAL  ━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ processing panicked: The parser is no longer progressing. Stuck at ')' R_PAREN:242..243

  ⚠ This diagnostic was derived from an internal Biome error. Potential bug, please report it if necessary.


### What happened?

1. I run  ```npx @biomejs/biome check --write .``` and then encounter error 
2. I've tried formatting ```pnpm biome format --write . ```  and this command runs  successfully.
3. When I try linting ```pnpm biome lint --write .``` I get same error as explained above in 'Environment information' field

### Expected result

Safe fixes should be applied to all files using a linting command based on documentation based on documentation https://biomejs.dev/guides/getting-started/. 

However, at the moment, I have only encountered an error in one of my project so far. This is an error that I have never had before.

### Code of Conduct

- [X] I agree to follow Biome's Code of Conduct
denbezrukov commented 1 week ago

I'm wondering if you have an example to reproduce the issue. You can use our playground: https://biomejs.dev/playground/?indentStyle=space&quoteStyle=single&jsxQuoteStyle=single&lintRules=all

ugistelmokaitis commented 1 week ago

It's a private repository with over 400 commits. So not too sure what's the best way to reproduce an example of it. Any suggestions as I don't want to open source it?

minht11 commented 1 week ago

Can you isolate that one file? I imagine that Biome parses files independently, so you shouldn't need the whole project. The method that works for me: delete files until error is gone, thats how I narrow reproductions down.

Sec-ant commented 1 week ago

It's a private repository with over 400 commits. So not too sure what's the best way to reproduce an example of it. Any suggestions as I don't want to open source it?

From the error message, the error is triggered by this file: ./src/styles/minHeight/minHeight.module.css, somewhere around the 242nd character. Should that help you narrow down the file and the place?

ugistelmokaitis commented 1 week ago

I've isolated and seems like problem is css files for some reason.

here is an example of entire file - minHeight.module.css


.literal {
    min-height: var(--umrel-min-height-xs, auto);
}

.min-height {
    min-height: calc(var(--umrel-min-height-xs) * var(--umrel-height-100));
}

@each $breakpoint in xs, sm, md, lg, xl {
    @media (--umrel-breakpoints-$breakpoint) {
        .literal--$breakpoint {
            min-height: var(--umrel-min-height-$breakpoint);
        }

        .min-height--$breakpoint {
            min-height: calc(var(--umrel-min-height-$breakpoint) * var(--umrel-height-100));
        }
    }
}

this shouldn't have any issues with linting but for some reason it does

ugistelmokaitis commented 1 week ago

so the issues seems to be with 'postcss-each' https://www.npmjs.com/package/postcss-each. Every-time in css modules I used @each I get a linting error

Sec-ant commented 1 week ago

The minimal reproduction: https://biomejs.dev/playground/?files.main.css=QABtAGUAZABpAGEAIAAoAC0ALQB1AG0AcgBlAGwALQBiAHIAZQBhAGsAcABvAGkAbgB0AHMALQAkAGIAcgBlAGEAawBwAG8AaQBuAHQAKQAgAHsAfQA%3D

Is the dollar sign SASS syntax? We only support standard CSS and CSS modules at the moment.

But yeah the parser shouldn't panic.

ugistelmokaitis commented 1 week ago

@Sec-ant yes that's right. But with postcss-each plugin you can iterate through values which is very handy and it's using dollar sign

ematipico commented 1 week ago

Ah, we don't support SASS/LESS syntax, and we don't support esoteric plugins like postcss does