pub trait Plugin: Send + Sync {
// Required method
fn name(&self) -> &'static str;
// Provided methods
fn enablers(&self) -> &'static [&'static str] { ... }
fn is_enabled(&self, pkg: &PackageJson, _root: &Path) -> bool { ... }
fn entry_patterns(&self) -> &'static [&'static str] { ... }
fn config_patterns(&self) -> &'static [&'static str] { ... }
fn always_used(&self) -> &'static [&'static str] { ... }
fn used_exports(&self) -> Vec<(&'static str, &'static [&'static str])> { ... }
fn tooling_dependencies(&self) -> &'static [&'static str] { ... }
fn resolve_config(
&self,
_config_path: &Path,
_source: &str,
_root: &Path,
) -> PluginResult { ... }
}Expand description
A framework/tool plugin that contributes to dead code analysis.
Required Methods§
Provided Methods§
Sourcefn enablers(&self) -> &'static [&'static str]
fn enablers(&self) -> &'static [&'static str]
Package names that activate this plugin when found in package.json.
Supports exact matches and prefix patterns (ending with /).
Sourcefn is_enabled(&self, pkg: &PackageJson, _root: &Path) -> bool
fn is_enabled(&self, pkg: &PackageJson, _root: &Path) -> bool
Check if this plugin should be active for the given project.
Default implementation checks enablers() against package.json dependencies.
Sourcefn entry_patterns(&self) -> &'static [&'static str]
fn entry_patterns(&self) -> &'static [&'static str]
Default glob patterns for entry point files.
Sourcefn config_patterns(&self) -> &'static [&'static str]
fn config_patterns(&self) -> &'static [&'static str]
Glob patterns for config files this plugin can parse.
Sourcefn always_used(&self) -> &'static [&'static str]
fn always_used(&self) -> &'static [&'static str]
Files that are always considered “used” when this plugin is active.
Sourcefn used_exports(&self) -> Vec<(&'static str, &'static [&'static str])>
fn used_exports(&self) -> Vec<(&'static str, &'static [&'static str])>
Exports that are always considered used for matching file patterns.
Sourcefn tooling_dependencies(&self) -> &'static [&'static str]
fn tooling_dependencies(&self) -> &'static [&'static str]
Dependencies that are tooling (used via CLI/config, not source imports). These should not be flagged as unused devDependencies.
Sourcefn resolve_config(
&self,
_config_path: &Path,
_source: &str,
_root: &Path,
) -> PluginResult
fn resolve_config( &self, _config_path: &Path, _source: &str, _root: &Path, ) -> PluginResult
Parse a config file’s AST to discover additional entries, dependencies, etc.
Called for each config file matching config_patterns(). The source code
and parsed AST are provided — use config_parser utilities to extract values.