-
-
Notifications
You must be signed in to change notification settings - Fork 449
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: enable CSS linter and CSS formatter #2790
Conversation
64abeb0
to
5fc1929
Compare
5fc1929
to
a19dffd
Compare
CodSpeed Performance ReportMerging #2790 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand correctly that we don't even parse a file if we disable linting and formatting?
crates/biome_cli/tests/snapshots/main_commands_check/check_help.snap
Outdated
Show resolved
Hide resolved
Exactly, we skip it |
Co-authored-by: Victorien Elvinger <victorien@elvinger.fr>
Thank you for the hard work here, but this feels like something that should have required a major version release.
Anyone else coming here who need to resolve this quickly can add the following to their biome.json:
|
Summary
This PR enables CSS parsing and CSS formatting.
Important
Internally, we decided that linter and formatting are opt-in and disabled by default. Why? Because it's possible that parser, formatter and linter aren't quite stable yet, and it's hightly possible that there are bugs.
Enabling this in Biome comes with new options across the configuration. Mainly now, each language section can enable or disable the linter. This was required because, until now, we haven't officially had lint rules for languages other than JSON, and that single lint rule still needs some work, that's why it isn't documented yet.
The PR adds:
javascript.linter.enabled
css.linter.enabled
json.linter.enabled
The relative CLI options are also added.
Also, since we are officially enabling the CSS formatter to the people with this PR, I took the chance to remove
inde_size
from the options. It doesn't make sense to expose an option that is already deprecated.Technical changes
Most of the changes are around configuration and overrides. It's mostly boilerplate and copying code from other implementations.
One thing of relevance though, is the creation of the type
AnalyzerOptions
when we do linting. So far, we were using a standalone function to do that, however, that's not the right way not.Our infrastructure allows to generate generic functions at triat level that return options for a specifict language, for example
format_options
. These are function meant to receive options from global settings (biome.json
and CLI) and the LSP (client options). I did create a new function calledanalyzer_options
, and how each language implements that. The implementation of each function is a copy-paste of their former functions, but adapted to use the proper parameters.Test Plan
I created new test cases inside a new file called
handle_css_files.rs
. I find using the "cases" concept better than grouping stuff by commands. More files, sure, but they are smaller and focused on certain things.