From a446c89620a049b4bddc1f6453ebe5dd788105ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 22 Dec 2024 21:35:29 +0100 Subject: [PATCH] remove --plugins flag support for now --- cli/args/flags.rs | 56 ------------------------ cli/args/mod.rs | 8 +--- cli/tools/lint/mod.rs | 9 +--- fo.json | 23 ---------- lint.md | 0 test_lint_plugins/deno.json | 11 +++++ foo.js => test_lint_plugins/foo.js | 0 foo.tsx => test_lint_plugins/foo.tsx | 0 plugin.ts => test_lint_plugins/plugin.ts | 0 9 files changed, 13 insertions(+), 94 deletions(-) delete mode 100644 fo.json delete mode 100644 lint.md create mode 100644 test_lint_plugins/deno.json rename foo.js => test_lint_plugins/foo.js (100%) rename foo.tsx => test_lint_plugins/foo.tsx (100%) rename plugin.ts => test_lint_plugins/plugin.ts (100%) diff --git a/cli/args/flags.rs b/cli/args/flags.rs index a22acbc419..416a55685b 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -298,7 +298,6 @@ pub struct LintFlags { pub json: bool, pub compact: bool, pub watch: Option, - pub maybe_plugins: Option>, } impl LintFlags { @@ -2867,16 +2866,6 @@ To ignore linting on an entire file, you can add an ignore comment at the top of .help("Use set of rules with a tag") .help_heading(LINT_HEADING), ) - .arg( - Arg::new("plugins") - .long("plugins") - .require_equals(true) - .num_args(1..) - .action(ArgAction::Append) - .use_value_delimiter(true) - .help("Plugins to run, relative or absolute paths") - .help_heading(LINT_HEADING), - ) .arg( Arg::new("rules-include") .long("rules-include") @@ -5145,10 +5134,6 @@ fn lint_parse( .remove_many::("rules-exclude") .map(|f| f.collect()); - let maybe_plugins = matches - .remove_many::("plugins") - .map(|f| f.collect()); - let json = matches.get_flag("json"); let compact = matches.get_flag("compact"); @@ -5165,7 +5150,6 @@ fn lint_parse( json, compact, watch: watch_arg_parse(matches)?, - maybe_plugins, }); Ok(()) } @@ -7177,7 +7161,6 @@ mod tests { json: false, compact: false, watch: Default::default(), - maybe_plugins: None, }), ..Flags::default() } @@ -7207,7 +7190,6 @@ mod tests { json: false, compact: false, watch: Some(Default::default()), - maybe_plugins: None, }), permissions: PermissionFlags { allow_import: Some(vec![]), @@ -7245,7 +7227,6 @@ mod tests { no_clear_screen: true, exclude: vec![], }), - maybe_plugins: None, }), ..Flags::default() } @@ -7273,7 +7254,6 @@ mod tests { json: false, compact: false, watch: Default::default(), - maybe_plugins: None, }), ..Flags::default() } @@ -7296,7 +7276,6 @@ mod tests { json: false, compact: false, watch: Default::default(), - maybe_plugins: None, }), ..Flags::default() } @@ -7324,7 +7303,6 @@ mod tests { json: false, compact: false, watch: Default::default(), - maybe_plugins: None, }), ..Flags::default() } @@ -7353,7 +7331,6 @@ mod tests { json: false, compact: false, watch: Default::default(), - maybe_plugins: None, }), ..Flags::default() } @@ -7376,7 +7353,6 @@ mod tests { json: true, compact: false, watch: Default::default(), - maybe_plugins: None, }), ..Flags::default() } @@ -7406,7 +7382,6 @@ mod tests { json: true, compact: false, watch: Default::default(), - maybe_plugins: None, }), config_flag: ConfigFlag::Path("Deno.jsonc".to_string()), ..Flags::default() @@ -7437,42 +7412,11 @@ mod tests { json: false, compact: true, watch: Default::default(), - maybe_plugins: None, }), config_flag: ConfigFlag::Path("Deno.jsonc".to_string()), ..Flags::default() } ); - - let r = flags_from_vec(svec![ - "deno", - "lint", - "--plugins=./plugins/plugin1.js,/dev/plugins/plugin2.js", - ]); - assert_eq!( - r.unwrap(), - Flags { - subcommand: DenoSubcommand::Lint(LintFlags { - files: FileFlags { - include: vec![], - ignore: vec![], - }, - fix: false, - rules: false, - maybe_rules_tags: None, - maybe_rules_include: None, - maybe_rules_exclude: None, - json: false, - compact: false, - watch: Default::default(), - maybe_plugins: Some(vec![ - "./plugins/plugin1.js".to_string(), - "/dev/plugins/plugin2.js".to_string() - ]), - }), - ..Flags::default() - } - ); } #[test] diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 4aa4f54682..e021e52b6e 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -457,13 +457,7 @@ impl LintOptions { lint_flags.maybe_rules_exclude.clone(), ), fix: lint_flags.fix, - plugins: if !lint_config.options.plugins.is_empty() { - lint_config.options.plugins.clone() - } else if let Some(plugins) = lint_flags.maybe_plugins.as_ref() { - plugins.clone() - } else { - vec![] - }, + plugins: lint_config.options.plugins, } } } diff --git a/cli/tools/lint/mod.rs b/cli/tools/lint/mod.rs index cb15d49105..becab5a03c 100644 --- a/cli/tools/lint/mod.rs +++ b/cli/tools/lint/mod.rs @@ -118,8 +118,6 @@ pub async fn lint( deno_lint_config.clone(), paths_with_options.dir, paths_with_options.paths, - // TODO(bartlomieju): clean this up - lint_flags.maybe_plugins.clone(), ) .await?; } @@ -178,8 +176,6 @@ async fn lint_with_watch_inner( lint_config.clone(), paths_with_options.dir, paths_with_options.paths, - // TODO(bartlomieju): clean this up - lint_flags.maybe_plugins.clone(), ) .await?; } @@ -285,7 +281,6 @@ impl WorkspaceLinter { lint_config: DenoLintConfig, member_dir: WorkspaceDirectory, paths: Vec, - maybe_plugins: Option>, ) -> Result<(), AnyError> { self.file_count += paths.len(); @@ -302,9 +297,7 @@ impl WorkspaceLinter { )) }); - let maybe_plugins = if maybe_plugins.is_some() { - maybe_plugins - } else if lint_options.plugins.is_empty() { + let maybe_plugins = if lint_options.plugins.is_empty() { None } else { Some(lint_options.plugins.clone()) diff --git a/fo.json b/fo.json deleted file mode 100644 index 1f84fdcfa1..0000000000 --- a/fo.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "lint": { - "plugins2": ["npm:foo"], - "rules": { - "exclude": [ - "ban-ts-comment", - "prefix/whatever" - ] - }, - "plugins": { - "foo/bar": { - "url": "./foo.js", - "rules": { - "exclude": {} - } - }, - "specifier": "npm:foo/url", - "rules": { - "exclude": "" - } - } - } -} diff --git a/lint.md b/lint.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test_lint_plugins/deno.json b/test_lint_plugins/deno.json new file mode 100644 index 0000000000..cceefcd94d --- /dev/null +++ b/test_lint_plugins/deno.json @@ -0,0 +1,11 @@ +{ + "lint": { + "plugins": ["./plugin.ts"], + "rules": { + "exclude": [ + "ban-ts-comment", + "prefix/whatever" + ] + } + } +} diff --git a/foo.js b/test_lint_plugins/foo.js similarity index 100% rename from foo.js rename to test_lint_plugins/foo.js diff --git a/foo.tsx b/test_lint_plugins/foo.tsx similarity index 100% rename from foo.tsx rename to test_lint_plugins/foo.tsx diff --git a/plugin.ts b/test_lint_plugins/plugin.ts similarity index 100% rename from plugin.ts rename to test_lint_plugins/plugin.ts