refactor(cli): improve --help documentation

This commit is contained in:
Boshen 2024-04-22 11:14:51 +08:00
parent 023c1acfd0
commit 5241e1e127
No known key found for this signature in database
GPG key ID: 234DA6A7079C6801
2 changed files with 29 additions and 22 deletions

View file

@ -55,11 +55,11 @@ pub struct LintOptions {
/// ESLint configuration file (experimental)
///
/// * only `.json` extension is supported
#[bpaf(long, short, argument("PATH"))]
#[bpaf(long, short, argument("./eslintrc.json"))]
pub config: Option<PathBuf>,
/// TypeScript `tsconfig.json` path for reading path alias and project references for import plugin
#[bpaf(argument("PATH"))]
#[bpaf(argument("./tsconfig.json"), hide_usage)]
pub tsconfig: Option<PathBuf>,
/// Single file, single path or list of paths
@ -136,7 +136,7 @@ pub struct WarningOptions {
#[derive(Debug, Clone, Bpaf)]
pub struct OutputOptions {
/// Use a specific output format (default, json)
#[bpaf(long, short, fallback(OutputFormat::Default))]
#[bpaf(long, short, fallback(OutputFormat::Default), hide_usage)]
pub format: OutputFormat,
}
@ -165,7 +165,8 @@ impl FromStr for OutputFormat {
#[allow(clippy::struct_field_names)]
#[derive(Debug, Clone, Bpaf)]
pub struct EnablePlugins {
/// Enable the experimental import plugin and detect ESM problems
/// Enable the experimental import plugin and detect ESM problems.
/// It is recommended to use along side with the `--tsconfig` option.
#[bpaf(switch, hide_usage)]
pub import_plugin: bool,

View file

@ -54,7 +54,7 @@ Run
`npx oxlint@latest --help`:
```
Usage: oxlint [-A=NAME | -D=NAME]... [--fix] [PATH]...
Usage: oxlint [-A=NAME | -D=NAME]... [--fix] [-c=<./eslintrc.json>] [PATH]...
Allowing / Denying Multiple Lints
For example `-D correctness -A no-debugger` or `-A all -D no-debugger`.
@ -65,41 +65,47 @@ Allowing / Denying Multiple Lints
-D, --deny=NAME Deny the rule or category (emit an error)
Enable Plugins
--import-plugin Enable the experimental import plugin and detect ESM problems
--import-plugin Enable the experimental import plugin and detect ESM problems. It is
recommended to use along side with the `--tsconfig` option.
--jsdoc-plugin Enable the experimental jsdoc plugin and detect JSDoc problems
--jest-plugin Enable the Jest plugin and detect test problems
--jsx-a11y-plugin Enable the JSX-a11y plugin and detect accessibility problems
--nextjs-plugin Enable the Next.js plugin and detect Next.js problems
--react-perf-plugin Enable the React performance plugin and detect rendering performance problems
--react-perf-plugin Enable the React performance plugin and detect rendering performance
problems
Fix Problems
--fix Fix as many issues as possible. Only unfixed issues are reported in the
output
--fix Fix as many issues as possible. Only unfixed issues are reported in
the output
Ignore Files
--ignore-path=PATH Specify the file to use as your .eslintignore
--ignore-pattern=PAT Specify patterns of files to ignore (in addition to those in .eslintignore)
--no-ignore Disables excluding of files from .eslintignore files, --ignore-path flags
and --ignore-pattern flags
--ignore-pattern=PAT Specify patterns of files to ignore (in addition to those in
.eslintignore)
--no-ignore Disables excluding of files from .eslintignore files, --ignore-path
flags and --ignore-pattern flags
Handle Warnings
--quiet Disable reporting on warnings, only errors are reported
--max-warnings=INT Specify a warning threshold, which can be used to force exit with an error
status if there are too many warning-level rule violations in your project
--deny-warnings Ensure warnings produce a non-zero exit code
--max-warnings=INT Specify a warning threshold, which can be used to force exit with an
error status if there are too many warning-level rule violations in
your project
Output
-f, --format=ARG Use a specific output format (default, json)
Miscellaneous
--timing Display the execution time of each lint rule
[env:TIMING: not set]
--rules list all the rules that are currently registered
--threads=INT Number of threads to use. Set to 1 for using only 1 CPU core
Codeowners
--codeowners-file=PATH Path to CODEOWNERS file
--codeowners=NAME Code owner names, e.g. @Boshen
Available positional items:
PATH Single file, single path or list of paths
Available options:
--rules list all the rules that are currently registered
-c, --config=<./eslintrc.json> ESLint configuration file (experimental)
--tsconfig=<./tsconfig.json> TypeScript `tsconfig.json` path for reading path alias and
project references for import plugin
-h, --help Prints help information
-V, --version Prints version information
```