-
-
Notifications
You must be signed in to change notification settings - Fork 841
feat(analyze/html/vue): add v-bind/v-on style rules #8586
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: 1d5df15 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 |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
aa15832 to
5e3884a
Compare
204192f to
d45faf3
Compare
ematipico
left a 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.
Nothing blocking, but it would be nice if we could use the try operator a bit more as we do in all rules
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs
Outdated
Show resolved
Hide resolved
5e3884a to
657a687
Compare
d45faf3 to
3abd143
Compare
3abd143 to
79b9249
Compare
657a687 to
83be210
Compare
79b9249 to
07548c6
Compare
WalkthroughThis pull request adds two new Vue nursery lint rules: UseVueConsistentVBindStyle and UseVueConsistentVOnStyle. Each rule enforces a consistent directive style (shorthand vs longhand), emits diagnostics, supports auto-fixing by rewriting directives, introduces configuration option types with a VueDirectiveStyle enum and defaults, and includes test fixtures (valid/invalid) plus changeset entries and rule-options module exports. Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (2 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: 1
♻️ Duplicate comments (6)
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs (3)
12-14: Consider splitting the doc comment for readability.The doc comment could be formatted across multiple lines for better readability, separating the rule description from the preference statement.
Suggested format
- /// Enforce a consistent style for `v-bind` in Vue templates. Prefer either shorthand (`:prop="..."`) or longhand (`v-bind:prop="..."`). + /// Enforce a consistent style for `v-bind` in Vue templates. + /// + /// Prefer either shorthand (`:prop="..."`) or longhand (`v-bind:prop="..."`).
152-157: Inconsistent action message phrasing with v-on rule.The v-on rule uses
"Rewrite to shorthand '@' syntax."but this rule uses"Remove v-bind to use the shorthand ':' syntax.". For consistency, consider aligning the phrasing.Suggested fix
- markup! { "Remove v-bind to use the shorthand ':' syntax." }.to_owned(), + markup! { "Rewrite to shorthand ':' syntax." }.to_owned(),
160-172: Use.ok()?for cleaner control flow.The
if let Ok(arg)pattern causes the action to be returned even whensh.arg()fails (mutation would be empty). Using.ok()?would returnNoneearly if the argument extraction fails.Suggested fix
// Convert shorthand :prop to v-bind:prop (AnyVueDirective::VueVBindShorthandDirective(sh), VueDirectiveStyle::Longhand) => { - if let Ok(arg) = sh.arg() { - let mut builder = - make::vue_directive(make::ident("v-bind"), sh.modifiers()).with_arg(arg); - if let Some(init) = sh.initializer() { - builder = builder.with_initializer(init); - } - let new_node = builder.build(); - mutation.replace_node( - AnyVueDirective::VueVBindShorthandDirective(sh.clone()), - AnyVueDirective::VueDirective(new_node), - ); + let arg = sh.arg().ok()?; + let mut builder = + make::vue_directive(make::ident("v-bind"), sh.modifiers()).with_arg(arg); + if let Some(init) = sh.initializer() { + builder = builder.with_initializer(init); } + let new_node = builder.build(); + mutation.replace_node( + AnyVueDirective::VueVBindShorthandDirective(sh.clone()), + AnyVueDirective::VueDirective(new_node), + ); Some(biome_analyze::RuleAction::new(crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs (3)
12-14: Consider splitting the doc comment for readability.Same as the v-bind rule — the doc comment could be formatted across multiple lines for better readability.
Suggested format
- /// Enforce a consistent style for `v-on` in Vue templates. Prefer either shorthand (`@event="..."`) or longhand (`v-on:event="..."`). + /// Enforce a consistent style for `v-on` in Vue templates. + /// + /// Prefer either shorthand (`@event="..."`) or longhand (`v-on:event="..."`).
143-158: Use.ok()?for cleaner control flow.The nested
if let Ok(inner) = arg.arg()pattern can be simplified. Ifarg.arg()fails, the action returns with an empty mutation.Suggested fix
(AnyVueDirective::VueDirective(dir), VueDirectiveStyle::Shorthand) => { let modifiers = dir.modifiers(); let initializer = dir.initializer(); - if let Some(arg) = dir.arg() { - // Build VueVOnShorthandDirective: at_token '@' + arg + modifiers (+initializer) - let at_token = HtmlSyntaxToken::new_detached(T![@], "@", [], []); - if let Ok(inner) = arg.arg() { - let mut builder = - make::vue_v_on_shorthand_directive(at_token, inner, modifiers); - if let Some(init) = initializer { - builder = builder.with_initializer(init); - } - let new_node = builder.build(); - mutation.replace_node( - AnyVueDirective::VueDirective(dir.clone()), - AnyVueDirective::VueVOnShorthandDirective(new_node), - ); - } + let arg = dir.arg()?; + let inner = arg.arg().ok()?; + // Build VueVOnShorthandDirective: at_token '@' + arg + modifiers (+initializer) + let at_token = HtmlSyntaxToken::new_detached(T![@], "@", [], []); + let mut builder = + make::vue_v_on_shorthand_directive(at_token, inner, modifiers); + if let Some(init) = initializer { + builder = builder.with_initializer(init); } + let new_node = builder.build(); + mutation.replace_node( + AnyVueDirective::VueDirective(dir.clone()), + AnyVueDirective::VueVOnShorthandDirective(new_node), + ); Some(biome_analyze::RuleAction::new(
167-184: Use.ok()?for cleaner control flow.Same issue here — the
if let Ok(any_arg) = sh.arg()pattern should use.ok()?for early return.Suggested fix
// Convert shorthand @event to v-on:event (AnyVueDirective::VueVOnShorthandDirective(sh), VueDirectiveStyle::Longhand) => { let name_token = make::ident("v-on"); let modifiers = sh.modifiers(); let initializer = sh.initializer(); - if let Ok(any_arg) = sh.arg() { - // Build VueDirectiveArgument with ':' token and same inner arg - let colon = HtmlSyntaxToken::new_detached(HtmlSyntaxKind::COLON, ":", [], []); - let arg = make::vue_directive_argument(colon, any_arg); - let mut builder = make::vue_directive(name_token, modifiers).with_arg(arg); - if let Some(init) = initializer { - builder = builder.with_initializer(init); - } - let new_node = builder.build(); - mutation.replace_node( - AnyVueDirective::VueVOnShorthandDirective(sh.clone()), - AnyVueDirective::VueDirective(new_node), - ); + let any_arg = sh.arg().ok()?; + // Build VueDirectiveArgument with ':' token and same inner arg + let colon = HtmlSyntaxToken::new_detached(HtmlSyntaxKind::COLON, ":", [], []); + let arg = make::vue_directive_argument(colon, any_arg); + let mut builder = make::vue_directive(name_token, modifiers).with_arg(arg); + if let Some(init) = initializer { + builder = builder.with_initializer(init); } + let new_node = builder.build(); + mutation.replace_node( + AnyVueDirective::VueVOnShorthandDirective(sh.clone()), + AnyVueDirective::VueDirective(new_node), + ); Some(biome_analyze::RuleAction::new(
🧹 Nitpick comments (1)
crates/biome_rule_options/src/use_vue_consistent_v_on_style.rs (1)
14-23: Consider extractingVueDirectiveStyleto a shared module.The
VueDirectiveStyleenum is duplicated betweenuse_vue_consistent_v_bind_style.rsand this file. If both rules always share the same enum semantics, extracting it to a common module would reduce duplication and ensure consistency.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (13)
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/useVueConsistentVBindStyle/invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/valid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/valid.vue.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 (19)
.changeset/add-v-bind-style-rule.md.changeset/add-v-on-style-rule.mdcrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rscrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/valid.vuecrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rscrates/biome_rule_options/src/use_vue_consistent_v_on_style.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
🧠 Learnings (40)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Place new rules inside the `nursery` group during development
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Add `issue_number` field to `declare_lint_rule!` macro for work-in-progress rules
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For new nursery rules, send PRs to the maintenance branch `main`
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).same()` when implementing a rule that matches the behavior of an ESLint rule
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*valid* : Create test files prefixed with `valid` for code that should not trigger the rule
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.json
📚 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/useVueConsistentVOnStyle/longhand-valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.json
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Valid code examples in rule documentation should not trigger any diagnostics
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/valid.vue
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Invalid code examples in rule documentation must be marked with `expect_diagnostic` code block property
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/valid.vue
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*invalid* : Create test files prefixed with `invalid` for code that should trigger the rule
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.json
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For new nursery rules, send PRs to the maintenance branch `main`
Applied to files:
.changeset/add-v-bind-style-rule.md.changeset/add-v-on-style-rule.md
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Place new rules inside the `nursery` group during development
Applied to files:
.changeset/add-v-bind-style-rule.mdcrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.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: 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/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-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_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.json
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*.jsonc : Use `.jsonc` files to contain arrays of code snippet strings for snapshot tests
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.json
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `full_options` code block property for complete biome.json configuration snippets in documentation
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.json
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `options` code block property for rule-specific configuration snippets in documentation
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.options.jsoncrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 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/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.json
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Wrap rule options fields in `Option<>` to properly track set and unset options during merge
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be placed inside the `biome_rule_options` crate
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Implement `Merge` trait for rule options to support configuration inheritance
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `rename_all = "camelCase"` in serde derive macro for rule options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `deny_unknown_fields` in serde derive macro for rule options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `Box<[T]>` instead of `Vec<T>` for rule options arrays to save memory
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `version` field to `next` in `declare_lint_rule!` macro
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation must include `## Options` section if the rule has options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Assist rules should detect refactoring opportunities and emit code action signals
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Add `issue_number` field to `declare_lint_rule!` macro for work-in-progress rules
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-22T09:26:56.943Z
Learnt from: ematipico
Repo: biomejs/biome PR: 8537
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:167-210
Timestamp: 2025-12-22T09:26:56.943Z
Learning: When defining lint rules (declare_lint_rule!), only specify fix_kind if the rule implements an action(...) function. Rules that only emit diagnostics without a code fix should omit fix_kind. This applies to all Rust lint rule definitions under crates/.../src/lint (e.g., crates/biome_js_analyze/src/lint/...).
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Specify `fix_kind: FixKind::Safe` in `declare_lint_rule!` for safe code actions
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).inspired()` when implementing a rule inspired by but with different behavior than an ESLint rule
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should perform static analysis of source code to detect invalid or error-prone patterns and emit diagnostics with proposed fixes
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).same()` when implementing a rule that matches the behavior of an ESLint rule
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Specify `fix_kind: FixKind::Unsafe` in `declare_lint_rule!` for unsafe code actions
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_lint_rule!` macro to declare analyzer rule types and implement the RuleMeta trait
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Add `sources` field with `RuleSource` to cite ESLint or other rules that inspired the implementation
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use try operator `?` when `run` function returns `Option` to transform `Result` into `Option`
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Implement `action` function in Rule trait to provide code actions
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should check syntax according to language specification and emit error diagnostics
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation code blocks should be ordered as language, expect_diagnostic, options/full_options/use_options, ignore, file
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `use_options` code block property for code examples that follow an options configuration in documentation
Applied to files:
crates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options struct must derive `Deserializable`, `Serialize`, `Deserialize`, and optionally `JsonSchema`
Applied to files:
crates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: Applies to **/*.rs : Use inline rustdoc documentation for rules, assists, and their options
Applied to files:
crates/biome_rule_options/src/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `domains` field in `declare_lint_rule!` to tag rules that belong to specific concepts like testing or frameworks
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
🧬 Code graph analysis (3)
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs (3)
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs (3)
run(72-96)diagnostic(98-133)action(135-194)crates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs (1)
style(28-30)crates/biome_rule_options/src/use_vue_consistent_v_on_style.rs (1)
style(28-30)
crates/biome_rule_options/src/use_vue_consistent_v_on_style.rs (1)
crates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs (1)
style(28-30)
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs (2)
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs (3)
run(72-96)diagnostic(98-133)action(135-182)crates/biome_rule_options/src/use_vue_consistent_v_on_style.rs (1)
style(28-30)
⏰ 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). (11)
- GitHub Check: Test Node.js API
- GitHub Check: Check JS Files
- GitHub Check: autofix
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Documentation
- GitHub Check: Check Dependencies
- GitHub Check: End-to-end tests
- GitHub Check: Bench (biome_configuration)
🔇 Additional comments (19)
.changeset/add-v-bind-style-rule.md (1)
1-5: LGTM!Changelog entry is clear and follows the standard format.
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.options.json (1)
1-15: LGTM!Test configuration correctly sets the longhand style option.
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.json (1)
1-15: LGTM!Configuration correctly sets longhand style for testing invalid shorthand usage.
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/valid.vue (1)
1-4: LGTM!Valid test case correctly uses shorthand syntax with the default configuration.
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.options.json (1)
1-15: LGTM!Test configuration correctly enables the longhand style option for v-on directives.
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/valid.vue (1)
1-4: LGTM!Valid test case correctly demonstrates shorthand v-bind syntax with the default configuration.
.changeset/add-v-on-style-rule.md (1)
1-5: LGTM!Changelog entry accurately describes the new v-on style rule.
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/invalid.vue (1)
1-5: Test case correctly uses longhand v-on syntax.The test appropriately demonstrates invalid longhand usage with the default shorthand preference. Minor observation: inconsistent indentation (tab on line 3, spaces on line 4) – likely inconsequential for this rule test, but worth noting.
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.vue (1)
1-4: LGTM!Test fixture correctly demonstrates valid longhand
v-bindusage.crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.json (1)
1-15: LGTM!Configuration correctly enables the rule with longhand style option.
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.vue (1)
1-4: LGTM!Test fixture correctly demonstrates that shorthand is invalid when longhand style is configured.
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.vue (1)
1-4: LGTM!Test fixture correctly demonstrates that shorthand
@is invalid when longhandv-on:style is configured.crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.vue (1)
1-4: LGTM!Test fixture correctly demonstrates valid longhand
v-onusage.crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/invalid.vue (1)
1-5: LGTM!Test fixture correctly demonstrates that longhand
v-bind:is invalid when the default shorthand style is active.crates/biome_rule_options/src/lib.rs (1)
401-402: LGTM!Module declarations correctly expose the new Vue directive style option modules.
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs (1)
66-96: LGTM!The
runfunction correctly identifies v-bind directives and returns violations based on the configured style preference.crates/biome_rule_options/src/use_vue_consistent_v_on_style.rs (1)
1-31: LGTM!The options struct is well-structured with proper serde configuration, derives, and a sensible default. Follows the established pattern in the codebase.
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs (2)
72-96: LGTM!The
runfunction correctly identifies v-on directives and returns violations based on the configured style preference.
98-133: LGTM!The diagnostic function is well-structured with clear messages and appropriate
debug_assertguards for the unreachable branches.
| use biome_deserialize_macros::{Deserializable, Merge}; | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| #[derive(Default, Clone, Debug, Deserialize, Deserializable, Merge, Eq, PartialEq, Serialize)] | ||
| #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] | ||
| #[serde(rename_all = "camelCase", deny_unknown_fields, default)] | ||
| pub struct UseVueConsistentVBindStyleOptions { | ||
| /// Preferred style for `v-bind` usage: "shorthand" or "longhand". | ||
| /// If omitted, shorthand is preferred. | ||
| #[serde(skip_serializing_if = "Option::<_>::is_none")] | ||
| pub style: Option<VueDirectiveStyle>, | ||
| } | ||
|
|
||
| #[derive( | ||
| Clone, Copy, Default, Debug, Deserialize, Deserializable, Merge, Eq, PartialEq, Serialize, | ||
| )] | ||
| #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub enum VueDirectiveStyle { | ||
| #[default] | ||
| Shorthand, | ||
| Longhand, | ||
| } | ||
|
|
||
| impl UseVueConsistentVBindStyleOptions { | ||
| pub const DEFAULT_STYLE: VueDirectiveStyle = VueDirectiveStyle::Shorthand; | ||
|
|
||
| pub fn style(&self) -> VueDirectiveStyle { | ||
| self.style.unwrap_or(Self::DEFAULT_STYLE) | ||
| } | ||
| } |
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
Add rustdoc documentation to public API.
The struct, enum, constant, and method lack rustdoc comments. Per coding guidelines, inline documentation is required for rule options.
🔎 Suggested documentation structure
+/// Options for the `useVueConsistentVBindStyle` rule.
+///
+/// Enforces consistent usage of either shorthand (`:`) or longhand (`v-bind:`) form.
#[derive(Default, Clone, Debug, Deserialize, Deserializable, Merge, Eq, PartialEq, Serialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields, default)]
pub struct UseVueConsistentVBindStyleOptions {
- /// Preferred style for `v-bind` usage: "shorthand" or "longhand".
- /// If omitted, shorthand is preferred.
+ /// Preferred style for `v-bind` directives.
+ ///
+ /// Defaults to [`VueDirectiveStyle::Shorthand`] if not specified.
#[serde(skip_serializing_if = "Option::<_>::is_none")]
pub style: Option<VueDirectiveStyle>,
}
+/// Represents the style preference for Vue directives.
#[derive(
Clone, Copy, Default, Debug, Deserialize, Deserializable, Merge, Eq, PartialEq, Serialize,
)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[serde(rename_all = "camelCase")]
pub enum VueDirectiveStyle {
+ /// Use shorthand form (`:prop` or `@event`).
#[default]
Shorthand,
+ /// Use longhand form (`v-bind:prop` or `v-on:event`).
Longhand,
}
impl UseVueConsistentVBindStyleOptions {
+ /// The default directive style when none is specified.
pub const DEFAULT_STYLE: VueDirectiveStyle = VueDirectiveStyle::Shorthand;
+ /// Returns the configured style, or the default if not set.
pub fn style(&self) -> VueDirectiveStyle {
self.style.unwrap_or(Self::DEFAULT_STYLE)
}
}Based on coding guidelines.
📝 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.
| use biome_deserialize_macros::{Deserializable, Merge}; | |
| use serde::{Deserialize, Serialize}; | |
| #[derive(Default, Clone, Debug, Deserialize, Deserializable, Merge, Eq, PartialEq, Serialize)] | |
| #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] | |
| #[serde(rename_all = "camelCase", deny_unknown_fields, default)] | |
| pub struct UseVueConsistentVBindStyleOptions { | |
| /// Preferred style for `v-bind` usage: "shorthand" or "longhand". | |
| /// If omitted, shorthand is preferred. | |
| #[serde(skip_serializing_if = "Option::<_>::is_none")] | |
| pub style: Option<VueDirectiveStyle>, | |
| } | |
| #[derive( | |
| Clone, Copy, Default, Debug, Deserialize, Deserializable, Merge, Eq, PartialEq, Serialize, | |
| )] | |
| #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] | |
| #[serde(rename_all = "camelCase")] | |
| pub enum VueDirectiveStyle { | |
| #[default] | |
| Shorthand, | |
| Longhand, | |
| } | |
| impl UseVueConsistentVBindStyleOptions { | |
| pub const DEFAULT_STYLE: VueDirectiveStyle = VueDirectiveStyle::Shorthand; | |
| pub fn style(&self) -> VueDirectiveStyle { | |
| self.style.unwrap_or(Self::DEFAULT_STYLE) | |
| } | |
| } | |
| use biome_deserialize_macros::{Deserializable, Merge}; | |
| use serde::{Deserialize, Serialize}; | |
| /// Options for the `useVueConsistentVBindStyle` rule. | |
| /// | |
| /// Enforces consistent usage of either shorthand (`:`) or longhand (`v-bind:`) form. | |
| #[derive(Default, Clone, Debug, Deserialize, Deserializable, Merge, Eq, PartialEq, Serialize)] | |
| #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] | |
| #[serde(rename_all = "camelCase", deny_unknown_fields, default)] | |
| pub struct UseVueConsistentVBindStyleOptions { | |
| /// Preferred style for `v-bind` directives. | |
| /// | |
| /// Defaults to [`VueDirectiveStyle::Shorthand`] if not specified. | |
| #[serde(skip_serializing_if = "Option::<_>::is_none")] | |
| pub style: Option<VueDirectiveStyle>, | |
| } | |
| /// Represents the style preference for Vue directives. | |
| #[derive( | |
| Clone, Copy, Default, Debug, Deserialize, Deserializable, Merge, Eq, PartialEq, Serialize, | |
| )] | |
| #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] | |
| #[serde(rename_all = "camelCase")] | |
| pub enum VueDirectiveStyle { | |
| /// Use shorthand form (`:prop` or `@event`). | |
| #[default] | |
| Shorthand, | |
| /// Use longhand form (`v-bind:prop` or `v-on:event`). | |
| Longhand, | |
| } | |
| impl UseVueConsistentVBindStyleOptions { | |
| /// The default directive style when none is specified. | |
| pub const DEFAULT_STYLE: VueDirectiveStyle = VueDirectiveStyle::Shorthand; | |
| /// Returns the configured style, or the default if not set. | |
| pub fn style(&self) -> VueDirectiveStyle { | |
| self.style.unwrap_or(Self::DEFAULT_STYLE) | |
| } | |
| } |
🤖 Prompt for AI Agents
In crates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs around lines
1 to 31, public API items (the UseVueConsistentVBindStyleOptions struct, its
style field, the VueDirectiveStyle enum and its variants, the DEFAULT_STYLE
constant, and the style() method) lack rustdoc comments; add concise /// doc
comments for each public item: document the struct's purpose and when to
configure it, document the style field meaning and accepted values, document the
enum and each variant (Shorthand and Longhand) describing behavior, document
DEFAULT_STYLE as the built-in fallback, and document style() to state it returns
the configured style or the DEFAULT_STYLE when unset; follow project doc style
(///, brief summary sentence then optional details) and keep wording consistent
with existing rule-option docs.
CodSpeed Performance ReportMerging #8586 will not alter performanceComparing Summary
Footnotes
|
07548c6 to
0a828ea
Compare
0a828ea to
fdbd85b
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/use_vue_consistent_v_bind_style.rs (1)
1-31: Add rustdoc documentation to public API.The struct, enum, constant, and method lack comprehensive rustdoc comments. Per coding guidelines, inline documentation is required for rule options.
🧹 Nitpick comments (1)
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs (1)
98-133: Consider consolidating the match blocks.The message and note generation have identical match patterns. Could be combined into a single match returning a tuple, though the current approach is clear enough.
🔎 Optional consolidation
fn diagnostic(ctx: &RuleContext<Self>, state: &Self::State) -> Option<RuleDiagnostic> { let prefer = ctx.options().style(); - let message = match (state, prefer) { + let (message, note) = match (state, prefer) { (AnyVueDirective::VueDirective(_), VueDirectiveStyle::Shorthand) => { - markup! { "Use shorthand '@' syntax instead of 'v-on'." } + ( + markup! { "Use shorthand '@' syntax instead of 'v-on'." }, + markup! { "This project prefers to use shorthand syntax for v-on." }, + ) } (AnyVueDirective::VueVOnShorthandDirective(_), VueDirectiveStyle::Longhand) => { - markup! { "Use longhand 'v-on' syntax instead of '@'." } + ( + markup! { "Use longhand 'v-on' syntax instead of '@'." }, + markup! { "This project prefers to use longhand syntax for v-on." }, + ) } _ => { debug_assert!( false, "Diagnostic should only be created for invalid states." ); return None; } }; - let note = match (state, prefer) { - (AnyVueDirective::VueDirective(_), VueDirectiveStyle::Shorthand) => { - markup! { "This project prefers to use shorthand syntax for v-on." } - } - (AnyVueDirective::VueVOnShorthandDirective(_), VueDirectiveStyle::Longhand) => { - markup! { "This project prefers to use longhand syntax for v-on." } - } - _ => { - debug_assert!( - false, - "Diagnostic should only be created for invalid states." - ); - return None; - } - }; Some(RuleDiagnostic::new(rule_category!(), state.range(), message).note(note)) }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (13)
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/useVueConsistentVBindStyle/invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/valid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/valid.vue.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 (19)
.changeset/add-v-bind-style-rule.md.changeset/add-v-on-style-rule.mdcrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rscrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.options.jsoncrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/valid.vuecrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rscrates/biome_rule_options/src/use_vue_consistent_v_on_style.rs
✅ Files skipped from review due to trivial changes (1)
- crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.options.json
🚧 Files skipped from review as they are similar to previous changes (13)
- crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs
- crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.options.json
- crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.vue
- crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/valid.vue
- crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.options.json
- crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-invalid.vue
- crates/biome_rule_options/src/use_vue_consistent_v_on_style.rs
- crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/invalid.vue
- crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-valid.options.json
- crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVOnStyle/longhand-valid.vue
- crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/longhand-invalid.vue
- .changeset/add-v-bind-style-rule.md
- .changeset/add-v-on-style-rule.md
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use thedbg!()macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
🧠 Learnings (35)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: For new nursery rules, send PRs to the maintenance branch `main`
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Wrap rule options fields in `Option<>` to properly track set and unset options during merge
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be placed inside the `biome_rule_options` crate
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `rename_all = "camelCase"` in serde derive macro for rule options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Implement `Merge` trait for rule options to support configuration inheritance
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `deny_unknown_fields` in serde derive macro for rule options
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `Box<[T]>` instead of `Vec<T>` for rule options arrays to save memory
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `version` field to `next` in `declare_lint_rule!` macro
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `options` code block property for rule-specific configuration snippets in documentation
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Assist rules should detect refactoring opportunities and emit code action signals
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Add `sources` field with `RuleSource` to cite ESLint or other rules that inspired the implementation
Applied to files:
crates/biome_rule_options/src/lib.rscrates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*valid* : Create test files prefixed with `valid` for code that should not trigger the rule
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/valid.vuecrates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/invalid.vue
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Add `issue_number` field to `declare_lint_rule!` macro for work-in-progress rules
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).inspired()` when implementing a rule inspired by but with different behavior than an ESLint rule
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_lint_rule!` macro to declare analyzer rule types and implement the RuleMeta trait
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-22T09:26:56.943Z
Learnt from: ematipico
Repo: biomejs/biome PR: 8537
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:167-210
Timestamp: 2025-12-22T09:26:56.943Z
Learning: When defining lint rules (declare_lint_rule!), only specify fix_kind if the rule implements an action(...) function. Rules that only emit diagnostics without a code fix should omit fix_kind. This applies to all Rust lint rule definitions under crates/.../src/lint (e.g., crates/biome_js_analyze/src/lint/...).
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should perform static analysis of source code to detect invalid or error-prone patterns and emit diagnostics with proposed fixes
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).same()` when implementing a rule that matches the behavior of an ESLint rule
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Specify `fix_kind: FixKind::Safe` in `declare_lint_rule!` for safe code actions
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Place new rules inside the `nursery` group during development
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use try operator `?` when `run` function returns `Option` to transform `Result` into `Option`
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Implement `action` function in Rule trait to provide code actions
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Specify `fix_kind: FixKind::Unsafe` in `declare_lint_rule!` for unsafe code actions
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should check syntax according to language specification and emit error diagnostics
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation code blocks should be ordered as language, expect_diagnostic, options/full_options/use_options, ignore, file
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rscrates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Each invalid code example in rule documentation must emit exactly one diagnostic
Applied to files:
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation must include `## Options` section if the rule has options
Applied to files:
crates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `use_options` code block property for code examples that follow an options configuration in documentation
Applied to files:
crates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `full_options` code block property for complete biome.json configuration snippets in documentation
Applied to files:
crates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: Applies to **/*.rs : Use inline rustdoc documentation for rules, assists, and their options
Applied to files:
crates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Each rule option must have its own h3 header with description, default value, options block, and code example
Applied to files:
crates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-21T21:15:03.796Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.796Z
Learning: Applies to **/*.rs : Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests
Applied to files:
crates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options struct must derive `Deserializable`, `Serialize`, `Deserialize`, and optionally `JsonSchema`
Applied to files:
crates/biome_rule_options/src/use_vue_consistent_v_bind_style.rs
📚 Learning: 2025-12-19T12:53:30.413Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.413Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*invalid* : Create test files prefixed with `invalid` for code that should trigger the rule
Applied to files:
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/invalid.vue
📚 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/useVueConsistentVBindStyle/invalid.vue
🧬 Code graph analysis (1)
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs (2)
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_bind_style.rs (3)
run(72-96)diagnostic(98-133)action(135-180)crates/biome_rule_options/src/use_vue_consistent_v_on_style.rs (1)
style(28-30)
⏰ 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). (9)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Documentation
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Check Dependencies
- GitHub Check: Test Node.js API
- GitHub Check: Check JS Files
- GitHub Check: autofix
- GitHub Check: Bench (biome_configuration)
🔇 Additional comments (6)
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/valid.vue (1)
1-4: LGTM!Clean and correct test case for the default shorthand style. The comment and structure follow conventions.
crates/biome_html_analyze/tests/specs/nursery/useVueConsistentVBindStyle/invalid.vue (1)
1-5: LGTM!Good coverage with two test cases for the invalid longhand usage. The mixed indentation (tab on line 3, spaces on line 4) might be intentional for testing purposes.
crates/biome_rule_options/src/lib.rs (1)
401-402: LGTM!Module declarations are correctly placed in alphabetical order among the other Vue rules.
crates/biome_html_analyze/src/lint/nursery/use_vue_consistent_v_on_style.rs (3)
12-64: LGTM!Rule declaration follows conventions with proper metadata, documentation, and examples. The
version: "next"and source attribution are correctly set.
72-96: LGTM!Clean implementation using the
ok()?pattern as recommended. The matching logic correctly identifies style violations.
135-190: LGTM!The action function correctly handles both conversion directions. The asymmetric
dir.arg()?.arg().ok()?vssh.arg().ok()?reflects the different AST structures for longhand (withVueDirectiveArgumentwrapper) versus shorthand forms.

Summary
This adds 2 new vue html lint rules that I consider to be a little more high value, but they are still pretty simple.
useVueConsistentVBindStyleuseVueConsistentVOnStyleIt's mostly AI generated, but I had to intervene pretty heavily for writing the diagnostic messages, and the code fix. Of course I reviewed it myself to make sure it wasn't doing anything crazy stupid.
I chose to implement some of the options for the source rule because the logic was trivial.
Test Plan
snapshots
Docs