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 is_declared_ignored(&self, package_name: &str) -> bool
pub fn is_declared_ignored(&self, package_name: &str) -> bool
Like Self::is_ignored for a name declared in a package.json
dependency section. Only this check makes
Self::unmatched_globs report anything.
Sourcepub fn reset_usage(&self)
pub fn reset_usage(&self)
Forget the glob 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.