Skip to content

Commit 9079f50

Browse files
committed
Merge remote-tracking branch 'upstream/main' into root-dirs-sloppy-imports
2 parents c78d87f + f08ca64 commit 9079f50

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3545
-1813
lines changed

Cargo.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ deno_doc = { version = "=0.164.0", features = ["rust", "comrak"] }
7474
deno_error.workspace = true
7575
deno_graph = { version = "=0.87.2" }
7676
deno_lib.workspace = true
77-
deno_lint = { version = "0.70.0" }
77+
deno_lint = { version = "0.71.0" }
7878
deno_lockfile.workspace = true
7979
deno_media_type = { workspace = true, features = ["data_url", "decoding", "module_specifier"] }
8080
deno_npm.workspace = true

cli/args/flags.rs

+1
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ impl DenoSubcommand {
499499
| Self::Jupyter(_)
500500
| Self::Repl(_)
501501
| Self::Bench(_)
502+
| Self::Lint(_)
502503
| Self::Lsp
503504
)
504505
}

cli/args/mod.rs

+32-10
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ pub struct LintOptions {
366366
pub rules: LintRulesConfig,
367367
pub files: FilePatterns,
368368
pub fix: bool,
369+
pub plugins: Vec<Url>,
369370
}
370371

371372
impl Default for LintOptions {
@@ -380,20 +381,41 @@ impl LintOptions {
380381
rules: Default::default(),
381382
files: FilePatterns::new_with_base(base),
382383
fix: false,
384+
plugins: vec![],
383385
}
384386
}
385387

386-
pub fn resolve(lint_config: LintConfig, lint_flags: &LintFlags) -> Self {
387-
Self {
388+
pub fn resolve(
389+
dir_path: PathBuf,
390+
lint_config: LintConfig,
391+
lint_flags: &LintFlags,
392+
) -> Result<Self, AnyError> {
393+
let rules = resolve_lint_rules_options(
394+
lint_config.options.rules,
395+
lint_flags.maybe_rules_tags.clone(),
396+
lint_flags.maybe_rules_include.clone(),
397+
lint_flags.maybe_rules_exclude.clone(),
398+
);
399+
400+
let plugins = {
401+
let plugin_specifiers = lint_config.options.plugins;
402+
let mut plugins = Vec::with_capacity(plugin_specifiers.len());
403+
for plugin in &plugin_specifiers {
404+
// TODO(bartlomieju): handle import-mapped specifiers
405+
let url = resolve_url_or_path(plugin, &dir_path)?;
406+
plugins.push(url);
407+
}
408+
// ensure stability for hasher
409+
plugins.sort_unstable();
410+
plugins
411+
};
412+
413+
Ok(Self {
388414
files: lint_config.files,
389-
rules: resolve_lint_rules_options(
390-
lint_config.options.rules,
391-
lint_flags.maybe_rules_tags.clone(),
392-
lint_flags.maybe_rules_include.clone(),
393-
lint_flags.maybe_rules_exclude.clone(),
394-
),
415+
rules,
395416
fix: lint_flags.fix,
396-
}
417+
plugins,
418+
})
397419
}
398420
}
399421

@@ -759,7 +781,7 @@ impl CliOptions {
759781
.resolve_lint_config_for_members(&cli_arg_patterns)?;
760782
let mut result = Vec::with_capacity(member_configs.len());
761783
for (ctx, config) in member_configs {
762-
let options = LintOptions::resolve(config, lint_flags);
784+
let options = LintOptions::resolve(ctx.dir_path(), config, lint_flags)?;
763785
result.push((ctx, options));
764786
}
765787
Ok(result)

0 commit comments

Comments
 (0)