-
-
Notifications
You must be signed in to change notification settings - Fork 794
fix(linter): improve Vue defineProps handling in noVueReservedKeys #8448
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: 03aa965 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 |
WalkthroughThis PR adds detection for Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (1)
284-292: Bug:VueSetupComponent::declarationsbails unlessPropis requested.
As written, asking only forSetupand/orSetupImportwill always return[]. Consider early-returning only when none of{Prop, Setup, SetupImport}are requested.- if !filter.contains(VueDeclarationCollectionFilter::Prop) { - return vec![]; - } + if !(filter.contains(VueDeclarationCollectionFilter::Prop) + || filter.contains(VueDeclarationCollectionFilter::Setup) + || filter.contains(VueDeclarationCollectionFilter::SetupImport)) + { + return vec![]; + }
🧹 Nitpick comments (5)
crates/biome_html_syntax/src/element_ext.rs (1)
198-202: Nice, minimal helper — please add a unit test for<script setup>. It’s small enough that a regression would be annoyingly easy otherwise.crates/biome_js_syntax/src/file_source.rs (2)
127-130: Nice, the Vue embedding is now future-proofed (and the helpers are tidy).
Small wording tweak: “inside script tag with setup attribute” → “inside a<script setup>tag” to match Vue terminology.Also applies to: 143-148
223-230:JsFileSource::vue_setup()is a clean addition; call-sites will thank you.crates/biome_service/src/file_handlers/mod.rs (1)
1099-1113: Avoid exportingParsedLangAndSetupmore widely than needed.
If this is purely internal plumbing, considerpub(crate)(or even private) +#[derive(Default)]to keep the public API surface lean.crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (1)
1147-1346: Nice decomposition withVueCollectSetupDeclarations; fewer ad-hoc branches, more reuse.
One small thought: the trait returnsVec<VueDeclaration>(mixing Prop/Setup/Import); if this grows further, a more typed return (or a small accumulator) could keep callers from double-filtering.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-interface.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-type-alias.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-define-props.vue.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (16)
.changeset/mighty-shoes-deny.md(1 hunks)crates/biome_html_syntax/src/element_ext.rs(1 hunks)crates/biome_js_analyze/src/frameworks/vue/vue_component.rs(7 hunks)crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs(1 hunks)crates/biome_js_analyze/src/lint/nursery/no_vue_setup_props_reactivity_loss.rs(1 hunks)crates/biome_js_analyze/tests/spec_tests.rs(2 hunks)crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-interface.vue(0 hunks)crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-type-alias.vue(0 hunks)crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-define-props.vue(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue.snap.new(1 hunks)crates/biome_js_syntax/src/file_source.rs(3 hunks)crates/biome_service/src/file_handlers/html.rs(1 hunks)crates/biome_service/src/file_handlers/mod.rs(3 hunks)crates/biome_service/src/file_handlers/svelte.rs(2 hunks)crates/biome_service/src/file_handlers/vue.rs(2 hunks)
💤 Files with no reviewable changes (2)
- crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-type-alias.vue
- crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-interface.vue
🧰 Additional context used
📓 Path-based instructions (2)
crates/**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates
Files:
crates/biome_service/src/file_handlers/html.rscrates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rscrates/biome_js_analyze/tests/spec_tests.rscrates/biome_html_syntax/src/element_ext.rscrates/biome_service/src/file_handlers/vue.rscrates/biome_js_syntax/src/file_source.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rscrates/biome_js_analyze/src/lint/nursery/no_vue_setup_props_reactivity_loss.rscrates/biome_service/src/file_handlers/svelte.rs
.changeset/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Write changesets that are concise (1-3 sentences), user-focused, use past tense for actions taken and present tense for Biome behavior, include code examples for rules, and end sentences with periods
Files:
.changeset/mighty-shoes-deny.md
🧠 Learnings (49)
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new variant to `LanguageKind` enum in `language_kind.rs` file and implement all methods for the new language variant
Applied to files:
crates/biome_service/src/file_handlers/html.rscrates/biome_js_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/vue.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rscrates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue.snap.newcrates/biome_js_analyze/src/lint/nursery/no_vue_setup_props_reactivity_loss.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRestricted` prefix for rules that report user-banned entities (e.g., `noRestrictedGlobals`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_js_analyze/tests/spec_tests.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/spec_tests.rs : Use the `tests_macros::gen_tests!` macro in `spec_tests.rs` to generate test functions for each specification file matching the pattern `tests/specs/<language>/**/*.<ext>`
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.jsonc : Use `.jsonc` files in test specs with code snippets as array of strings to test rules in script environment (no import/export syntax)
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-define-props.vuecrates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue.snap.newcrates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/vue.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP tests
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : For rules ported from other ecosystems like ESLint or Clippy, add a `sources` field with `RuleSource` metadata using `.same()` for identical behavior or `.inspired()` for different behavior
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When navigating CST nodes that return `Result`, use the try operator `?` to convert to `Option`, or use `let else` pattern for `Vec` return types in rule run functions
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Implement custom `Queryable` types and `Visitor` traits for rules requiring deep AST inspection to avoid redundant traversal passes
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new language prefix to the `LANGUAGE_PREFIXES` constant in `language_kind.rs` file
Applied to files:
crates/biome_service/src/file_handlers/vue.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/*_kinds_src.rs : Create a file called `src/{language}_kinds_src.rs` that returns a static `KindSrc` for new language parsers
Applied to files:
crates/biome_service/src/file_handlers/vue.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.{js,ts,tsx,jsx,json,css} : Test rules using snapshot tests via the `insta` library with test cases in `tests/specs/<group>/<rule_name>/` directories prefixed by `invalid` or `valid`
Applied to files:
crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-define-props.vuecrates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue.snap.newcrates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Set the `language` field in `declare_lint_rule!` to the primary language (js for JavaScript, jsx for JSX, ts for TypeScript, tsx for TSX) that the rule applies to
Applied to files:
crates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Create two new crates `biome_{language}_syntax` and `biome_{language}_factory` using `cargo new --lib` for new language parsers
Applied to files:
crates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Parse rule functions must be prefixed with `parse_` and use the name defined in the grammar file, e.g., `parse_for_statement` or `parse_expression`
Applied to files:
crates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.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/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits
Applied to files:
crates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Parse rules must take a mutable reference to the parser as their only parameter and return a `ParsedSyntax`
Applied to files:
crates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/svelte.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/src/comments.rs : Define `<Language>CommentStyle` as a public type alias for `Comments<<Language>Language>` in a `comments.rs` file
Applied to files:
crates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_service/src/file_handlers/mod.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_service/src/file_handlers/mod.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `p.eat(token)` for optional tokens, `p.expect(token)` for required tokens, `parse_rule(p).ok(p)` for optional nodes, and `parse_rule(p).or_add_diagnostic(p, error)` for required nodes
Applied to files:
crates/biome_service/src/file_handlers/mod.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_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops
Applied to files:
crates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : A parser struct must implement the `Parser` trait and save the token source, parser context, and optional parser options
Applied to files:
crates/biome_service/src/file_handlers/mod.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/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes for enclosing syntax errors must have the `Bogus` word, e.g., `HtmlBogusAttribute`, and must be part of a variant
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Unions of nodes must start with `Any*`, e.g., `AnyHtmlAttribute`
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.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/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_setup_props_reactivity_loss.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/language.rs : Implement `TestFormatLanguage` trait in `tests/language.rs` for the formatter's test language
Applied to files:
crates/biome_service/src/file_handlers/svelte.rs
🧬 Code graph analysis (3)
crates/biome_service/src/file_handlers/html.rs (3)
crates/biome_service/src/file_handlers/svelte.rs (1)
file_source(67-83)crates/biome_service/src/file_handlers/vue.rs (1)
file_source(67-85)crates/biome_html_formatter/src/context.rs (1)
file_source(77-79)
crates/biome_service/src/file_handlers/vue.rs (1)
crates/biome_service/src/file_handlers/mod.rs (8)
parse_lang_and_setup_from_script_opening_tag(1138-1191)from(92-94)from(98-100)from(104-106)from(110-112)from(116-118)from(122-124)from(128-130)
crates/biome_service/src/file_handlers/svelte.rs (1)
crates/biome_service/src/file_handlers/mod.rs (1)
parse_lang_and_setup_from_script_opening_tag(1138-1191)
⏰ 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). (8)
- GitHub Check: Check Dependencies
- GitHub Check: Documentation
- GitHub Check: Test Node.js API
- GitHub Check: Parser conformance
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: autofix
🔇 Additional comments (14)
crates/biome_js_analyze/src/lint/nursery/no_vue_setup_props_reactivity_loss.rs (1)
87-87: LGTM! Proper exhaustive match handling.The default arm correctly returns an empty signal set for other component variants introduced by the broader Vue setup script changes. This keeps the rule focused on the relevant patterns (object literals and call expressions) whilst remaining robust as new variants are added.
.changeset/mighty-shoes-deny.md (1)
1-5: Changeset text matches the guidelines. Crisp, user-facing, and correctly mixes past tense (“Improved…”) with present tense (“rule now avoids…”).crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-define-props.vue (1)
1-6: Good regression fixture for the “defineProps in non-setup” false-positive. Comment makes the intent obvious for future readers.crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs (1)
118-133: Filter tweak looks right: excludeSetup/SetupImportbefore checking reserved keys. This should stop the rule from yelling at setup-local bindings that aren’t component option keys.crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue.snap.new (1)
1-18: Snapshot matches the intent:$*bindings in<script setup>stay unflagged.crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue (1)
1-11: Solid fixture coverage (imports + bindings) for the setup exclusion path.crates/biome_service/src/file_handlers/html.rs (1)
486-503: Good: Vue embedding now carriessetupper<script>tag. This should finally stop mixing up the two script worlds like socks in a tumble dryer.crates/biome_js_analyze/tests/spec_tests.rs (1)
120-133: The concern about losing Vue embedding is unfounded.VueFileHandler::file_source()always returns with.with_embedding(source_type.as_embedding_kind()), meaning the embedding kind is preserved regardless of whether a<script>tag is found. Even for Vue files with only<template>, the Vue embedding persists andVueFileHandler::input()executes as intended.The code itself is redundant—the derived embedding will always match the input (Vue remains Vue), so the suggested defensive fallback is unnecessary. However, the current implementation works correctly and the proposed changes are not required.
crates/biome_service/src/file_handlers/svelte.rs (1)
1-1: Looks good; please sanity-check lang detection still works with “opening-tag-only” parsing.
This now depends onparse_lang_and_setup_from_script_opening_tag(captures.name("opening")...)successfully recovering from parsing an opening tag fragment; worth ensuring the Svelte fixtures cover<script lang="ts">/<script lang="tsx">variants.Also applies to: 71-75
crates/biome_service/src/file_handlers/vue.rs (1)
1-1: LGTM: setup flag is now correctly threaded intoEmbeddingKind::Vue { setup }.
This should unblock setup-aware analysis without guessing based on file extension alone.Also applies to: 71-82
crates/biome_service/src/file_handlers/mod.rs (2)
1058-1061: Good catch updating the Vue match arm toEmbeddingKind::Vue { .. }.
1115-1130: Please verify the JSX parser reliably handles an opening tag only (<script ...>).
If recovery ever causestry_tree()to returnNone, lang/setup will quietly default (JS + non-setup), which is exactly the kind of “it works on my Vue file” gremlin we all deserve.Also applies to: 1138-1191
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (2)
34-37: Solid: setup components are now detected viaJsModuleand gated onis_vue_setup().
This should cut false positives from non-setup scripts nicely.Also applies to: 142-151, 214-215
755-756:token_text_trimmed()here is a tidy correctness win.
d975a23 to
ecf062b
Compare
CodSpeed Performance ReportMerging #8448 will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
crates/biome_service/src/file_handlers/mod.rs (2)
1099-1104: Consider narrowing ParsedLangAndSetup’s visibility to avoid exporting a “can’t-use-me” type.
Line 1099:ParsedLangAndSetupispub, but (a) its fields are private and (b) the only constructor here ispub(crate), so external crates can’t practically use it. If it’s intended to stay internal plumbing,pub(crate)would keep the public API surface tidier.
1106-1182: Nice AST-based extraction; add a fallback (or explicitly document) for HTML-valid but non-JSX attributes.
Line 1129 onwards: parsing the opening tag as JSX is a neat way to avoid regex soup, but it likely won’t handle cases likelang=ts(unquoted) which are valid in HTML-ish syntaxes. Either add a small fallback scan forlang/setupwhenparse(...).try_tree()fails, or call out the quoting constraint in the rustdoc so behaviour is predictable.crates/biome_js_analyze/tests/spec_tests.rs (1)
9-9: Tests may be under-parsing Vue fixtures by forcing TS and only copying the embedding kind.
Line 123-126:JsFileSource::ts().with_embedding_kind(*VueFileHandler::file_source(...).as_embedding_kind())drops whateverVueFileHandler::file_sourceinferred for language/variant (e.g.lang="tsx"). If the goal is to mirror real behaviour more closely (especially for setup), consider using the handler’s full file source:- let source_type = if source_type.as_embedding_kind().is_vue() { - JsFileSource::ts() - .with_embedding_kind(*VueFileHandler::file_source(&input_code).as_embedding_kind()) - } else { - source_type - }; + let source_type = if source_type.as_embedding_kind().is_vue() { + VueFileHandler::file_source(&input_code) + } else { + source_type + };Also applies to: 123-126
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-interface.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-type-alias.vue.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-define-props.vue.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**
📒 Files selected for processing (17)
.changeset/mighty-shoes-deny.md(1 hunks)crates/biome_html_syntax/src/element_ext.rs(1 hunks)crates/biome_js_analyze/src/frameworks/vue/vue_component.rs(7 hunks)crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs(1 hunks)crates/biome_js_analyze/src/lint/nursery/no_vue_setup_props_reactivity_loss.rs(1 hunks)crates/biome_js_analyze/tests/spec_tests.rs(2 hunks)crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-interface.vue(0 hunks)crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-type-alias.vue(0 hunks)crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-define-props.vue(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue(1 hunks)crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue.snap.new(1 hunks)crates/biome_js_syntax/src/file_source.rs(3 hunks)crates/biome_service/src/file_handlers/html.rs(1 hunks)crates/biome_service/src/file_handlers/mod.rs(3 hunks)crates/biome_service/src/file_handlers/svelte.rs(2 hunks)crates/biome_service/src/file_handlers/vue.rs(2 hunks)xtask/rules_check/src/lib.rs(1 hunks)
💤 Files with no reviewable changes (2)
- crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-interface.vue
- crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/invalid-setup-type-alias.vue
✅ Files skipped from review due to trivial changes (1)
- crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-define-props.vue
🚧 Files skipped from review as they are similar to previous changes (7)
- crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue
- crates/biome_js_analyze/src/lint/nursery/no_vue_setup_props_reactivity_loss.rs
- crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue.snap.new
- .changeset/mighty-shoes-deny.md
- crates/biome_service/src/file_handlers/html.rs
- crates/biome_html_syntax/src/element_ext.rs
- crates/biome_js_analyze/src/lint/nursery/no_vue_reserved_keys.rs
🧰 Additional context used
📓 Path-based instructions (1)
crates/**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates
Files:
crates/biome_js_syntax/src/file_source.rscrates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/vue.rscrates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rscrates/biome_service/src/file_handlers/mod.rs
🧠 Learnings (38)
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new variant to `LanguageKind` enum in `language_kind.rs` file and implement all methods for the new language variant
Applied to files:
crates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/vue.rscrates/biome_js_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
crates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/vue.rscrates/biome_js_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new language prefix to the `LANGUAGE_PREFIXES` constant in `language_kind.rs` file
Applied to files:
crates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/vue.rscrates/biome_service/src/file_handlers/mod.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/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits
Applied to files:
crates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Set the `language` field in `declare_lint_rule!` to the primary language (js for JavaScript, jsx for JSX, ts for TypeScript, tsx for TSX) that the rule applies to
Applied to files:
crates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Create two new crates `biome_{language}_syntax` and `biome_{language}_factory` using `cargo new --lib` for new language parsers
Applied to files:
crates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/*_kinds_src.rs : Create a file called `src/{language}_kinds_src.rs` that returns a static `KindSrc` for new language parsers
Applied to files:
crates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Parse rule functions must be prefixed with `parse_` and use the name defined in the grammar file, e.g., `parse_for_statement` or `parse_expression`
Applied to files:
crates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/mod.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/src/comments.rs : Define `<Language>CommentStyle` as a public type alias for `Comments<<Language>Language>` in a `comments.rs` file
Applied to files:
crates/biome_service/src/file_handlers/svelte.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_service/src/file_handlers/svelte.rscrates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP tests
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.jsonc : Use `.jsonc` files in test specs with code snippets as array of strings to test rules in script environment (no import/export syntax)
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : For rules ported from other ecosystems like ESLint or Clippy, add a `sources` field with `RuleSource` metadata using `.same()` for identical behavior or `.inspired()` for different behavior
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When navigating CST nodes that return `Result`, use the try operator `?` to convert to `Option`, or use `let else` pattern for `Vec` return types in rule run functions
Applied to files:
crates/biome_js_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Implement custom `Queryable` types and `Visitor` traits for rules requiring deep AST inspection to avoid redundant traversal passes
Applied to files:
crates/biome_js_analyze/tests/spec_tests.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/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes for enclosing syntax errors must have the `Bogus` word, e.g., `HtmlBogusAttribute`, and must be part of a variant
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Unions of nodes must start with `Any*`, e.g., `AnyHtmlAttribute`
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rscrates/biome_service/src/file_handlers/mod.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/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Parse rules must take a mutable reference to the parser as their only parameter and return a `ParsedSyntax`
Applied to files:
crates/biome_service/src/file_handlers/mod.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/language.rs : Implement `TestFormatLanguage` trait in `tests/language.rs` for the formatter's test language
Applied to files:
crates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `p.eat(token)` for optional tokens, `p.expect(token)` for required tokens, `parse_rule(p).ok(p)` for optional nodes, and `parse_rule(p).or_add_diagnostic(p, error)` for required nodes
Applied to files:
crates/biome_service/src/file_handlers/mod.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_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops
Applied to files:
crates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : A parser struct must implement the `Parser` trait and save the token source, parser context, and optional parser options
Applied to files:
crates/biome_service/src/file_handlers/mod.rs
🧬 Code graph analysis (3)
crates/biome_service/src/file_handlers/svelte.rs (1)
crates/biome_service/src/file_handlers/mod.rs (1)
parse_lang_and_setup_from_script_opening_tag(1129-1182)
crates/biome_service/src/file_handlers/vue.rs (1)
crates/biome_service/src/file_handlers/mod.rs (8)
parse_lang_and_setup_from_script_opening_tag(1129-1182)from(92-94)from(98-100)from(104-106)from(110-112)from(116-118)from(122-124)from(128-130)
crates/biome_js_analyze/tests/spec_tests.rs (3)
crates/biome_js_syntax/src/file_source.rs (1)
ts(185-192)crates/biome_service/src/file_handlers/svelte.rs (1)
file_source(67-83)crates/biome_service/src/file_handlers/vue.rs (1)
file_source(67-85)
⏰ 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). (13)
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Check Dependencies
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Parser conformance
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Documentation
- GitHub Check: autofix
- GitHub Check: Check JS Files
🔇 Additional comments (14)
crates/biome_service/src/file_handlers/mod.rs (1)
1057-1062: EmbeddingKind::Vue payload matching looks correct.
Line 1059: switching toEmbeddingKind::Vue { .. }keeps the handler routing future-proof.crates/biome_js_syntax/src/file_source.rs (2)
122-152: EmbeddingKind::Vue { setup } and the helper predicates are a good ergonomic upgrade.
Line 127-148: this keeps pattern matches readable and avoids sprinklingmatches!(..., Vue { .. })everywhere.
222-230: Constructors look consistent; vue_setup() is a welcome addition.
Line 223-230:vue()defaulting tosetup: false+ explicitvue_setup()is clean and keeps call-sites obvious.crates/biome_service/src/file_handlers/svelte.rs (1)
1-1: Good adoption of ParsedLangAndSetup without dragging setup semantics into Svelte.
Line 71-75: the..destructure keeps this nicely focused on lang/variant only.Also applies to: 67-83
xtask/rules_check/src/lib.rs (1)
299-313: Correctly updated Vue embedding match for the new payload variant.
Line 308:EmbeddingKind::Vue { .. }keeps the docs/test runner behaving as before while accepting the newsetupflag.crates/biome_service/src/file_handlers/vue.rs (2)
1-1: LGTM!The updated imports correctly bring in the new
ParsedLangAndSetupstructure and parsing function needed to extract the setup flag.
67-85: LGTM!The refactor correctly extracts and threads the setup flag through to the
EmbeddingKind::Vueembedding. The destructuring pattern aligns perfectly with the newParsedLangAndSetupstructure.crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (7)
5-15: LGTM!The expanded imports support the new trait-based declaration collection across multiple JS/TS node types.
34-37: LGTM!Adding
JsModuleto the union enables detection of Vue setup components at the module level.
142-151: LGTM!The new match arm correctly identifies Vue setup components by checking the embedding kind and constructs a
VueSetupComponentwith the module reference.
212-215: LGTM!Changing from a specific
define_props_callto the broaderjs_moduleenables comprehensive declaration collection across the entire setup script.
292-360: Implementation logic is sound once the early return is fixed.The restructured declaration collection properly filters and delegates to the trait-based collection methods. The handling of expression statements, variable statements, function declarations, and imports is well-organised.
753-753: LGTM!Using
token_text_trimmed()is more robust for extracting identifier names, ensuring any whitespace is stripped.
1145-1344: Well-structured trait-based collection system.The trait implementations comprehensively handle declaration extraction across various node types with proper recursive traversal. The pattern is clean and maintainable.
One minor observation: the implementations recursively delegate to each other (e.g.,
JsObjectBindingPattern→AnyJsObjectBindingPatternMember→ nested patterns), which is appropriate for the nested structure of binding patterns.
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_js_analyze/src/frameworks/vue/vue_component.rs (1)
289-291: Critical logic error: early return prevents Setup and SetupImport collection.This early return exits when
Propis not in the filter, but subsequent code (lines 328-337 forSetup, lines 341-354 forSetupImport) has its own filter checks and should still execute.- if !filter.contains(VueDeclarationCollectionFilter::Prop) { - return vec![]; - }
🧹 Nitpick comments (2)
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (2)
697-715: Consider adding rustdoc for the public method.The method logic is correct. Per coding guidelines, adding inline rustdoc documentation would help explain when this returns
true(i.e., for patterns likeconst { foo } = defineProps(...)).impl AnyVueSetupDeclaration { + /// Returns `true` if this setup declaration is bound to a `defineProps()` call. + /// + /// For example, returns `true` for `foo` in `const { foo } = defineProps(...)`. pub fn is_assigned_to_props(&self, model: &SemanticModel) -> bool {
1202-1212: Consider handlingJsBogusBindingexplicitly for clarity.Currently the catch-all
_ => vec![]handlesJsBogusBinding. This is correct behaviour, but an explicit match arm would document the intent.impl VueCollectSetupDeclarations for AnyJsBinding { fn collect_vue_setup_declarations(&self, _model: &SemanticModel) -> Vec<VueDeclaration> { match self { Self::JsIdentifierBinding(identifier) => { vec![VueDeclaration::Setup( AnyVueSetupDeclaration::JsIdentifierBinding(identifier.clone()), )] } - _ => vec![], + // Bogus bindings represent parse errors - nothing to collect + Self::JsBogusBinding(_) => vec![], } } }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
crates/biome_js_analyze/tests/specs/nursery/noVueReservedKeys/valid-setup-definitions.vue.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (2)
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs(8 hunks)crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.rs(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
crates/**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates
Files:
crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
🧠 Learnings (18)
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.rscrates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.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/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes for enclosing syntax errors must have the `Bogus` word, e.g., `HtmlBogusAttribute`, and must be part of a variant
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Unions of nodes must start with `Any*`, e.g., `AnyHtmlAttribute`
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.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/frameworks/vue/vue_component.rs
🧬 Code graph analysis (2)
crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.rs (1)
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (2)
from_potential_component(80-89)from_potential_component(136-180)
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (2)
crates/biome_js_syntax/src/file_source.rs (1)
js_module(170-172)crates/biome_js_syntax/src/import_ext.rs (2)
import_clause(240-242)named_specifiers(79-95)
⏰ 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). (13)
- GitHub Check: Check JS Files
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test Node.js API
- GitHub Check: autofix
- GitHub Check: Check Dependencies
- GitHub Check: Documentation
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Parser conformance
🔇 Additional comments (5)
crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.rs (1)
128-148: LGTM!The model extraction improves reusability, and the guard correctly skips setup declarations that are assigned from
defineProps()to avoid false positives. This properly handles patterns likeconst { foo } = defineProps(...)wherefoois effectively a prop, not a standalone setup variable.crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (4)
34-37: LGTM!Adding
JsModuleto the union enables proper detection of<script setup>components, which are represented as full JS modules rather than individual call expressions.
142-151: LGTM!The gating on
is_vue_setup()ensures this path only activates for<script setup>tags, preventing false matches on regular Vue scripts or non-Vue modules.
773-773: LGTM!Using
token_text_trimmed()ensures consistency with otherVueDeclarationNameimplementations in this file.
1165-1168: Well-structured trait-based collection.The trait provides a clean, extensible approach for collecting setup declarations across different AST node types. The private visibility is appropriate for internal use.
dyc3
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.
LGTM
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/frameworks/vue/vue_component.rs (1)
1173-1186: Remove the unused trait implementation or document its purpose.The
VueCollectSetupDeclarationsimpl forJsVariableDeclaratorisn't called anywhere. TheVueSetupComponent::declarationsmethod unpacks declarators and calls the trait method onid()andinitializer().expression()separately rather than delegating to this implementation. If it's meant for future use or API completeness, add a comment; otherwise, remove it.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs(8 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
crates/**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates
Files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
🧠 Learnings (13)
📚 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/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes for enclosing syntax errors must have the `Bogus` word, e.g., `HtmlBogusAttribute`, and must be part of a variant
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Unions of nodes must start with `Any*`, e.g., `AnyHtmlAttribute`
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.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/frameworks/vue/vue_component.rs
🧬 Code graph analysis (1)
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (2)
crates/biome_js_syntax/src/file_source.rs (1)
js_module(170-172)crates/biome_js_syntax/src/import_ext.rs (2)
import_clause(240-242)named_specifiers(79-95)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
- GitHub Check: Parser conformance
- 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: Check Dependencies
- GitHub Check: Documentation
- GitHub Check: End-to-end tests
- GitHub Check: Check JS Files
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: autofix
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
🔇 Additional comments (5)
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (5)
142-151: Clean integration for script setup detection.The gating on
is_vue_setup()correctly ensuresVueSetupComponentis only instantiated for<script setup>blocks. Good defensive check before constructing the component.
289-294: Previous early return issue resolved.The condition now correctly returns early only when none of the relevant filters (Prop, Setup, SetupImport) are set, ensuring all declaration types are collected when requested.
700-718: Well-designed helper for detecting defineProps assignment.The ancestor traversal correctly handles both simple bindings (
const props = defineProps(...)) and destructuring patterns (const { a } = defineProps(...)). Clean use of existingis_vue_compiler_macro_call.
1168-1171: Solid trait abstraction for declaration collection.The trait provides a clean way to uniformly collect setup declarations from various AST node types.
1288-1327: Comprehensive import clause handling.All import clause variants are covered: combined, default, named, namespace, and bare. The delegation to specifier-level collection is clean and complete.
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
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs(8 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
crates/**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update inline rustdoc documentation for rules, assists, and their options when adding new features or changing existing features in Rust crates
Files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
🧠 Learnings (14)
📚 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/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Nodes for enclosing syntax errors must have the `Bogus` word, e.g., `HtmlBogusAttribute`, and must be part of a variant
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/*.ungram : Unions of nodes must start with `Any*`, e.g., `AnyHtmlAttribute`
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_js_analyze/src/frameworks/vue/vue_component.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/frameworks/vue/vue_component.rs
⏰ 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). (7)
- GitHub Check: Test Node.js API
- GitHub Check: Check JS Files
- GitHub Check: Parser conformance
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: autofix
🔇 Additional comments (3)
crates/biome_js_analyze/src/frameworks/vue/vue_component.rs (3)
140-149: LGTM!The JsModule handling correctly checks for Vue setup embedding and constructs the appropriate component variant.
1166-1365: Trait implementations are well-structured.The
VueCollectSetupDeclarationstrait and its implementations across various AST node types correctly traverse and collect declarations. The recursive handling of binding patterns and import clauses is appropriate.
721-721: Good consistency in usingtoken_text_trimmed().The change from
token_text()totoken_text_trimmed()for declaration names is appropriate, as it strips surrounding trivia for cleaner name extraction.Also applies to: 729-729, 774-774
| for declarator in declaration.declarators().iter().flatten() { | ||
| if filter.contains(VueDeclarationCollectionFilter::Setup) | ||
| && let Ok(declarations) = declarator | ||
| .id() | ||
| .map(|id| id.collect_vue_setup_declarations(model)) | ||
| { | ||
| result.extend(declarations); | ||
| } | ||
| if filter.contains(VueDeclarationCollectionFilter::Prop) | ||
| && let Some(declarations) = declarator | ||
| .initializer() | ||
| .and_then(|initializer| initializer.expression().ok()) | ||
| .map(|expression| { | ||
| expression.collect_vue_setup_declarations(model) | ||
| }) | ||
| { | ||
| result.extend(declarations); | ||
| } | ||
| } | ||
| } |
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.
Critical: is_assigned_to_props helper is unused, causing incorrect declaration collection.
When both Setup and Prop filters are active, a variable like const props = defineProps({ foo: String }) will be collected twice:
- As a
Setupdeclaration for thepropsvariable (line 314) - As
Propdeclarations for properties withindefineProps(line 324)
The is_assigned_to_props helper (lines 698-716) was added to detect this case but is never invoked. The props variable itself shouldn't be exposed as a setup variable.
Apply this diff to filter out bindings assigned to defineProps:
AnyJsStatement::JsVariableStatement(variable_statement) => {
if let Ok(declaration) = variable_statement.declaration() {
for declarator in declaration.declarators().iter().flatten() {
if filter.contains(VueDeclarationCollectionFilter::Setup)
&& let Ok(declarations) = declarator
.id()
.map(|id| id.collect_vue_setup_declarations(model))
{
- result.extend(declarations);
+ result.extend(declarations.into_iter().filter(|decl| {
+ !matches!(decl, VueDeclaration::Setup(setup) if setup.is_assigned_to_props(model))
+ }));
}
if filter.contains(VueDeclarationCollectionFilter::Prop)
&& let Some(declarations) = declarator📝 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.
| for declarator in declaration.declarators().iter().flatten() { | |
| if filter.contains(VueDeclarationCollectionFilter::Setup) | |
| && let Ok(declarations) = declarator | |
| .id() | |
| .map(|id| id.collect_vue_setup_declarations(model)) | |
| { | |
| result.extend(declarations); | |
| } | |
| if filter.contains(VueDeclarationCollectionFilter::Prop) | |
| && let Some(declarations) = declarator | |
| .initializer() | |
| .and_then(|initializer| initializer.expression().ok()) | |
| .map(|expression| { | |
| expression.collect_vue_setup_declarations(model) | |
| }) | |
| { | |
| result.extend(declarations); | |
| } | |
| } | |
| } | |
| for declarator in declaration.declarators().iter().flatten() { | |
| if filter.contains(VueDeclarationCollectionFilter::Setup) | |
| && let Ok(declarations) = declarator | |
| .id() | |
| .map(|id| id.collect_vue_setup_declarations(model)) | |
| { | |
| result.extend(declarations.into_iter().filter(|decl| { | |
| !matches!(decl, VueDeclaration::Setup(setup) if setup.is_assigned_to_props(model)) | |
| })); | |
| } | |
| if filter.contains(VueDeclarationCollectionFilter::Prop) | |
| && let Some(declarations) = declarator | |
| .initializer() | |
| .and_then(|initializer| initializer.expression().ok()) | |
| .map(|expression| { | |
| expression.collect_vue_setup_declarations(model) | |
| }) | |
| { | |
| result.extend(declarations); | |
| } | |
| } | |
| } |
🤖 Prompt for AI Agents
In crates/biome_js_analyze/src/frameworks/vue/vue_component.rs around lines 308
to 327, the loop collecting declarations currently adds both Setup and Prop
declarations causing duplicates when a binding is assigned to defineProps; call
the existing is_assigned_to_props helper for each declarator and skip adding the
Setup declaration when it returns true (i.e., do not extend result with setup
declarations for bindings assigned to defineProps), so only the inner Prop
declarations are collected in that case.
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.
is_assigned_to_props is to be used by lint rules and decide what to do with Setup declaration depending on lint rule logic. The fact that a Setup declaration is assigned to props doesn't mean that the declaration should be excluded.
Summary
This PR enables proper handling of SFC components defined via
<script setup>tags as we can now handle HTML-ish languages better.As a result:
Improved handling of
defineProps()macro in Vue components. ThenoVueReservedKeysrule now avoids false positives in non-setup scripts.Test Plan
Tests are included.
Docs