Skip to content

Commit

Permalink
refactor: --only=<GROUP> run all rules of a group
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos committed May 23, 2024
1 parent 0a67bb4 commit ed03882
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 1,988 deletions.
8 changes: 3 additions & 5 deletions crates/biome_cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,9 @@ pub enum BiomeCommand {
#[bpaf(external, hide_usage)]
cli_options: CliOptions,

/// Run only the given rule or rule group.
///
/// When a rule is passed, its severity level is set to `error' if it is a recommended rule, or `warn' otherwise.
///
/// When a rule group is passed, the `recommended` flag is enabled, but if the `all` flag is enabled.
/// Run only the given rule or group of rules.
/// If the severity level of a rule is `off`,
/// then the severity level of the rule is set to `error` if it is a recommended rule or `warn` otherwise.
///
/// Example: `biome lint --only=correctness/noUnusedVariables --only=suspicious`
#[bpaf(long("only"), argument("GROUP|RULE"))]
Expand Down
7 changes: 3 additions & 4 deletions crates/biome_cli/src/execute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,9 @@ pub enum TraversalMode {
/// 1. The virtual path to the file
/// 2. The content of the file
stdin: Option<Stdin>,
/// Run only the given rule or rule group.
/// The option overrides the Biome configuration file as follows:
/// - When a rule is passed, its severity level is set to `error' if it is a recommended rule, or `warn' otherwise.
/// - When a rule group is passed, the `recommended` flag is enabled, but if the `all` flag is enabled.
/// Run only the given rule or group of rules.
/// If the severity level of a rule is `off`,
/// then the severity level of the rule is set to `error` if it is a recommended rule or `warn` otherwise.
only: Vec<RuleSelector>,
/// Skip the given rule or group of rules by setting the severity level of the rules to `off`.
/// This option takes precedence over `--only`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@ Available options:
--apply Alias for `--write`, writes safe fixes (deprecated, use `--write`)
--apply-unsafe Alias for `--write --unsafe`, writes safe and unsafe fixes (deprecated,
use `--write --unsafe`)
--only=<GROUP|RULE> Run only the given rule or rule group.
When a rule is passed, its severity level is set to `error' if it is a
recommended rule, or `warn' otherwise.
When a rule group is passed, the `recommended` flag is enabled, but if
the `all` flag is enabled.
--only=<GROUP|RULE> Run only the given rule or group of rules. If the severity level of a rule
is `off`, then the severity level of the rule is set to `error` if it is
a recommended rule or `warn` otherwise.
Example: `biome lint --only=correctness/noUnusedVariables --only=suspicious`
--skip=<GROUP|RULE> Skip the given rule or group of rules by setting the severity level of
the rules to `off`. This option takes precedence over `--only`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,44 @@ expression: content
debugger;
}

```

# Termination Message

```block
lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Some errors were emitted while running checks.
```

# Emitted Messages

```block
check.js:3:9 lint/suspicious/noDebugger FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× This is an unexpected use of the debugger statement.
2 │ export function CONSTANT_CASE(){
> 3 │ debugger;
│ ^^^^^^^^^
4 │ }
5 │
i Unsafe fix: Remove debugger statement
1 1 │
2 2 │ export function CONSTANT_CASE(){
3 │ - ········debugger;
4 3 │ }
5 4 │
```

```block
Checked 1 file in <TIME>. No fixes needed.
Found 1 error.
```
Loading

0 comments on commit ed03882

Please sign in to comment.