Repository navigation
feat(core): add correctness/checkable-bind-value rule - #306
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…indValues Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Also fixes two CLI test fixtures (malformed-svelte.test.ts, suppression-e2e.test.ts) missing the checkableBindValues field on ComponentFacts literals — a gap from an earlier task that only surfaced under the monorepo-wide `pnpm typecheck`, not core's own `tsc --noEmit`. Remaining diff is oxfmt reformatting picked up by `pnpm format` while fixing the lint step.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a correctness rule that detects static checkbox and radio inputs using ChangesCheckable bind value rule
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SvelteComponent
participant ComponentParser
participant ComponentFacts
participant CorrectnessRule
SvelteComponent->>ComponentParser: parse template AST
ComponentParser->>ComponentFacts: record checkableBindValues
ComponentFacts->>CorrectnessRule: provide component findings
CorrectnessRule-->>SvelteComponent: emit warning and fix guidance
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/superpowers/plans/2026-07-24-checkable-bind-value.md`:
- Line 22: Update the working-directory instruction in the document to refer
generically to the repository root, removing the machine-specific absolute path
while preserving the command context.
- Around line 492-507: Fix the nested Markdown fences in the documented
examples, including the sections around the shown examples and the additional
affected ranges, so inner Svelte code blocks close with three backticks while
the surrounding four-backtick fence remains open. Ensure the outer fence closes
only after all examples, eliminating the downstream MD040 warnings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 097f6126-16b8-43af-8a42-eb3dbf04e3da
📒 Files selected for processing (22)
.changeset/checkable-bind-value-rule.mddocs/src/content/docs/ja/rules/correctness/checkable-bind-value.mddocs/src/content/docs/rules/correctness/checkable-bind-value.mddocs/superpowers/plans/2026-07-24-checkable-bind-value.mddocs/superpowers/specs/2026-07-24-checkable-bind-value-design.mdpackages/cli/test/malformed-svelte.test.tspackages/cli/test/suppression-e2e.test.tspackages/core/src/component-collect.tspackages/core/src/component-parse.tspackages/core/src/component.tspackages/core/src/index.tspackages/core/src/rules/correctness/checkable-bind-value.tspackages/core/src/rules/index.tspackages/core/test/architecture-rules.test.tspackages/core/test/bundle-rules.test.tspackages/core/test/checkable-bind-value-parse.test.tspackages/core/test/checkable-bind-value-rule.test.tspackages/core/test/component-collect.test.tspackages/core/test/component-rule.test.tspackages/core/test/correctness-rules.test.tspackages/core/test/security-kit-rules.test.tspackages/core/test/security-rules.test.ts
Remove a machine-specific absolute path from the working-directory note, and fix nested Markdown fences in the Task 4 doc-page examples — the inner ```svelte/```js examples were closing the outer four-backtick wrapper early, which also swallowed the Japanese doc-page's frontmatter into a stray fence further down. Verified with `pnpm exec oxfmt --check`. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Resolves the conflicts with #306 (correctness/checkable-bind-value), which landed on main while this branch was open. Every conflict was the same shape: both rules add a fact to the component channel and a field to the same object literals, so both sides are kept, with checkable-bind-value's entries first to keep main's ordering stable. - component.ts: both fact interfaces (CheckableBindValueFact, BasePathLinkFact) had been interleaved by the auto-merge — reconstructed as two complete interfaces, then both fields on ComponentFacts. - component-parse.ts: same for the two collector functions, plus both collections wired into parseComponentFacts and both defaults in parseModuleFacts. - The nine remaining files are one-line "both sides added a field" cases. Verified: pnpm lint / typecheck / build / test all pass (1639 tests), and both rules' facts are extracted side by side from one component. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Summary
correctness/checkable-bind-value: flags<input type="checkbox" bind:value={x}>and<input type="radio" bind:value={x}>—bind:valuebinds the DOMvalueproperty, which checkbox/radio interaction never changes, so the bound state silently never updates in production.svelte.compile()reports zero warnings for this pattern, confirming it's a real deploy-blocker that only static analysis catches.<input>with a statically-literaltypeonly. Dynamictype={expr},<svelte:element>,<select bind:value>, and custom components accepting abind:value-shaped prop are documented out-of-scope limitations.Design doc:
docs/superpowers/specs/2026-07-24-checkable-bind-value-design.mdPlan:
docs/superpowers/plans/2026-07-24-checkable-bind-value.mdCloses #299
Test plan
pnpm --filter @svelte-vitals/core exec vitest run test/checkable-bind-value-parse.test.ts— 10/10 passing (detection logic + exclusions)pnpm --filter @svelte-vitals/core exec vitest run test/checkable-bind-value-rule.test.ts— 5/5 passing (rule messages, severity, registration)pnpm lint && pnpm typecheck && pnpm build && pnpm test && pnpm check:publish— all green (1569 tests passing across core/cli/mcp/vite)🤖 Generated with Claude Code
Summary by CodeRabbit
correctness/checkable-bind-valuerule.bind:value, which may not update after user interaction.bind:checkedfor individual checkboxes andbind:groupfor checkbox or radio groups.