Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
t-shiratori committed May 5, 2024
1 parent b3cfcf4 commit f536251
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ declare_rule! {
}
}

pub struct RuleState {
span: TextRange,
}

impl Rule for NoInvalidPositionAtImportRule {
type Query = Ast<CssRuleList>;
type State = RuleState;
type State = TextRange;
type Signals = Option<Self::State>;
type Options = ();

Expand All @@ -64,9 +60,7 @@ impl Rule for NoInvalidPositionAtImportRule {
let import_rule = any_css_at_rule.as_css_import_at_rule();
if let Some(import_rule) = import_rule {
if is_invalid_position {
return Some(RuleState {
span: import_rule.range(),
});
return Some(import_rule.range());
}
} else {
is_invalid_position = true;
Expand All @@ -80,11 +74,10 @@ impl Rule for NoInvalidPositionAtImportRule {
}

fn diagnostic(_: &RuleContext<Self>, state: &Self::State) -> Option<RuleDiagnostic> {
let span = state.span;
Some(
RuleDiagnostic::new(
rule_category!(),
span,
state,
markup! {
"This "<Emphasis>"@import"</Emphasis>" is in the wrong position."
},
Expand Down

0 comments on commit f536251

Please sign in to comment.