Skip to content

v0.7.8

Choose a tag to compare

@github-actions github-actions released this 08 Nov 06:27
86287be

Summary

0.7.8 adds two lint rules that catch component code drifting from Nativele's design, and states the design principles in docs/design.md. Both rules are data-flow warnings whose Fix: links the principle they rest on.

Changes

  • Lint rule static-markup-in-code (data-flow, warning): a component class that creates an element with document.createElement and gives it a fixed text or attribute in the same block (b.textContent = "Remove", b.type = "button", setAttribute with a literal), structure the template can hold. A value that adds data, a write to another element, comments and strings are not reported, nor is an element whose content comes from data.
  • Lint rule dom-node-in-state (data-flow, warning): a state or props value that holds several DOM nodes ([] as HTMLElement[], new Set<HTMLElement>(), a DocumentFragment), a copy of what the DOM holds. A single element such as an anchor a parent passes in is not reported.
  • docs/design.md states the design principles in five parts: HTML describes, TypeScript decides; the browser is the runtime; data flows one way; small surface, checked by tools; integrations stay at the edge.
  • npx ts-dom rules --explain=<id> explains both rules with an example.

Breaking Changes

None. New lint rules are warnings.