From 955a4b44799038acbadc2f9c2e4efcb50f7fa74e Mon Sep 17 00:00:00 2001 From: Boshen Date: Mon, 12 Aug 2024 14:55:45 +0800 Subject: [PATCH] docs(oxlint): improve cli doc regarding fix and `-D all` closes #3944 --- apps/oxlint/src/command/lint.rs | 20 +++++++++---------- tasks/website/src/linter/snapshots/cli.snap | 16 +++++++-------- .../src/linter/snapshots/cli_terminal.snap | 17 ++++++++-------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/apps/oxlint/src/command/lint.rs b/apps/oxlint/src/command/lint.rs index 69afcce3a91a9..93a8ca7d02e6e 100644 --- a/apps/oxlint/src/command/lint.rs +++ b/apps/oxlint/src/command/lint.rs @@ -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`. @@ -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, } diff --git a/tasks/website/src/linter/snapshots/cli.snap b/tasks/website/src/linter/snapshots/cli.snap index 7df968dd6a60a..9f563414052bf 100644 --- a/tasks/website/src/linter/snapshots/cli.snap +++ b/tasks/website/src/linter/snapshots/cli.snap @@ -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>`_ — @@ -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: diff --git a/tasks/website/src/linter/snapshots/cli_terminal.snap b/tasks/website/src/linter/snapshots/cli_terminal.snap index 842d4cd679242..193dfb931d734 100644 --- a/tasks/website/src/linter/snapshots/cli_terminal.snap +++ b/tasks/website/src/linter/snapshots/cli_terminal.snap @@ -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) @@ -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)