Skip to content

feat(html/a11y): add noRedundantRoles rule for HTML#9276

Merged
dyc3 merged 9 commits intobiomejs:nextfrom
IxxyDev:feat/html-no-redundant-roles
Mar 22, 2026
Merged

feat(html/a11y): add noRedundantRoles rule for HTML#9276
dyc3 merged 9 commits intobiomejs:nextfrom
IxxyDev:feat/html-no-redundant-roles

Conversation

@IxxyDev
Copy link

@IxxyDev IxxyDev commented Feb 28, 2026

Summary

Added HTML support for the noRedundantRoles lint rule.

  • Implemented biome_aria::Element and biome_aria::Attribute traits for HTML elements, enabling ARIA role detection.
  • Biome now detects redundant explicit role attributes on HTML elements (e.g., <button role="button">) and provides an unsafe fix to remove them.
  • Added component-aware logic for Vue/Svelte/Astro files: PascalCase element names (e.g., <Button>) are treated as custom components and skipped, while lowercase native elements are still checked.

Test Plan

  • cargo test -p biome_html_analyze -- no_redundant_roles — 9 tests pass (HTML invalid, HTML valid, HTML-AAM generic role, plus Vue/Svelte/Astro valid and invalid)
  • Vue/Svelte/Astro valid tests confirm <Button role="button"> (component) is NOT flagged
  • Vue/Svelte/Astro invalid tests confirm <button role="button"> (native) IS still flagged
  • Existing HTML tests pass unchanged

Docs

Documentation is inline in the rule's rustdoc — added a :::note block explaining that PascalCase names are treated as custom components in framework files and are ignored by this rule.

@changeset-bot
Copy link

changeset-bot bot commented Feb 28, 2026

🦋 Changeset detected

Latest commit: 89399c0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@biomejs/biome Minor
@biomejs/cli-win32-x64 Minor
@biomejs/cli-win32-arm64 Minor
@biomejs/cli-darwin-x64 Minor
@biomejs/cli-darwin-arm64 Minor
@biomejs/cli-linux-x64 Minor
@biomejs/cli-linux-arm64 Minor
@biomejs/cli-linux-x64-musl Minor
@biomejs/cli-linux-arm64-musl Minor
@biomejs/wasm-web Minor
@biomejs/wasm-bundler Minor
@biomejs/wasm-nodejs Minor
@biomejs/backend-jsonrpc Patch
@biomejs/js-api Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added A-Linter Area: linter A-Parser Area: parser L-HTML Language: HTML and super languages labels Feb 28, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 28, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a new HTML accessibility lint rule NoRedundantRoles (with an unsafe autofix) and nursery CSS/HTML lint rules NoUndeclaredClasses and NoUnusedClasses. Integrates module-graph services into HTML and CSS analyzers (new HtmlModuleGraphService/CssModuleGraphService, HtmlAnalyzerServices, and related Queryable wrappers) and plumbs module_graph/project_layout through analyzer services. Implements biome_aria::Element and biome_aria::Attribute for HTML nodes, adds CSS embedding applicability for embedded HTML (Vue/ Astro/ Svelte), and introduces analyzer working-directory plumbing. Many new tests and changesets accompany the rules and infrastructure.

Possibly related PRs

Suggested reviewers

  • ematipico
  • dyc3
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(html/a11y): add noRedundantRoles rule for HTML' accurately describes the primary change—implementing a new HTML accessibility lint rule.
Description check ✅ Passed The description clearly relates to the changeset, detailing implementation of the noRedundantRoles rule, trait implementations for ARIA detection, component-aware logic, and test coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/some-trams-cut.md:
- Around line 1-3: The changeset currently marks the package update as a patch;
change the entry for "@biomejs/biome": patch to use a minor release instead
(i.e. "@biomejs/biome": minor) so the new HTML support is recorded as a
feature-level changeset; update the YAML header value accordingly in the
.changeset file.

In `@crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs`:
- Around line 89-90: Update the diagnostic message in no_redundant_roles.rs so
the user-facing sentence reads "implied by its semantics" instead of "implied by
its semantic"; locate the message string (the literal containing "Using the role
attribute '{role_attribute}' on the '{element_name}' element is redundant,
because it is implied by its semantic.") and replace "semantic" with "semantics"
in that string so the diagnostic copy is grammatically correct.
- Around line 69-71: The fixer currently reads role_attribute_value and calls
AriaRole::from_roles on the whole string but then removes the entire role
attribute if the first parsed role is redundant; instead split the
role_attribute_value by whitespace into tokens, map/parse each token via
AriaRole::from_roles (or the appropriate single-token parse), determine which
tokens are redundant for the element (reuse the existing redundancy check
logic), and then: if all tokens are redundant remove the role attribute,
otherwise reconstruct the role attribute value from only the non-redundant
tokens and update the attribute (preserving remaining fallback roles). Update
the logic around role_attribute.initializer()?value().value().string_value()?
and AriaRole::from_roles usage to operate on each token rather than assuming a
single role.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 412a08d and 183ad77.

⛔ Files ignored due to path filters (4)
  • Cargo.lock is excluded by !**/*.lock and included by **
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/invalid.html.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/invalidHtmlAamRoleGeneric.html.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/valid.html.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (8)
  • .changeset/some-trams-cut.md
  • crates/biome_html_analyze/Cargo.toml
  • crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/invalid.html
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/invalidHtmlAamRoleGeneric.html
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/valid.html
  • crates/biome_html_syntax/Cargo.toml
  • crates/biome_html_syntax/src/element_ext.rs

Comment on lines +1 to +3
---
"@biomejs/biome": patch
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use minor for this feature changeset.

Given this introduces new HTML support, patch looks under-scoped here.

Suggested fix
 ---
-"@biomejs/biome": patch
+"@biomejs/biome": minor
 ---

As per coding guidelines: “Use change types in changesets: patch for bug fixes and non-breaking changes (targets main branch), minor for new features and non-breaking additions (targets next branch), major for breaking changes (targets next branch)”.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
---
"@biomejs/biome": patch
---
---
"@biomejs/biome": minor
---
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.changeset/some-trams-cut.md around lines 1 - 3, The changeset currently
marks the package update as a patch; change the entry for "@biomejs/biome":
patch to use a minor release instead (i.e. "@biomejs/biome": minor) so the new
HTML support is recorded as a feature-level changeset; update the YAML header
value accordingly in the .changeset file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines +69 to +71
let role_attribute_value = role_attribute.initializer()?.value().ok()?.string_value()?;
let explicit_role = AriaRole::from_roles(role_attribute_value.trim())?;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Locate AriaRole::from_roles implementation =="
rg -nP 'fn\s+from_roles\s*\(' --type rust -C3

echo
echo "== Inspect no_redundant_roles usage of parsed role + fixer =="
rg -nP 'from_roles|get_implicit_role|remove_node' crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs -C4

echo
echo "== Check fixture coverage for multi-token or case-variant role values =="
rg -nP 'role="[^"]+\s+[^"]+"|role="[A-Z][^"]*"' crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles -C2

Repository: biomejs/biome

Length of output: 1834


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== List fixture files for noRedundantRoles =="
find crates/biome_html_analyze/tests/specs/a11y -name "*noRedundantRoles*" -type f | head -20

echo
echo "== Search fixture content broadly for role attributes =="
find crates/biome_html_analyze/tests/specs/a11y -name "*oRedundantRoles*" -type f -exec cat {} \; | grep -i 'role=' | head -20

echo
echo "== Check AriaRole documentation and parse method =="
rg -nP 'pub fn from_roles|pub fn parse|impl.*Parse' crates/biome_aria_metadata/src/lib.rs -C6

Repository: biomejs/biome

Length of output: 160


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Find test files broadly =="
find crates/biome_html_analyze/tests -type f -name "*.html" -o -name "*.json" | grep -i "redundant\|role" | head -20

echo
echo "== Check the full no_redundant_roles.rs file structure =="
wc -l crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs
head -n 120 crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs

echo
echo "== Check AriaRole full implementation =="
wc -l crates/biome_aria_metadata/src/lib.rs
rg -nP 'pub fn from_roles|pub fn|impl.*FromStr' crates/biome_aria_metadata/src/lib.rs -A5 -B2 | head -80

Repository: biomejs/biome

Length of output: 7446


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Check noRedundantRoles fixtures content =="
cat crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/invalid.html
echo ""
echo "---"
echo ""
cat crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/valid.html

echo ""
echo "== Search all fixture files for space-separated role values =="
rg 'role="[^"]*\s+[^"]*"' crates/biome_html_analyze/tests/specs/a11y/ -t html

Repository: biomejs/biome

Length of output: 1718


Verify multi-token role handling before shipping.

The fixer removes the entire role attribute (line 96) but only checks the first parsed role (line 70). If a multi-token role like role="button presentation" appears on a <button>, the code detects button as redundant and discards the entire attribute—losing the presentation fallback. The ARIA spec allows space-separated fallback roles, yet test fixtures for noRedundantRoles don't cover this case (though useValidAriaRole fixtures show multi-token roles are used elsewhere in the codebase).

Consider handling token lists properly: either parse all tokens and verify none are redundant, or preserve non-redundant fallback roles.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs` around lines
69 - 71, The fixer currently reads role_attribute_value and calls
AriaRole::from_roles on the whole string but then removes the entire role
attribute if the first parsed role is redundant; instead split the
role_attribute_value by whitespace into tokens, map/parse each token via
AriaRole::from_roles (or the appropriate single-token parse), determine which
tokens are redundant for the element (reuse the existing redundancy check
logic), and then: if all tokens are redundant remove the role attribute,
otherwise reconstruct the role attribute value from only the non-redundant
tokens and update the attribute (preserving remaining fallback roles). Update
the logic around role_attribute.initializer()?value().value().string_value()?
and AriaRole::from_roles usage to operate on each token rather than assuming a
single role.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's default behaviour

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IxxyDev

I think what the bot is trying to tell is to handle multiple roles.

In fact, your tests focus solely on one role. What about

<button role="presentation button"></button>

I think we should add more tests and maybe fix that if there's some mistakes

Copy link
Author

@IxxyDev IxxyDev Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ematipico
added couple of relevant cases

dyc3
dyc3 previously requested changes Feb 28, 2026
Copy link
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • This needs to be based on next
  • needs to have a minor changeset

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 28, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 156 skipped benchmarks1


Comparing IxxyDev:feat/html-no-redundant-roles (89399c0) with next (8574432)

Open in CodSpeed

Footnotes

  1. 156 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@ematipico
Copy link
Member

...and it needs to restore the original PR template

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lint rule needs more work and harness:

  • it doesn't check for HTML elements VS components
  • there aren't tests for Vue/svelte/astro
  • components will hit this rule, which is a bug

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/html-no-redundant-roles.md:
- Line 2: Update the changeset entry that currently reads `"@biomejs/biome":
minor` to use `patch` instead of `minor` because this PR targets main; edit the
string in .changeset/html-no-redundant-roles.md so it becomes `"@biomejs/biome":
patch`, save the file and commit the change.

In `@crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs`:
- Around line 75-85: The logic in the lint (inside no_redundant_roles.rs where
ctx.source_type::<HtmlFileSource>() is checked) only skips PascalCase component
names; update the early-return condition to also skip kebab-case/custom-element
names by checking the element name text (from node.name() and
element_name.text()) for a hyphen (e.g., name_text.contains('-')) and return
None when present; keep the existing uppercase check and short-circuit so
framework files ignore both PascalCase and hyphenated custom component tags.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 183ad77 and ef3e74d.

📒 Files selected for processing (2)
  • .changeset/html-no-redundant-roles.md
  • crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs

@IxxyDev IxxyDev requested review from dyc3 and ematipico March 4, 2026 16:19
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs (1)

93-95: ⚠️ Potential issue | 🟠 Major

Prevent destructive auto-fix for multi-token role values.

At Line 93 the rule parses via AriaRole::from_roles(...), while at Line 119 the fixer always removes the entire role attribute. For token lists (for example fallback roles), this can drop non-redundant tokens.

Please either preserve remaining tokens when fixing, or skip the fix when multiple tokens are present.

💡 Minimal safe patch (avoid data loss until token-preserving rewrite is added)
 fn action(ctx: &RuleContext<Self>, state: &Self::State) -> Option<HtmlRuleAction> {
+    let role_value = state.role_attribute_value.to_string();
+    if role_value.split_ascii_whitespace().nth(1).is_some() {
+        // Multi-token role values may contain fallback roles; avoid destructive removal.
+        return None;
+    }
+
     let mut mutation = ctx.root().begin();
     mutation.remove_node(state.redundant_attribute.clone());
     Some(HtmlRuleAction::new(
#!/bin/bash
set -euo pipefail

# Verify how role parsing is done and where fixer removes the full attribute
rg -nP --type=rust '\bpub\s+fn\s+from_roles\s*\(' crates/biome_aria_metadata/src/lib.rs -C4
rg -nP --type=rust '\bfrom_roles\s*\(' crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs -C3
rg -nP --type=rust 'remove_node\s*\(' crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs -C3

# Check whether noRedundantRoles fixtures already cover multi-token role values
rg -nP 'role="[^"]+\s+[^"]+"' crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles -g '*.html' -g '*.vue' -g '*.svelte' -g '*.astro'

Also applies to: 117-120

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs` around lines
93 - 95, The fixer currently parses role values with AriaRole::from_roles(...)
and compares with AriaRoles.get_implicit_role(node) but then unconditionally
removes the entire role attribute (via remove_node or the fixer code), which
destroys multi-token role lists; change the fixer to first split the role
attribute value on whitespace and if it contains more than one token, do not
apply the automatic fix (i.e., skip calling remove_node or skip creating a fix)
— preserve current behavior for single-token values only; alternatively, if you
prefer to preserve tokens now, implement token-aware removal by rebuilding the
role attribute without the redundant token(s) and update the attribute node
instead of calling remove_node (use the same parsing via AriaRole::from_roles
and operate on the role attribute string).
🧹 Nitpick comments (1)
crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs (1)

62-65: Move RuleState below impl Rule to match the project’s rule-file layout.

Small maintainability tidy-up: keep helper structs/enums/functions after the impl Rule block in these lint files.

Based on learnings: in crates/biome_analyze/**/*.rs rule files, helper functions/structs/enums should be placed below the impl Rule block (except node unions used by Query).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs` around lines
62 - 65, The struct RuleState is currently declared before the impl Rule block;
move the RuleState declaration so it appears after the impl Rule implementation
to follow the project's rule-file layout convention (place helper
structs/enums/functions after impl Rule). Locate the RuleState type (fields
redundant_attribute: HtmlAttribute and role_attribute_value: Text) and relocate
its entire declaration to immediately after the impl Rule block while keeping
any references/usages unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs`:
- Around line 93-95: The fixer currently parses role values with
AriaRole::from_roles(...) and compares with AriaRoles.get_implicit_role(node)
but then unconditionally removes the entire role attribute (via remove_node or
the fixer code), which destroys multi-token role lists; change the fixer to
first split the role attribute value on whitespace and if it contains more than
one token, do not apply the automatic fix (i.e., skip calling remove_node or
skip creating a fix) — preserve current behavior for single-token values only;
alternatively, if you prefer to preserve tokens now, implement token-aware
removal by rebuilding the role attribute without the redundant token(s) and
update the attribute node instead of calling remove_node (use the same parsing
via AriaRole::from_roles and operate on the role attribute string).

---

Nitpick comments:
In `@crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs`:
- Around line 62-65: The struct RuleState is currently declared before the impl
Rule block; move the RuleState declaration so it appears after the impl Rule
implementation to follow the project's rule-file layout convention (place helper
structs/enums/functions after impl Rule). Locate the RuleState type (fields
redundant_attribute: HtmlAttribute and role_attribute_value: Text) and relocate
its entire declaration to immediately after the impl Rule block while keeping
any references/usages unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fff5454b-18f8-446c-b1ed-499c10a24560

📥 Commits

Reviewing files that changed from the base of the PR and between ef3e74d and 0ff3efe.

⛔ Files ignored due to path filters (8)
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/astro/invalid.astro.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/astro/valid.astro.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/invalid.html.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/invalidHtmlAamRoleGeneric.html.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/svelte/invalid.svelte.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/svelte/valid.svelte.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/vue/invalid.vue.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/vue/valid.vue.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (7)
  • crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/astro/invalid.astro
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/astro/valid.astro
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/svelte/invalid.svelte
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/svelte/valid.svelte
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/vue/invalid.vue
  • crates/biome_html_analyze/tests/specs/a11y/noRedundantRoles/vue/valid.vue

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs (1)

62-65: Keep RuleState internal and place it below impl Rule.

This state type is internal to this rule; dropping pub and moving it below the impl Rule block keeps the module surface cleaner and matches local rule-file conventions.

Suggested tidy-up
-pub struct RuleState {
+struct RuleState {
     redundant_attribute: HtmlAttribute,
     role_attribute_value: Text,
 }
// Move `RuleState` below the `impl Rule for NoRedundantRoles` block.
Based on learnings: In `crates/biome_analyze/**/*.rs` rule files, all helper functions, structs, and enums must be placed below the `impl Rule` block.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs` around lines
62 - 65, Drop the public visibility from the RuleState struct (change `pub
struct RuleState` to `struct RuleState`) and move its declaration so it appears
below the `impl Rule for NoRedundantRoles` block; this keeps RuleState internal
to the rule and follows the project convention of placing helper types after the
`impl Rule` implementation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs`:
- Around line 62-65: Drop the public visibility from the RuleState struct
(change `pub struct RuleState` to `struct RuleState`) and move its declaration
so it appears below the `impl Rule for NoRedundantRoles` block; this keeps
RuleState internal to the rule and follows the project convention of placing
helper types after the `impl Rule` implementation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 78b40007-d669-4a80-881c-d9b2944e00c9

📥 Commits

Reviewing files that changed from the base of the PR and between 0ff3efe and 6e002a5.

📒 Files selected for processing (1)
  • crates/biome_html_analyze/src/lint/a11y/no_redundant_roles.rs

@dyc3
Copy link
Contributor

dyc3 commented Mar 4, 2026

This still needs to be rebased on next

@IxxyDev IxxyDev force-pushed the feat/html-no-redundant-roles branch from 6e002a5 to dc35c27 Compare March 5, 2026 15:27
@github-actions github-actions bot added A-CLI Area: CLI A-Project Area: project A-Tooling Area: internal tools labels Mar 5, 2026
@IxxyDev IxxyDev changed the base branch from main to next March 5, 2026 15:28
@github-actions github-actions bot added L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS and super languages L-JSON Language: JSON and super languages A-Diagnostic Area: diagnostocis A-Resolver Area: resolver labels Mar 5, 2026
@IxxyDev
Copy link
Author

IxxyDev commented Mar 5, 2026

This still needs to be rebased on next

done

@github-actions github-actions bot removed A-Project Area: project A-Tooling Area: internal tools L-CSS Language: CSS and super languages labels Mar 6, 2026
@github-actions github-actions bot removed A-Diagnostic Area: diagnostocis A-Resolver Area: resolver labels Mar 6, 2026
@IxxyDev IxxyDev force-pushed the feat/html-no-redundant-roles branch from 4c7d959 to c118d4b Compare March 8, 2026 20:33
@IxxyDev IxxyDev force-pushed the feat/html-no-redundant-roles branch from e64feec to d52543f Compare March 10, 2026 11:10
@ematipico ematipico dismissed dyc3’s stale review March 11, 2026 08:47

Comments addressed

@ematipico
Copy link
Member

@IxxyDev can you resolve the conflicts?

@IxxyDev
Copy link
Author

IxxyDev commented Mar 11, 2026

@IxxyDev can you resolve the conflicts?

done

@dyc3 dyc3 self-assigned this Mar 22, 2026
@dyc3 dyc3 merged commit 6d041d9 into biomejs:next Mar 22, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Linter Area: linter A-Parser Area: parser L-HTML Language: HTML and super languages L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants