Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Comments are removed when updating from rome-ignore to biome-ignore #257

Closed
1 task done
stutrek opened this issue Sep 12, 2023 · 5 comments
Closed
1 task done

Comments

@stutrek
Copy link

stutrek commented Sep 12, 2023

Environment information

This is far too long for me to review, and I do see things I shouldn't put in. I can provide a subset of information if needed.

I did get this error when running --apply-unsafe

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/rome_rowan/src/ast/mod.rs:230:13
Thread Name: rome::worker_4
Message: Tried to cast node with kind JS_STATIC_MEMBER_EXPRESSION as `"rome_js_syntax::generated::nodes::AnyJsAssignmentPattern"` but was unable to cast

What happened?

Comments before // rome-ignore statements are removed.

image

Expected result

It should leave these comments in.

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@stutrek
Copy link
Author

stutrek commented Sep 12, 2023

I just did a find and replace to update rome-ignore, but I still get logs about the error above. It does fix things.

@ematipico
Copy link
Member

ematipico commented Sep 13, 2023

Could please share the code that generates that error please? We're trying to hunt down the rule/code that triggers that for days!

Also:

  • I believe we removed the code action of the diagnostic that warns about the deprecated comment in one of the latest patches
  • the error you see was generated by some rule that emitted invalid code

@stutrek
Copy link
Author

stutrek commented Sep 13, 2023

I believe it's this code in combination with complexity/useLiteralKeys

// Add optimizely service to global window; this allows us to debug feature flag flakiness in localhost a bit better
if (typeof window !== 'undefined' && Boolean(window)) {
  ((window as unknown) as Record<string, unknown>)['optimizelyService'] = optimizelyService;
}

const IS_RUNNING_IN_CYPRESS =
  typeof window === 'undefined' ? false : Boolean((window as never)?.['Cypress']);

but it's unrelated to this specific bug :(

@yckbilly1929
Copy link

happens on 1.2.2

@ematipico
Copy link
Member

ematipico commented Sep 18, 2023

I am going to close this.

@yckbilly1929 subscribe to #98, which is a broader issue that doesn't involve a specific rule, but a how code actions are applied to the code, which causes these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants