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
14.19k stars 439 forks source link

📎 Create new option `--diagnostic-level` #671

Closed ematipico closed 10 months ago

ematipico commented 10 months ago

Description

Relative discussion: https://github.com/biomejs/biome/discussions/550

This should be relatively easy to implement.

We want to add a new option to `CliOptions:

https://github.com/biomejs/biome/blob/main/crates/biome_cli/src/cli_options.rs#L8

Accepted values: "info", "warn" and "error"

Check how we do it in LoggingLevel, which is similar:

https://github.com/biomejs/biome/blob/52dae46505805ecf87969544867c88a388df6b93/crates/biome_cli/src/cli_options.rs#L50-L55

What's different is that we already have a way to categorize diagnostics, here:

https://github.com/biomejs/biome/blob/52dae46505805ecf87969544867c88a388df6b93/crates/biome_diagnostics/src/diagnostic.rs#L114-L125

So the new options can be this:

pub diagnostic_level: Severity

This is the place where we print the diagnostics:

https://github.com/biomejs/biome/blob/52dae46505805ecf87969544867c88a388df6b93/crates/biome_cli/src/execute/traverse.rs#L570-L573

Before printing, we should filter diagnostics based on this new option

unvalley commented 10 months ago

I think this issue is resolved.