Skip to content

Commit

Permalink
refactor: change rule state name
Browse files Browse the repository at this point in the history
  • Loading branch information
neoki07 committed Apr 20, 2024
1 parent f8af9e9 commit ba1aef2
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions crates/biome_css_analyze/src/lint/nursery/no_unknown_unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ declare_rule! {
}
}

pub struct RuleState {
value: String,
pub struct NoUnknownUnitState {
unit: String,
span: TextRange,
}

impl Rule for NoUnknownUnit {
type Query = Ast<AnyCssDimension>;
type State = RuleState;
type State = NoUnknownUnitState;
type Signals = Option<Self::State>;
type Options = ();

Expand All @@ -93,8 +93,8 @@ impl Rule for NoUnknownUnit {
return None;
}

Some(RuleState {
value: unit,
Some(NoUnknownUnitState {
unit,
span: unit_token.text_trimmed_range(),
})
}
Expand Down Expand Up @@ -158,8 +158,8 @@ impl Rule for NoUnknownUnit {
}

if !allow_x {
return Some(RuleState {
value: unit,
return Some(NoUnknownUnitState {
unit,
span: unit_token.text_trimmed_range(),
});
}
Expand All @@ -172,13 +172,12 @@ impl Rule for NoUnknownUnit {
}

fn diagnostic(_: &RuleContext<Self>, state: &Self::State) -> Option<RuleDiagnostic> {
let span = state.span;
Some(
RuleDiagnostic::new(
rule_category!(),
span,
state.span,
markup! {
"Unexpected unknown unit: "<Emphasis>{ state.value }</Emphasis>
"Unexpected unknown unit: "<Emphasis>{ state.unit }</Emphasis>
},
)
.note(markup! {
Expand Down

0 comments on commit ba1aef2

Please sign in to comment.