diff --git a/crates/oxc_linter/src/rule.rs b/crates/oxc_linter/src/rule.rs index 8ffbbfa87..9cdd72823 100644 --- a/crates/oxc_linter/src/rule.rs +++ b/crates/oxc_linter/src/rule.rs @@ -5,7 +5,8 @@ use crate::{context::LintContext, AstNode}; pub trait Rule: Sized + Default + Debug { const NAME: &'static str; - fn from_json(_value: serde_json::Value) -> Self { + /// Initialize from eslint json configuration + fn from_configuration(_value: serde_json::Value) -> Self { Self::default() } diff --git a/crates/oxc_linter/src/rules.rs b/crates/oxc_linter/src/rules.rs index 9f8707127..af45a38c6 100644 --- a/crates/oxc_linter/src/rules.rs +++ b/crates/oxc_linter/src/rules.rs @@ -29,11 +29,11 @@ impl RuleEnum { pub fn read_json(&self, maybe_value: Option) -> Self { match self { - Self::NoDebugger(_) => { - Self::NoDebugger(maybe_value.map(NoDebugger::from_json).unwrap_or_default()) - } + Self::NoDebugger(_) => Self::NoDebugger( + maybe_value.map(NoDebugger::from_configuration).unwrap_or_default(), + ), Self::NoEmpty(_) => { - Self::NoEmpty(maybe_value.map(NoEmpty::from_json).unwrap_or_default()) + Self::NoEmpty(maybe_value.map(NoEmpty::from_configuration).unwrap_or_default()) } } } diff --git a/crates/oxc_linter/src/rules/no_empty.rs b/crates/oxc_linter/src/rules/no_empty.rs index ffcea0c7d..86e9cbdd7 100644 --- a/crates/oxc_linter/src/rules/no_empty.rs +++ b/crates/oxc_linter/src/rules/no_empty.rs @@ -21,7 +21,7 @@ const RULE_NAME: &str = "no-empty"; impl Rule for NoEmpty { const NAME: &'static str = RULE_NAME; - fn from_json(value: serde_json::Value) -> Self { + fn from_configuration(value: serde_json::Value) -> Self { let obj = value.get(0); Self { allow_empty_catch: obj