diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-21 14:18:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-21 14:18:59 -0700 |
commit | ffbcad3800ef086bad791c1c640b62fd72d60172 (patch) | |
tree | f350a54862928e19ba93a75b71a4c4bebcc974f3 /cli/args/mod.rs | |
parent | 2166aa8fb6be5fdd6d607db587e236de11b6fb91 (diff) |
feat(lint): `deno lint --fix` and lsp quick fixes (#22615)
Adds a `--fix` option to deno lint. This currently doesn't work for
basically any rules, but we can add them over time to deno lint.
Diffstat (limited to 'cli/args/mod.rs')
-rw-r--r-- | cli/args/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cli/args/mod.rs b/cli/args/mod.rs index d957b8f80..cb4473ca2 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -391,6 +391,7 @@ pub struct LintOptions { pub rules: LintRulesConfig, pub files: FilePatterns, pub reporter_kind: LintReporterKind, + pub fix: bool, } impl LintOptions { @@ -399,6 +400,7 @@ impl LintOptions { rules: Default::default(), files: FilePatterns::new_with_base(base), reporter_kind: Default::default(), + fix: false, } } @@ -407,6 +409,7 @@ impl LintOptions { maybe_lint_flags: Option<LintFlags>, initial_cwd: &Path, ) -> Result<Self, AnyError> { + let fix = maybe_lint_flags.as_ref().map(|f| f.fix).unwrap_or(false); let mut maybe_reporter_kind = maybe_lint_flags.as_ref().and_then(|lint_flags| { if lint_flags.json { @@ -464,6 +467,7 @@ impl LintOptions { maybe_rules_include, maybe_rules_exclude, ), + fix, }) } } |