pub struct IgnoreDependencyMatcher { /* private fields */ }Expand description
Compiled ignoreDependencies entries.
Entries without glob metacharacters match a package name exactly. Entries
with glob metacharacters (@acme/*, @types/*) use the same glob syntax as
ignorePatterns, matched against the package name.
Implementations§
Source§impl IgnoreDependencyMatcher
impl IgnoreDependencyMatcher
Sourcepub fn compile(entries: &[String]) -> Self
pub fn compile(entries: &[String]) -> Self
Compile the configured ignoreDependencies entries.
§Panics
Panics when a glob entry is invalid. Config loading validates every glob entry before resolution, so this does not happen for a loaded config.
Sourcepub fn is_ignored(&self, package_name: &str) -> bool
pub fn is_ignored(&self, package_name: &str) -> bool
Whether package_name is excluded by an exact entry or a glob entry.
Sourcepub fn note_declared(&self, package_name: &str)
pub fn note_declared(&self, package_name: &str)
Record a name declared in a package.json dependency section. Only
this check makes Self::unmatched_globs and
Self::redundant_entries report anything.
Sourcepub fn suppresses(&self, package_name: &str) -> bool
pub fn suppresses(&self, package_name: &str) -> bool
Whether an entry hides the finding that a detector found for
package_name. Call it only for a name that the detector reports when
no entry matches it: every matching entry is then recorded as one that
had an effect.
Sourcepub fn reset_usage(&self)
pub fn reset_usage(&self)
Forget the hits of an earlier analysis pass.
A long-lived process (watch mode, the LSP, an engine session) keeps one resolved config for many passes. Each dead-code pass calls this first, so a glob that matched in an earlier pass is reported again when its dependency is gone.
Sourcepub fn unmatched_globs(&self) -> Vec<&str>
pub fn unmatched_globs(&self) -> Vec<&str>
Glob entries that matched no dependency this run, in config order.
Empty when no glob was configured or when no declared dependency was checked, because such a run says nothing about a typo.
Sourcepub fn redundant_entries(&self) -> Vec<&str>
pub fn redundant_entries(&self) -> Vec<&str>
Entries that hid no dependency finding this run, in config order.
A glob that matched no package name is left out, because
Self::unmatched_globs reports it. Empty when no declared
dependency was checked.