Skip to content

Commit 8c02ebd

Browse files
committed
refactor(linter/js-plugins): rename specifiers to paths (#12241)
Follow-on after #12160. Pure refactor. Use vars called `paths` when they're the full path of plugins. `specifiers` is what we're calling the things which appear in plugins array in config, which can be either bare specifiers or relative paths (`my-plugin` or `../plugins/my-plugin.js`).
1 parent c551b8f commit 8c02ebd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

crates/oxc_linter/src/external_plugin_store.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,29 @@ impl ExternalRuleId {
4646

4747
#[derive(Debug, Default)]
4848
pub struct ExternalPluginStore {
49-
registered_plugin_specifiers: FxHashSet<String>,
49+
registered_plugin_paths: FxHashSet<String>,
5050

5151
plugins: IndexVec<ExternalPluginId, ExternalPlugin>,
5252
plugin_names: FxHashMap<String, ExternalPluginId>,
5353
rules: IndexVec<ExternalRuleId, ExternalRule>,
5454
}
5555

5656
impl ExternalPluginStore {
57-
pub fn is_plugin_registered(&self, plugin_specifier: &str) -> bool {
58-
self.registered_plugin_specifiers.contains(plugin_specifier)
57+
pub fn is_plugin_registered(&self, plugin_path: &str) -> bool {
58+
self.registered_plugin_paths.contains(plugin_path)
5959
}
6060

6161
/// # Panics
6262
/// Panics if you use it wrong
6363
pub fn register_plugin(
6464
&mut self,
65-
plugin_specifier: String,
65+
plugin_path: String,
6666
plugin_name: String,
6767
offset: usize,
6868
rules: Vec<String>,
6969
) {
70-
let registered_plugin_specifier_newly_inserted =
71-
self.registered_plugin_specifiers.insert(plugin_specifier);
72-
assert!(registered_plugin_specifier_newly_inserted);
70+
let newly_inserted = self.registered_plugin_paths.insert(plugin_path);
71+
assert!(newly_inserted);
7372

7473
let plugin_id: ExternalPluginId = self
7574
.plugins

0 commit comments

Comments
 (0)