openpencil/tools/checks/lint
Danila Poyarkov 1c09e3074d
refactor(canvas): draw screen-sized chrome through one outline helper (#947)
* refactor(canvas): draw screen-sized chrome through one outline helper

Overlays each set a zoom-divided stroke width, built a zoom-divided dash,
and reset the shared paint and freed the dash by hand. withScreenStroke
and inNodeSpace do that once, and slot outlines, component set borders,
code focus, the entered container, path-text selection, issue highlights,
and the text-edit frame use them.

The drop-target highlight and the text-edit caret and selection were drawn
inside the scene, which is cached and scaled while navigating; they move
to the overlay pass. open-pencil/no-zoom-in-scene-drawing rejects reading
the zoom in scene drawing modules, apart from choosing effect raster
quality, and the Core guide states the rule.

* refactor(canvas): outline a layer's bounds through one helper

The drop-target highlight and the entered container drew the same screen-sized rectangle around a layer; outlineNode draws it for both.

* fix(lint): stop the effect raster exemption at function boundaries

A zoom read inside a callback passed to effectRasterScale is not the raster scale argument.

* perf(canvas): keep the cached scene while drop targeting and editing text

Both are drawn only in the overlay pass now, so they no longer need an uncached scene render each frame.
2026-10-07 18:37:05 +00:00
..
src refactor(canvas): draw screen-sized chrome through one outline helper (#947) 2026-10-07 18:37:05 +00:00
tests refactor(canvas): draw screen-sized chrome through one outline helper (#947) 2026-10-07 18:37:05 +00:00
NOTICE build(tools): group tools by role and gate them like the rest of the repo (#791) 2026-09-30 05:00:31 +04:00
package.json chore: prefer es-toolkit helpers and lint the mechanical cases (#898) 2026-10-05 09:34:00 +00:00
README.md build(tools): group tools by role and gate them like the rest of the repo (#791) 2026-09-30 05:00:31 +04:00

OpenPencil lint rules

src/plugin.ts registers locally owned rules; the workspace oxlint.json selects policy. Run bun run --cwd tools/checks/lint test for rule tests and bun run lint for repository enforcement.

Test and type policies

  • no-module-mocking rejects Bun, Vitest, and Jest module registry mocking, including Bun's mock and jest exports and Vitest's vi and vitest exports. Scoped spies and injected dependencies remain supported. Detection covers direct framework calls and renamed named imports, not arbitrary alias propagation or destructuring.
  • no-reduce-accumulator-copy detects unbounded accumulator copies through Object.assign, Array.from, and array copy methods. It complements oxc/no-accumulating-spread. Literal-bounded slices such as slice(0, 2) and slice(-2) are allowed; slice(2) and slice(0, -1) still copy a potentially growing range. This is a conservative syntactic check, not a proof of quadratic runtime for every reducer.
  • no-widen-then-assert detects immutable local bindings widened to broad types and then asserted narrower in the same function. It intentionally avoids inferring arbitrary type aliases, imported return types, or cross-function flows.

The experimental known-value-widening audit is not included: its broad policy produced too many intentional-contract diagnostics to justify maintaining a separate type resolver.

Maintenance

Upstream attribution and the full license are in NOTICE. These are adapted, locally owned rules, not an automatically synchronized vendor directory. Compare any upstream updates against the recorded commit, preserve local behavior, and add positive and negative regression cases before changing enforcement.

Tests share tests/helpers/lint.ts, which invokes the real Oxlint plugin, rejects parser/configuration failures, and cleans each fixture in finally. Keep test infrastructure out of runtime source helpers.