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

feat: flag to suppress existing diagnostics #4008

Merged
merged 67 commits into from
Oct 21, 2024

Conversation

anthonyshew
Copy link
Contributor

@anthonyshew anthonyshew commented Sep 20, 2024

Summary

Working on #4007 to create a flag for writing ignores. This is useful when migrating a large codebase, and you want to enable a rule that has hundreds (thousands?!) of existing violations for that rule. With this feature, you can have Biome ignore those existing violations, and burn them down later.

Test Plan

Some new tests have been written in crates/biome_cli/tests/cases/suppressions.rs. Additionally, I've ran this against a large codebase to validate that things work as I'd expect.

@github-actions github-actions bot added the A-CLI Area: CLI label Sep 20, 2024
@anthonyshew
Copy link
Contributor Author

anthonyshew commented Sep 20, 2024

I would appreciate a look from a maintainer here to see if I'm on the right track architecturally. I'm not completely sure that I have the right idea. I was following what looks like the strategy for --fix, which seems like it follows the same workflow (find a diagnostic, make an edit). Plenty more work to do but would love to find out if I'm directionally correct at this point.

Copy link
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely take a look at ematipico's comment here: #4007 (comment)

crates/biome_cli/src/commands/mod.rs Outdated Show resolved Hide resolved
@anthonyshew
Copy link
Contributor Author

anthonyshew commented Sep 20, 2024

TL;DR from Ema's comment: I wasn't even close on my first attempt. 😄 Circling back.

@github-actions github-actions bot added the A-Project Area: project label Sep 22, 2024
@anthonyshew anthonyshew changed the title feat: flag to suppress linting errors feat: flag to suppress existing diagnostics Sep 23, 2024
@github-actions github-actions bot added A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages labels Sep 26, 2024
@github-actions github-actions bot removed the A-Formatter Area: formatter label Sep 26, 2024
@github-actions github-actions bot added the A-LSP Area: language server protocol label Sep 26, 2024
@anthonyshew
Copy link
Contributor Author

anthonyshew commented Sep 26, 2024

Well, it at least works now. 😄

Maintainer questions:

  • Would love to hear from a maintainer that I'm architecturally correct now that I've pivoted my strategy
  • Is this the right name for the flag?
  • It looks like I can implement the other languages pretty simply from a quick look? Is this desired?

My to-dos:

  • The default message is still <explanation>
    • Would be great to make the explanation customizable, but will probably do this in a follow up PR
  • Take it for a larger test in a bigger repo than create-turbo
  • Write tests (Not really sure what tests to write)

@anthonyshew
Copy link
Contributor Author

anthonyshew commented Oct 3, 2024

Alright, I think I finally have this ready! Let me know if there are still changes needed (possible I need more tests, wasn't sure what you'd like to see tested).

Learned a lot about how Biome works and will handle follow-ups for customizing the explanation once this one lands. Thanks for tolerating my noob questions, @dyc3, @ematipico, and @Conaclos. 😄

@ematipico ematipico added the S-Merge for next minor Status: the PR should be merged in the next minor label Oct 4, 2024
crates/biome_cli/src/commands/mod.rs Outdated Show resolved Hide resolved
crates/biome_service/src/workspace.rs Show resolved Hide resolved
crates/biome_service/src/workspace.rs Outdated Show resolved Hide resolved
crates/biome_service/src/file_handlers/json.rs Outdated Show resolved Hide resolved
crates/biome_service/src/file_handlers/javascript.rs Outdated Show resolved Hide resolved
crates/biome_service/src/file_handlers/graphql.rs Outdated Show resolved Hide resolved
crates/biome_service/src/file_handlers/css.rs Outdated Show resolved Hide resolved
crates/biome_cli/src/execute/mod.rs Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the A-LSP Area: language server protocol label Oct 5, 2024
@anthonyshew
Copy link
Contributor Author

Thanks, @ematipico! Addressed your comments. 👍

@anthonyshew
Copy link
Contributor Author

@ematipico, just checked back in on this PR and had to resolve some conflicts. Is there anything else you need me to do to get merged? I'd love to get started on the custom descriptions but don't want to be working against myself. 😄

@ematipico
Copy link
Member

@anthonyshew

You don't need to do anything now. Since this is a feature, we need to wait a bit. We're still merging bug fixes. Once we're ready, we'll merge it

@anthonyshew
Copy link
Contributor Author

Ah, okay, no worries. Sorry, should've put that together.

Would it be wise for me to start trying to work on the custom explanations or should I hold back on that?

@ematipico ematipico merged commit 03e48b8 into biomejs:main Oct 21, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI A-Project Area: project L-JavaScript Language: JavaScript and super languages S-Merge for next minor Status: the PR should be merged in the next minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants