Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crates/oxc_linter/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub struct RuleTable {
pub sections: Vec<RuleTableSection>,
pub total: usize,
pub turned_on_by_default_count: usize,
pub rules_with_fixes: usize,
}

pub struct RuleTableSection {
Expand Down Expand Up @@ -75,6 +76,8 @@ impl RuleTable {

rows.sort_by_key(|row| (row.plugin.clone(), row.name));

let rules_with_fixes = rows.iter().filter(|r| r.autofix.has_fix()).count();

let mut rows_by_category = rows.into_iter().fold(
FxHashMap::default(),
|mut map: FxHashMap<RuleCategory, Vec<RuleTableRow>>, row| {
Expand All @@ -101,7 +104,12 @@ impl RuleTable {
})
.collect::<Vec<_>>();

RuleTable { total, sections, turned_on_by_default_count: default_rules.len() }
RuleTable {
total,
sections,
turned_on_by_default_count: default_rules.len(),
rules_with_fixes,
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion tasks/website_linter/src/rules/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use oxc_linter::table::RuleTable;
pub fn render_rules_table(table: &RuleTable, docs_prefix: &str) -> String {
let total = table.total;
let turned_on_by_default_count = table.turned_on_by_default_count;

let rules_with_fixes = table.rules_with_fixes;
let body = table
.sections
.iter()
Expand All @@ -28,6 +28,7 @@ The progress of all rule implementations is tracked [here](https://github.com/ox

- Total number of rules: {total}
- Rules turned on by default: {turned_on_by_default_count}
- Rules with fixes available: {rules_with_fixes}

**Legend for 'Fixable?' column:**
- 🛠️: an auto-fix is available for this rule
Expand Down
Loading