Skip to content

Commit c1495aa

Browse files
committed
docs(linter): note which rules require type info to run on rule page
1 parent e29e6c0 commit c1495aa

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

crates/oxc_linter/src/table.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub struct RuleTableRow {
2828

2929
pub turned_on_by_default: bool,
3030
pub autofix: RuleFixMeta,
31+
pub is_tsgolint_rule: bool,
3132
}
3233

3334
impl Default for RuleTable {
@@ -65,6 +66,7 @@ impl RuleTable {
6566
category: rule.category(),
6667
turned_on_by_default: default_rules.contains(name),
6768
autofix: rule.fix(),
69+
is_tsgolint_rule: rule.is_tsgolint_rule(),
6870
}
6971
})
7072
.collect::<Vec<_>>();

tasks/website/src/linter/rules/doc_page.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ impl Context {
3939
turned_on_by_default,
4040
autofix,
4141
category,
42+
is_tsgolint_rule,
4243
} = rule;
4344
let resolved =
4445
schema.as_ref().map(|schema| self.schemas.dereference(schema).unwrap_or(schema));
@@ -71,6 +72,13 @@ const source = `{}`;
7172
p.writeln(r#"<span class="emoji">✅</span> This rule is turned on by default."#)
7273
})?;
7374
}
75+
if *is_tsgolint_rule {
76+
p.Alert(r#"type="info""#, |p| {
77+
p.writeln(
78+
r#"<span class="emoji">💭</span> This rule requires <a href="https://oxc.rs/docs/guide/usage/linter/type-aware.html" target="_blank" rel="noreferrer">type information</a>."#
79+
)
80+
})?;
81+
}
7482

7583
if let Some(emoji) = autofix.emoji() {
7684
p.Alert(r#"class="fix" type="info""#, |p| {

0 commit comments

Comments
 (0)