-
-
Notifications
You must be signed in to change notification settings - Fork 794
feat(lint): implement noAmbiguousAnchorText #8372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 49e1ca9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
CodSpeed Performance ReportMerging #8372 will not alter performanceComparing Summary
Footnotes
|
b698d8b to
a457df3
Compare
WalkthroughAdds a new nursery lint rule Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this 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
🧹 Nitpick comments (3)
crates/biome_html_syntax/src/element_ext.rs (1)
92-108: Consider extracting the duplicated attribute lookup logic.This implementation is identical to
HtmlSelfClosingElement::find_attribute_by_name(lines 74-90). You could extract a helper function or use a macro to avoid duplication.crates/biome_html_analyze/src/a11y.rs (1)
3-8: Clean up the commented‑out doc blockThe
// ///lines look like a doc comment that was commented out in a hurry. Either convert this back into a proper doc comment:/// Check the element is hidden from screen reader. /// /// Ref: /// - https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden /// - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/hidden /// - https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/v6.10.0/src/util/isHiddenFromScreenReader.jsor drop it entirely if you’d rather keep the helper undocumented. At the moment it just reads as leftover noise.
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs (1)
17-24: Consider returning a reference or cached value to avoid repeated allocations.The method clones the Vec and allocates Strings from static strs on every call. For a rule option accessor that may be called multiple times, consider caching the default or returning a reference.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (15)
crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rsis excluded by!**/migrate/eslint_any_rule_to_biome.rsand included by**crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_html_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (20)
.changeset/shy-sites-join.md(1 hunks)crates/biome_html_analyze/src/a11y.rs(1 hunks)crates/biome_html_analyze/src/lib.rs(1 hunks)crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json(1 hunks)crates/biome_html_syntax/src/element_ext.rs(3 hunks)crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/no_ambiguous_anchor_text.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use thedbg!()macro for debugging output during testing, and pass the--show-outputflag tocargoto view debug output
Usecargo torcargo testto run tests; for a single test, pass the test name after thetestcommand
Use snapshot testing with theinstacrate; runcargo insta accept,cargo insta reject, orcargo insta reviewto manage snapshot changes
Write doctests as doc comments with code blocks; the code inside code blocks will be run during the testing phase
Usejust f(alias forjust format) to format Rust and TOML files before committing
Files:
crates/biome_html_analyze/src/a11y.rscrates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_syntax/src/element_ext.rs
.changeset/**/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
.changeset/**/*.md: Create changesets for user-facing changes usingjust new-changeset; use headers with####or#####only; keep descriptions concise (1-3 sentences) and focus on user-facing changes
Use past tense when describing what was done ('Added new feature'), present tense when describing Biome behavior ('Biome now supports'); end sentences with a full stop
For new lint rules, show an example of an invalid case in an inline code snippet or code block; for rule changes, demonstrate what is now invalid or valid; for formatter changes, use adiffcode block
Files:
.changeset/shy-sites-join.md
🧠 Learnings (52)
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.htmlcrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.htmlcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsxcrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.htmlcrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : In rule documentation code blocks, mark invalid examples with the `expect_diagnostic` property and valid examples without it; each invalid example must emit exactly one diagnostic
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.htmlcrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases
Applied to files:
.changeset/shy-sites-join.mdcrates/biome_rule_options/src/lib.rscrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/src/lib.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Applies to .changeset/**/*.md : Create changesets for user-facing changes using `just new-changeset`; use headers with `####` or `#####` only; keep descriptions concise (1-3 sentences) and focus on user-facing changes
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Applies to .changeset/**/*.md : Use past tense when describing what was done ('Added new feature'), present tense when describing Biome behavior ('Biome now supports'); end sentences with a full stop
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Applies to .changeset/**/*.md : For new lint rules, show an example of an invalid case in an inline code snippet or code block; for rule changes, demonstrate what is now invalid or valid; for formatter changes, use a `diff` code block
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
Applied to files:
.changeset/shy-sites-join.mdcrates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lib.rscrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.htmlcrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.htmlcrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noMisleading` prefix for rules that report valid but potentially misleading code (e.g., `noMisleadingCharacterClass`)
Applied to files:
.changeset/shy-sites-join.mdcrates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRestricted` prefix for rules that report user-banned entities (e.g., `noRestrictedGlobals`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options must be defined in the `biome_rule_options` crate and implement traits: `Deserializable`, `Merge`, `Serialize`, `Deserialize`, and `JsonSchema`
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `no` prefix naming convention when the sole intention is to forbid a single concept (e.g., `noDebugger` to disallow debugger statements)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.{js,ts,tsx,jsx,json,css} : Test rules using snapshot tests via the `insta` library with test cases in `tests/specs/<group>/<rule_name>/` directories prefixed by `invalid` or `valid`
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsxcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsxcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsxcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noInvalid` prefix for rules that report runtime errors from mistyping (e.g., `noInvalidConstructorSuper`)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsxcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.jsonc : Use `.jsonc` files in test specs with code snippets as array of strings to test rules in script environment (no import/export syntax)
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/specs/**/options.json : Create an `options.json` file (formatted as `biome.json`) in test specification folders to apply non-default formatting options to all test files in that folder
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Biome linter is designed to work across languages, so rule naming should be generic if potentially implementable for multiple languages, or specific if meant for one language only
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.htmlcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Set rule severity to `error` for correctness/security/a11y rules, `warn` for suspicious/performance rules, `info` for style/complexity rules, and `info` for actions
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/src/lib.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope
Applied to files:
crates/biome_html_analyze/src/lib.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : No module may copy or clone data from another module in the module graph, not even behind an `Arc`
Applied to files:
crates/biome_html_analyze/src/lib.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes
Applied to files:
crates/biome_html_analyze/src/lib.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_html_analyze/src/lib.rscrates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rule diagnostics must explain to the user what the error is, why it is triggered, and what should be done to fix it following the three pillars: (1) what the error is, (2) why the error is triggered, (3) what the user should do
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules must be implemented using the `Rule` trait with type parameters: `Query` (node type to analyze), `State` (information for signals), `Signals` (return type from run function), and `Options` (rule configuration)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `use` prefix naming convention when the sole intention is to mandate a single concept (e.g., `useValidLang` to enforce valid HTML lang attribute values)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `diagnostic` function must return a `RuleDiagnostic` that defines the message reported to the user using the `markup!` macro
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Use `Box<[T]>` instead of `Vec<T>` for rule options array fields to save memory (boxed slices and boxed str use 2 words instead of three words)
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options struct fields should use `#[serde(rename_all = "camelCase")]`, `#[serde(deny_unknown_fields)]`, and `#[serde(default)]` attributes for proper JSON serialization
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Implement the `Merge` trait for rule options to define how options from extended configuration merge with user configuration (usually reset instead of extend)
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Unions of nodes must start with `Any*`, e.g., `AnyHtmlAttribute`
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : All grammar nodes must start with the prefix of the language, e.g., `HtmlSimpleAttribute`
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes for enclosing syntax errors must have the `Bogus` word, e.g., `HtmlBogusAttribute`, and must be part of a variant
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Define `FormatHtmlSyntaxNode` struct in a `cst.rs` file implementing `FormatRule<HtmlSyntaxNode>`, `AsFormat<HtmlFormatContext>`, and `IntoFormat<HtmlFormatContext>` traits using the provided boilerplate code
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
🧬 Code graph analysis (3)
crates/biome_html_analyze/src/a11y.rs (1)
crates/biome_html_syntax/src/element_ext.rs (2)
name(56-71)name(238-243)
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx (1)
crates/biome_analyze/src/rule.rs (1)
span(1477-1479)
crates/biome_html_syntax/src/element_ext.rs (1)
crates/biome_html_syntax/src/lib.rs (1)
inner_string_text(120-129)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Check JS Files
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Check Dependencies
- GitHub Check: Documentation
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Test Node.js API
- GitHub Check: autofix
- GitHub Check: Bench (biome_configuration)
🔇 Additional comments (22)
.changeset/shy-sites-join.md (1)
1-11: Changeset looks good!The format follows all guidelines: past tense, concise description, and includes an invalid example. Well done.
crates/biome_html_syntax/src/element_ext.rs (2)
233-235: LGTM!Union type follows the
Any*naming convention and correctly unifies the two element types.
263-272: Verify the truthy attribute logic against HTML spec.The
is_none_or(|value| value != "false")on line 270 treats both missing initialisers and any non-"false"string as truthy. Whilst this seems correct for HTML boolean attributes, please verify this matches the expected behaviour for all attribute types this will be used with.crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html (1)
1-2: LGTM!Test fixture correctly uses the disallowed word configured in the options file.
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json (1)
1-17: LGTM!Options correctly configure the custom words list for the test case.
crates/biome_html_analyze/src/lib.rs (1)
3-3: LGTM!Module declaration for the new a11y helpers.
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html (1)
1-2: LGTM!This test verifies that custom
wordsconfiguration replaces the default forbidden phrases rather than adding to them. With only "disabling the defaults" configured invalid.options.json, "click here" correctly doesn't trigger a diagnostic.crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx (1)
1-4: LGTM!Test fixture correctly exercises the JSX variant of the rule with a disallowed word.
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json (1)
1-17: LGTM!Options correctly configure a custom words list that replaces the default forbidden phrases, enabling the test to verify that "click here" isn't flagged when not in the custom list.
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json (1)
1-17: Confirm intended rule level valueThe options shape and nesting look right for a nursery rule. Please just double‑check that
level: "on"is the intended value here (rather than e.g."error") so this stays consistent with other a11y rule fixtures and the config schema.crates/biome_rule_options/src/lib.rs (1)
5-11: New options module wiring looks correct
pub mod no_ambiguous_anchor_text;is in the expected place and matches the rule naming; assuming this came from codegen, nothing else to tweak here.crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx (1)
1-4: Good coverage of “override default words” behaviourThis fixture neatly exercises the case where custom
wordsreplace the defaults, soclick hereno longer triggers the rule. Looks good.crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html (1)
1-8: HTML valid cases look well‑chosenNice spread of valid patterns (plain text, aria‑label on the anchor, descendant aria‑label, and img
alt) to ensure the rule respects accessible names and doesn’t over‑fire.crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json (1)
1-17: Mirror check on rule level and optionsStructure and nesting match the other options fixture, and this will drive the “custom word triggers diagnostics” tests. As with the valid options, please confirm
level: "on"is the desired value for this rule.crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx (1)
1-20: Solid set of JS/JSX non‑diagnostic casesThese fixtures exercise the main “safe” patterns: descriptive text, aria‑label on the anchor or a child, and
imgalt. The${here}literal is slightly quirky but fine if you just want to prove non‑matching text stays untouched.crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx (1)
1-100: Comprehensive ambiguous anchor coverageNice thorough port: you cover the common phrases, spacing/punctuation variants, aria‑hidden noise, misuse of
alt, and custom elements. This should give the rule a very robust behaviour surface.crates/biome_html_analyze/src/a11y.rs (1)
9-21: Helper logic aligns with intended a11y behaviourThe function cleanly follows the two key cases (truthy
aria-hiddenandinput[type="hidden"]), and short‑circuits correctly. Looks good as a shared building block for the HTML rule.crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html (1)
1-49: Test fixture covers the expected scenarios well.The test cases comprehensively exercise the rule with default forbidden words, punctuation variations, nested elements, aria-label, aria-hidden, and img alt attributes.
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (3)
17-67: Rule declaration follows the correct structure.Documentation includes proper examples and options explanation.
69-111: Rule implementation is correct.The logic properly filters anchor tags, extracts accessible text, and emits diagnostics with clear guidance for users.
113-196: Helper functions implement the text extraction logic correctly.The functions properly handle aria-label, alt attributes, nested elements, and screen-reader visibility. Text normalisation with punctuation removal and case folding matches the rule requirements.
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (1)
1-194: JS/JSX rule implementation mirrors the HTML version appropriately.The logic correctly adapts to JSX syntax whilst maintaining the same accessibility and text extraction behaviour. The parallel structure between HTML and JSX implementations is appropriate given they operate on different syntax trees.
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
Outdated
Show resolved
Hide resolved
| #[serde(rename_all = "camelCase", deny_unknown_fields, default)] | ||
| pub struct NoAmbiguousAnchorTextOptions { | ||
| /// It allows users to modify the strings that can be checked for in the anchor text. Useful for specifying other words in other languages | ||
| pub words: Option<Vec<String>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Use Box<[String]> instead of Vec<String> for memory efficiency.
As per coding guidelines, boxed slices use 2 words instead of 3.
Based on learnings, rule options should prefer Box<[String]> over Vec<String>.
Apply this diff:
- pub words: Option<Vec<String>>,
+ pub words: Option<Box<[String]>>,📝 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.
| pub words: Option<Vec<String>>, | |
| pub words: Option<Box<[String]>>, |
🤖 Prompt for AI Agents
In crates/biome_rule_options/src/no_ambiguous_anchor_text.rs around line 8, the
field currently uses Option<Vec<String>> which is less memory-efficient; change
its type to Option<Box<[String]>> and update all uses accordingly: replace Vec
construction sites with boxed slice creation (e.g.,
vec![...].into_boxed_slice()), adjust any pattern matches, method calls, and
trait bounds expecting Vec to work with Box<[String]> (or convert where
mutability is required), and update serialization/deserialization or Default
implementations to handle Option<Box<[String]>>.
a457df3 to
a173255
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
crates/biome_html_syntax/src/element_ext.rs (1)
92-108: Consider extracting shared attribute lookup logic.This implementation is nearly identical to
HtmlSelfClosingElement::find_attribute_by_name(lines 75-89). You could potentially extract a shared helper function that accepts anHtmlAttributeListto reduce duplication.That said, the duplication is minor and the code is straightforward—feel free to defer this if you prefer keeping it explicit.
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (3)
66-91: Confirm options use the same normalisation as the derived text
get_accessible_child_textreturns text that has been lowercased and had punctuation/whitespace normalised, whilewordsare compared as-is. IfNoAmbiguousAnchorTextOptions::words()does not already apply the same normalisation, customwordswill behave in a case‑sensitive / punctuation‑sensitive way, which may surprise users and diverge from the HTML rule.
137-146: Standardisation helper matches the rule’s needs; consider sharing laterThe punctuation stripping + lowercasing + whitespace collapsing pipeline is nicely explicit and should keep matching stable. Given the HTML rule uses the same logic, you might eventually want a shared a11y normalisation helper to avoid subtle drift between crates, but that can wait for a tidy‑up pass.
164-194: Child text traversal is good; expression children are a possible future extensionHandling
JsxText, nested elements, and self‑closing children with ARIA/altgives good coverage for the common patterns. At the momentJsxExpressionChildcases like<a>{'click here'}</a>are ignored; that’s a reasonable v1 trade‑off, but if you ever feel like chasing a few extra percentage points of coverage, handling simple string‑literal expressions here would be a natural extension.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (15)
crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rsis excluded by!**/migrate/eslint_any_rule_to_biome.rsand included by**crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_html_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (20)
.changeset/shy-sites-join.md(1 hunks)crates/biome_html_analyze/src/a11y.rs(1 hunks)crates/biome_html_analyze/src/lib.rs(1 hunks)crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json(1 hunks)crates/biome_html_syntax/src/element_ext.rs(3 hunks)crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/no_ambiguous_anchor_text.rs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (14)
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html
- crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx
- crates/biome_html_analyze/src/a11y.rs
- crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx
- .changeset/shy-sites-join.md
- crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx
- crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
- crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
- crates/biome_html_analyze/src/lib.rs
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use thedbg!()macro for debugging output during testing, and pass the--show-outputflag tocargoto view debug output
Usecargo torcargo testto run tests; for a single test, pass the test name after thetestcommand
Use snapshot testing with theinstacrate; runcargo insta accept,cargo insta reject, orcargo insta reviewto manage snapshot changes
Write doctests as doc comments with code blocks; the code inside code blocks will be run during the testing phase
Usejust f(alias forjust format) to format Rust and TOML files before committing
Files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_syntax/src/element_ext.rs
🧠 Learnings (48)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Biome linter is designed to work across languages, so rule naming should be generic if potentially implementable for multiple languages, or specific if meant for one language only
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noMisleading` prefix for rules that report valid but potentially misleading code (e.g., `noMisleadingCharacterClass`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `use` prefix naming convention when the sole intention is to mandate a single concept (e.g., `useValidLang` to enforce valid HTML lang attribute values)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `no` prefix naming convention when the sole intention is to forbid a single concept (e.g., `noDebugger` to disallow debugger statements)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRestricted` prefix for rules that report user-banned entities (e.g., `noRestrictedGlobals`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noMisleading` prefix for rules that report valid but potentially misleading code (e.g., `noMisleadingCharacterClass`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Implement the `Merge` trait for rule options to define how options from extended configuration merge with user configuration (usually reset instead of extend)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options must be defined in the `biome_rule_options` crate and implement traits: `Deserializable`, `Merge`, `Serialize`, `Deserialize`, and `JsonSchema`
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `no` prefix naming convention when the sole intention is to forbid a single concept (e.g., `noDebugger` to disallow debugger statements)
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `use` prefix naming convention when the sole intention is to mandate a single concept (e.g., `useValidLang` to enforce valid HTML lang attribute values)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `declare_lint_rule!` macro must include metadata fields: `version` (set to 'next'), `name` (rule identifier), `language` (applicable language), `recommended` (boolean), and optional fields like `severity`, `fix_kind`, `sources`, `domains`, and `deprecated`
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules must be implemented using the `Rule` trait with type parameters: `Query` (node type to analyze), `State` (information for signals), `Signals` (return type from run function), and `Options` (rule configuration)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rule diagnostics must explain to the user what the error is, why it is triggered, and what should be done to fix it following the three pillars: (1) what the error is, (2) why the error is triggered, (3) what the user should do
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUseless` prefix for rules that report unnecessary code that could be removed or simplified (e.g., `noUselessConstructor`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useConsistent` prefix for rules that ensure consistency across the codebase (e.g., `useConsistentArrayType`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `diagnostic` function must return a `RuleDiagnostic` that defines the message reported to the user using the `markup!` macro
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `run` function of a lint rule should return `Option<Self::State>` or an iterable like `Vec<Self::State>` or `Box<[Self::State]>` to signal zero or more diagnostics
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Unions of nodes must start with `Any*`, e.g., `AnyHtmlAttribute`
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : All grammar nodes must start with the prefix of the language, e.g., `HtmlSimpleAttribute`
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Define `FormatHtmlSyntaxNode` struct in a `cst.rs` file implementing `FormatRule<HtmlSyntaxNode>`, `AsFormat<HtmlFormatContext>`, and `IntoFormat<HtmlFormatContext>` traits using the provided boilerplate code
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes for enclosing syntax errors must have the `Bogus` word, e.g., `HtmlBogusAttribute`, and must be part of a variant
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
crates/biome_html_syntax/src/element_ext.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.jsonc : Use `.jsonc` files in test specs with code snippets as array of strings to test rules in script environment (no import/export syntax)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/specs/**/options.json : Create an `options.json` file (formatted as `biome.json`) in test specification folders to apply non-default formatting options to all test files in that folder
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.{js,ts,tsx,jsx,json,css} : Test rules using snapshot tests via the `insta` library with test cases in `tests/specs/<group>/<rule_name>/` directories prefixed by `invalid` or `valid`
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noInvalid` prefix for rules that report runtime errors from mistyping (e.g., `noInvalidConstructorSuper`)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Biome linter is designed to work across languages, so rule naming should be generic if potentially implementable for multiple languages, or specific if meant for one language only
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Set rule severity to `error` for correctness/security/a11y rules, `warn` for suspicious/performance rules, `info` for style/complexity rules, and `info` for actions
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
🧬 Code graph analysis (1)
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (3)
crates/biome_html_analyze/src/a11y.rs (1)
is_hidden_from_screen_reader(9-22)crates/biome_html_syntax/src/element_ext.rs (3)
name(56-71)name(238-243)value_token(346-351)crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (5)
run(72-91)get_accessible_child_text(164-194)diagnostic(93-108)node(172-190)input(138-144)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: End-to-end tests
- GitHub Check: Documentation
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Check JS Files
- GitHub Check: autofix
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_configuration)
🔇 Additional comments (14)
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json (1)
1-17: LGTM!Test configuration correctly enables the rule with a custom words option that aligns with the test fixture in
invalid.jsx.crates/biome_html_syntax/src/element_ext.rs (1)
233-273: LGTM!The
AnyHtmlTagElementunion provides a clean unified interface for attribute access across both opening and self-closing elements. Thehas_truthy_attributelogic correctly handles the semantics of boolean-like HTML attributes.crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx (1)
1-4: LGTM!Minimal and focused test case that exercises the custom
wordsoption. Pairs nicely with the corresponding options file.crates/biome_rule_options/src/lib.rs (1)
9-9: LGTM!New module export correctly placed in alphabetical order. As per learnings, this is part of the standard codegen process for rule options.
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (6)
15-65: LGTM!Documentation is thorough with clear examples for both invalid and valid cases, plus proper options documentation. Rule metadata correctly references the ESLint jsx-a11y source. Well done following the coding guidelines for doc block ordering.
73-91: LGTM!Clean implementation following the early-return pattern. Properly avoids
unwrap()/expect()in favour of the?operator.
93-109: LGTM!Diagnostic follows the three pillars: what (ambiguous description), why (insufficient context for screen readers), and what to do (provide more context).
137-146: LGTM!Text normalisation logic is sound. The punctuation filter and whitespace collapse ensure consistent matching regardless of formatting variations.
148-194: LGTM!Accessible text derivation correctly prioritises
aria-label→alt→ inner text, and respects screen-reader visibility. The recursive traversal handles nested structures properly.
111-119: The code shown is the final state of implementation, meaning it compiles and runs. Thefind_by_namemethod used onnode.attributes()is the correct API forHtmlAttributeList. There is no issue with this code.Likely an incorrect or invalid review comment.
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (4)
14-63: Rule declaration and docs look solidDocs, examples, options, and metadata (version/name/language/sources) all line up with existing nursery rules and the linked jsx-a11y rule. As per coding guidelines, this matches the expected lint rule metadata shape.
93-108: Diagnostic wiring and messaging are appropriateUsing the parent
<a>range for the diagnostic and the brief note about screen reader context feels clear and consistent with the rule’s intent.
111-135: ARIA andalthelpers are defensive and focusedBoth helpers bail out cleanly via
?and only act when the element type/attribute is exactly what you expect, which keeps false positives down and avoids crashes on odd ASTs.
148-162: Accessible-text resolution order is sensibleShort‑circuiting on “hidden from screen reader” and then preferring
aria-labeloverimgaltbefore falling back to children mirrors how users experience links, and keeps the rule focused on what assistive tech will actually announce.
a173255 to
3494088
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
crates/biome_html_syntax/src/element_ext.rs (2)
2-4: Attribute lookup helpers look sound and consistentThe new
HtmlOpeningElement::find_attribute_by_name, the updatedHtmlElement::find_attribute_by_namedelegation, and theAnyHtmlTagElementhelpers are all aligned with the existingHtmlSelfClosingElementlogic (case‑insensitive, cloning the attribute node). This should make the a11y helpers and new rule much simpler to write against.If you ever end up touching this again, you could consider factoring the shared “scan attributes list and compare name” logic into a small internal helper to avoid the duplication between opening/self‑closing/tag unions, but it’s perfectly fine as is.
Also applies to: 92-108, 111-115, 233-261
263-272: Clarifyhas_truthy_attributesemantics
has_truthy_attributetreats an attribute as truthy when:
- the attribute exists and has no value, or
- the value is anything other than the string
"false"(case‑sensitive here viastring_value()),
and false only when the value is exactly"false".That’s great for things like
aria-hidden/boolean‑ish attributes; if you plan to reuse it more broadly, a short doc comment spelling this out (and maybe noting the special handling of"false") would help future readers.crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (1)
164-194: Minor naming inconsistency:any_jsx_elementin HTML context.The variables on lines 166 and 185 are named
any_jsx_elementbut holdAnyHtmlTagElementvalues. Consider renaming toany_html_elementortag_elementfor clarity.if let Ok(opening) = node.opening_element() { - let any_jsx_element: AnyHtmlTagElement = opening.clone().into(); - if let Some(accessible_text) = get_accessible_text(&any_jsx_element) { + let tag_element: AnyHtmlTagElement = opening.clone().into(); + if let Some(accessible_text) = get_accessible_text(&tag_element) { return accessible_text; } };AnyHtmlElement::HtmlSelfClosingElement(element) => { - let any_jsx_element: AnyHtmlTagElement = element.clone().into(); - get_accessible_text(&any_jsx_element).unwrap_or_default() + let tag_element: AnyHtmlTagElement = element.clone().into(); + get_accessible_text(&tag_element).unwrap_or_default() }crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (1)
137-146: Consider extractingstandardize_space_and_caseto a shared utility.This function is identical to the one in the HTML version. If code sharing between
biome_html_analyzeandbiome_js_analyzeis feasible (perhaps in a common crate), it would reduce duplication. However, this is a low priority and can be deferred.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (15)
crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rsis excluded by!**/migrate/eslint_any_rule_to_biome.rsand included by**crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_html_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (20)
.changeset/shy-sites-join.md(1 hunks)crates/biome_html_analyze/src/a11y.rs(1 hunks)crates/biome_html_analyze/src/lib.rs(1 hunks)crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json(1 hunks)crates/biome_html_syntax/src/element_ext.rs(3 hunks)crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/no_ambiguous_anchor_text.rs(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
- crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx
🚧 Files skipped from review as they are similar to previous changes (7)
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html
- crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
- crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use thedbg!()macro for debugging output during testing, and pass the--show-outputflag tocargoto view debug output
Usecargo torcargo testto run tests; for a single test, pass the test name after thetestcommand
Use snapshot testing with theinstacrate; runcargo insta accept,cargo insta reject, orcargo insta reviewto manage snapshot changes
Write doctests as doc comments with code blocks; the code inside code blocks will be run during the testing phase
Usejust f(alias forjust format) to format Rust and TOML files before committing
Files:
crates/biome_html_analyze/src/lib.rscrates/biome_html_syntax/src/element_ext.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/a11y.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/lib.rs
.changeset/**/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
.changeset/**/*.md: Create changesets for user-facing changes usingjust new-changeset; use headers with####or#####only; keep descriptions concise (1-3 sentences) and focus on user-facing changes
Use past tense when describing what was done ('Added new feature'), present tense when describing Biome behavior ('Biome now supports'); end sentences with a full stop
For new lint rules, show an example of an invalid case in an inline code snippet or code block; for rule changes, demonstrate what is now invalid or valid; for formatter changes, use adiffcode block
Files:
.changeset/shy-sites-join.md
🧠 Learnings (53)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Biome linter is designed to work across languages, so rule naming should be generic if potentially implementable for multiple languages, or specific if meant for one language only
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.jsonc : Use `.jsonc` files in test specs with code snippets as array of strings to test rules in script environment (no import/export syntax)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/specs/**/options.json : Create an `options.json` file (formatted as `biome.json`) in test specification folders to apply non-default formatting options to all test files in that folder
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_html_analyze/src/lib.rs.changeset/shy-sites-join.mdcrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.{js,ts,tsx,jsx,json,css} : Test rules using snapshot tests via the `insta` library with test cases in `tests/specs/<group>/<rule_name>/` directories prefixed by `invalid` or `valid`
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsxcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_html_analyze/src/lib.rs.changeset/shy-sites-join.mdcrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Biome linter is designed to work across languages, so rule naming should be generic if potentially implementable for multiple languages, or specific if meant for one language only
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Set rule severity to `error` for correctness/security/a11y rules, `warn` for suspicious/performance rules, `info` for style/complexity rules, and `info` for actions
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_html_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `no` prefix naming convention when the sole intention is to forbid a single concept (e.g., `noDebugger` to disallow debugger statements)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.htmlcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsxcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope
Applied to files:
crates/biome_html_analyze/src/lib.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : No module may copy or clone data from another module in the module graph, not even behind an `Arc`
Applied to files:
crates/biome_html_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)
Applied to files:
crates/biome_html_analyze/src/lib.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRestricted` prefix for rules that report user-banned entities (e.g., `noRestrictedGlobals`)
Applied to files:
crates/biome_html_analyze/src/lib.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)
Applied to files:
crates/biome_html_analyze/src/lib.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes
Applied to files:
crates/biome_html_analyze/src/lib.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_html_analyze/src/lib.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Unions of nodes must start with `Any*`, e.g., `AnyHtmlAttribute`
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : All grammar nodes must start with the prefix of the language, e.g., `HtmlSimpleAttribute`
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Define `FormatHtmlSyntaxNode` struct in a `cst.rs` file implementing `FormatRule<HtmlSyntaxNode>`, `AsFormat<HtmlFormatContext>`, and `IntoFormat<HtmlFormatContext>` traits using the provided boilerplate code
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes for enclosing syntax errors must have the `Bogus` word, e.g., `HtmlBogusAttribute`, and must be part of a variant
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes that represent a list must end with the postfix `List`, e.g., `HtmlAttributeList`, and lists are mandatory (not optional) but empty by default
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging
Applied to files:
crates/biome_html_syntax/src/element_ext.rscrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Applies to .changeset/**/*.md : Create changesets for user-facing changes using `just new-changeset`; use headers with `####` or `#####` only; keep descriptions concise (1-3 sentences) and focus on user-facing changes
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Applies to .changeset/**/*.md : Use past tense when describing what was done ('Added new feature'), present tense when describing Biome behavior ('Biome now supports'); end sentences with a full stop
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Applies to .changeset/**/*.md : For new lint rules, show an example of an invalid case in an inline code snippet or code block; for rule changes, demonstrate what is now invalid or valid; for formatter changes, use a `diff` code block
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noMisleading` prefix for rules that report valid but potentially misleading code (e.g., `noMisleadingCharacterClass`)
Applied to files:
.changeset/shy-sites-join.mdcrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `use` prefix naming convention when the sole intention is to mandate a single concept (e.g., `useValidLang` to enforce valid HTML lang attribute values)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rule diagnostics must explain to the user what the error is, why it is triggered, and what should be done to fix it following the three pillars: (1) what the error is, (2) why the error is triggered, (3) what the user should do
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUseless` prefix for rules that report unnecessary code that could be removed or simplified (e.g., `noUselessConstructor`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useConsistent` prefix for rules that ensure consistency across the codebase (e.g., `useConsistentArrayType`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules must be implemented using the `Rule` trait with type parameters: `Query` (node type to analyze), `State` (information for signals), `Signals` (return type from run function), and `Options` (rule configuration)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `diagnostic` function must return a `RuleDiagnostic` that defines the message reported to the user using the `markup!` macro
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `run` function of a lint rule should return `Option<Self::State>` or an iterable like `Vec<Self::State>` or `Box<[Self::State]>` to signal zero or more diagnostics
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `declare_lint_rule!` macro must include metadata fields: `version` (set to 'next'), `name` (rule identifier), `language` (applicable language), `recommended` (boolean), and optional fields like `severity`, `fix_kind`, `sources`, `domains`, and `deprecated`
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
🧬 Code graph analysis (4)
crates/biome_html_analyze/src/a11y.rs (1)
crates/biome_html_syntax/src/element_ext.rs (2)
name(56-71)name(238-243)
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (2)
crates/biome_html_analyze/src/a11y.rs (1)
is_hidden_from_screen_reader(9-22)crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (7)
run(73-91)get_accessible_child_text(164-194)diagnostic(93-108)node(172-190)standardize_space_and_case(137-146)input(138-144)get_accessible_text(148-162)
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx (1)
crates/biome_analyze/src/rule.rs (1)
span(1477-1479)
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx (1)
crates/biome_analyze/src/rule.rs (1)
span(1477-1479)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: Check JS Files
- GitHub Check: Documentation
- GitHub Check: autofix
- GitHub Check: Test Node.js API
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: End-to-end tests
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_configuration)
🔇 Additional comments (16)
crates/biome_rule_options/src/lib.rs (1)
9-9: New rule options module is wired correctly
pub mod no_ambiguous_anchor_text;matches the rule’s naming and existing options layout; consistent with the rest of this generated file.crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html (1)
1-2: Fixture relies on options overriding the default words
<a>click here</a>would normally be ambiguous, so this “should not generate diagnostics” case implicitly depends on the matchingwords/valid.options.jsonoverriding the default ambiguous word list. As long as the HTML specs mirror the JS options setup, this is a nice regression test that “words” replaces the defaults rather than extending them.Please just double‑check that the HTML
words/valid.options.jsonis present and wired as intended.crates/biome_html_analyze/src/lib.rs (1)
3-3: a11y module wiring is tidyAdding
mod a11y;keeps the new accessibility helpers internal to the crate and avoids any surface‑area churn. Nicely scoped.crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json (1)
1-17: Options fixture correctly exercises custom word listConfiguring
noAmbiguousAnchorTextwith"words": ["disabling the defaults"]is a good way to assert that user‑provided words replace, rather than augment, the default ambiguous phrases. Structure and schema reference all look spot‑on..changeset/shy-sites-join.md (1)
1-11: Changeset matches lint‑rule guidelinesNice concise changeset: correct front‑matter, past‑tense description, and a clear invalid example for
noAmbiguousAnchorText. The docs link and kebab‑case rule slug also line up with the rule name.crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx (1)
1-20: Good coverage of “safe” accessible namesThese valid fixtures exercise the main escape hatches (descriptive text, dynamic content,
aria-label, nestedaria-label, andimg[alt]inside the anchor). That should keep the rule honest about only flagging genuinely ambiguous link text.crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx (1)
1-100: Nicely evil set of ambiguous link examplesThis fixture is a great torture‑test for the rule: you’ve covered casing, spacing, punctuation, nested nodes,
aria-hidden, misappliedalt, and custom elements. If this lot passes, the implementation is doing the right (and delightful) kind of pedantry.crates/biome_html_analyze/src/a11y.rs (1)
9-22: LGTM!The logic correctly identifies elements hidden from screen readers: first checking
aria-hidden, then specifically handling<input type="hidden">. Good use ofis_some_andfor the type check.crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (4)
1-14: LGTM!Imports are well-organised and the
is_hidden_from_screen_readerhelper is correctly imported from the newa11ymodule.
15-65: LGTM!Rule declaration follows Biome conventions:
version: "next"for new rules, proper source attribution toeslint-plugin-jsx-a11y, and clear documentation with examples. Thewordsoption is well documented.
67-109: LGTM!The rule implementation correctly targets
<a>elements, extracts accessible text, and checks against configured forbidden words. The diagnostic provides both the error and guidance for resolution — nicely done.
111-146: LGTM!Helper functions are clean and follow Rust idioms. Nice touch including international punctuation marks (¿, ¡, ‽) in the normalisation filter.
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (4)
1-13: LGTM!Imports are appropriate for JSX analysis. The structure mirrors the HTML counterpart nicely.
14-64: LGTM!Rule declaration is consistent with the HTML version, appropriately targeting
language: "js"with JSX-specific examples.
66-109: LGTM!The rule implementation correctly handles JSX syntax, using
as_jsx_name()for element name extraction. Logic is consistent with the HTML counterpart.
148-194: LGTM!The accessible text extraction correctly handles JSX structures: text nodes, nested elements, and self-closing elements. The recursive approach ensures deeply nested content is captured.
3494088 to
201891d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs (1)
6-9: UseBox<[String]>instead ofVec<String>for memory efficiency.As per coding guidelines, boxed slices use 2 words instead of 3.
🧹 Nitpick comments (5)
crates/biome_html_analyze/src/a11y.rs (1)
15-21: Consider case-insensitive comparison for thetypeattribute.HTML attribute values are case-insensitive for enumerated attributes like
type. The current comparisonvalue.text() == "hidden"will misstype="HIDDEN"ortype="Hidden".Some(name) if name.text_trimmed() == "input" => element .find_attribute_by_name("type") .and_then(|attribute| attribute.initializer()?.value().ok()?.string_value()) - .is_some_and(|value| value.text() == "hidden"), + .is_some_and(|value| value.text().eq_ignore_ascii_case("hidden")), _ => false,crates/biome_html_syntax/src/element_ext.rs (1)
92-108: Code duplication withHtmlSelfClosingElement::find_attribute_by_name.This implementation is identical to
HtmlSelfClosingElement::find_attribute_by_name(lines 75-89). Consider extracting the shared logic into a helper function that operates onHtmlAttributeList, or leverageAnyHtmlTagElement::find_attribute_by_nameinternally.For example, a helper could be:
fn find_attribute_in_list(attributes: HtmlAttributeList, name_to_lookup: &str) -> Option<HtmlAttribute> { attributes.iter().find_map(|attr| { let attribute = attr.as_html_attribute()?; let name = attribute.name().ok()?; let name_token = name.value_token().ok()?; if name_token.text_trimmed().eq_ignore_ascii_case(name_to_lookup) { Some(attribute.clone()) } else { None } }) }crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (1)
1-3: Remove unused importQueryMatch.The
QueryMatchimport is not used in this file.use biome_analyze::{ - Ast, QueryMatch, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, + Ast, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, };crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (2)
1-3: Remove unused importQueryMatch.The
QueryMatchimport is not used in this file.use biome_analyze::{ - Ast, QueryMatch, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, + Ast, Rule, RuleDiagnostic, RuleSource, context::RuleContext, declare_lint_rule, };
137-146: Consider extracting shared utility.
standardize_space_and_caseis duplicated between the HTML and JS implementations. This could be extracted to a shared crate (e.g.,biome_string_caseor a new utility module) to reduce duplication. Not blocking, just a thought for future maintainability.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (15)
crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rsis excluded by!**/migrate/eslint_any_rule_to_biome.rsand included by**crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_html_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (20)
.changeset/shy-sites-join.md(1 hunks)crates/biome_html_analyze/src/a11y.rs(1 hunks)crates/biome_html_analyze/src/lib.rs(1 hunks)crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html(1 hunks)crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json(1 hunks)crates/biome_html_syntax/src/element_ext.rs(3 hunks)crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/no_ambiguous_anchor_text.rs(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.html
🚧 Files skipped from review as they are similar to previous changes (9)
- crates/biome_rule_options/src/lib.rs
- crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.jsx
- crates/biome_html_analyze/src/lib.rs
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.html
- crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.options.json
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
- crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.jsx
- crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/invalid.html
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/**/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
.changeset/**/*.md: Create changesets for user-facing changes usingjust new-changeset; use headers with####or#####only; keep descriptions concise (1-3 sentences) and focus on user-facing changes
Use past tense when describing what was done ('Added new feature'), present tense when describing Biome behavior ('Biome now supports'); end sentences with a full stop
For new lint rules, show an example of an invalid case in an inline code snippet or code block; for rule changes, demonstrate what is now invalid or valid; for formatter changes, use adiffcode block
Files:
.changeset/shy-sites-join.md
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use thedbg!()macro for debugging output during testing, and pass the--show-outputflag tocargoto view debug output
Usecargo torcargo testto run tests; for a single test, pass the test name after thetestcommand
Use snapshot testing with theinstacrate; runcargo insta accept,cargo insta reject, orcargo insta reviewto manage snapshot changes
Write doctests as doc comments with code blocks; the code inside code blocks will be run during the testing phase
Usejust f(alias forjust format) to format Rust and TOML files before committing
Files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/a11y.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_html_syntax/src/element_ext.rs
🧠 Learnings (54)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Biome linter is designed to work across languages, so rule naming should be generic if potentially implementable for multiple languages, or specific if meant for one language only
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.{js,ts,tsx,jsx,json,css} : Test rules using snapshot tests via the `insta` library with test cases in `tests/specs/<group>/<rule_name>/` directories prefixed by `invalid` or `valid`
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsxcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsxcrates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.htmlcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.jsonc : Use `.jsonc` files in test specs with code snippets as array of strings to test rules in script environment (no import/export syntax)
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsxcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.jsoncrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases
Applied to files:
.changeset/shy-sites-join.mdcrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Applies to .changeset/**/*.md : Create changesets for user-facing changes using `just new-changeset`; use headers with `####` or `#####` only; keep descriptions concise (1-3 sentences) and focus on user-facing changes
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Applies to .changeset/**/*.md : Use past tense when describing what was done ('Added new feature'), present tense when describing Biome behavior ('Biome now supports'); end sentences with a full stop
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Applies to .changeset/**/*.md : For new lint rules, show an example of an invalid case in an inline code snippet or code block; for rule changes, demonstrate what is now invalid or valid; for formatter changes, use a `diff` code block
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style
Applied to files:
.changeset/shy-sites-join.md
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
Applied to files:
.changeset/shy-sites-join.mdcrates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noMisleading` prefix for rules that report valid but potentially misleading code (e.g., `noMisleadingCharacterClass`)
Applied to files:
.changeset/shy-sites-join.mdcrates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Use `Box<[T]>` instead of `Vec<T>` for rule options array fields to save memory (boxed slices and boxed str use 2 words instead of three words)
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Implement the `Merge` trait for rule options to define how options from extended configuration merge with user configuration (usually reset instead of extend)
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options struct fields should use `#[serde(rename_all = "camelCase")]`, `#[serde(deny_unknown_fields)]`, and `#[serde(default)]` attributes for proper JSON serialization
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options must be defined in the `biome_rule_options` crate and implement traits: `Deserializable`, `Merge`, `Serialize`, `Deserialize`, and `JsonSchema`
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRestricted` prefix for rules that report user-banned entities (e.g., `noRestrictedGlobals`)
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()` which allocates heap memory
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `use` prefix naming convention when the sole intention is to mandate a single concept (e.g., `useValidLang` to enforce valid HTML lang attribute values)
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useConsistent` prefix for rules that ensure consistency across the codebase (e.g., `useConsistentArrayType`)
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rscrates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When navigating CST nodes that return `Result`, use the try operator `?` to convert to `Option`, or use `let else` pattern for `Vec` return types in rule run functions
Applied to files:
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rule diagnostics must explain to the user what the error is, why it is triggered, and what should be done to fix it following the three pillars: (1) what the error is, (2) why the error is triggered, (3) what the user should do
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `diagnostic` function must return a `RuleDiagnostic` that defines the message reported to the user using the `markup!` macro
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUseless` prefix for rules that report unnecessary code that could be removed or simplified (e.g., `noUselessConstructor`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules must be implemented using the `Rule` trait with type parameters: `Query` (node type to analyze), `State` (information for signals), `Signals` (return type from run function), and `Options` (rule configuration)
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `run` function of a lint rule should return `Option<Self::State>` or an iterable like `Vec<Self::State>` or `Box<[Self::State]>` to signal zero or more diagnostics
Applied to files:
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `declare_lint_rule!` macro must include metadata fields: `version` (set to 'next'), `name` (rule identifier), `language` (applicable language), `recommended` (boolean), and optional fields like `severity`, `fix_kind`, `sources`, `domains`, and `deprecated`
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `no` prefix naming convention when the sole intention is to forbid a single concept (e.g., `noDebugger` to disallow debugger statements)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rscrates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/specs/**/options.json : Create an `options.json` file (formatted as `biome.json`) in test specification folders to apply non-default formatting options to all test files in that folder
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Biome linter is designed to work across languages, so rule naming should be generic if potentially implementable for multiple languages, or specific if meant for one language only
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Set rule severity to `error` for correctness/security/a11y rules, `warn` for suspicious/performance rules, `info` for style/complexity rules, and `info` for actions
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Unions of nodes must start with `Any*`, e.g., `AnyHtmlAttribute`
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : All grammar nodes must start with the prefix of the language, e.g., `HtmlSimpleAttribute`
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Define `FormatHtmlSyntaxNode` struct in a `cst.rs` file implementing `FormatRule<HtmlSyntaxNode>`, `AsFormat<HtmlFormatContext>`, and `IntoFormat<HtmlFormatContext>` traits using the provided boilerplate code
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes for enclosing syntax errors must have the `Bogus` word, e.g., `HtmlBogusAttribute`, and must be part of a variant
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding
Applied to files:
crates/biome_html_syntax/src/element_ext.rs
🧬 Code graph analysis (5)
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx (1)
crates/biome_analyze/src/rule.rs (1)
span(1477-1479)
crates/biome_html_analyze/src/a11y.rs (1)
crates/biome_html_syntax/src/element_ext.rs (2)
name(56-71)name(238-243)
crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (2)
crates/biome_html_analyze/src/a11y.rs (1)
is_hidden_from_screen_reader(9-22)crates/biome_rule_options/src/no_ambiguous_anchor_text.rs (1)
words(17-24)
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (2)
crates/biome_html_analyze/src/a11y.rs (1)
is_hidden_from_screen_reader(9-22)crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (8)
run(73-91)get_accessible_child_text(164-194)node(172-190)get_aria_label(111-119)get_img_alt(121-135)standardize_space_and_case(137-146)input(138-144)get_accessible_text(148-162)
crates/biome_html_syntax/src/element_ext.rs (1)
crates/biome_html_syntax/src/lib.rs (1)
inner_string_text(120-129)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: Test Node.js API
- GitHub Check: End-to-end tests
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Documentation
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: autofix
- GitHub Check: Check Dependencies
- GitHub Check: Check JS Files
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_configuration)
🔇 Additional comments (12)
crates/biome_html_syntax/src/element_ext.rs (1)
233-273: LGTM!The
AnyHtmlTagElementunion and its methods are well-structured. Thehas_truthy_attributelogic correctly handles boolean HTML attributes (present without value = truthy, explicit"false"= falsy). Good use ofis_none_orfor the edge cases.crates/biome_html_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.html (2)
1-49: Comprehensive test coverage.Good spread of edge cases: case sensitivity, whitespace normalisation, punctuation stripping, nested elements,
aria-hidden, andaria-label. This aligns well with the jsx-a11y reference implementation.
47-49: Verify intended behaviour foralton non-image elements.Lines 47-49 test
altattributes on<a>and<span>elements. Thealtattribute is only semantically meaningful on<img>,<area>, and<input type="image">.If the rule intentionally ignores
alton these elements (relying only on text content), the test is valid. Otherwise, this might indicate a gap in the rule's implementation.crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/words/valid.options.json (1)
1-17: LGTM!Sensible test configuration to verify custom
wordsoption overrides the defaults. The phrase "disabling the defaults" clearly documents the test's intent..changeset/shy-sites-join.md (1)
1-11: LGTM!Changeset follows the guidelines: past tense for the action, present tense for behaviour, concise description, and includes an invalid example. Well done.
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/valid.jsx (1)
1-20: LGTM!Good coverage of valid anchor patterns: non-ambiguous text, dynamic expressions, aria-label overrides (both direct and nested), and img alt fallbacks.
crates/biome_js_analyze/tests/specs/nursery/noAmbiguousAnchorText/invalid.jsx (1)
1-100: LGTM!Excellent test coverage—case insensitivity, punctuation stripping, whitespace normalisation, aria-hidden handling, nested elements, and edge cases with
alton non-img elements are all well represented.crates/biome_html_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (2)
67-109: LGTM!Rule implementation is clean—correct filtering to
<a>elements, proper accessible text extraction, and a helpful diagnostic message.
111-194: LGTM!Helper functions are well-structured with proper Option chaining. Good consistency with the JS implementation.
crates/biome_rule_options/src/no_ambiguous_anchor_text.rs (1)
11-25: LGTM!Default words and fallback logic are correctly implemented.
crates/biome_js_analyze/src/lint/nursery/no_ambiguous_anchor_text.rs (2)
66-109: LGTM!Rule implementation correctly handles JSX elements with proper node type extraction and accessible text computation.
164-194: LGTM!Recursive text extraction handles the relevant JSX child types correctly. The wildcard arm appropriately ignores expression children (whose values are unknowable at lint time).
Summary
Closes #8348
Implement jsx-a11y's
anchor-ambiguous-textTest Plan
Docs