Repository navigation
chore(lint): check Svelte components with svelte-policy - #409
Merged
Merged
Conversation
Svelte compiles an each block keyed by its own index to the same code as an unkeyed one, so the bundle is byte-identical; the key satisfies the require-each-key policy that svelte-policy enforces.
The package is not on npm yet. The vendored tarball is replaced by the published 0.1.0 before this branch merges.
npm run lint now runs the svelte-policy component checker after oxlint, and oxlint applies its svelte/internal import guard to source files. Debug tags and $inspect are errors to match lint's --deny-warnings.
# Conflicts: # AGENTS.md # package.json
Deploying podnotes with
|
| Latest commit: |
4b569de
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://aad38922.podnotes.pages.dev |
| Branch Preview URL: | https://chore-svelte-policy.podnotes.pages.dev |
# Conflicts: # AGENTS.md # package-lock.json # package.json
chhoumann
marked this pull request as ready for review
October 12, 2026 20:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
npm run lintnow checks every Svelte component with svelte-policy. The package also replaces QuickAdd'stooling/checker, so both plugins share one copy of each rule. Before this, oxlint ignored.sveltefiles entirely.svelte-policychecks each component. It requires each-block keys that reference the item or index, and it reports the following:{@html}consolemethods other thanwarnanderrornew Functionon:/use:directivessvelte-ignorecommentsbind:thiselementssvelte-policy.jsonmakes{@debug}and$inspecterrors, to match lint's--deny-warnings. The runes requirement and the store ban stay off, their defaults. 20 components still use legacy syntax, and the UI redesign will turnrunes-onlyon once they are migrated..oxlintrc.jsonloadssvelte-policy/oxlintand runssvelte-policy/no-svelte-internalonsrc/**/*.ts.ChapterList.svelte. It is now keyed by its index. Svelte compiles an index-keyed each block to the same code as an unkeyed one, somain.jsis byte-identical.The package is svelte-policy 0.1.0 on npm, installed as
"svelte-policy": "^0.1.0".Verification
Commands, on Node v22.23.2:
These all pass on the merge with origin/master 33e0e62, which includes build: make native Svelte checks fast and fail closed #416's scripts and the svelte-check patch:
npm run lintnpm run format:checknpm run typechecknpm run buildnpm run size: 284,862 raw bytes and 90,640 gzip bytes.npm run test: 1,712 tests.npm run test:tooling: 10 tests.npm run docs:buildmain.jsis byte-identical to origin/master's build at 33e0e62, sha2567f6eb5a2ee8c7e4ddf474082d2594b74314b8b1e0b0af6ad015e8f838bfcf005. It was also identical to each earlier master this branch merged: beda5be, 3980111 and 2cd9974.npm run test:e2epassed once on this branch, before the later master merges: 11 files and 68 tests in the isolated Obsidian instance (Linux, headless). The bundle is unchanged since then.With the npm-installed 0.1.0, lint catches planted violations. A planted
onclick={42}and a keyless{#each}giveno-not-function-handlerandrequire-each-key, and the checker exits 1. Earlier, with the vendored build, a plantedsvelte/internalimport in a.tsfile gavesvelte-policy(no-svelte-internal)from oxlint, and a planted{@debug}gaveno-at-debug-tags.package-lock.jsonchanges only what this needs, compared with master:svelte-policydevDependency, resolved from the registry with integritysha512-3BP+Gm91..., which matches the published tarball;esquery1.6.0 to 1.7.0;zimmerframe1.1.4 to 1.1.5.There is no
libcordevOptionalchurn.No Obsidian runtime behavior changes, so there is no runtime evidence beyond the e2e run.
Release impact
None. This adds dev tooling only, and the bundle is unchanged.
Docs at release
None.
Note
Add
svelte-policylint checks for Svelte componentssvelte-policypackage and loads its oxlint plugin with theno-svelte-internalrule at error severity in .oxlintrc.jsonnpm run lintnow runs thesvelte-policychecker after oxlint, using a new svelte-policy.json config that reports@debugtags and$inspectusage as errorseachblock by index in ChapterList.svelte to satisfy the new checkernpm run lintandnpm run formatnow fail on@debugtags,$inspectusage, and Svelte internal API referencesMacroscope summarized 4b569de.