Skip to content

chore: extra rule sources#9895

Merged
Netail merged 4 commits intomainfrom
chore/extra-rule-sources
Apr 10, 2026
Merged

chore: extra rule sources#9895
Netail merged 4 commits intomainfrom
chore/extra-rule-sources

Conversation

@Netail
Copy link
Copy Markdown
Member

@Netail Netail commented Apr 9, 2026

Summary

Event more rule sources

Test Plan

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 9, 2026

🦋 Changeset detected

Latest commit: 3e97fcd

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

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

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

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

@github-actions github-actions Bot added A-CLI Area: CLI A-Linter Area: linter L-JavaScript Language: JavaScript and super languages L-HTML Language: HTML and super languages labels Apr 9, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 9, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 196 skipped benchmarks1


Comparing chore/extra-rule-sources (13694d7) with main (a2933bf)2

Open in CodSpeed

Footnotes

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

  2. No successful run was found on main (362b638) during the generation of this report, so a2933bf was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 78cb0f10-4d21-4d75-87f2-d215a6217d89

📥 Commits

Reviewing files that changed from the base of the PR and between 25d8cc3 and 3e97fcd.

📒 Files selected for processing (1)
  • crates/biome_analyze/src/rule.rs

Walkthrough

Adds two new RuleSource variants: EslintReactJsx and EslintReactDom, and updates Display, as_rule_name, namespace, and to_rule_url logic to handle them. Updates the ESLint→Biome migration converter to recognise react-jsx and react-dom. Numerous JS/HTML lint-rule metadata entries were extended to register these new ESLint rule-source identifiers. Adds a changeset to bump @biomejs/biome patch version. No diagnostic, fix, or control-flow behaviour outside the enum/mapping adjustments was changed.

Possibly related PRs

Suggested reviewers

  • dyc3
  • ematipico
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately describes the main change: adding extra ESLint rule source mappings across multiple lint rules.
Description check ✅ Passed Description relates to the changeset, albeit tersely—it mentions 'Event more rule sources' which aligns with adding additional rule sources.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/extra-rule-sources

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.changeset/violet-turtles-smile.md (1)

5-5: Clarify the user-facing impact in the changeset text.

This reads a bit vague (“react-xyz”, “a bit better”). Please name the affected sources explicitly and state the behaviour change directly.

✍️ Suggested wording
-Added extra rule sources from react-xyz. `biome migrate eslint` should do a bit better detecting rules in your eslint configurations.
+Added support for additional ESLint React rule sources, including `react-jsx` and `react-dom`. `biome migrate eslint` now detects and migrates more React plugin rules from ESLint configurations.

As per coding guidelines: “Write changeset descriptions concisely and clearly (1-3 sentences) …”.

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

In @.changeset/violet-turtles-smile.md at line 5, Update the changeset text that
currently reads "Added extra rule sources from react-xyz. `biome migrate eslint`
should do a bit better detecting rules in your eslint configurations." to a
concise 1–3 sentence description that explicitly lists the added rule sources
(replace "react-xyz" with the actual package/rule names added) and clearly
states the user-facing behavior change (for example: "`biome migrate eslint` now
recognizes and maps rules from <list-of-sources>, improving detection and
migration of those rules in ESLint configs"). Ensure the new text names the
affected sources and describes the exact improvement to rule detection/mapping.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/biome_cli/src/execute/migrate/eslint_to_biome.rs`:
- Around line 417-418: Add end-to-end tests that cover the new mapping cases for
"react-jsx" and "react-dom": create test fixtures that simulate an ESLint config
containing rules/plugins referencing "react-jsx" and "react-dom", invoke the
ESLint-to-Biome migration logic (the code paths that resolve to
RuleSource::EslintReactJsx and RuleSource::EslintReactDom in
migrate::eslint_to_biome), and assert the migrated output includes the expected
RuleSource resolution and resulting Biome rules (use snapshot assertions or
precise asserts depending on existing test style). Place these tests alongside
the other migration specs in the migrate tests module, name them clearly (e.g.,
migrate_react_jsx_plugin_and_react_dom_plugin), and ensure they fail before the
fix and pass after to provide full coverage for the added mappings.

In
`@crates/biome_js_analyze/src/lint/correctness/no_void_elements_with_children.rs`:
- Line 38: The issue is that using RuleSource::EslintReactDom with the rule name
"dom-no-void-elements-with-children" causes to_rule_url to prepend another
"dom-" resulting in "dom-dom-no-void-elements-with-children"; fix by replacing
the second source variant
RuleSource::EslintReactDom("dom-no-void-elements-with-children") with the
non-prefixed variant RuleSource::EslintReactXyz (or RuleSource::EslintReact with
the correct rule name) and pass the rule name without the "dom-" prefix so the
generated URL becomes correct; update the sources array where
RuleSource::EslintReactDom is referenced to use the appropriate
EslintReactXyz/EslintReact variant and remove the duplicated "dom-" in the rule
string.

---

Nitpick comments:
In @.changeset/violet-turtles-smile.md:
- Line 5: Update the changeset text that currently reads "Added extra rule
sources from react-xyz. `biome migrate eslint` should do a bit better detecting
rules in your eslint configurations." to a concise 1–3 sentence description that
explicitly lists the added rule sources (replace "react-xyz" with the actual
package/rule names added) and clearly states the user-facing behavior change
(for example: "`biome migrate eslint` now recognizes and maps rules from
<list-of-sources>, improving detection and migration of those rules in ESLint
configs"). Ensure the new text names the affected sources and describes the
exact improvement to rule detection/mapping.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4c59d8ce-f4bc-477f-b9e4-b171fda44af4

📥 Commits

Reviewing files that changed from the base of the PR and between 362b638 and 605c222.

📒 Files selected for processing (16)
  • .changeset/violet-turtles-smile.md
  • crates/biome_analyze/src/rule.rs
  • crates/biome_cli/src/execute/migrate/eslint_to_biome.rs
  • crates/biome_html_analyze/src/lint/nursery/no_script_url.rs
  • crates/biome_js_analyze/src/lint/a11y/use_button_type.rs
  • crates/biome_js_analyze/src/lint/complexity/no_useless_fragments.rs
  • crates/biome_js_analyze/src/lint/correctness/no_children_prop.rs
  • crates/biome_js_analyze/src/lint/correctness/no_nested_component_definitions.rs
  • crates/biome_js_analyze/src/lint/correctness/no_void_elements_with_children.rs
  • crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs
  • crates/biome_js_analyze/src/lint/correctness/use_jsx_key_in_iterable.rs
  • crates/biome_js_analyze/src/lint/nursery/no_script_url.rs
  • crates/biome_js_analyze/src/lint/security/no_blank_target.rs
  • crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html.rs
  • crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html_with_children.rs
  • crates/biome_js_analyze/src/lint/suspicious/no_array_index_key.rs

Comment on lines +417 to +418
Some("react-jsx") => RuleSource::EslintReactJsx,
Some("react-dom") => RuleSource::EslintReactDom,
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Apr 9, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add migration tests for the new react-jsx/react-dom mappings.

Line [417] and Line [418] introduce new rule-source resolution paths, but there’s no accompanying spec/snapshot coverage proving these keys migrate correctly. Please add fixtures that exercise both plugin names end-to-end.

As per coding guidelines: “All code changes MUST include appropriate tests … and bug fixes require tests that reproduce and validate the fix.”

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

In `@crates/biome_cli/src/execute/migrate/eslint_to_biome.rs` around lines 417 -
418, Add end-to-end tests that cover the new mapping cases for "react-jsx" and
"react-dom": create test fixtures that simulate an ESLint config containing
rules/plugins referencing "react-jsx" and "react-dom", invoke the
ESLint-to-Biome migration logic (the code paths that resolve to
RuleSource::EslintReactJsx and RuleSource::EslintReactDom in
migrate::eslint_to_biome), and assert the migrated output includes the expected
RuleSource resolution and resulting Biome rules (use snapshot assertions or
precise asserts depending on existing test style). Place these tests alongside
the other migration specs in the migrate tests module, name them clearly (e.g.,
migrate_react_jsx_plugin_and_react_dom_plugin), and ensure they fail before the
fix and pass after to provide full coverage for the added mappings.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@coderabbitai we usually don't this because everything is code generated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ematipico got it — since the rule source resolution and migration mappings are all code-generated, manual snapshot tests for these new plugin name entries aren't necessary. I'll update my understanding accordingly.


✏️ Learnings added
Learnt from: ematipico
Repo: biomejs/biome PR: 9895
File: crates/biome_cli/src/execute/migrate/eslint_to_biome.rs:417-418
Timestamp: 2026-04-10T06:06:26.184Z
Learning: In biomejs/biome, new plugin name → RuleSource mappings added to the `TryFrom<&EslintRuleName> for RuleSource` impl in `crates/biome_cli/src/execute/migrate/eslint_to_biome.rs` do not require manual snapshot/migration tests because the entire rule source detection and migration pipeline is code-generated. This applies to additions like `Some("react-jsx") => RuleSource::EslintReactJsx` and `Some("react-dom") => RuleSource::EslintReactDom`.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: ematipico
Repo: biomejs/biome PR: 9895
File: crates/biome_analyze/src/rule.rs:157-160
Timestamp: 2026-04-10T06:05:01.625Z
Learning: In biomejs/biome, `RuleSource` enum variants in `crates/biome_analyze/src/rule.rs` (e.g., `EslintReactJsx`, `EslintReactDom`) are pure metadata that only affect codegen and `biome migrate eslint` detection. Adding new variants does not require snapshot tests, as there is no behavioral rule logic to validate.

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Use `RuleSource::Eslint("rule-name").inspired()` when porting an ESLint rule with different behavior or options

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Use `RuleSource::Eslint("rule-name").same()` when porting an ESLint rule with matching behavior

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_js_analyze/lib/src/lint/**/*.rs : Rule language field in `declare_lint_rule!` must be set to `js` for JavaScript, or `jsx`, `ts`, `tsx` for specific dialects

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_js_analyze/lib/src/lint/**/*.rs : Rule naming: Use `use<Framework>...` prefix for rules that overwhelmingly apply to a specific framework (e.g., `noVueReservedProps`)

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Implement `action` function to provide code actions if the rule can suggest fixes or refactorings

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_js_analyze/lib/src/lint/**/*.rs : Rule naming: Use `useShorthand<Concept>` for syntax that can be rewritten using compact syntax (e.g., `useShorthandAssign`)

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Use `.ok()?` to convert `Result` to `Option` in rule code that returns `Option`

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_js_analyze/lib/src/lint/**/*.rs : Rule naming: Mandate a concept using `use<Concept>` prefix (e.g., `useValidLang`)

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Use `Semantic<>` query type for rules requiring semantic information like variable references and bindings

Learnt from: CR
Repo: biomejs/biome PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-23T19:15:52.743Z
Learning: Applies to **/*.{rs,ts,tsx,js} : All code changes MUST include appropriate tests: lint rules require snapshot tests in 'tests/specs/{group}/{rule}/', formatters require snapshot tests with valid/invalid cases, parsers require test files covering valid and error cases, and bug fixes require tests that reproduce and validate the fix.

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/tests/specs/*/valid*.{js,ts,tsx,jsx,css,json,graphql} : Create test files with names prefixed `valid` containing code that does not violate the rule

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/tests/specs/*/invalid*.{js,ts,tsx,jsx,css,json,graphql} : Create test files with names prefixed `invalid` containing code that violates the rule

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.

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Add `fix_kind: FixKind::Safe` to `declare_lint_rule!` when code actions always result in code that doesn't change behavior

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Add `fix_kind: FixKind::Unsafe` to `declare_lint_rule!` when code actions may change program behavior

Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2026-04-06T21:31:01.863Z
Learning: Provide pull requests to the `next` branch for promoting rules from nursery and for implementing new features that affect end users

Learnt from: dyc3
Repo: biomejs/biome PR: 8901
File: crates/biome_analyze_macros/src/group_macro.rs:9-9
Timestamp: 2026-01-29T22:10:30.888Z
Learning: Do not import xtask inside biome crates. In the biomeps repository, ensure that biome crates (e.g., crates/biome_*/...) do not have imports like use xtask_glue::... or other xtask-related crates. The correct dependency direction is for xtask to depend on and import biome crates, not the reverse, since xtask contains heavier utilities (e.g., git2) that can inflate build times when included in biome crates. When reviewing, verify dependency declarations (Cargo.toml) and any use statements to confirm xtask crates are not pulled into biome crates; prefer having xtask depend on biome crates and export needed functionality through stable interfaces.

Learnt from: jfmcdowell
Repo: biomejs/biome PR: 9783
File: crates/biome_markdown_parser/src/syntax/inline/html.rs:261-269
Timestamp: 2026-04-03T17:11:44.346Z
Learning: In the biomejs/biome codebase, when handling whitespace and character classification, use the whitespace/character classification dispatch tables from `biome_unicode_table::lookup_byte` (e.g., `Dispatch::WHS`) rather than ad-hoc raw byte literal comparisons (e.g., `b <= b' '` or explicit `b == b'\t'`). When reviewing this repo, do not treat `biome_unicode_table` dispatch variants as a spec-alignment issue—dispatch-table usage is the requested/accepted approach.

Comment thread crates/biome_js_analyze/src/lint/correctness/no_void_elements_with_children.rs Outdated
@Netail Netail force-pushed the chore/extra-rule-sources branch from 634b2b1 to e72d94f Compare April 9, 2026 21:51
@Netail Netail requested review from a team April 9, 2026 21:53
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@crates/biome_analyze/src/rule.rs`:
- Around line 157-160: Add snapshot regression tests that assert the
name-spacing and URL generation for the new enum variants EslintReactJsx and
EslintReactDom: create focused tests that construct rules using these variants
and verify the mapped namespace string and generated URL are exactly as expected
(cover both variants and any expected formatting differences). Place tests
alongside other rule mapping specs following the project's test conventions for
rule mappings/snapshots, include both positive assertions and a snapshot of the
resulting mapping output, and mirror the same coverage added for the other
variants referenced (lines showing similar variants) so future mapping drift is
caught.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fe782a59-f80c-4b38-a560-360a1c7a9883

📥 Commits

Reviewing files that changed from the base of the PR and between 605c222 and e72d94f.

⛔ Files ignored due to path filters (1)
  • crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs is excluded by !**/migrate/eslint_any_rule_to_biome.rs and included by **
📒 Files selected for processing (16)
  • .changeset/violet-turtles-smile.md
  • crates/biome_analyze/src/rule.rs
  • crates/biome_cli/src/execute/migrate/eslint_to_biome.rs
  • crates/biome_html_analyze/src/lint/nursery/no_script_url.rs
  • crates/biome_js_analyze/src/lint/a11y/use_button_type.rs
  • crates/biome_js_analyze/src/lint/complexity/no_useless_fragments.rs
  • crates/biome_js_analyze/src/lint/correctness/no_children_prop.rs
  • crates/biome_js_analyze/src/lint/correctness/no_nested_component_definitions.rs
  • crates/biome_js_analyze/src/lint/correctness/no_void_elements_with_children.rs
  • crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs
  • crates/biome_js_analyze/src/lint/correctness/use_jsx_key_in_iterable.rs
  • crates/biome_js_analyze/src/lint/nursery/no_script_url.rs
  • crates/biome_js_analyze/src/lint/security/no_blank_target.rs
  • crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html.rs
  • crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html_with_children.rs
  • crates/biome_js_analyze/src/lint/suspicious/no_array_index_key.rs
✅ Files skipped from review due to trivial changes (9)
  • .changeset/violet-turtles-smile.md
  • crates/biome_js_analyze/src/lint/correctness/no_nested_component_definitions.rs
  • crates/biome_html_analyze/src/lint/nursery/no_script_url.rs
  • crates/biome_js_analyze/src/lint/nursery/no_script_url.rs
  • crates/biome_js_analyze/src/lint/a11y/use_button_type.rs
  • crates/biome_js_analyze/src/lint/correctness/no_children_prop.rs
  • crates/biome_js_analyze/src/lint/complexity/no_useless_fragments.rs
  • crates/biome_js_analyze/src/lint/correctness/use_jsx_key_in_iterable.rs
  • crates/biome_js_analyze/src/lint/security/no_blank_target.rs
🚧 Files skipped from review as they are similar to previous changes (6)
  • crates/biome_cli/src/execute/migrate/eslint_to_biome.rs
  • crates/biome_js_analyze/src/lint/suspicious/no_array_index_key.rs
  • crates/biome_js_analyze/src/lint/correctness/use_exhaustive_dependencies.rs
  • crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html.rs
  • crates/biome_js_analyze/src/lint/correctness/no_void_elements_with_children.rs
  • crates/biome_js_analyze/src/lint/security/no_dangerously_set_inner_html_with_children.rs

Comment thread crates/biome_analyze/src/rule.rs Outdated
Comment on lines +157 to +160
/// Rules from [eslint-react.xyz](https://eslint-react.xyz/)
EslintReactJsx(&'a str),
/// Rules from [eslint-react.xyz](https://eslint-react.xyz/)
EslintReactDom(&'a str),
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Apr 9, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Please add regression tests for the new source variants.

This change adds new externally visible mapping behaviour, but there’s no test coverage shown for EslintReactJsx/EslintReactDom name-spacing and URL generation. A small focused test here would prevent silent mapping drift later.

As per coding guidelines: **/*.{rs,ts,tsx,js}: “All code changes MUST include appropriate tests: lint rules require snapshot tests in 'tests/specs/{group}/{rule}/', formatters require snapshot tests with valid/invalid cases, parsers require test files covering valid and error cases, and bug fixes require tests that reproduce and validate the fix.”

Also applies to: 237-238, 319-320, 373-374, 435-436

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

In `@crates/biome_analyze/src/rule.rs` around lines 157 - 160, Add snapshot
regression tests that assert the name-spacing and URL generation for the new
enum variants EslintReactJsx and EslintReactDom: create focused tests that
construct rules using these variants and verify the mapped namespace string and
generated URL are exactly as expected (cover both variants and any expected
formatting differences). Place tests alongside other rule mapping specs
following the project's test conventions for rule mappings/snapshots, include
both positive assertions and a snapshot of the resulting mapping output, and
mirror the same coverage added for the other variants referenced (lines showing
similar variants) so future mapping drift is caught.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@coderabbitai this an exception. These are pure metadata that only affect codegen

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ematipico, understood! Since RuleSource enum variants are pure metadata used exclusively for codegen and ESLint migration mapping — with no behavioral rule logic — the snapshot test requirement doesn't apply here. I'll note this for future reviews.


✏️ Learnings added
Learnt from: ematipico
Repo: biomejs/biome PR: 9895
File: crates/biome_analyze/src/rule.rs:157-160
Timestamp: 2026-04-10T06:05:01.625Z
Learning: In biomejs/biome, `RuleSource` enum variants in `crates/biome_analyze/src/rule.rs` (e.g., `EslintReactJsx`, `EslintReactDom`) are pure metadata that only affect codegen and `biome migrate eslint` detection. Adding new variants does not require snapshot tests, as there is no behavioral rule logic to validate.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Use `RuleSource::Eslint("rule-name").inspired()` when porting an ESLint rule with different behavior or options

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Use `RuleSource::Eslint("rule-name").same()` when porting an ESLint rule with matching behavior

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_js_analyze/lib/src/lint/**/*.rs : Rule language field in `declare_lint_rule!` must be set to `js` for JavaScript, or `jsx`, `ts`, `tsx` for specific dialects

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_js_analyze/lib/src/lint/**/*.rs : Rule naming: Use `use<Framework>...` prefix for rules that overwhelmingly apply to a specific framework (e.g., `noVueReservedProps`)

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Implement the `Rule` trait with required associated types: `Query`, `State`, `Signals`, and `Options`

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Implement `action` function to provide code actions if the rule can suggest fixes or refactorings

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Use `Semantic<>` query type for rules requiring semantic information like variable references and bindings

Learnt from: dyc3
Repo: biomejs/biome PR: 8960
File: crates/biome_js_analyze/src/lint/nursery/use_playwright_valid_describe_callback.rs:74-74
Timestamp: 2026-02-05T23:24:11.386Z
Learning: In Rust rule files under crates/biome_analyze/**/*.rs, ensure all helper functions, structs, and enums appear below the impl Rule block, with the only exception being node union declarations used in the rule's Query type, which may stay above the rule block for readability. This guideline applies to files within that specific path; for files outside crates/biome_analyze (e.g., crates/biome_js_analyze/... ), apply the same rule if they belong to a similar analyze crate or review context.

Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2026-04-06T21:31:01.863Z
Learning: Applies to crates/biome_analyze/**/*.rs : Follow technical guidelines and patterns documented in the biome_analyze CONTRIBUTING.md for creating analyzer rules and lint rules

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Use `.ok()?` to convert `Result` to `Option` in rule code that returns `Option`

Learnt from: CR
Repo: biomejs/biome PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-23T19:15:52.743Z
Learning: Applies to **/*.{rs,ts,tsx,js} : All code changes MUST include appropriate tests: lint rules require snapshot tests in 'tests/specs/{group}/{rule}/', formatters require snapshot tests with valid/invalid cases, parsers require test files covering valid and error cases, and bug fixes require tests that reproduce and validate the fix.

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/tests/specs/*/valid*.{js,ts,tsx,jsx,css,json,graphql} : Create test files with names prefixed `valid` containing code that does not violate the rule

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/tests/specs/*/invalid*.{js,ts,tsx,jsx,css,json,graphql} : Create test files with names prefixed `invalid` containing code that violates the rule

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Add `fix_kind: FixKind::Unsafe` to `declare_lint_rule!` when code actions may change program behavior

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Add `fix_kind: FixKind::Safe` to `declare_lint_rule!` when code actions always result in code that doesn't change behavior

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Use `issue_number` in the rule macro to add a footnote linking to an open GitHub issue for work-in-progress rules

Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-04-07T12:58:59.356Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/lint/**/*.rs : Set rule severity to `Severity::Information` for stylistic suggestions

Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2026-04-06T21:31:01.863Z
Learning: Provide pull requests to the `next` branch for promoting rules from nursery and for implementing new features that affect end users

Learnt from: dyc3
Repo: biomejs/biome PR: 8901
File: crates/biome_analyze_macros/src/group_macro.rs:9-9
Timestamp: 2026-01-29T22:10:30.888Z
Learning: Do not import xtask inside biome crates. In the biomeps repository, ensure that biome crates (e.g., crates/biome_*/...) do not have imports like use xtask_glue::... or other xtask-related crates. The correct dependency direction is for xtask to depend on and import biome crates, not the reverse, since xtask contains heavier utilities (e.g., git2) that can inflate build times when included in biome crates. When reviewing, verify dependency declarations (Cargo.toml) and any use statements to confirm xtask crates are not pulled into biome crates; prefer having xtask depend on biome crates and export needed functionality through stable interfaces.

Learnt from: jfmcdowell
Repo: biomejs/biome PR: 9783
File: crates/biome_markdown_parser/src/syntax/inline/html.rs:261-269
Timestamp: 2026-04-03T17:11:44.346Z
Learning: In the biomejs/biome codebase, when handling whitespace and character classification, use the whitespace/character classification dispatch tables from `biome_unicode_table::lookup_byte` (e.g., `Dispatch::WHS`) rather than ad-hoc raw byte literal comparisons (e.g., `b <= b' '` or explicit `b == b'\t'`). When reviewing this repo, do not treat `biome_unicode_table` dispatch variants as a spec-alignment issue—dispatch-table usage is the requested/accepted approach.

Comment thread crates/biome_analyze/src/rule.rs Outdated
Comment on lines +157 to +160
/// Rules from [eslint-react.xyz](https://eslint-react.xyz/)
EslintReactJsx(&'a str),
/// Rules from [eslint-react.xyz](https://eslint-react.xyz/)
EslintReactDom(&'a str),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

after looking at it more closely, I see why you did this. the upstream is somewhat annoyingly organized.

that being said, these comments need to explain how they are different from the base EslintReactXyz

Copy link
Copy Markdown
Member Author

@Netail Netail Apr 9, 2026

Choose a reason for hiding this comment

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

Yeah they basically have the category plugins and an overarching plugin that contains all the rules from all categories

@Netail Netail requested a review from dyc3 April 10, 2026 11:29
@Netail Netail merged commit 1c8e1ef into main Apr 10, 2026
30 checks passed
@Netail Netail deleted the chore/extra-rule-sources branch April 10, 2026 12:50
@github-actions github-actions Bot mentioned this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants