-
-
Notifications
You must be signed in to change notification settings - Fork 794
feat(lint/html/vue): add useVueValidVText
#8158
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: 3182d1a 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 |
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
WalkthroughAdds a Vue-specific HTML lint rule Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
xtask/codegen/src/generate_new_analyzer_rule.rs (1)
387-425: HtmlVue rule template looks good; consider generating the ESLint rule nameThe Html‑Vue template correctly:
- Uses
HtmlRootas the query AST.- Marks
language: "html"while scoping to Vue viadomains: &[RuleDomain::Vue].- Seeds
sourceswithRuleSource::EslintVueJs("rule-name").same().That’s a solid baseline. If you fancy a small quality‑of‑life tweak, you could derive the
"rule-name"string from the rule name (e.g. kebab‑case) so new rules start with a closer default ESLint mapping instead of a hard‑coded placeholder, but it’s strictly optional.crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue (1)
1-4: Valid fixture covers the key happy pathsBoth examples use
v-textwith a value and no argument/modifier, including a self‑closing tag, which is exactly what this rule should accept. If you need extra paranoia later, you could add a case alongside other directives, but this is perfectly adequate for now.crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue (1)
1-9: Invalid fixture set looks good, consider adding empty-string caseThe fixture nicely covers no value, arguments, and modifiers (both normal and self-closing). Since the rule also treats
v-text=""as a missing value, you might want to add that explicitly to these cases for a bit more coverage, but it’s not essential.crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs (1)
9-46: Rule metadata and docs look consistent, tiny example nitThe rule declaration looks spot-on: Vue domain, ESLint rule wired, and examples aligned with the behaviour. One tiny polish you could do: in the bullet list you use
<div v-text:aaa></div>as the “argument” example, while the invalid snippets below and tests usev-text:aaa="foo". Aligning those examples would make the docs just a bit crisper, but it’s purely cosmetic.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (7)
crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_html_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (8)
.changeset/use-vue-valid-v-text-rule.md(1 hunks)crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs(1 hunks)crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue(1 hunks)crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/use_vue_valid_v_text.rs(1 hunks)justfile(1 hunks)xtask/codegen/src/generate_new_analyzer_rule.rs(6 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
crates/biome_rule_options/src/use_vue_valid_v_text.rs (1)
crates/biome_rule_options/src/use_vue_valid_v_html.rs (1)
UseVueValidVHtmlOptions(6-6)
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs (1)
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_html.rs (1)
Rule(55-145)
⏰ 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). (10)
- GitHub Check: Test Node.js API
- GitHub Check: Check Dependencies
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Documentation
- GitHub Check: Check JS Files
- GitHub Check: autofix
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Parser conformance
🔇 Additional comments (8)
justfile (1)
115-118: Html‑Vue rule scaffolding looks consistentRecipe mirrors
new-html-lintruleand wires--kind=html-vuethroughgen-analyzer, so it should fit nicely into the existing workflow. No changes needed.xtask/codegen/src/generate_new_analyzer_rule.rs (4)
7-14: HtmlVue language kind wiring looks soundAdding
HtmlVuetoLanguageKind, mapping--kind=html-vueinFromStr, while keepingas_str()as"html"to reuse the HTML analyser crate, all hangs together nicely. It should route html-vue rules intobiome_html_analyzewithout surprising the rest of the codegen pipeline.Also applies to: 17-25, 31-39
359-383: GraphQL template body: sensible defaultsThe new GraphQL
run/diagnosticstubs match the other language templates and give a reasonable starting point for new rules. Nothing to change here.
427-458: HtmlVue Rule impl mirrors Html impl correctlyThe generated
Ruleimpl for Html‑Vue reuses the same trivialrun/diagnosticpattern as HTML, just with the Vue domain metadata above. Looks consistent and should compile cleanly once options exist.
541-555: Vue test generation: extension and fixtures line upThe
test_extensionoverride to"vue"forHtmlVue, plus the Vue‑flavoured valid/invalid contents, means new html‑vue rules will get:
valid.vue/invalid.vueundercrates/biome_html_analyze/tests/specs/nursery/<RuleName>/- Sensible starter HTML snippets for Vue templates.
Nice touch; this matches the added
useVueValidVTextfixtures.Also applies to: 623-636
crates/biome_rule_options/src/lib.rs (1)
379-389: Rule options export is in the right placeExporting
use_vue_valid_v_textalongside the other Vue rules keeps the module list tidy and makes the new options type available where expected. All good.crates/biome_rule_options/src/use_vue_valid_v_text.rs (1)
1-6: Options struct matches existing Vue rule patternsThis mirrors the
UseVueValidVHtmlOptionspattern and gives you room to evolve options later without churn. No issues from my side.crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs (1)
49-139: Logic mirrorsvalid-v-htmlnicely and handles all three violation kindsThe
runimplementation correctly gates onv-text, then short-circuits on argument, modifier, and finally missing/empty value. The empty-string handling and “non-string initialiser is fine” behaviour match the existingUseVueValidVHtmlpattern, which is great for consistency. Diagnostics read well and the ranges you highlight (argument/modifier vs whole directive) make sense from a UX perspective. I don’t see any issues here.
91b2bc7 to
1b2f87c
Compare
CodSpeed Performance ReportMerging #8158 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: 0
🧹 Nitpick comments (1)
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs (1)
49-53: Consider makingViolationKindnon‑public
ViolationKindseems internal to this rule; if it’s not referenced from other modules, you can drop thepubto keep the public surface minimal. Not urgent, just tidier.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (7)
crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_html_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (8)
.changeset/use-vue-valid-v-text-rule.md(1 hunks)crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs(1 hunks)crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue(1 hunks)crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/use_vue_valid_v_text.rs(1 hunks)justfile(1 hunks)xtask/codegen/src/generate_new_analyzer_rule.rs(6 hunks)
✅ Files skipped from review due to trivial changes (1)
- .changeset/use-vue-valid-v-text-rule.md
🚧 Files skipped from review as they are similar to previous changes (4)
- crates/biome_rule_options/src/use_vue_valid_v_text.rs
- crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue
- crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue
- justfile
🧰 Additional context used
🧬 Code graph analysis (1)
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs (1)
crates/biome_analyze/src/rule.rs (4)
recommended(602-605)domains(632-635)sources(617-620)same(246-251)
⏰ 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: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Documentation
- GitHub Check: End-to-end tests
- GitHub Check: Check Dependencies
- GitHub Check: Test Node.js API
- GitHub Check: Parser conformance
- GitHub Check: autofix
- GitHub Check: Validate rules documentation
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Check JS Files
🔇 Additional comments (8)
crates/biome_rule_options/src/lib.rs (1)
379-389: Vue rule export placement looks goodThe new
use_vue_valid_v_textmodule is named and ordered consistently with the other Vue rules; no issues from this side.crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs (3)
9-46: Rule metadata and docs look solid, just double‑check recommended statusDocs, examples, language/domain wiring, and
sourcespointing atvalid-v-textall look spot on. The only thing I'd sanity‑check isrecommended: truefor a nursery rule – if nursery rules are usually opt‑in, you might want thisfalseuntil it graduates.
61-99: Edge cases around “missing value” might be worth re‑checkingThe control‑flow for arguments/modifiers looks good, and the overall idea for detecting a missing value matches the rule description. Two nuance points you may want to verify against the actual AST and ESLint’s behaviour:
initializer.value()returningErr(_)is treated as “no value at all”, but that may also cover parse errors in the directive expression. Users could see a “missing value” message on what is essentially a syntax error.- The HtmlString branch flags empty string tokens as missing, but it’s not obvious from the HTML AST whether cases like
<div v-text=""></div>or whitespace‑only values should be treated as “missing”, or left to the generic parsing/expr rules.Might be worth running this against a few edge templates (
v-text="",v-text=" ", invalid JS expressions) to confirm you get the same diagnostics you expect from the ESLint rule.
102-139: Diagnostics are clear and nicely explanatoryMessages and notes make it very obvious what’s wrong (argument, modifier, or missing value) and how to fix it, and ranges are appropriate (
rangefor arg/modifier, whole directive for missing value). Nicely done.xtask/codegen/src/generate_new_analyzer_rule.rs (4)
6-42:LanguageKind::HtmlVuewiring looks correctAdding
HtmlVuewithas_str()→"html"and"html-vue"inFromStrcleanly reuses the existingbiome_html_analyzecrate while giving a distinct CLI kind. No concerns here.
312-385: GraphQL template stub change is harmlessThe GraphQL branch now mirrors the JSON stub (no signals, generic diagnostic). Since this is just a scaffold that authors will immediately edit, there’s no functional risk. All good.
387-461: HtmlVue rule template is a good starting point for Vue rulesThe new HtmlVue template pulls in
RuleDomain::Vueand anEslintVueJssource, queriesHtmlRoot, and setslanguage: "html", which is exactly what you want for Vue SFC templates living in the HTML analyser. The stubbedrun/diagnosticare generic but compile‑ready, so future Vue rules can iterate from there.
538-556:.vuetest generation logic is nicely scopedUsing
test_extension = "vue"only forLanguageKind::HtmlVueand otherwise falling back torule_kind, plus the Vue‑specificvalid_contents/invalid_contents, ensures new Vue rules get.vuefixtures while existing languages keep their current behaviour. Pathsvalid.{test_extension}/invalid.{test_extension}look consistent.Also applies to: 622-636
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.
Left some comments to make the code shorter. The rule should test against empty values
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs
Outdated
Show resolved
Hide resolved
crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue
Show resolved
Hide resolved
crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue
Show resolved
Hide resolved
1b2f87c to
7654ddd
Compare
crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue
Show resolved
Hide resolved
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.
I went ahead and updated the implementation for useVueValidVHtml because useVueValidVText was copied from there.
7654ddd to
7188d7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_html.rs (1)
9-16: Update v-html rule docs to match empty-string handlingThe new
runlogic correctly reportsMissingValuefor both absent values and empty/whitespace-only values viainner_string_text. The doc comment above still only mentions “does not have an attribute value” and shows<div v-html></div>as the sole example. It would be clearer to also call out (and/or example)v-html=""/ whitespace-only as reported cases so docs stay in lockstep with the behaviour.Also applies to: 55-87
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (8)
crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_html_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_html_analyze/tests/specs/nursery/useVueValidVHtml/invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (10)
.changeset/use-vue-valid-v-text-rule.md(1 hunks).changeset/weak-houses-doubt.md(1 hunks)crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_html.rs(2 hunks)crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs(1 hunks)crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue(1 hunks)crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/use_vue_valid_v_text.rs(1 hunks)justfile(1 hunks)xtask/codegen/src/generate_new_analyzer_rule.rs(6 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue
- crates/biome_rule_options/src/lib.rs
- crates/biome_rule_options/src/use_vue_valid_v_text.rs
🧰 Additional context used
🧬 Code graph analysis (2)
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_html.rs (1)
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs (1)
run(61-88)
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs (1)
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_html.rs (2)
run(61-87)diagnostic(89-126)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Documentation
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: Test Node.js API
- GitHub Check: Check JS Files
- GitHub Check: autofix
- GitHub Check: Parser conformance
- GitHub Check: Bench (biome_configuration)
🔇 Additional comments (7)
justfile (1)
115-118: Html-Vue rule scaffolding and move-rule regeneration look solidThe
new-html-vue-lintrulerecipe cleanly mirrors the existing HTML rule scaffolder with--kind=html-vue, and extendingmove-ruleto rerun the analyzer avoids stale codegen. No concerns here.Also applies to: 121-124
xtask/codegen/src/generate_new_analyzer_rule.rs (3)
7-13: HtmlVue language kind and test generation are wired coherently
LanguageKind::HtmlVuemaps from"html-vue"and deliberately reuses"html"foras_str(), so new Vue rules land inbiome_html_analyzewhile getting.vuefixtures viatest_extension. The HtmlVue-specific valid/invalid contents also line up with Vue templates. Looks consistent with the rest of the generator.Also applies to: 17-25, 29-41, 538-555, 622-636
313-386: Nice consistency bump for GraphQL rule templatesAdding
runanddiagnosticstubs for the GraphQL template brings it in line with the other languages, which should make new rules less of a blank page. No functional issues spotted.
387-461: Vue-specific rule skeleton looks appropriateThe HtmlVue template sets
language: "html",domains: &[RuleDomain::Vue], and an ESLint Vue.js source, which matches how the concrete Vue rules are structured. The Vue-flavoured examples andHtmlRootquery give a sensible starting point for new rules..changeset/weak-houses-doubt.md (1)
1-5: Changeset accurately documents the v-html fixThe note about
useVueValidVHtmlnow flaggingv-html=""matches the new empty-string handling in the rule. All good.crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue (1)
1-13: Invalid fixtures nicely cover the rule’s surfaceYou’ve got missing values, explicit empty strings, arguments, modifiers, and both normal and self-closing tags covered, which should exercise all ViolationKind branches. Looks comprehensive.
crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs (1)
61-87: Rule logic matches intent and mirrors v-html nicelyThe
runimplementation cleanly sequences argument → modifier → value checks, and theinner_string_text(...).trim().is_empty()guard is a neat way to treat empty/whitespace values as missing. UsingVueDirectivedirectly also keeps the query tight. No issues from the engine room.
| Added the `useVueValidVText` lint rule to enforce valid `v-text` directives. The rule reports when `v-text` has an argument, has modifiers, or is missing a value. | ||
|
|
||
| Invalid: | ||
|
|
||
| ```vue | ||
| <div v-text /> <!-- missing value --> | ||
| <div v-text:aaa="foo" /> <!-- has argument --> | ||
| <div v-text.bbb="foo" /> <!-- has modifier --> | ||
| ``` |
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.
Clarify that empty or whitespace-only values are also reported
The rule (and fixtures) treat v-text="" / whitespace-only as a missing value, but the changeset text and examples only mention the attribute being absent. Consider adding an empty-value example (e.g. v-text="") or explicitly saying “missing or empty value” so users know those cases are intentional.
🤖 Prompt for AI Agents
.changeset/use-vue-valid-v-text-rule.md around lines 5 to 13: the changeset
examples only mention a missing attribute value but the rule also treats empty
or whitespace-only values as missing; update the text to say “missing or empty
value (including empty or whitespace-only strings)” and add an example such as
`<div v-text="" />` or `<div v-text=" " />` to the invalid list so users
clearly understand those cases are intentionally reported.
| /// Enforce valid `v-text` Vue directives. | ||
| /// | ||
| /// This rule reports `v-text` directives in the following cases: | ||
| /// - The directive has an argument. E.g. `<div v-text:aaa></div>` | ||
| /// - The directive has any modifiers. E.g. `<div v-text.bbb></div>` | ||
| /// - The directive does not have a value. E.g. `<div v-text></div>` | ||
| /// |
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.
Align v-text rule docs with empty/whitespace-value behaviour
Like the v-html rule, this one now reports MissingValue for both absent values and empty/whitespace-only ones (e.g. v-text=""), and the tests reflect that. The comment currently only says “does not have a value” and shows <div v-text></div>. Consider tweaking the wording (e.g. “missing or empty value”) and/or adding an v-text="" example so users aren’t surprised by those diagnostics.
Also applies to: 61-87
🤖 Prompt for AI Agents
In crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs around
lines 10 to 16 (and similarly update lines 61 to 87), the doc comment only
mentions “does not have a value” and shows <div v-text></div> but the rule also
reports MissingValue for empty or whitespace-only values (e.g. v-text="").
Update the comment to say “missing or empty/whitespace-only value” (or “missing
or empty value”) and add an example such as <div v-text=""></div> to the list so
the docs match the behavior and tests.
7188d7b to
3182d1a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue (1)
3-14: Add test coverage for argument/modifier combined with empty values.The test suite is missing cases where an argument or modifier is combined with an empty or whitespace-only value. These cases should trigger multiple violations.
Consider adding:
<div v-text:aaa=""></div> <div v-text.bbb=""></div> <div v-text:aaa=" "></div> <div v-text.bbb=" "></div>This addresses the concern raised in previous review comments and ensures the rule correctly handles multiple simultaneous violations.
xtask/codegen/src/generate_new_analyzer_rule.rs (1)
23-25: Consider adding a clarifying comment.Both
HtmlandHtmlVuereturn"html"since they share the same crate (biome_html_analyze). Whilst correct, a brief comment might help future maintainers understand this intentional duplication.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (8)
crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_html_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_html_analyze/tests/specs/nursery/useVueValidVHtml/invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (10)
.changeset/use-vue-valid-v-text-rule.md(1 hunks).changeset/weak-houses-doubt.md(1 hunks)crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_html.rs(2 hunks)crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs(1 hunks)crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/invalid.vue(1 hunks)crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/use_vue_valid_v_text.rs(1 hunks)justfile(1 hunks)xtask/codegen/src/generate_new_analyzer_rule.rs(6 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
- crates/biome_html_analyze/tests/specs/nursery/useVueValidVText/valid.vue
- crates/biome_rule_options/src/use_vue_valid_v_text.rs
- crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_html.rs
- crates/biome_html_analyze/src/lint/nursery/use_vue_valid_v_text.rs
- .changeset/weak-houses-doubt.md
- .changeset/use-vue-valid-v-text-rule.md
- justfile
⏰ 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). (12)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Check Dependencies
- GitHub Check: Documentation
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: End-to-end tests
- GitHub Check: Test Node.js API
- GitHub Check: Check JS Files
- GitHub Check: Parser conformance
- GitHub Check: autofix
- GitHub Check: Bench (biome_configuration)
🔇 Additional comments (8)
crates/biome_rule_options/src/lib.rs (1)
388-388: LGTM!Module declaration correctly placed in alphabetical order and follows the established pattern.
xtask/codegen/src/generate_new_analyzer_rule.rs (7)
13-13: LGTM!Clean addition of the HtmlVue variant to the enum.
37-39: LGTM!The
"html-vue"string mapping is intuitive and consistent with the hyphenated naming convention.
359-383: Diff annotations appear spurious.These lines are marked as changed but appear to be pre-existing Graphql template code with no visible modifications. This is likely a formatting artefact or diff generation issue.
387-461: Excellent Vue template implementation.The HtmlVue branch properly includes Vue-specific configuration (
RuleDomain::Vue,RuleSource::EslintVueJs) whilst correctly using the HTML language infrastructure. The placeholder"rule-name"on line 423 is appropriate for developers to replace when generating rules.
541-555: LGTM!The conditional logic properly sets Vue-specific test extensions and HTML-style test content for HtmlVue rules. Clean implementation.
623-627: LGTM!Valid test file creation properly uses the
test_extensionvariable, ensuring.vuefiles are generated for HtmlVue rules.
631-635: LGTM!Invalid test file creation mirrors the valid test logic correctly.
Summary
Adds a new lint rule to enforce valid
v-textdirectives. It's a direct port of https://eslint.vuejs.org/rules/valid-v-text.html Implementation is pretty much the same as thev-htmlone.Also adds some codegen to make new html/vue lint rules easier to author.
This now also refactors
useVueValidVHtmlbased on the feedback given here, since the implementation for this rule was copied from that one.Test Plan
Snapshot tests.
Docs