mirror of
https://github.com/denoland/deno.git
synced 2025-02-01 12:16:11 -05:00
remove --plugins flag support for now
This commit is contained in:
parent
06ddb574f3
commit
a446c89620
9 changed files with 13 additions and 94 deletions
|
@ -298,7 +298,6 @@ pub struct LintFlags {
|
|||
pub json: bool,
|
||||
pub compact: bool,
|
||||
pub watch: Option<WatchFlags>,
|
||||
pub maybe_plugins: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
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::<String>("rules-exclude")
|
||||
.map(|f| f.collect());
|
||||
|
||||
let maybe_plugins = matches
|
||||
.remove_many::<String>("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]
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<PathBuf>,
|
||||
maybe_plugins: Option<Vec<String>>,
|
||||
) -> 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())
|
||||
|
|
23
fo.json
23
fo.json
|
@ -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": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
0
lint.md
0
lint.md
11
test_lint_plugins/deno.json
Normal file
11
test_lint_plugins/deno.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"lint": {
|
||||
"plugins": ["./plugin.ts"],
|
||||
"rules": {
|
||||
"exclude": [
|
||||
"ban-ts-comment",
|
||||
"prefix/whatever"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue