Repository navigation
Check import cycles with knip, and turn on ruff's preview F401 and prefer-const - #5222
Merged
Merged
Conversation
…efer-const A survey of candidate lints, each run over the tree with a sample of its findings read, found three that report only real problems here: - knip's `cycles`, which reads the whole tree and the framework facade's edges. It found two cycles dependency-cruiser's `no-cycle` couldn't see: voice.js reached the application publisher through `/runtime/framework.js`, which the cruiser excludes, to import Lit's `html`, and build/runtime-bundle.mjs and build/browser/build.mjs imported each other for `signalsPath`. voice.js now imports `html` from `/vendor/lit.js`, and `signalsPath` lives in runtime-bundle.mjs, which compiles the signals in. `no-cycle` is deleted: knip reports every static cycle it did, and the dynamic-import cycles it also reported have no evaluation order to break. - ruff's preview behaviour for the selected rules (no preview rules), whose F401 reports an unused `import http.cookiejar` beside a used `import http.client`. It removed four such imports from tests. - eslint's `prefer-const` with `ignoreReadBeforeAssign`, which leaves the forward declarations boot reads from closures and reports the four bindings that were never reassigned. The survey also found three page styles reading tokens the theme doesn't define, now pointed at the ones it does: data-explorer's `--r-sm` (`--r-s`), the notification playground's `--bad` (`--danger`), and the cutover fixture's `--border` (`--border-2`). `referencing`, which src/leaf imports directly, is now a declared dependency rather than one jsonschema happens to bring.
# Conflicts: # dist/kernel/kernel.json # dist/kernel/runtime/bundle-errors.js
leaf-agent
approved these changes
Nov 3, 2026
max-sixty
pushed a commit
that referenced
this pull request
Nov 18, 2026
…t cycles (#5301) Some agent instructions still point to where things used to live. #5121 moved every `:root` theme token from `browser/base.css` into `browser/styles/tokens.css`, and #5222 moved the import-cycle check from dependency-cruiser to knip. This PR updates those pointers and changes no rule. - **`browser/AGENTS.md`** - `--lf-line` and `--raise-1` to `--raise-3` now point to `styles/tokens.css`. - The Layout/style/widget rule now says the style's tokens are in `styles/tokens.css`. - The module-boundaries paragraph now credits knip (`knip.config.js`) with rejecting import cycles. `.dependency-cruiser.mjs` has had no cycle rule since #5222. - **The developing-leaf glossary:** **Focus ring** now places `--focus-ring` in `styles/tokens.css`. - **The shipped `skills/leaf/references/package-themes.md`:** the default palette and the "Where it stands" tokens (`--focus-region-gap`, etc.) now point to `browser/styles/tokens.css`. An agent writing a theme would otherwise search `base.css` and find none of them. I grepped both files to confirm each named token is declared in `tokens.css` and not in `base.css`. `prek run` passes on the changed files. #5299 fixes the same stale pointers in code comments. This PR is separate because these paths need the control-plane owner's approval. Co-authored-by: leaf-agent <[email protected]>
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.
A survey of candidate lints, each run over the tree with a sample of its findings read, found three that report only real problems here. This adds them and fixes what they reported.
cycles, which reads the whole tree and the framework facade's edges. It found two import cycles dependency-cruiser'sno-cyclecouldn't see.voice.jsreached the application publisher through/runtime/framework.js, which the cruiser excludes, to import Lit'shtml; it now importshtmlfrom/vendor/lit.js, asicons.jsdoes.build/runtime-bundle.mjsandbuild/browser/build.mjsimported each other forsignalsPath, which now lives inruntime-bundle.mjs, the module that compiles the signals in.no-cycleis deleted: on a planted static cycle knip fails as it did, and the dynamic-import cycles only the cruiser reported have no evaluation order to break.previewwithexplicit-preview-rules, so no preview rules), whose F401 reports an unusedimport http.cookiejarbeside a usedimport http.client. It removed five such imports from tests, one of them from a test that landed onmainsince the survey.prefer-constwithignoreReadBeforeAssign, which leaves the forward declarations boot reads from closures (17 of the default form's 21 findings) and reports the four bindings that were never reassigned.The survey also found three page styles reading tokens the theme doesn't define, so the declaration computed to nothing; they now name the ones it does:
data-explorer.html's--r-sm(--r-s), the notification playground's--bad(--danger), and the cutover eval fixture's--border(--border-2).referencing, whichsrc/leafimports directly, is now a declared dependency rather than one jsonschema brings.Rejected after measuring: further ruff families, about 45 eslint core rules, typescript-eslint's type-aware rules (211 s and a second TypeScript), oxlint's
no-floating-promises(22 calls missing the tree'svoidmarker, none failing silently), ty's default-off rules, stylelint, commented-out-code detectors and jscpd, each either noise or clean.Validation: every pre-commit hook and
pnpm run check:browserpass on the merged tree, and the 737 runtime tests passed on the change beforemainwas merged in.