mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(linter): s/from_json/from_configuration
This commit is contained in:
parent
8b9ebcd6e5
commit
9d4367c2cd
3 changed files with 7 additions and 6 deletions
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ impl RuleEnum {
|
|||
|
||||
pub fn read_json(&self, maybe_value: Option<serde_json::Value>) -> 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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue