Skip to content

Commit

Permalink
docs(oxlint): improve cli doc regarding fix and -D all
Browse files Browse the repository at this point in the history
closes #3944
  • Loading branch information
Boshen committed Aug 12, 2024
1 parent 1965aa6 commit 955a4b4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
20 changes: 10 additions & 10 deletions apps/oxlint/src/command/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ pub struct BasicOptions {
/// Accumulate rules and categories from left to right on the command-line.
/// For example `-D correctness -A no-debugger` or `-A all -D no-debugger`.
/// The categories are:
/// * `correctness` - code that is outright wrong or useless (default)
/// * `suspicious` - code that is most likely wrong or useless
/// * `pedantic` - lints which are rather strict or have occasional false positives
/// * `style` - code that should be written in a more idiomatic way
/// * `nursery` - new lints that are still under development
/// * `restriction` - lints which prevent the use of language and library features
/// * `all` - all the categories listed above except nursery
/// * `correctness` - code that is outright wrong or useless (default).
/// * `suspicious` - code that is most likely wrong or useless.
/// * `pedantic` - lints which are rather strict or have occasional false positives.
/// * `style` - code that should be written in a more idiomatic way.
/// * `nursery` - new lints that are still under development.
/// * `restriction` - lints which prevent the use of language and library features.
/// * `all` - all the categories listed above except nursery. Does not enable plugins automatically.
///
/// Arguments:
// ^ This shows up on the website but not from the cli's `--help`.
Expand Down Expand Up @@ -120,14 +120,14 @@ impl LintFilter {
#[derive(Debug, Clone, Bpaf)]
pub struct FixOptions {
/// Fix as many issues as possible. Only unfixed issues are reported in the output
#[bpaf(switch)]
#[bpaf(switch, hide_usage)]
pub fix: bool,
/// Apply auto-fixable suggestions. May change program behavior.
#[bpaf(switch)]
#[bpaf(switch, hide_usage)]
pub fix_suggestions: bool,

/// Apply dangerous fixes and suggestions.
#[bpaf(switch)]
#[bpaf(switch, hide_usage)]
pub fix_dangerously: bool,
}

Expand Down
16 changes: 8 additions & 8 deletions tasks/website/src/linter/snapshots/cli.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ expression: snapshot


## Usage
**`oxlint`** \[**`-c`**=_`<./oxlintrc.json>`_\] \[**`--fix`**\] \[**`--fix-suggestions`**\] \[**`--fix-dangerously`**\] \[_`PATH`_\]...
**`oxlint`** \[**`-c`**=_`<./oxlintrc.json>`_\] \[_`PATH`_\]...

## Basic Configuration
- **`-c`**, **`--config`**=_`<./oxlintrc.json>`_ &mdash;
Expand All @@ -24,13 +24,13 @@ Accumulate rules and categories from left to right on the command-line.

For example `-D correctness -A no-debugger` or `-A all -D no-debugger`.
The categories are:
* `correctness` - code that is outright wrong or useless (default)
* `suspicious` - code that is most likely wrong or useless
* `pedantic` - lints which are rather strict or have occasional false positives
* `style` - code that should be written in a more idiomatic way
* `nursery` - new lints that are still under development
* `restriction` - lints which prevent the use of language and library features
* `all` - all the categories listed above except nursery
* `correctness` - code that is outright wrong or useless (default).
* `suspicious` - code that is most likely wrong or useless.
* `pedantic` - lints which are rather strict or have occasional false positives.
* `style` - code that should be written in a more idiomatic way.
* `nursery` - new lints that are still under development.
* `restriction` - lints which prevent the use of language and library features.
* `all` - all the categories listed above except nursery. Does not enable plugins automatically.

Arguments:

Expand Down
17 changes: 9 additions & 8 deletions tasks/website/src/linter/snapshots/cli_terminal.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
source: tasks/website/src/linter/cli.rs
expression: snapshot
---
Usage: [-c=<./oxlintrc.json>] [--fix] [--fix-suggestions] [--fix-dangerously] [PATH]...
Usage: [-c=<./oxlintrc.json>] [PATH]...

Basic Configuration
-c, --config=<./oxlintrc.json> Oxlint configuration file (experimental)
Expand All @@ -15,13 +15,14 @@ Allowing / Denying Multiple Lints
Accumulate rules and categories from left to right on the command-line.
For example `-D correctness -A no-debugger` or `-A all -D no-debugger`.
The categories are:
* `correctness` - code that is outright wrong or useless (default)
* `suspicious` - code that is most likely wrong or useless
* `pedantic` - lints which are rather strict or have occasional false positives
* `style` - code that should be written in a more idiomatic way
* `nursery` - new lints that are still under development
* `restriction` - lints which prevent the use of language and library features
* `all` - all the categories listed above except nursery
* `correctness` - code that is outright wrong or useless (default).
* `suspicious` - code that is most likely wrong or useless.
* `pedantic` - lints which are rather strict or have occasional false positives.
* `style` - code that should be written in a more idiomatic way.
* `nursery` - new lints that are still under development.
* `restriction` - lints which prevent the use of language and library features.
* `all` - all the categories listed above except nursery. Does not enable plugins
automatically.
-A, --allow=NAME Allow the rule or category (suppress the lint)
-W, --warn=NAME Deny the rule or category (emit a warning)
-D, --deny=NAME Deny the rule or category (emit an error)
Expand Down

0 comments on commit 955a4b4

Please sign in to comment.