-
-
Notifications
You must be signed in to change notification settings - Fork 839
feat(lint): add noVueOptionsApi rule #8648
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: 7bd398f 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 |
WalkthroughAdds a new nursery lint rule Possibly related PRs
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
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (29)
📒 Files selected for processing (28)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (18)
🧰 Additional context used📓 Path-based instructions (1)**/*.rs📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
🧠 Learnings (28)📚 Learning: 2025-11-24T18:05:20.371ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-11-21T01:10:53.059ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-12-21T21:15:03.796ZApplied to files:
📚 Learning: 2025-12-31T15:35:41.261ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-11-24T18:05:42.356ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-12-04T13:29:49.287ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-12-31T15:35:32.899ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-12-22T09:26:56.943ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-10-03T12:28:56.788ZApplied to files:
📚 Learning: 2025-11-24T18:05:27.810ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2025-12-21T21:15:03.796ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
📚 Learning: 2026-01-02T14:58:16.536ZApplied to files:
🧬 Code graph analysis (2)crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-definecomponent-function-with-options.js (2)
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs (5)
⏰ 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). (16)
🔇 Additional comments (11)
✏️ Tip: You can disable this entire section by setting 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-functional-component.js (1)
1-5: Consider importinghfor a more realistic test.Whilst this correctly tests that functional components don't trigger the rule, the
hfunction should be imported from 'vue' to represent valid Vue 3 code.🔎 Suggested addition
+import { h } from 'vue' + // should not generate diagnostics export default function MyComponent(props) { return h('div', props.message) }crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-mixed-setup-data.vue (1)
5-5: Consider addingimport { ref } from 'vue'for test realism (optional).Whilst test fixtures needn't be executable, adding the import would make this more representative of real-world code. Not critical, as the rule analyses syntax rather than runtime behaviour.
Suggested enhancement
<script> +import { ref } from 'vue' + // Mixed setup() with Options API is not supported in Vapor Mode export default { setup() {crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-full-options-api.vue (1)
2-4: Consider clarifying the comment regarding which properties are flagged.The comment states "all should be flagged", but
name(line 4) is component metadata rather than an Options API property requiring migration. The rule targetsdata,methods,computed,watch, lifecycle hooks,props, etc.Suggested clarification
-// Full Options API component with multiple properties - all should be flagged +// Full Options API component - all Options API properties should be flagged export default { name: 'MyComponent',crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-composition-setup-only.vue (1)
1-11: Test case looks good.Correctly validates that pure Composition API with
setup()doesn't trigger the rule.Optional: Add import for completeness
Whilst not required for lint testing, adding the import would make the example more realistic:
<script> +import { ref } from 'vue' /* should not generate diagnostics */ // Pure Composition API with setup() is valid export default {crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs (1)
188-224: Consider extracting the duplicated detection logic.The three match arms for
OptionsApi,DefineComponent, andCreateAppcontain identical logic. This could be refactored to reduce duplication.🔎 Proposed refactor
If the
VueOptionsApiBasedComponenttrait (or similar) exposesiter_declaration_groups(), you could unify this:- match component.kind() { - AnyVueComponent::OptionsApi(opts) => { - for (name, member) in opts.iter_declaration_groups() { - let name_text = name.text(); - // Allow pure setup() - only flag if has other Options API props - if name_text != "setup" && OPTIONS_API_PROPERTIES.contains(&name_text) { - signals.push(RuleState { - range: member.range(), - property_name: name_text.to_string(), - }); - } - } - } - AnyVueComponent::DefineComponent(dc) => { - for (name, member) in dc.iter_declaration_groups() { - let name_text = name.text(); - if name_text != "setup" && OPTIONS_API_PROPERTIES.contains(&name_text) { - signals.push(RuleState { - range: member.range(), - property_name: name_text.to_string(), - }); - } - } - } - AnyVueComponent::CreateApp(ca) => { - for (name, member) in ca.iter_declaration_groups() { - let name_text = name.text(); - if name_text != "setup" && OPTIONS_API_PROPERTIES.contains(&name_text) { - signals.push(RuleState { - range: member.range(), - property_name: name_text.to_string(), - }); - } - } - } - _ => {} - } + let declaration_groups: Box<dyn Iterator<Item = _>> = match component.kind() { + AnyVueComponent::OptionsApi(opts) => Box::new(opts.iter_declaration_groups()), + AnyVueComponent::DefineComponent(dc) => Box::new(dc.iter_declaration_groups()), + AnyVueComponent::CreateApp(ca) => Box::new(ca.iter_declaration_groups()), + _ => return signals, + }; + + for (name, member) in declaration_groups { + let name_text = name.text(); + if name_text != "setup" && OPTIONS_API_PROPERTIES.contains(&name_text) { + signals.push(RuleState { + range: member.range(), + property_name: name_text.to_string(), + }); + } + }Alternatively, a helper closure or macro could achieve the same. This is a minor nit—the current code is perfectly readable.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (24)
crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_configuration/src/generated/domain_selector.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_js_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-createapp-data.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-definecomponent-data.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-computed.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-data.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-methods.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-mounted.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-watch.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-full-options-api.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-mixed-setup-data.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-class-export.js.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-composition-setup-only.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-definecomponent-setup.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-empty-object.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-functional-component.js.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-non-vue-object.js.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-passthrough-export.js.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-script-setup.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 (22)
.changeset/add-no-v-options-api.mdcrates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-createapp-data.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-definecomponent-data.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-computed.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-data.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-methods.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-mounted.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-watch.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-full-options-api.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-mixed-setup-data.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-class-export.jscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-composition-setup-only.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-definecomponent-setup.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-empty-object.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-functional-component.jscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-non-vue-object.jscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-passthrough-export.jscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-script-setup.vuecrates/biome_rule_options/src/lib.rscrates/biome_rule_options/src/no_vue_options_api.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/no_vue_options_api.rscrates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
🧠 Learnings (32)
📓 Common learnings
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.
📚 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_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-definecomponent-data.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-mixed-setup-data.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-createapp-data.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-full-options-api.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/**/*valid* : Create test files prefixed with `valid` for code that should not trigger the rule
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-definecomponent-data.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-functional-component.jscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-non-vue-object.jscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-class-export.jscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-script-setup.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-createapp-data.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-full-options-api.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-empty-object.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-composition-setup-only.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-passthrough-export.js
📚 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/no_vue_options_api.rscrates/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/**/biome_rule_options/lib/**/*.rs : Rule options struct must derive `Deserializable`, `Serialize`, `Deserialize`, and optionally `JsonSchema`
Applied to files:
crates/biome_rule_options/src/no_vue_options_api.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 : Wrap rule options fields in `Option<>` to properly track set and unset options during merge
Applied to files:
crates/biome_rule_options/src/no_vue_options_api.rscrates/biome_rule_options/src/lib.rscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vuecrates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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/no_vue_options_api.rscrates/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 : Rule documentation must include `## Options` section if the rule has options
Applied to files:
crates/biome_rule_options/src/no_vue_options_api.rscrates/biome_rule_options/src/lib.rscrates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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/no_vue_options_api.rscrates/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/**/biome_rule_options/lib/**/*.rs : Rule options must be placed inside the `biome_rule_options` crate
Applied to files:
crates/biome_rule_options/src/no_vue_options_api.rscrates/biome_rule_options/src/lib.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_rule_options/src/no_vue_options_api.rscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vuecrates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs.changeset/add-no-v-options-api.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/**/*.rs : Use `full_options` code block property for complete biome.json configuration snippets in documentation
Applied to files:
crates/biome_rule_options/src/no_vue_options_api.rscrates/biome_rule_options/src/lib.rscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-full-options-api.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 : Use `options` code block property for rule-specific configuration snippets in documentation
Applied to files:
crates/biome_rule_options/src/no_vue_options_api.rscrates/biome_rule_options/src/lib.rscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vuecrates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-non-vue-object.jscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-full-options-api.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_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-non-vue-object.jscrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-script-setup.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/**/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-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : No module may copy or clone data from another module in the module graph, not even behind an `Arc`
Applied to files:
crates/biome_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/tests/specs/**/*.jsonc : Use `.jsonc` files to contain arrays of code snippet strings for snapshot tests
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vuecrates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-script-setup.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/**/*.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2025-12-31T15:35:32.899Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8639
File: crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs:101-108
Timestamp: 2025-12-31T15:35:32.899Z
Learning: In Rust lint rules under the nursery category, the issue_number field in declare_lint_rule! is optional and should not be added unless there is a compelling reason. In code reviews, verify that no unnecessary issue_number is included in nursery lint declarations. Only add issue_number if there is an explicit, justified reason (e.g., tracked issue for external observers). This guidance broadly applies to all nursery lint rule files, not just the single file.
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.rs.changeset/add-no-v-options-api.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/**/*.rs : Use `declare_lint_rule!` macro to declare analyzer rule types and implement the RuleMeta trait
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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 `deprecated` field to `declare_lint_rule!` macro when deprecating a rule
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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 : Invalid code examples in rule documentation must be marked with `expect_diagnostic` code block property
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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: For new nursery rules, send PRs to the maintenance branch `main`
Applied to files:
.changeset/add-no-v-options-api.md
📚 Learning: 2025-12-31T15:35:41.261Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8639
File: crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs:101-108
Timestamp: 2025-12-31T15:35:41.261Z
Learning: In crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs, the `issue_number` field in `declare_lint_rule!` macro is optional and the vast majority of nursery rules do not need it. Do not recommend adding `issue_number` unless there's a specific reason.
Applied to files:
.changeset/add-no-v-options-api.md
🧬 Code graph analysis (3)
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-functional-component.js (1)
crates/biome_js_analyze/tests/specs/suspicious/noRedeclare/valid-declaration-merging.ts (1)
h(131-133)
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs (1)
crates/biome_analyze/src/rule.rs (3)
recommended(619-622)domains(649-652)sources(634-637)
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-passthrough-export.js (1)
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-functional-component.js (1)
MyComponent(2-4)
🔇 Additional comments (20)
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-class-export.js (1)
1-6: Good test case for preventing false positives.This correctly validates that class-based exports with methods named like Options API properties shouldn't trigger the rule. The noVueOptionsApi rule properly targets Vue component patterns (plain objects, defineComponent, createApp) rather than arbitrary classes.
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-empty-object.vue (1)
1-5: LGTM!Valid test case – an empty component object correctly demonstrates that the rule doesn't flag non-Options-API patterns.
crates/biome_rule_options/src/lib.rs (1)
261-261: LGTM!Module correctly added in alphabetical order amongst the other Vue rule options.
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vue (1)
1-14: LGTM!Test correctly validates detection of multiple Options API properties in a single component.
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-definecomponent-data.vue (1)
1-10: LGTM!Test correctly validates that Options API usage is detected within
defineComponent()wrappers.crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-definecomponent-setup.vue (1)
1-13: Test fixture correctly represents valid Composition API usage.This test case properly demonstrates defineComponent with setup() function, which is Vapor Mode compatible and should not trigger diagnostics.
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-createapp-data.vue (1)
1-10: Test fixture correctly represents invalid Options API usage.This test case properly demonstrates createApp with the Options API data property, which should trigger diagnostics as it's incompatible with Vapor Mode.
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-script-setup.vue (1)
1-12: Test fixture correctly represents valid Composition API usage.This test case properly demonstrates the <script setup> syntax, which is the recommended Vapor Mode compatible pattern and should not trigger diagnostics.
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-mounted.vue (1)
1-9: Test fixture correctly represents invalid Options API usage.This test case properly demonstrates the Options API mounted() lifecycle hook, which should trigger diagnostics as it's incompatible with Vapor Mode.
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-methods.vue (1)
1-11: Test fixture correctly represents invalid Options API usage.This test case properly demonstrates the Options API methods property, which should trigger diagnostics as it's incompatible with Vapor Mode.
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-data.vue (1)
1-8: Test fixture looks correct.Clear, minimal test case for detecting
data()Options API usage. Comment appropriately explains the incompatibility..changeset/add-no-v-options-api.md (1)
1-22: Changeset documentation is clear and well-structured.Proper format, concise explanation, and helpful examples contrasting invalid and valid patterns. Good work.
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-watch.vue (1)
1-10: Test fixture appropriately demonstrateswatchdetection.The fixture correctly tests Options API watch option detection. The referenced
countproperty needn't be defined for the lint rule to function.crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-full-options-api.vue (1)
5-27: Excellent comprehensive test coverage.This fixture nicely exercises multiple Options API properties (
props,data,computed,watch,methods,mounted) in a single component, ensuring the rule can detect and report multiple diagnostics correctly.crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-passthrough-export.js (1)
1-3: Test case looks good.The passthrough export pattern is correctly identified as valid—the rule should only flag component definitions, not re-exports.
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-computed.vue (1)
1-10: Test case looks good.Correctly demonstrates Options API
computedusage that should trigger diagnostics for Vapor Mode incompatibility.crates/biome_rule_options/src/no_vue_options_api.rs (1)
1-6: Spot on—follows all conventions.Empty options struct with proper derives (
Deserializable,Merge, serde traits) and attributes (camelCase,deny_unknown_fields). Standard practice for rules without configuration options.crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/valid-non-vue-object.js (1)
1-6: Edge case properly tested. Plain objects with Options API–like properties in.jsfiles correctly bypass the rule since the implementation distinguishes Vue components from regular exports via file type and component pattern detection.crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs (2)
11-74: Well-structured rule declaration.Documentation is clear, examples are correctly annotated with
expect_diagnostic, and the metadata follows nursery conventions (version: "next",recommended: false). Based on learnings, this aligns with Biome's lint rule guidelines.
229-247: Clear and helpful diagnostics.The diagnostic messages are well-crafted: they identify the offending property, explain the Vapor Mode constraint, and suggest a specific Composition API alternative. This will be genuinely useful for developers migrating their codebases.
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.
Thank you! The code can be improved and simplified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs (1)
244-277: Consider extracting the common iteration logic.The three match arms for
OptionsApi,DefineComponent, andCreateAppperform identical operations. You could reduce duplication with a helper function, though the current structure is perfectly functional.🔎 Potential refactor
fn check_properties<'a>( iter: impl Iterator<Item = (TokenText, impl AstNode)>, ) -> Option<RuleState> { for (name, member) in iter { let name_text = name.text(); if name_text != "setup" && OPTIONS_API_PROPERTIES.contains(&name_text) { return Some(RuleState { range: member.range(), property_name: name, }); } } None } // Then in run(): match component.kind() { AnyVueComponent::OptionsApi(opts) => check_properties(opts.iter_declaration_groups()), AnyVueComponent::DefineComponent(dc) => check_properties(dc.iter_declaration_groups()), AnyVueComponent::CreateApp(ca) => check_properties(ca.iter_declaration_groups()), _ => None, }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-full-options-api.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vue.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (1)
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.rs
🧠 Learnings (27)
📓 Common learnings
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.
📚 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_js_analyze/src/lint/nursery/no_vue_options_api.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 : Wrap rule options fields in `Option<>` to properly track set and unset options during merge
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2025-12-31T15:35:32.899Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8639
File: crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs:101-108
Timestamp: 2025-12-31T15:35:32.899Z
Learning: In Rust lint rules under the nursery category, the issue_number field in declare_lint_rule! is optional and should not be added unless there is a compelling reason. In code reviews, verify that no unnecessary issue_number is included in nursery lint declarations. Only add issue_number if there is an explicit, justified reason (e.g., tracked issue for external observers). This guidance broadly applies to all nursery lint rule files, not just the single file.
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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 `deprecated` field to `declare_lint_rule!` macro when deprecating a rule
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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 : Return `Option<State>` from `run` function for single diagnostic signals
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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 : Return `Vec<State>` or `Box<[State]>` from `run` function for multiple diagnostic signals
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2025-10-03T12:28:56.788Z
Learnt from: ematipico
Repo: biomejs/biome PR: 7670
File: crates/biome_service/src/file_handlers/html.rs:744-748
Timestamp: 2025-10-03T12:28:56.788Z
Learning: In Biome's codebase, when creating tokens with new text content, use the factory pattern with functions like `ident(text)` from the respective `*_factory` crates (e.g., `biome_html_factory::make::ident`). There is no `.with_text()` method on tokens. The `ident()` function creates a new detached token with the IDENT kind, which is the standard approach for token construction.
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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 : Avoid string allocations by comparing against `&str` or using `TokenText`
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.rs
🔇 Additional comments (7)
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs (7)
1-10: LGTM!Imports are correctly structured and follow Biome lint rule conventions.
12-134: Verify whether an Options section is needed for empty options.The rule declares
type Options = NoVueOptionsApiOptions. According to retrieved learnings, rule documentation must include an## Optionssection if the rule has options. However, the PR summary indicates this is an empty options struct. Please confirm whether an Options section should be added to the documentation even when the options struct contains no fields.Based on learnings, as per coding guidelines.
136-172: LGTM!Comprehensive coverage of Options API properties, including both Vue 2 and Vue 3 lifecycle hooks. The commented grouping aids readability.
174-213: LGTM!Excellent property-specific guidance for Composition API alternatives. The comprehensive mappings align well with the OPTIONS_API_PROPERTIES list.
215-221: LGTM!Proper use of
TokenTextavoids unnecessary string allocations, following Biome best practices.
229-282: LGTM!The logic correctly:
- Skips
<script setup>components- Allows pure
setup()functions- Detects Options API properties across all component patterns
- Uses
TokenTextto avoid allocationsPast review feedback has been properly addressed (OptionSelf::State, TokenText usage).
284-303: LGTM!Diagnostic messaging is clear and provides actionable guidance with property-specific Composition API alternatives.
|
@ematipico Thanks for the review! I've addressed all the feedback. Let me know if anything else needs to be changed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs (1)
113-117: Consider adding a direct link to Vue Options API documentation.The Resources section links to Composition API docs and API comparison, but a direct link to the Options API documentation would help users understand what's being flagged.
Suggested addition
/// ## Resources /// +/// - [Vue Options API](https://vuejs.org/api/options-state.html) /// - [Vue 3 Composition API](https://vuejs.org/api/composition-api-setup.html) /// - [Options API vs Composition API](https://vuejs.org/guide/introduction.html#api-styles)Based on learnings, this addresses ematipico's earlier feedback about providing links to the Options API.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (11)
crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-createapp-data.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-definecomponent-data.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-computed.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-data.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-methods.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-mounted.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-export-default-watch.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-full-options-api.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-mixed-setup-data.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-multiple-options.vue.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (2)
crates/biome_html_analyze/src/lint/nursery/use_vue_vapor.rscrates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
✅ Files skipped from review due to trivial changes (1)
- crates/biome_html_analyze/src/lint/nursery/use_vue_vapor.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_js_analyze/src/lint/nursery/no_vue_options_api.rs
🧠 Learnings (21)
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Use `declare_lint_rule!` macro with a `version` field set to `next` for new rules
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Deprecated rules must include a `deprecated` field in the `declare_lint_rule!` macro with an explanation of what rule to use instead
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2025-12-31T15:35:32.899Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8639
File: crates/biome_js_analyze/src/lint/nursery/no_excessive_lines_per_file.rs:101-108
Timestamp: 2025-12-31T15:35:32.899Z
Learning: In Rust lint rules under the nursery category, the issue_number field in declare_lint_rule! is optional and should not be added unless there is a compelling reason. In code reviews, verify that no unnecessary issue_number is included in nursery lint declarations. Only add issue_number if there is an explicit, justified reason (e.g., tracked issue for external observers). This guidance broadly applies to all nursery lint rule files, not just the single file.
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Rule names should use the `no` prefix when the rule's sole intention is to forbid a single concept
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate with a file named after the rule
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Use `Option<_>` wrapper for rule option fields to enable proper merging of configurations
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : New rules must be placed inside the `nursery` group before promotion to other groups
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.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_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Rule names should use the `use` prefix when the rule's sole intention is to mandate a single concept
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Implement the `run` function to return `Option<Self::State>` or `Vec<Self::State>` (as `Box<[Self::State]>`) depending on whether the rule reports one or multiple signals
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2025-10-03T12:28:56.788Z
Learnt from: ematipico
Repo: biomejs/biome PR: 7670
File: crates/biome_service/src/file_handlers/html.rs:744-748
Timestamp: 2025-10-03T12:28:56.788Z
Learning: In Biome's codebase, when creating tokens with new text content, use the factory pattern with functions like `ident(text)` from the respective `*_factory` crates (e.g., `biome_html_factory::make::ident`). There is no `.with_text()` method on tokens. The `ident()` function creates a new detached token with the IDENT kind, which is the standard approach for token construction.
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Apply `#[serde(deny_unknown_fields)]` to rule option structs to enforce strict configuration validation
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Rule option types must derive `Deserializable`, `Serialize`, `Deserialize`, and optionally `JsonSchema` traits
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Use `Box<[Box<str>]>` instead of `Vec<String>` for collections of strings in rule options to save memory
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Apply `#[serde(rename_all = "camelCase")]` to rule option structs to match JSON configuration naming convention
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/**/*.rs : Implement `biome_deserialize::Merge` for rule option types to define how shared and user configurations are merged
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Check if a variable is global using the semantic model before reporting diagnostics for rules that ban global functions or variables
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Code blocks in rule documentation must specify a language identifier and be tagged with `expect_diagnostic` for invalid examples or remain untagged for valid examples
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
📚 Learning: 2026-01-02T14:58:16.514Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2026-01-02T14:58:16.514Z
Learning: Applies to crates/biome_analyze/**/*_analyze/**/src/lint/**/*.rs : Invalid code snippets in rule documentation must emit exactly one diagnostic
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs
🧬 Code graph analysis (1)
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs (4)
crates/biome_service/src/workspace.rs (1)
markup(1195-1197)crates/biome_analyze/src/rule.rs (2)
recommended(619-622)domains(649-652)crates/biome_js_syntax/src/expr_ext.rs (1)
callee(33-38)crates/biome_html_analyze/src/lint/nursery/use_vue_vapor.rs (2)
run(59-76)diagnostic(78-91)
🔇 Additional comments (4)
crates/biome_js_analyze/src/lint/nursery/no_vue_options_api.rs (4)
1-12: Imports look good.All necessary imports are present and follow Biome conventions.
128-132: RuleState structure is appropriate.Simple and focused state for passing range information to diagnostics.
160-213: Implementation follows conventions correctly.The rule implementation properly uses the VueComponent framework helpers and follows Biome patterns. The simplified approach (flagging any Options API usage rather than providing property-specific alternatives) aligns with the feedback that Vapor Mode doesn't support Options API at all.
134-148: The duplicate detection logic is necessary and correct.The
VueComponentQuerymatches multiple independent node types (JsExportDefaultExpressionClauseandJsCallExpression), so code likeexport default defineComponent({data(){...}})would be categorised as bothOptionsApi(the export default) andDefineComponent(the call expression). Without the check, both cases would fire and generate duplicate diagnostics. The test snapshots confirm only one diagnostic is generated per case, validating this approach.
|
@dyc3 Regarding the simplification suggestion: since Options API usage results in a compile-time error in Vapor Mode, I understand the concern that a linter rule might seem redundant. The intent here is to provide early, actionable feedback so developers can identify and refactor incompatible patterns before hitting compiler errors during migration. Please let me know if there’s anything else you’d like me to adjust. |
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-createapp-data.vue
Show resolved
Hide resolved
crates/biome_js_analyze/tests/specs/nursery/noVueOptionsApi/invalid-definecomponent-data.vue
Show resolved
Hide resolved
0978dbc to
3692dd4
Compare
|
Hi @dyc3, thank you for the thorough review. I've addressed all of your feedback in the latest commits. In particular, I added the guard for Please take another look when you have a chance. Thanks again! |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
|
One of my comments hasn't been addressed #8648 (comment) |
|
Apologies — it seems the change didn’t get applied earlier. I’ve applied it now! |
|
No worries! It happens :) |
|
Snapshots need to be updated |
|
Done! |
|
Please avoid merging main into this branch because it invalidates the CI, and since you are a first time contributor, we have to manually approve the runs. If there's merge conflicts, we'll handle it. |
|
Got it, thanks! |
Detects Vue Options API usage incompatible with Vue 3.6 Vapor Mode. - Flags Options API properties: data, methods, computed, watch, lifecycle hooks - Provides Composition API alternatives specific to each property - Supports export default, defineComponent, createApp patterns - Includes 18 test cases (9 invalid, 9 valid patterns) - Severity: Error, recommended: false (nursery) Helps prepare Vue codebases for Vapor Mode migration.
Addressed review comments for the `noVueOptionsApi` rule: - Changed `type Signals` from `Vec<Self::State>` to `Option<Self::State>` - Changed `property_name` type from `String` to `TokenText` to avoid heap allocation - Changed `type Options` from `()` to `NoVueOptionsApiOptions` (generated options type) - Removed empty `sources: &[]` field - Added more Invalid examples: `computed`, `mounted`, `defineComponent` - Added more Valid examples: `computed()`, `onMounted()` - Added `## Resources` section with Vue official documentation links - `just test-lintrule noVueOptionsApi` - 18 tests passed - `just f` / `just l` / `just gen-analyzer` - all passed
- Add useVueVapor reference to noVueOptionsApi docs - Add noVueOptionsApi reference to useVueVapor docs - Update test snapshots - Remove redundant test cases
Add comprehensive test coverage for defineComponent and createApp edge cases. Update snapshots and fix documentation.
Co-authored-by: Carson McManus <dyc3@users.noreply.github.com>
69d9c20 to
7bd398f
Compare
Closes #8566
Summary
Adds a new nursery rule
noVueOptionsApito detect Options API usage incompatible with Vue 3.6's Vapor Mode.Motivation:
Vue 3.6's Vapor Mode only supports Composition API with
<script setup>. The Options API (data,methods,computed, lifecycle hooks, etc.) is not compatible withVapor Mode.
This rule helps developers:
What this rule does:
data,methods,computed,watch, lifecycle hooks (Vue 2 & 3),props,emits,mixins,extends, etc.export default {},defineComponent(),createApp()data→ "Use ref() or reactive()"mounted→ "Use onMounted()"computed→ "Use computed()"watch→ "Use watch() or watchEffect()"setup()function usage (valid Composition API pattern)Example:
Test Plan
Comprehensive test coverage with 18 test cases:
Invalid cases (9):
Valid cases (9):
Docs
The rule documentation is implemented in the code as rustdoc comments in no_vue_options_api.rs, following Biome's conventions:
The diagnostic messages are self-documenting, providing specific Composition API alternatives for each detected Options API property.
AI Assistance Disclosure
This PR was created with AI assistance (Cursor / Claude Opus 4.5). I reviewed and adjusted the implementation, diagnostics, and snapshots.