feat(html/nursery): add noDupeElseIfBlocks, noDupeStyleProperties, noDupeUseDirectives#10549
feat(html/nursery): add noDupeElseIfBlocks, noDupeStyleProperties, noDupeUseDirectives#10549Mokto wants to merge 6 commits into
Conversation
…DupeUseDirectives
Port three eslint-plugin-svelte rules:
- noDupeElseIfBlocks: disallow duplicate conditions in {#if}/{:else if} chains
- noDupeStyleProperties: disallow duplicate style: directives on the same element
- noDupeUseDirectives: disallow duplicate use: directives on the same element
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 6edb74c 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 |
✅ Organic activityNo automation signals detected in the analyzed events. This is an automated analysis by AgentScan |
WalkthroughThis PR adds three independent Svelte nursery lint rules to the Biome linter. The Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
crates/biome_html_analyze/src/lint/nursery/no_dupe_style_properties.rs (2)
95-110: ⚡ Quick winDiagnostic is missing the "how to fix" pillar.
It explains the what (duplicate) and why (first occurrence), but not the what to do. A short note nudging the user to remove the redundant directive completes the three pillars.
♻️ Suggested note
.detail( state.original_range, "This is the first occurrence of the directive.", - ), + ) + .note(markup! { + "Remove the duplicate "<Emphasis>"style:"</Emphasis>" directive." + }),As per coding guidelines: "The 'diagnostic' function must explain what the error is, why it is triggered, and what the user should do to fix it according to the three pillars".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/biome_html_analyze/src/lint/nursery/no_dupe_style_properties.rs` around lines 95 - 110, The diagnostic in fn diagnostic(_ctx: &RuleContext<Self>, state: &Self::State) builds a RuleDiagnostic that states the duplicate and points to the original occurrence but lacks a remediation message; update the RuleDiagnostic (where RuleDiagnostic::new is constructed for state.duplicate_range) to include a short "how to fix" pillar—e.g., add a .help or .note (or the crate's equivalent) telling the user to remove the redundant "style:" directive or merge its properties into the first occurrence so the diagnostic explains what to do to fix the issue.
29-36: 🏗️ Heavy liftConsider
noDuplicateStylePropertiesovernoDupe....Biome convention spells out "Duplicate" (e.g.
noDuplicateObjectKeys,noDuplicateClassMembers), even when portingno-dupe-*ESLint rules. Since this reports duplicate directives where only the last wins, thenoDuplicate<Concept>prefix fits. Worth aligning now while it's still nursery (and the same applies to the two sibling rules in this PR).As per coding guidelines: "Use
noDuplicate<Concept>prefix for rules that report duplication overriding previous occurrences".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/biome_html_analyze/src/lint/nursery/no_dupe_style_properties.rs` around lines 29 - 36, Rename the rule to use the "Duplicate" spelling: change the identifier NoDupeStyleProperties to NoDuplicateStyleProperties and update the rule metadata name string from "noDupeStyleProperties" to "noDuplicateStyleProperties"; also search and update any other usages (registrations, tests, docs, sibling rule references) that reference NoDupeStyleProperties or "noDupeStyleProperties" so identifiers and the published rule name stay consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/biome_html_analyze/src/lint/nursery/no_dupe_else_if_blocks.rs`:
- Line 43: Rename the rule identifier "noDupeElseIfBlocks" to the full-word,
cross-language form "noDuplicateElseIf" throughout the module: update the rule's
name field (currently "noDupeElseIfBlocks"), rename the Rust module/file, the
rule struct and any Options/config struct(s) and references (e.g., types or
constructors named around NoDupeElseIfBlocks) to use NoDuplicateElseIf /
noDuplicateElseIf; after renaming, re-run the generation tasks `just gen-rules`
and `just gen-configuration` to regenerate rule metadata and configuration.
In `@crates/biome_rule_options/src/no_dupe_else_if_blocks.rs`:
- Line 7: Add a rustdoc comment above the NoDupeElseIfBlocksOptions struct:
include a short one-line description of what the options represent (even if you
simply state "Options for the NoDupeElseIfBlocks lint" or similar) and, if
helpful, a note that the struct is currently empty and reserved for future
options; place the doc comment immediately above the pub struct
NoDupeElseIfBlocksOptions {} declaration so generated docs include this type.
In `@crates/biome_rule_options/src/no_dupe_style_properties.rs`:
- Line 7: Add a rustdoc comment for the NoDupeStylePropertiesOptions struct
explaining its purpose and usage so the rule options are discoverable; locate
the struct declaration NoDupeStylePropertiesOptions and add a short /// comment
above it that describes what options it represents (e.g., controls behavior for
the "no duplicate style properties" rule) and any default/field semantics if
applicable.
In `@crates/biome_rule_options/src/no_dupe_use_directives.rs`:
- Line 7: Add rustdoc for the new options type NoDupeUseDirectivesOptions by
placing a /// doc comment above the struct that briefly explains what the
options control (e.g., prevents duplicate use directives in a module), documents
any fields or the lack thereof, describes default behavior and example usage if
applicable, and includes any relevant notes or stability/feature flags; ensure
the comment follows project doc style and uses complete sentences so it shows up
in generated docs.
---
Nitpick comments:
In `@crates/biome_html_analyze/src/lint/nursery/no_dupe_style_properties.rs`:
- Around line 95-110: The diagnostic in fn diagnostic(_ctx: &RuleContext<Self>,
state: &Self::State) builds a RuleDiagnostic that states the duplicate and
points to the original occurrence but lacks a remediation message; update the
RuleDiagnostic (where RuleDiagnostic::new is constructed for
state.duplicate_range) to include a short "how to fix" pillar—e.g., add a .help
or .note (or the crate's equivalent) telling the user to remove the redundant
"style:" directive or merge its properties into the first occurrence so the
diagnostic explains what to do to fix the issue.
- Around line 29-36: Rename the rule to use the "Duplicate" spelling: change the
identifier NoDupeStyleProperties to NoDuplicateStyleProperties and update the
rule metadata name string from "noDupeStyleProperties" to
"noDuplicateStyleProperties"; also search and update any other usages
(registrations, tests, docs, sibling rule references) that reference
NoDupeStyleProperties or "noDupeStyleProperties" so identifiers and the
published rule name stay consistent.
🪄 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: 342bed8c-93fa-43dd-9074-322992070865
⛔ Files ignored due to path filters (10)
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_configuration/src/generated/linter_options_check.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_html_analyze/tests/specs/nursery/noDupeElseIfBlocks/invalid.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noDupeElseIfBlocks/valid.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noDupeStyleProperties/invalid.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noDupeStyleProperties/valid.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noDupeUseDirectives/invalid.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noDupeUseDirectives/valid.svelte.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (13)
crates/biome_html_analyze/src/lint/nursery/no_dupe_else_if_blocks.rscrates/biome_html_analyze/src/lint/nursery/no_dupe_style_properties.rscrates/biome_html_analyze/src/lint/nursery/no_dupe_use_directives.rscrates/biome_html_analyze/tests/specs/nursery/noDupeElseIfBlocks/invalid.sveltecrates/biome_html_analyze/tests/specs/nursery/noDupeElseIfBlocks/valid.sveltecrates/biome_html_analyze/tests/specs/nursery/noDupeStyleProperties/invalid.sveltecrates/biome_html_analyze/tests/specs/nursery/noDupeStyleProperties/valid.sveltecrates/biome_html_analyze/tests/specs/nursery/noDupeUseDirectives/invalid.sveltecrates/biome_html_analyze/tests/specs/nursery/noDupeUseDirectives/valid.sveltecrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/no_dupe_else_if_blocks.rscrates/biome_rule_options/src/no_dupe_style_properties.rscrates/biome_rule_options/src/no_dupe_use_directives.rs
| /// | ||
| pub NoDupeElseIfBlocks { | ||
| version: "next", | ||
| name: "noDupeElseIfBlocks", |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift
Rule name: prefer the full-word, cross-language form noDuplicateElseIf.
Biome already ships the JS rule noDuplicateElseIf, and naming conventions favour full words (noDuplicate<Concept> / noRedundant<Concept>) over abbreviations like "Dupe". Reusing the established name keeps the linter consistent across languages and avoids a painful rename later. Note this also affects the file/module name and the options struct.
If you do rename, remember to re-run just gen-rules and just gen-configuration.
As per coding guidelines: "Use noDuplicate<Concept> prefix for rules that report duplication overriding previous occurrences" and "Biome linter is designed to work across multiple languages, so rule naming and design should consider cross-language applicability".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/biome_html_analyze/src/lint/nursery/no_dupe_else_if_blocks.rs` at line
43, Rename the rule identifier "noDupeElseIfBlocks" to the full-word,
cross-language form "noDuplicateElseIf" throughout the module: update the rule's
name field (currently "noDupeElseIfBlocks"), rename the Rust module/file, the
rule struct and any Options/config struct(s) and references (e.g., types or
constructors named around NoDupeElseIfBlocks) to use NoDuplicateElseIf /
noDuplicateElseIf; after renaming, re-run the generation tasks `just gen-rules`
and `just gen-configuration` to regenerate rule metadata and configuration.
There was a problem hiding this comment.
The bot is correct, rename this html rule to match the js rule name. Make a note that it only works for svelte, and not vue as well.
There was a problem hiding this comment.
If we rename the rule to match what we already have, it must be shipped as a feature, and it can't belong to this PR. FYI
Merging this PR will not alter performance
Comparing Footnotes
|
… for svelte dupe rules Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
05a42bb to
db70b98
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/svelte-dupe-rules.md:
- Around line 5-9: The changeset adds three new Svelte lint rules but lacks the
required invalid-example snippets; update the .changeset entry to include at
least one invalid Svelte code example for each rule named noDupeElseIfBlocks,
noDupeStyleProperties, and noDupeUseDirectives (you may also include a valid
example for clarity). For each rule, add a brief fenced code block showing the
minimal Svelte template that violates the rule (e.g., duplicate {:else if}
condition for noDupeElseIfBlocks, repeated style: directives on one element for
noDupeStyleProperties, and repeated use: directives on one element for
noDupeUseDirectives) and label them as invalid cases.
🪄 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: 1e6d007c-31d4-40fe-a63d-6e70a4e20b28
⛔ Files ignored due to path filters (3)
crates/biome_configuration/src/generated/domain_selector.rsis excluded by!**/generated/**,!**/generated/**and 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 (4)
.changeset/svelte-dupe-rules.mdcrates/biome_rule_options/src/no_dupe_else_if_blocks.rscrates/biome_rule_options/src/no_dupe_style_properties.rscrates/biome_rule_options/src/no_dupe_use_directives.rs
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/biome_rule_options/src/no_dupe_use_directives.rs
- crates/biome_rule_options/src/no_dupe_else_if_blocks.rs
| Added three new nursery rules for Svelte templates: | ||
|
|
||
| - [`noDupeElseIfBlocks`](https://biomejs.dev/linter/rules/no-dupe-else-if-blocks/): disallow duplicate conditions in `{#if}` / `{:else if}` chains. A condition that is textually identical to a previous one can never execute. | ||
| - [`noDupeStyleProperties`](https://biomejs.dev/linter/rules/no-dupe-style-properties/): disallow duplicate `style:` directives on the same element. | ||
| - [`noDupeUseDirectives`](https://biomejs.dev/linter/rules/no-dupe-use-directives/): disallow duplicate `use:` directives on the same element. |
There was a problem hiding this comment.
Add at least one invalid Svelte example per new rule in this changeset.
The entry is clear, but it misses the required invalid-case examples for new lint rules.
Suggested patch
Added three new nursery rules for Svelte templates:
-- [`noDupeElseIfBlocks`](https://biomejs.dev/linter/rules/no-dupe-else-if-blocks/): disallow duplicate conditions in `{`#if`}` / `{:else if}` chains. A condition that is textually identical to a previous one can never execute.
-- [`noDupeStyleProperties`](https://biomejs.dev/linter/rules/no-dupe-style-properties/): disallow duplicate `style:` directives on the same element.
-- [`noDupeUseDirectives`](https://biomejs.dev/linter/rules/no-dupe-use-directives/): disallow duplicate `use:` directives on the same element.
+- [`noDupeElseIfBlocks`](https://biomejs.dev/linter/rules/no-dupe-else-if-blocks/): disallow duplicate conditions in `{`#if`}` / `{:else if}` chains. For example, `{`#if` a}{:else if a}{/if}` is now reported because the second branch can never execute.
+- [`noDupeStyleProperties`](https://biomejs.dev/linter/rules/no-dupe-style-properties/): disallow duplicate `style:` directives on the same element. For example, `<div style:color="red" style:color="blue" />` is now reported.
+- [`noDupeUseDirectives`](https://biomejs.dev/linter/rules/no-dupe-use-directives/): disallow duplicate `use:` directives on the same element. For example, `<div use:tooltip={a} use:tooltip={a} />` is now reported.As per coding guidelines: “For new lint rules in changesets, show examples of invalid cases in inline code snippets or code blocks, optionally showing valid cases if it helps”.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~7-~7: Loose punctuation mark.
Context: ...ev/linter/rules/no-dupe-else-if-blocks/): disallow duplicate conditions in {#if`}...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~8-~8: Loose punctuation mark.
Context: .../linter/rules/no-dupe-style-properties/): disallow duplicate style: directives ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~9-~9: Loose punctuation mark.
Context: ...ev/linter/rules/no-dupe-use-directives/): disallow duplicate use: directives on...
(UNLIKELY_OPENING_PUNCTUATION)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.changeset/svelte-dupe-rules.md around lines 5 - 9, The changeset adds three
new Svelte lint rules but lacks the required invalid-example snippets; update
the .changeset entry to include at least one invalid Svelte code example for
each rule named noDupeElseIfBlocks, noDupeStyleProperties, and
noDupeUseDirectives (you may also include a valid example for clarity). For each
rule, add a brief fenced code block showing the minimal Svelte template that
violates the rule (e.g., duplicate {:else if} condition for noDupeElseIfBlocks,
repeated style: directives on one element for noDupeStyleProperties, and
repeated use: directives on one element for noDupeUseDirectives) and label them
as invalid cases.
dyc3
left a comment
There was a problem hiding this comment.
Generally, I would try to avoid putting multiple rules in one PR. It's fine for now, just for future reference.
There was a problem hiding this comment.
split this into 3 changesets, one for each rule
| /// Extract the property name text from an `AnySvelteBindingProperty`. | ||
| /// Handles both `SvelteName` (simple identifier) and `SvelteLiteral` (hyphenated name). | ||
| fn property_name_text(property: &AnySvelteBindingProperty) -> Option<String> { | ||
| if let Some(svelte_name) = property.as_svelte_name() { | ||
| let token = svelte_name.ident_token().ok()?; | ||
| return Some(token.text_trimmed().to_string()); | ||
| } | ||
| if let Some(svelte_literal) = property.as_svelte_literal() { | ||
| let token = svelte_literal.value_token().ok()?; | ||
| return Some(token.text_trimmed().to_string()); | ||
| } | ||
| None | ||
| } |
There was a problem hiding this comment.
prefer TokenText over String to avoid the heap allocation
| { | ||
| violations.push(State { | ||
| duplicate_range: directive.range(), | ||
| name: ident.text_trimmed().to_string(), |
There was a problem hiding this comment.
another heap allocated String, use TokenText
| /// | ||
| pub NoDupeStyleProperties { | ||
| version: "next", | ||
| name: "noDupeStyleProperties", |
There was a problem hiding this comment.
rename rule
| name: "noDupeStyleProperties", | |
| name: "noSvelteDuplicateStyleProperties", |
| /// | ||
| pub NoDupeUseDirectives { | ||
| version: "next", | ||
| name: "noDupeUseDirectives", |
There was a problem hiding this comment.
rename rule
| name: "noDupeUseDirectives", | |
| name: "noSvelteDuplicateUseDirectives", |
| fn diagnostic(_ctx: &RuleContext<Self>, state: &Self::State) -> Option<RuleDiagnostic> { | ||
| let name = state.name.as_str(); | ||
| Some( | ||
| RuleDiagnostic::new( | ||
| rule_category!(), | ||
| state.duplicate_range, | ||
| markup! { | ||
| "Duplicate "<Emphasis>"style:"</Emphasis>" directive for property "<Emphasis>{name}</Emphasis>"." | ||
| }, | ||
| ) | ||
| .detail( | ||
| state.original_range, | ||
| "This is the first occurrence of the directive.", | ||
| ), | ||
| ) | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
The diagnostic must explain:
- what is the error
- why is it an error
- how to fix the error
| fn diagnostic(_ctx: &RuleContext<Self>, state: &Self::State) -> Option<RuleDiagnostic> { | ||
| let name = state.name.as_str(); | ||
| Some( | ||
| RuleDiagnostic::new( | ||
| rule_category!(), | ||
| state.duplicate_range, | ||
| markup! { | ||
| "Duplicate "<Emphasis>"use:"</Emphasis>" directive "<Emphasis>{name}</Emphasis>"." | ||
| }, | ||
| ) | ||
| .detail( | ||
| state.original_range, | ||
| "This is the first occurrence of the directive.", | ||
| ), | ||
| ) | ||
| } |
There was a problem hiding this comment.
The diagnostic must explain:
- what is the error
- why is it an error
- how to fix the error
| fn diagnostic(_ctx: &RuleContext<Self>, state: &Self::State) -> Option<RuleDiagnostic> { | ||
| let condition = state.condition.as_str(); | ||
| Some( | ||
| RuleDiagnostic::new( | ||
| rule_category!(), | ||
| state.duplicate_range, | ||
| markup! { | ||
| "This branch can never execute. Its condition "<Emphasis>{condition}</Emphasis>" is a duplicate of a previous condition." | ||
| }, | ||
| ) | ||
| .detail( | ||
| state.original_range, | ||
| "This is the first occurrence of the condition.", | ||
| ), | ||
| ) | ||
| } |
There was a problem hiding this comment.
The diagnostic must explain:
- what is the error
- why is it an error
- how to fix the error
There was a problem hiding this comment.
FYI, link to it https://biomejs.dev/linter/#rule-pillars
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/invalid.svelte.snap.new (1)
1-100:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAccept and commit the snapshot instead of keeping
.snap.new.This still looks like a pending insta snapshot artefact; please run
cargo insta accept(or review/reject) and commit the canonical.snapfile to avoid test/CI churn.
As per coding guidelines: “Use snapshot testing with theinstacrate for testing Rust code, accepting/rejecting changes withcargo insta accept/reject/review.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/invalid.svelte.snap.new` around lines 1 - 100, The failing snapshot file invalid.svelte.snap.new is an unaccepted insta snapshot; run cargo insta accept (or cargo insta review/reject as appropriate) from the tests directory to convert the .snap.new into the canonical .snap, then commit the updated snapshot (the generated invalid.svelte.snap) and remove the .snap.new artifact so crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties uses the accepted snapshot referenced by spec_tests.rs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/no-duplicate-else-if.md:
- Line 5: Update the changeset sentence in .changeset/no-duplicate-else-if.md to
end with a full stop instead of a colon; specifically modify the sentence that
mentions the nursery rule noDuplicateElseIf so the final character is a period
(.) to comply with the changeset style guideline.
---
Outside diff comments:
In
`@crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/invalid.svelte.snap.new`:
- Around line 1-100: The failing snapshot file invalid.svelte.snap.new is an
unaccepted insta snapshot; run cargo insta accept (or cargo insta review/reject
as appropriate) from the tests directory to convert the .snap.new into the
canonical .snap, then commit the updated snapshot (the generated
invalid.svelte.snap) and remove the .snap.new artifact so
crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties
uses the accepted snapshot referenced by spec_tests.rs.
🪄 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: fa0ce64a-b887-4704-bdd5-f0eb77f4561d
⛔ Files ignored due to path filters (11)
crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_configuration/src/generated/linter_options_check.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_html_analyze/tests/specs/nursery/noDuplicateElseIf/invalid.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noDuplicateElseIf/valid.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/invalid.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/valid.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateUseDirectives/invalid.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateUseDirectives/valid.svelte.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 (22)
.changeset/no-duplicate-else-if.md.changeset/no-svelte-duplicate-style-properties.md.changeset/no-svelte-duplicate-use-directives.mdcrates/biome_html_analyze/src/lint/nursery/no_duplicate_else_if.rscrates/biome_html_analyze/src/lint/nursery/no_svelte_duplicate_style_properties.rscrates/biome_html_analyze/src/lint/nursery/no_svelte_duplicate_use_directives.rscrates/biome_html_analyze/tests/specs/nursery/noDuplicateElseIf/invalid.sveltecrates/biome_html_analyze/tests/specs/nursery/noDuplicateElseIf/invalid.svelte.snap.newcrates/biome_html_analyze/tests/specs/nursery/noDuplicateElseIf/valid.sveltecrates/biome_html_analyze/tests/specs/nursery/noDuplicateElseIf/valid.svelte.snap.newcrates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/invalid.sveltecrates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/invalid.svelte.snap.newcrates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/valid.sveltecrates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/valid.svelte.snap.newcrates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateUseDirectives/invalid.sveltecrates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateUseDirectives/invalid.svelte.snap.newcrates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateUseDirectives/valid.sveltecrates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateUseDirectives/valid.svelte.snap.newcrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/no_duplicate_else_if.rscrates/biome_rule_options/src/no_svelte_duplicate_style_properties.rscrates/biome_rule_options/src/no_svelte_duplicate_use_directives.rs
💤 Files with no reviewable changes (9)
- crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/invalid.svelte
- crates/biome_html_analyze/tests/specs/nursery/noDuplicateElseIf/valid.svelte
- crates/biome_html_analyze/tests/specs/nursery/noDuplicateElseIf/valid.svelte.snap.new
- crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateUseDirectives/valid.svelte
- crates/biome_html_analyze/tests/specs/nursery/noDuplicateElseIf/invalid.svelte
- crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/valid.svelte
- crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateUseDirectives/invalid.svelte
- crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateStyleProperties/valid.svelte.snap.new
- crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateUseDirectives/valid.svelte.snap.new
✅ Files skipped from review due to trivial changes (6)
- crates/biome_rule_options/src/no_duplicate_else_if.rs
- .changeset/no-svelte-duplicate-use-directives.md
- .changeset/no-svelte-duplicate-style-properties.md
- crates/biome_html_analyze/src/lint/nursery/no_svelte_duplicate_use_directives.rs
- crates/biome_html_analyze/tests/specs/nursery/noDuplicateElseIf/invalid.svelte.snap.new
- crates/biome_html_analyze/tests/specs/nursery/noSvelteDuplicateUseDirectives/invalid.svelte.snap.new
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Added the nursery rule [`noDuplicateElseIf`](https://biomejs.dev/linter/rules/no-duplicate-else-if/) for Svelte templates: disallow duplicate conditions in `{#if}` / `{:else if}` chains. A condition identical to a previous one can never execute: |
There was a problem hiding this comment.
End the sentence with a full stop.
Tiny docs nit: Line 5 currently ends with a colon; the changeset style requires a full stop at sentence end.
As per coding guidelines: “End every sentence in a changeset with a full stop (.).”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.changeset/no-duplicate-else-if.md at line 5, Update the changeset sentence
in .changeset/no-duplicate-else-if.md to end with a full stop instead of a
colon; specifically modify the sentence that mentions the nursery rule
noDuplicateElseIf so the final character is a period (.) to comply with the
changeset style guideline.
dyc3
left a comment
There was a problem hiding this comment.
Since noDuplicateElseIf is already a stable rule, we'll have to put it in a new PR against the next branch.
| let initializer_text = value | ||
| .initializer() | ||
| .map(|init| init.syntax().text_trimmed().to_string()); | ||
|
|
There was a problem hiding this comment.
This allocates a string. what you probably want is is_node_equal
There was a problem hiding this comment.
snapshots haven't been accepted
Summary
Ports three rules from eslint-plugin-svelte to Biome, all targeting Svelte templates (
.sveltefiles):noDupeElseIfBlocks: disallow duplicate conditions in{#if}/{:else if}chainsnoDupeStyleProperties: disallow duplicatestyle:directives on the same elementnoDupeUseDirectives: disallow duplicateuse:directives on the same elementAll three rules are in the
nurserygroup, tagged withRuleDomain::Svelte, and markedrecommended: true.Test plan
cargo test -p biome_html_analyze)