Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>WcStack IntelliSenseNew to Visual Studio Code? Get it now.
WcStack IntelliSense

WcStack IntelliSense

wcstack

|
1 install
| (0) | Free
TypeScript language features for <wcs-state> inline scripts in HTML
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

WcStack IntelliSense

A VS Code extension for @wcstack/state 4.0. Provides TypeScript language features for <wcs-state> inline scripts, and completions / hover / navigation / diagnostics for data-wcs bindings in HTML.

@wcstack/state 4.0. The bundled parser and manifest are 4.0's, and the checks follow the 4.0 rules: names 4.0 removed (the 3.2 old names, $scan, substr) are reported with their replacement, numeric index paths (items.0.name, groups.0.items.1.v) are not, and the 4.0 settings ($behavior, $features, <wcs-state features>) and the #direct modifier are understood. For a project still on 3.x, keep extension 1.21.x (1.21.0 bundles 3.5 and points out, as wcs/v4-migration hints, what 4.0 changes).

The same validator core is shipped headlessly as the wcs-validate CLI (@wcstack/lint), so the editor and CI report the same diagnostic codes on the same ranges.

Features

Inline Script Type Support

TypeScript completions work inside <script type="module"> within <wcs-state>. No import or defineState() required — the script is wrapped for you.

<wcs-state>
  <script type="module">
export default {
  count: 0,
  users: [{ name: "Alice", age: 30 }],

  increment() {
    this.count++;                 // number
    this["users.*.name"];         // string
    this["users.*.age"];          // number
    this.$getAll("users.*.age");  // number[]
  },

  get "users.*.ageCategory"() {
    return this["users.*.age"] < 25 ? "Young" : "Adult";
  }
};
  </script>
</wcs-state>

The wrapper's preamble knows the runtime API surface: $getAll(path, indexes?), $setAll, $update, $resolve, $command.<name>, $streamStatus.<name> / $streamError.<name>, and the contextual types of $watch handlers and $listKeys key functions (no false noImplicitAny errors). It types the 4.0 declarations $behavior (enableMustache / sameValueGuard / enableDirectionalInitialSync, booleans) and $features (add-on names), and has no member for the names 4.0 removed — this.$trackDependency(…) is a type error, as it is a runtime error.

Attribute Binding Completions

Completions for property names, state paths, modifiers, and filter names in data-wcs attribute values.

  • data-wcs=" → textContent, class., style., attr., onclick, for, if, ..., radio, checkbox, command., eventToken. ...
  • data-wcs="textContent: → count, users, users.*.name ...
  • data-wcs="textContent: count| → gt, eq, upper, trim ... (all 48 built-in filters of 4.2)
  • data-wcs="value| → write-back (input) filters such as int
  • data-wcs="onclick# → prevent, stop, ro, direct (the modifier list is the same after any #; ro suppresses write-back on two-way bindings; direct attaches an on*: listener to the element itself instead of delegating it to the root — 4.0)
  • data-wcs="for: → only array-typed paths
  • data-wcs="onclick: → only methods and $command.<name>
  • data-wcs="command.play: → only $command.<name> (from the $commandTokens declaration)
  • data-wcs="eventToken.value: → only token names from the $eventTokens declaration

Path candidates are derived from the <wcs-state> script (and from JSON state): nested arrays are followed (a.*.b.*.c), $stream entries appear as values plus $streamStatus.<name> / $streamError.<name>, and $listKeys declarations materialize list paths whose initial value is an empty array (the list path, .*, .length and the key field — not the other row fields).

The row shape of a list that starts as [] is read from the row literals in the assignments that add or replace rows — this.items = this.items.concat({ id, kind: "general" }), .toSpliced(i, n, { … }), .with(i, { … }), and [...this.items, { … }] / [{ … }, ...this.items] — anywhere in the script (methods, getters, $connectedCallback, $watch handlers). An assignment that rebuilds the rows is read the way a getter returning them is: this.rows = [...this.items].map((c) => ({ id: c.id, label: c.name })), this.rows = this.items.filter(Boolean).map((c) => { return { … }; }), this.rows = (await res.json()).map((r) => ({ … })) give the callback's literal as the row, and this.visible = this.items.filter(…) gives items' rows. So does the mapper of Array.from({ length: n }, (_, i) => ({ … })) / Array.from(source, (x) => ({ … })) and a map after [...Array(n).keys()]. A getter whose result the analyzer cannot read from its body (return buildRows(this.sound)) is declared with a JSDoc @returns {T} or @type {T} before it — either is the getter's result type, as in TypeScript. A key seeded with an object literal (fieldErrors: {}) gains the keys of the object literals assigned to it (this.fieldErrors = { date: "…" } → fieldErrors.date, added to the seed's; a spread inside the literal is not followed). Only a path already known to be an array, or seeded with an object, gains fields this way, and an explicit initial value always wins. A $listKeys entry is the other way to say "this is a list": $listKeys: { items: "id" } alone makes the analyzer know items, items.*, items.length, and the key field items.*.id — nothing else about the row. A row passed as a variable (concat(row)) cannot be read — declare a stateSchema for that case.

for-context Completions

Inside <template data-wcs="for: items">, shorthand paths (.name, .age) are generated as completion candidates.

<wcs-state>
  <script type="module">
export default {
  items: [{ name: "Alice", age: 30 }]
};
  </script>
</wcs-state>

<template data-wcs="for: items">
  <!-- .name, .age appear as candidates for data-wcs="textContent: " -->
  <span data-wcs="textContent: .name"></span>
</template>

Pattern paths (items.*.name) and shorthand paths (.name) are excluded from completions outside <template for>.

Template Syntax Support

Completions and diagnostics also work in Mustache {{ }} and comment binding <!--@@:--> syntax. Both are parsed through the same text-channel parser as the runtime, so {{ a; b }} is one path, exactly as the runtime reads it.

@wcstack/state 4.0 still binds comment bindings — even with $behavior: { enableMustache: false } — and they remain the recommended way to avoid FOUC outside a <template> on a page without SSR. Expressions may span lines in both forms. A comment inside <textarea> or <title> is text to the browser, so it is not a binding there (and is not validated as one); {{ }} inside them is a text node and is bound, and the FOUC hint there suggests binding the element (<title data-wcs="textContent: …">, <textarea data-wcs="value: …">) instead of the comment form.

{{ }} is read only where the runtime binds it: in text, not in an attribute value (aria-current="{{ x }}") or inside an HTML comment. A <wcs-state> binds the document's <body> (and shadow roots), not its <head>: a {{ }} or a comment binding in the document's <head> (<title>{{ pageTitle }}</title>) is a wcs/template-syntax warning, and its path is not checked (a route's <wcs-head> is bound, through the router). When the page's root state declares $behavior: { enableMustache: false } — a CMS's or a server template's {{ }} beside an island — no {{ }} is validated as a binding at all; comment bindings still are. The setting is read from the state wherever the validator can read it (inline, json=, state=, or an src= file); a state it cannot read leaves {{ }} validated as before.

<!-- Mustache syntax — path and filter completions -->
<p>{{ count|gt(0) }}</p>

<!-- Comment binding syntax — no FOUC -->
<p><!--@@:count|gt(0)--></p>
<p><!--@@wcs-text:count--></p>

wcs-* Tag Completions (HTML Custom Data)

The extension ships wcs.html-data.json — VS Code HTML custom data generated from every I/O package's static wcBindable surface and observedAttributes (npm run emit:builtin-tags; freshness against the committed bundles is CI-gated). It provides, in any HTML file with no <wcs-state> required:

  • Tag-name completion for all wcs-* elements (<wcs-f → <wcs-fetch>)
  • Hover on a tag showing its contract — bindable properties, inputs, command.* names — with a link to the package README
  • Attribute completion (observed attributes and input attribute mirrors)
  • data-wcs declared as a global attribute with a binding-syntax summary

Other editors that use the standard HTML language service (and VS Code setups without this extension) get the same completions by copying the file into the project and referencing it from the html.customData setting:

{ "html.customData": ["./wcs.html-data.json"] }

Hover, Go to Definition, Find References, Inlay Hints

Binding paths are runtime identifiers written directly in HTML, so navigation works without source maps. All four features are queries over the same positional reference index that powers diagnostics.

  • Hover on a binding path shows its kind (data / computed / list / method / command token / event token), inferred type, owning state, and declaration line. for-shorthand paths show their expansion (`.name` → `users.*.name`). Hovering a filter name shows its signature, description, and type transform (number → string); hovering a modifier (#prevent, #stop, #ro, #direct, #init=, #sync=, #on<event>) explains its semantics. Hovering a filter name 4.0 removed (uc, fix, substr, …) names its replacement. Unresolvable paths get no hover (zero-false-hint policy) — except src-external states, which are explicitly labeled as externally defined.
  • Go to Definition (F12) jumps from a path in data-wcs / {{ }} / <!--@@:--> to its declaration in the inline <wcs-state> script. Dotted paths fall back to their first segment; $command.<name> jumps to $commandTokens, $streamStatus.* / $streamError.* jump to $stream, event-token wirings jump to $eventTokens. Paths of a src-external state jump to the <wcs-state src=…> tag.
  • Find References (Shift+F12) works in both directions: from a binding path to all its occurrences across every channel (shorthand occurrences are unified with their expanded form), and from a declaration name inside the state script to every binding that reads it (including subpaths). $1…$9 are scoped to their for template, so unrelated loops are not merged.
  • Inlay hints show the expanded path after a for-shorthand (.name = users.*.name) — the exact attribute rewrite the runtime performs — the result type at the end of a filter chain (→ string), and the expansion size of a spread (...: target → → 13 props, built-in wcs-* tags only — user-defined tags cannot be statically expanded). Hints are omitted whenever the type cannot be statically determined.

Hover text follows wcstack.messageLanguage (default: the VS Code display language).

Diagnostics

Real-time validation of data-wcs attributes, {{ }}, <!--@@:-->, the <wcs-state> script, and the page's wcstack <script> setup. Every finding carries a stable code (wcs/…); the code and range are identical in the editor and in the CLI, and messages are available in Japanese and English.

Severity policy: error = the runtime raises or the binding can never work; warning = it runs but silently does the wrong thing (the class of bug these checks exist for); info = advisory.

Nothing inside an element marked data-wcs-ignore (the bind attribute plus -ignore) is reported, the element's own attributes included. The runtime does not read that markup as bindings either.

Deliberate exception — the 4.0 runtime throws at init, but the finding is a warning: wcs/wildcard-rank (a pattern path, a shorthand path or a loop index outside any for, #1401 / #1402; too few loop levels, #1401; or another list's *, #1403), because the for scope is reconstructed from the markup and is not exact in every shape. wcs/binding-path-missing is a warning for a similar reason: a missing top-level key fails its binding (#301), but without a stateSchema the validator cannot be sure the key is missing (the value may arrive from outside). Run wcs-validate --strict to fail CI on them too. (wcs/filter-unknown was a warning up to 2.0.0, on the grounds that a page could register filters of its own; no public API does that — not in 4.0, not in 3.x — so an unknown filter always stops the state, and it is an error.)

The outerHTML: / outerText: check (#203) looks at the for / if templates the state binds: those in the document, and those inside a top-level non-structural <template> only when the state binds that template's content — a route template under <wcs-router>, or a layout template that a <wcs-layout layout="id"> names (unless every such <wcs-layout> has enable-shadow-root: its template goes into the outlet's shadow root, which the page's state does not bind). A top-level <template id="tpl"> that only the app's JavaScript clones is not checked, nor a <template> with its own <wcs-state> (a declarative shadow root, a DCC). wcs/delegated-current-target uses the same scope. Both assume the router's defaults, which a page can change only in script: the tag names wcs-router / wcs-layout (config.tagNames) and light-DOM layouts (config.enableShadowRoot: false — set it to true and the layout templates are checked although the page's state does not bind them); a <wcs-layout> with both src and layout still counts its layout template, although the router loads src. The check rebuilds the element nesting from the raw markup: it closes omitted end tags (<li>…<li>, <p>…<div>, table rows and cells) by looking at the element opened last only — an approximation of the HTML parser's scope rules — and honors /> only on void elements and inside <svg> / <math>. A data-wcs attribute without quotes is read for the enclosing templates and elements, but the bindings themselves are validated only in a quoted attribute.

Binding expressions (data-wcs / {{ }} / <!--@@:-->)

Code Detects Severity
wcs/binding-path-missing Path not found in the state (textContent: typo). Skipped when no path candidates can be derived, and for a path in a state the validator cannot read: under the mount path of a volume whose source cannot be read (<wcs-state mount="cart" src="./cart.js"> when cart.js cannot be read — no file reader, a URL, a leading-/ path, a missing file; a script that is not a plain export default { … } literal, or has a top-level spread; or a <wcs-state> with no source, which waits for setInitialState()), on the ancestors of that mount path (shop of shop.cart), and outside every volume when the page's root state cannot be read (a <wcs-state> inside a <template> or with bind-component is another tree and does not count). An empty state that was read (json='{}', export default {}) is read: its paths are reported. A volume's src= that can be read (.js tries the same-named .ts first) adds its keys and its methods under the mount path (4.0 grafts methods: onclick: cart.add). A key written as a name — a shorthand (export default { lang, t }, the dictionary volume of examples/router-i18n) or items: ITEMS — has the shape of the value the name is bound to: a const of the module (through Object.freeze(…) too) or an import from a relative path, read relative to the importing file (export const, export default, export { a as b }, re-exports; a .js that is not there reads the .ts). A JSDoc @type {typeof import("./en.js").default} on the key or on the declaration names the value it stands for. A name it cannot follow to a literal — a value computed there (mergeAndFreeze(…)), a let, a namespace or bare-specifier import, a module it cannot read or parse — makes a key whose contents are unknown: nothing under it is reported (wcs/path-dynamic-unknown says so). So does a value written in place that is not a literal — a call (items: load()), a member of a value the validator cannot read (team: init.team beside const init = emptyEntry()), a conditional, a literal a call goes on from ([1, 2].map(…)) — and so do the rows of an array whose first row is not written out ([newRunner()]); a member of a const bound to an object literal (team: DEFAULTS.team, in the module or imported) has the shape of that key. With a stateSchema the schema decides instead, except for an event handler in a state that cannot be read (the schema carries no methods). A numeric index path (items.0.name, groups.0.items.1.v, groups.*.sel.0.id) is looked up with its indexes read as * — 4.0 reads any number of indexes as the row at that position and follows writes, so the path itself is not a finding (warning). $0, $01 or $1000 — not a loop index (no $1…$128 form), and the $ namespace holds no state path: the runtime fails the binding with this code, inside a for or not (error, reported even without path candidates). A row field the rows lack beside a near one they have is named, as the runtime names it for a data list (.amountLabl under for: rows — Did you mean "amountLabel"?), whatever the rows were read from: a data list's rows, a getter's or an assignment's mapped literal, a JSDoc type. The rows of a list the script changes in place (this.rows.splice(0, n, ...rows), push(row), this.rows[i] = row — wcs/array-mutation / wcs/array-index-assign report the change) are not checked when no literal or JSDoc type gave their fields: their shape cannot be read, and each field would be a false finding ⚠ / ❌
wcs/index-param-range $129 (or up to $999) inside a for — a loop index past the limit; the runtime fails the binding with this code. The limit, $128, comes from the manifest (syntax.indexParam.maxDepth). Outside a for it is the loop-index-outside-for warning (wcs/wildcard-rank), since the runtime throws #1401 first. Also this.$0 / this.$129 / this.$1000 in the <wcs-state> script (see below) ❌ error
wcs/path-nonexistent Same, but the state is declared in a sidecar stateSchema, so absence is definite. A numeric segment is read as a row (*) only where the schema has an array; under an object it is a plain key, as at runtime (sales.2024.totl and an undeclared sales.2025 are reported) ❌ error
wcs/path-type-mismatch for: on a path the stateSchema proves is not an array ❌ error
wcs/binding-type-expectation Non-array for: (error); non-boolean class., non-string attr. / style. (warning). A boolean given to attr.<name>: is judged by the attribute, because the runtime writes String(value) — "true" / "false" — and only null / undefined remove an attribute. Nothing is said where those words are the attribute's values: the ARIA states (attr.aria-invalid: flag\|truthy, aria-busy, aria-expanded, aria-pressed, …) and contenteditable, draggable, spellcheck. A boolean attribute of a native element (attr.disabled: flag; hidden, required, readonly, checked, open, inert, …) is on whenever it is present, so disabled="false" still disables: the message says so and gives the property to bind (disabled: flag). Any other attribute (attr.data-open: flag, a custom element's) is written as the text and never removed, so whatever tests its presence ([data-open] in CSS, hasAttribute()) finds it either way: the message gives attr.data-open: flag\|defaults(null) to remove it while false, or \|string where the text is meant — neither is reported. if: / elseif: take any value: 4.0 picks the first branch whose condition is truthy ❌ / ⚠
wcs/filter-unknown Unknown filter name (count\|fake) — as the 4.0 runtime reports it. This includes the filters 4.0 removed: the 3.2 old names (uc → upper, fix → toFixed, …; the message names the replacement) and substr, folded into slice — the message says to write slice(start, start + length) (with the literal result, substr(2, 3) → slice(2, 5), when the arguments are non-negative literals) ❌ error
wcs/filter-arity Too few / too many filter arguments (count\|mul) ❌ error
wcs/filter-arg-type A numeric argument that does not read as a number (count\|gt(abc)) — the runtime throws #27 when the bindings are planned (error; a quoted gt('5') reads as 5, as at runtime). Other mismatches, such as a number for a string argument (join(1)), which the runtime passes as a string (warning) ❌ / ⚠
wcs/filter-input-type Filter chain input type mismatch (count\|upper) ⚠ warning
wcs/token-undeclared command.<method>: $command.<name> with a name not in $commandTokens — the runtime throws #1302 when it attaches the binding (error). $command.<name> in an event binding or eventToken.<prop>: <name> not declared — logged as #1301 each time the event fires (warning). In a state's script, this.$command.<name> (or a $on handler's state.$command.<name>) with a name not in $commandTokens — $command holds the declared tokens only, so .emit() throws a TypeError that names nothing (error, with a did-you-mean) ❌ / ⚠
wcs/token-misconfigured command.<method>: right-hand side that is not a $command.<name> — the runtime throws #1201 when the bindings are planned (error). A native element's command.<method>: whose method is not in the manifest's nativeCommands (the native-commands feature's table: showModal on <dialog>, focus on any element, …; with a "did you mean") — the runtime throws #1205 at initialization (error) ❌ error
wcs/template-syntax Structural directive (for / if / elseif / else) combined with other bindings; spread with a filter or without a target; outerHTML: / outerText: inside a for / if template — a row or branch keeps its nodes by position, and 4.0 throws at init (#203; in a route or layout template too, not in a top-level <template> that only app code clones) (error). A filter on an event handler (onclick: fn\|gt(10)); #direct on a binding that is not an on*: event binding (ignored) (warning). A {{ }} or a comment binding in the document's <head>, which no <wcs-state> binds — the state binds the <body> (warning). {{ }} outside a <template> (FOUC; inside <title> / <textarea> the hint is to bind the element, as a comment binding is not bound there) (info). A comment binding is not reported for being one (up to 2.14 each gave a wcs-text binding: … info) ❌ / ⚠ / ℹ
wcs/delegated-current-target An on*: binding of an event 4.0 delegates to the root (click, dblclick, input, change, submit, keydown, keyup, mousedown, mouseup, pointerdown, pointerup) whose handler — a method of the root state (pick) or of a volume (cart.pick: 4.0 grafts a volume's methods and invokes them the same way) — reads currentTarget from its event parameter before its first await resumes (acorn): there it is the root, not the element. A read in a function nested in the handler counts too (this.items.find((x) => String(x.id) === event.currentTarget.closest(".card").dataset.id)), unless the function shadows the parameter or runs after the dispatch — one handed to setTimeout, requestAnimationFrame, .then(…) or addEventListener, or stored on an object (img.onload = () => …): currentTarget is null there either way. Write on*#direct: (keeping the other modifiers) or use event.target.closest(…). Not reported for #direct, for input / change / submit on a custom element (it may dispatch them without bubbling, heard on the element), inside a <template> with its own <wcs-state> (declarative shadow root, DCC), or inside a top-level <template> the state does not bind (one that only app code clones); router route templates and <wcs-layout layout> templates are checked — the same scope as #203 ⚠ warning
wcs/submit-without-prevent onsubmit: on a <form> without #prevent, whose handler — a method the page declares — does not call preventDefault: the browser submits the form too, so the page reloads, or with the router a GET puts the fields (a password too) in the URL and the history. Silent on a form with an action, and when the handler cannot be read. Always a bug where it is reported, so an error — a warning up to 2.15.0, which wcs-validate --errors-only hid ❌ error
wcs/binding-syntax What the runtime parser rejects since @wcstack/state 3.0 (error): an unterminated quote in filter arguments, a second # (value#ro#wo — write value#ro,wo), a value after else:, modifiers or left-side filters on for / if / elseif / else / ..., an empty filter (x|, x||y), and (4.0, #120) a state path through __proto__ / prototype (a.__proto__.x — not $command.<name>, an event token, or a method named alone, as at runtime). Judged by the canonical parser (@wcstack/state/parser), so lint and the runtime agree; quoted ; / | in filter arguments are not separators
wcs/wildcard-rank A pattern path items.*.name, a shorthand .name or a loop index $1 outside <template for> (4.0 throws #1401 / #1402 at init — the code is the runtime's); more * ranks (or a higher $N) than the enclosing for nesting provides; or a * that ranges over a list other than the one the enclosing for renders at that level (b.*.y inside for: a — 4.0 throws, #1403; read another list's row in a getter with $resolve(path, indexes)). In a state's script (@wcstack/state 4.22): a path relative to the row (this[".name"]) in a getter or setter that is not one of a list's rows — its key has no *, so there is no row and it throws #1402 each time it is evaluated. That one is an error: the key says it. A relative path in a method is not checked (its row is the caller's). Also an error, in any body: a relative path handed to $resolve, $setAll or $update — they take their rows from indexes, so the runtime expands no relative path there and the call throws ⚠ warning / ❌
wcs/index-arity $getAll / $setAll / $resolve / $update index count does not match the * count of the path — the runtime throws #901 / #902 where it is called ❌ error
wcs/path-readonly A binding that writes back — value: on an <input> / <select> / <textarea>, checked: on a checkbox or radio, radio: / checkbox:; not with #ro — on a getter without a setter: every edit throws "<path>" is a getter without a setter, and the state keeps its value. Add a setter, or write value#ro:. A method's or a setter's write of such a path (this.total = 0, $setAll / $update / $resolve on it) throws the same each time it runs (not in a state with a top-level spread, which may bring the setter) ❌ error
wcs/aria-attr-unknown attr.aria-* name that does not exist in WAI-ARIA (with a "did you mean" suggestion) ⚠ warning
wcs/live-region-inserted A live region — aria-live (polite / assertive), role="status", role="log", as written in the markup — inserted together with its text, by an if: / elseif: / else: branch, a for: row or a <wcs-route>'s content: it holds text of its own (not replaced by a binding), or, in an if: / elseif: branch, its text is bound to what the condition reads (if: notice with textContent: notice; a path above or below it, or one the condition's or the text's getter reads). A screen reader announces a region whose text changes while it is in the page, so such text is not announced: a status message meant to be heard belongs in a region that is always in the page — keep the region outside, bind its textContent: to the message and empty it when there is nothing to say. An inserted role="alert" is the one form announced on insertion (the user agent fires the alert event), so an alert is not reported, with an aria-live or not. A region whose text is bound to something else (a form's error in its route) is in the page before that text changes and is not reported ⚠ warning
wcs/radio-name-shared Radios in a for: row with a literal name and a binding of the row's — <input type="radio" name="sex" data-wcs="radio: .sex">, or checked: .picked. Every row's radios get the same name, so the browser makes one group of all the rows: only one radio on the whole page stays checked, and the page disagrees with the rows' values from the first render — a browser rule, so nothing at run time says so. Bind a name that differs per row (attr.name: .<a row field>), or drop the name: radio: keeps the radios bound to one path in step without it. Reported once per name and list, at the name attribute. Silent when the name is bound (attr.name: / name:), when the bound path is not the row's (value: .id; radio: selectedId — one choice over the rows is what is meant), and when each row holds its own <form> (a radio group ends at its form) ⚠ warning
wcs/number-written-as-string A two-way value: on an <input>, <textarea> or <select> with no conversion on the way in, bound to a data path the state holds as a number — its seed (count: 0), a JSDoc @type {number}, a stateSchema; a row field too (value: .qty). An element's value is a string: after the user enters 5 the state has "5", and count + 1 is "51", without a word. The message gives the binding to write: valueAsNumber: count (type="number", range, the date and time types), or an input filter on the left side — value\|number: count (\|int, \|float), keeping the modifiers and filters already written. Silent with an input filter chain that gives a number, with #ro, on a getter / setter pair (the setter may convert), on a path declared to take a string too (@type {number \| string}), on an input the user enters no value in (checkbox, radio, hidden, the buttons, file) and on a custom element (its write-back follows its wcBindable) ⚠ warning
wcs/two-way-output-filter An output filter on a two-way value: / valueAsNumber: of an <input>, <textarea> or <select> — value: code\|upper, value: price\|locale. In a field the user types in, written back on input (the default), the filter formats what the state holds on every keystroke: the field is rewritten while the user types — the caret jumps to the end, an IME composition is cut — and the state receives the field's formatted text, since an output filter is not undone on the way back. Show the formatted text in another element, write back when the field is committed and format in a setter (value#onchange:), or make the binding one-way (value#ro: code\|upper). Where a committed value is written back — #onchange, a slider, a picker, a <select> — nothing is rewritten while typing, and an input filter is the way back: value#onchange\|number: price\|toFixed(2) is silent, the same without the input filter is reported. Silent for the filters that give back what the element wrote (string, nullIfEmpty, coalesce(…), defaults('')), with #ro, and on a custom element. wcs/number-written-as-string is not stacked on a binding it reports ⚠ warning
wcs/body-binding The bind attribute on <body> or <html> — <body data-wcs="onkeydown: onKey; class.dark: dark">. <wcs-state> binds what is inside <body> (the runtime walks its children), never <body> or <html> themselves, so the bindings written there do nothing: the handler never runs, class. / attr. are never written. Move the binding to an element inside <body> (a wrapper, <main>), or write the value from $connectedCallback or a $watch handler (document.documentElement.lang = …). Reported at the attribute. Only the document's own start tags: not one in a comment, a script, other raw text or a <template> ❌ error
wcs/link-handler An on*: binding on a <wcs-link> — <wcs-link data-wcs="attr.to: .href; onclick: openPhoto">. The link's host is display: none, and what the user clicks is the <a> the link generates beside itself, so no event reaches the host and the handler never runs. Put the handler on an element inside the link (its children move into the <a>) or on one around it; to navigate from a handler, write the router's navigateUrl. Reported at each on* name, where the state binds the link (not in a <template> only app code clones). .onclick: (the explicit property form) is a property binding and is not reported ❌ error

Built-in wcs-* tag contracts

Code Detects Severity
wcs/tag-member-unknown Binding to a property / command. / eventToken. key the tag does not declare in wcBindable — the runtime refuses it with #38 / #1203 / #1204 (at the root the state fails to initialize, in a row the binding fails). That includes DOM properties such as hidden, title, id and textContent; only the HTML sinks (html:, innerHTML:, outerHTML:, srcdoc:) are written without a declaration. A custom element the page defines itself is checked the same way: customElements.define("tag", Class) in an inline script, an src= module or a module it imports by a relative path, whose class (or a superclass the page defines) declares static wcBindable as a literal — properties / inputs / commands lists of { name: "…" }. An element whose declaration is computed, spread or inherited from elsewhere is not checked, nor a dotted property on it (a component's state.x: wiring) ❌ error
wcs/handle-bound-as-value An output its tag declares semantics: "handle" — <wcs-camera>'s streamReady, the live MediaStream — bound to a state path (streamReady: cam.stream). It works, but puts an object no snapshot, DevTools view or SSR can carry into the state; receive it with eventToken.streamReady: and hand it to the next element as a command argument ⚠ warning
wcs/on-prefixed-member A tag member whose name starts with on (once on <wcs-timer>), bound without the leading dot: the runtime makes it an event binding and the value never arrives. Write .once: (@wcstack/state 3.1) ⚠ warning
wcs/spread-no-bindable ...: spread onto a helper tag without wcBindable (wcs-fetch-header, wcs-fetch-body, wcs-infinite-scroll, wcs-voice) — the runtime raises ❌ error
wcs/trigger-seeded-truthy A trigger slot seeded with true (fires immediately, no edge) ⚠ warning
wcs/storage-seed-clobber Non-manual <wcs-storage> value bound without #init=element to a slot seeded with a literal (null, '', [], or an object with content alike), or to an accessor pair (a getter with a setter — the restore form) — the initial write-back overwrites the stored value on every load, so it is data loss. The fix is value#init=element: (with a null seed for a data slot). A getter without a setter is not reported (it may be save-only), nor is an undefined seed or an expression ❌ error
wcs/storage-init-seed <wcs-storage> value#init=element: bound to a slot seeded with a literal other than null (cart: [], theme: "light") — #init=element pulls the element's value in, and an empty key loads as null, so the seed is gone on a first visit (this.cart.findIndex(…) throws). Seed null and supply the default where you read it, or bind an accessor pair whose setter ignores null ⚠ warning
wcs/input-nested-write Non-manual <wcs-storage> value bound to a path the page writes below (value: cart with this[`cart.${i}.quantity`] += 1, this["cart.0.quantity"] = 2, or value: .quantity in a for: cart row): a binding is re-applied only when its path itself is assigned, so those writes are never saved — no error, and a reload brings back the old value. Bind a getter that reads the fields by path (a row getter and $getAll) and returns a new value, or replace the array instead of writing below it. manual is exempt: its trigger save reads the current object. Also <wcs-fetch>'s body bound to such a path (body: newUser with value: newUser.name), manual or not: body resets to null after every request, so the second one goes without it — build a new object in the handler that starts the request. An error: the data is lost and the runtime says nothing (a page that also replaces the whole path afterwards does not need the write below it) ❌ error
wcs/root-margin-unit A literal root-margin on <wcs-intersect> or <wcs-infinite-scroll> that IntersectionObserver refuses — root-margin="200", "0 0 900 0". It takes one to four values, each a number with px or %; a 0 needs its unit too ("0 0 900px 0" is refused, in Chromium and in Firefox: rootMargin must be specified in pixels or percent), and another unit (1em) or a fifth value is refused as well. <wcs-intersect> then observes nothing (observing stays false) and <wcs-infinite-scroll> loads no page. The message gives the value with px added to its unitless numbers (root-margin="0px 0px 900px 0px"). Not checked: an empty value (the default, 0px), a value a server template fills in ({{ }}), an element whose data-wcs binds rootMargin: ⚠ warning

<wcs-state> script

Code Detects Severity
wcs/nested-assign this.user.name = x, +=, ++, expression-index chains — not reactive; use this["user.name"] = x. Also an in-place change the patterns above do not spell with this.: Object.assign(this.form, v), a change through an alias of a state value (const cards = this.cards; cards[0].title = x, const { form } = this), and a write two segments deep through a $on handler's state argument (state.board.cards = x). The message names the path to assign a new value to ❌ error
wcs/array-mutation push / splice / sort … (9 destructive methods) — not reactive; the message names the non-destructive alternative (concat, toSpliced, toSorted …). Also through an alias (const cards = this.cards; cards.push(x) — assigning the same array back adds no row) and through a $on handler's state argument (state.cards.push(x)) ❌ error
wcs/array-index-assign this.items[0] = x (bracket-only chain, all compound forms) — use this["items.0"] = x or with(). Also through an alias (const cards = this.cards; cards[i] = card; this.cards = cards — the same array back does not replace the row) and through a $on handler's state argument. When what is indexed is not known to be an array — an object seed (budgetErrors: {}), an object JSDoc type, keys read under it, or an unknown value indexed by a name rather than a number — the message says it assigns an object's key (nothing that reads it changes; assign a new object, or write the dot path this["budgetErrors.<id>"]) instead of "an array index" ❌ error
wcs/getter-cycle Path getters that reference each other in a cycle — the runtime throws #701 when they are evaluated, and every binding that reads them fails. The check does not follow conditions, so a cycle behind mutually exclusive branches is reported too ❌ error
wcs/getter-write A getter that writes while it is evaluated — an assignment, += / ++, $setAll, $update, a $resolve with a value — in its body or in a method it calls (reported at the call, naming the method). The runtime throws on every evaluation, naming the path and the getter. A write in a nested function (a handler the getter returns, a callback that runs later) is not counted. Write it from a method, a setter or a $watch handler ❌ error
wcs/setter-cycle A setter that writes its own path (error): the setter's path is the accessor itself, so the write calls the setter again until the stack overflows — store the value under a data path the getter reads (_count). Setters that write each other (warning on each: a condition may stop them). Synchronous writes only, through the methods a setter calls. The runtime's diagnostics add-on throws naming the setters at 64 calls deep ❌ error / ⚠ warning
wcs/setter-unobserved A setter none of whose writes its getter reads — set celsius(v) { this.c = v } beside get celsius() { return (this.f - 32) * 5 / 9 } — through the getters and methods the getter calls and inside $untracked: after the write the getter returns its old value, and a two-way input goes back to it. A read of the same path, above it (user for user.name) or below it is reached. Silent on a setter that writes nothing (it ignores the value), a getter that reads nothing of the state, and wherever either reads or writes what cannot be followed (this[key], this handed to a function, a path that is not a literal, a method the state does not declare) ⚠ warning
wcs/accessor-list-syntax A key that declares one accessor for several paths (@wcstack/state 4.22: get "users.*.full,employees.*.full"()) with a space beside a comma, an empty entry, or a recursive path (**). The runtime takes what is between the commas as it is, so "users.*.full, employees.*.full" declares a path nothing reads (the diagnostics add-on refuses the state with the same code; a recursive path in a list is refused by the recursion add-on). The listed paths are read without the spaces, so the mistake is said once ❌ error
wcs/accessor-list-path The body of an accessor declared for several lists reads or writes the rows of one of them by a full path — this["users.*.first"] in get "users.*.full,employees.*.full"(). At the rows of the other lists that path has no row: a read gives undefined and a write throws (the diagnostics add-on warns with the same code). The message gives the relative path to write (this[".first"]). Silent on two names in one list ("users.*.full,users.*.display"), on an outer row every listed path shares, on a path with an explicit index, and on $getAll / $setAll / $update / $resolve, which name their rows themselves ❌ error
wcs/getter-untracked-read this.form.name inside a getter — only form is tracked, so the getter never re-runs when form.name changes; reported only when the document writes form.name somewhere (value: / checked: / spread / an I/O node output / this["form.name"] = …, or state["form.name"] = … in a $on handler — where SSE and WebSocket data land), so a root that is only ever replaced wholesale (router params, $stream folds) stays quiet. Read this["form.name"] instead. An error when a binding on the page writes the path the getter reads (or a path above it, below the tracked root) — a spread on a built-in tag (...: monthFetch writes monthFetch.<each output>, not a member bound explicitly after it), a two-way binding (value: / valueAsNumber: / valueAsDate: on an <input>, checked: on a checkbox or radio, value: on <select> / <textarea>, radio: / checkbox:), or an output of a built-in tag (value: x.y on <wcs-fetch>), none with #ro — the message names that binding; the write never reaches the getter even if the root is replaced elsewhere. A warning when only the script writes it. Also a getter that reads the URL from location (location.pathname, window.location.search, new URL(location)): it is not state, so the getter keeps the URL it first read — bind <wcs-router>'s path / searchParams. location.protocol / host / origin do not change within a page and are not reported. Also a getter that reads the clock — Date.now(), a new Date() of no argument, performance.now(): the time is not state, so the cached getter keeps its first value (an event token firing every frame does not re-run it). Keep the time in state (the value <wcs-raf> or <wcs-timer> writes). Also a getter that reads the window or the document — innerWidth / innerHeight / outerWidth / outerHeight, devicePixelRatio, scrollX / scrollY / pageXOffset / pageYOffset, a call of matchMedia(…), navigator.onLine, the clientWidth / clientHeight / scrollTop / scrollLeft of document.documentElement / document.body / document.scrollingElement, document.visibilityState / document.hidden, with or without window. / globalThis.: none of them is state, so the cached getter keeps its first value (a resize, a scroll, going offline do not re-run it). The message names what to bind instead — <wcs-resize>'s width / height, <wcs-media-query>'s matched (for matchMedia, a breakpoint, a resolution threshold), <wcs-network>'s offline — or, for the scroll position and the page's visibility, which no element gives, says to keep the value in state and write it from an event handler. Not reported for a name the getter or the module binds (const innerWidth = …, a parameter, an import) or a state key of the same name (this.innerWidth) ❌ / ⚠
wcs/on-handler-this this.… in a $on handler. The runtime calls it as handler(state, event, …), so this is undefined and the handler throws when called — unlike $watch handlers and methods. Write name(state, event) { state.x = … } ❌ error
wcs/session-read-at-module-top A localStorage / sessionStorage / document.cookie read (also through window. / globalThis. / self.) at the top level of a module that is evaluated once — outside every function, the export default { … } literal's values included. In a <wcs-guard-handler>'s module it is an error: the router evaluates the module once and calls the exported function on every navigation, so the guard keeps the session it read when the page loaded (after a login, every guarded page bounces back). In a <wcs-state>'s module (inline or src=) it is a warning: the state keeps the value from load. A read inside a function — the exported one, a helper it calls, a getter, a method — and a write (setItem, document.cookie = …) are not reported ❌ / ⚠
wcs/updated-callback-unbound $renderedCallback tests a path that no binding reads — the branch never runs (the callback is binding-driven). Also a path the state does not have, beside a near one it has (paths.includes("labell") and label, items.*.onn and items.*.on): it is never in paths either. A test is a string compared with what the callback is given: paths.includes("x") / .indexOf / .has (through new Set(paths), [...paths] or another name for it too), or an element of it — paths.some((p) => p === "x"), for (const p of paths) — compared with === / !==, in a case "x": of a switch (p), or as a prefix (p.startsWith("form."), met by any bound path under it). A string compared with anything else is not a path ⚠ warning
wcs/command-token-unbound A token $commandTokens declares, emitted — .emit() in the script, or on*: $command.<name> in the markup — that no command.<method>: $command.<name> binding in the document receives: the emit reaches nothing, without a word. Only the page's root states (a volume's $commandTokens are ignored) ⚠ warning
wcs/event-token-unbound The mirror: a name $eventTokens declares that no eventToken.<member>: <name> binding in the document emits (in a for or route template too). Nothing fires it, so its $on handler never runs, without a word — the binding was removed or never written (a $watch on <wcs-fetch>'s status waiting for a response that fires nothing for a second 204). Reported on the name in $eventTokens. Only the page's root states, and not on a page where a binding the validator does not see can emit it: a layout loaded from a file (<wcs-layout src>), or a script besides the states' modules that writes eventToken. bindings ⚠ warning
wcs/write-path-missing this.<key> = … (or +=, ++, …) of a key the state does not declare, beside a near one it does (this.selectedID and selectedId): the write creates a new key, and nothing bound to the declared one changes. So does a nested path a script writes — this["items.*.nmae"] = …, a compound assignment, this[`items.${i}.nmae`] = …, $setAll("items.*.amout", …), $update("items.*.amout", …) — looked up as a binding's path is: the write creates a key in each row's object. A new key with no near name is not reported — a state may add keys on purpose ⚠ warning
wcs/read-path-missing A path a getter, setter or method reads through this — this["items.*.amout"], this.totl, this.$getAll("items.*.amout", []), $resolve / $dependOn with a literal path — that the state does not have, beside a near one it has: a nested read gives undefined and a wrong value without a word (the runtime's diagnostics add-on warns once with the same code, once a getter has read it); a top-level key throws on read (#301). Looked up as a binding's path is, under the mount path for a volume's script. Only with a near name — this["opts.flag"] ?? false reads an optional key on purpose — and never a path built at run time (this[key], `drafts.${key}` under an object). A template whose expressions each fill a segment under a list (this[`items.${i}.nmae`]) is read as items.*.nmae. Warning; error where a stateSchema says the path is not there ⚠ / ❌
wcs/path-dynamic-unknown A top-level spread in export default { … } (...defaults()) with no stateSchema: the keys it brings in cannot be read, so no path of that state is checked — said once, at the spread, with what turns the checks on (a stateSchema, which wcs-schema derives from JSDoc or TypeScript types). Also a key whose value the validator cannot read — a name it cannot follow to a literal ({ t } with t imported and computed by a merge of the locale catalogs), or an expression written in place that is not a literal: a member of such a value (team: init.team beside const init = emptyEntry()), a call (errs: emptyErrs()), a conditional, a literal a call goes on from ([1, 2].map(…)) — when the document binds paths under it (a row's .name under the key's for: is one; a path something else declares, like a getter get "items.*.size"(), is checked and not counted): those are not checked — said once, at the key, with the number of paths and what has them checked (a JSDoc @type on the key: its shape, or typeof import("./en.js").default for a module's literal — the default language's catalog, which has every key; or a stateSchema). And a key seeded with an object literal that spreads something the validator cannot read (draft: { ...makeDraft() }, a let, an import it cannot read), said the same way: the keys written beside the spread are read, the rest under the key is not checked. (A spread of a const bound to an object literal — draft: { ...EMPTY_DRAFT }, in the module or imported from a file it reads, also as a member of a namespace import, { ...M.DEFAULT_SOUND } with import * as M from "./lib/music.js" — brings in that literal's keys and is checked, the later key of a name winning as when the object is built; so is a spread in a list seed's first row.) A limit of the lint, not a mistake ℹ info
wcs/state-absent A file with bindings — a data-wcs attribute or a comment binding — and no <wcs-state>: a CMS's partial template, a route's content in a file of its own, a page whose state a script makes. Its paths are not checked (there is no state to check them against) — said once, at the first binding outside data-wcs-ignore. Not reported when a stateSchema applies (the paths are checked against it), nor for a file whose only text bindings are {{ }} (braces alone may be another template engine's). A limit of the lint, not necessarily a mistake ℹ info
wcs/state-src-unread A <wcs-state src> the validator cannot read — a path from / (the form docs/csp.md gives under a <base>), a URL, a file that is not there: that state's paths and script rules are not checked — said once, at the attribute. A src is read relative to the page; a path from / only with wcs-validate --root=<dir> (the site's root; the extension has no root and does not read it). A limit of the lint, not a mistake ℹ info
wcs/name-alias A dependency API name that 3.2 renamed and 4.0 removed ($trackDependency → $dependOn, $untrackDependency → $untracked) — the runtime throws when it is read (its diagnostics feature, which @wcstack/state and /auto include, detects it); the message suggests the canonical name ❌ error
wcs/declaration-alias A declaration key that 3.2 renamed and 4.0 removed ($streams → $stream, $updatedCallback → $renderedCallback) — the runtime throws at load time with its diagnostics feature (a volume, mount=, is refused at graft instead and reported with console.error). Warning when the script cannot be parsed statically (a class state, found by a pattern) ❌ / ⚠
wcs/declaration-alias-read Reading a removed declaration key (this.$streams) — 4.0's state has no such key, so the read is silently undefined. Warning when the AST proves the read; info when the script cannot be parsed statically ⚠ / ℹ
wcs/behavior-invalid $behavior (4.0) that the runtime rejects at load time: not an object, a key the manifest's behaviorOptions does not list (now enableMustache / sameValueGuard / enableDirectionalInitialSync; with a "did you mean"), a value of another type than the option's (all boolean now), or $behavior declared in a volume (mount=) ❌ error
wcs/feature-unknown A name in $features or in the root <wcs-state features="…"> that is not an add-on (the manifest's features: formats, diagnostics, temporal, list-keys, scopes, recursion, ssr, devtools, native-commands; with a "did you mean") — the runtime throws. A $features name fails as wcs/feature-unknown on a split auto page and as wcs/feature-not-installed elsewhere; the features= attribute is read only by the split auto (dist/split/auto.js), which fails with wcs/feature-unknown (other entries ignore the attribute) ❌ error
wcs/features-invalid $features that is not an array, or declared in a volume (error); features= on a <wcs-state> that is not the document's root — the runtime reads it only on the first <wcs-state> without mount and bind-component (warning) ❌ / ⚠
wcs/index-param-range this.$0 / this.$129 / this["$1000"] in a getter, a method or a $watch handler — 4.0 throws when a $ followed by a digit is read and is not $1…$128. Warning when the script cannot be parsed statically (a class state, found by a pattern) ❌ / ⚠
wcs/watch-declaration-invalid $watch key the runtime rejects: $-prefixed, empty segment, non-function handler literal ❌ error
wcs/watch-path-missing $watch key that does not exist in the state — the handler silently never fires. A key of the page's root may name a path under a volume ("cart.total" — it fires on writes to the grafted state): it is checked against the volume's keys, and not reported when the volume's source cannot be read (as for bindings). A volume belongs to the innermost enclosing <template> that holds a root <wcs-state> (a declarative shadow root, a DCC) and is checked by that root's $watch; any other volume — in the document, or in a route or layout template — belongs to the page's root. (A volume's own $watch is not checked: the volume is refused as a whole — wcs/volume-declaration.) ⚠ warning
wcs/scan-declaration-invalid $scan — removed in 4.0: the runtime throws at load time with its diagnostics feature (in a mounted component too; a volume is refused at graft and reported with console.error). Fold a path's changes in a $watch handler, or events in an $on handler. One finding on the key; warning when the script cannot be parsed statically (a class state). (The 3.x checks of the entries, wcs/scan-source-computed and wcs/scan-path-missing, are gone with it.) ❌ / ⚠
wcs/type-annotation JSDoc @type incompatible with the initial value (see below) ⚠ warning

$listKeys declarations are consumed rather than diagnosed: malformed keys (empty path, trailing *, non-flat field) simply produce no path candidates, so a broken declaration is never confirmed by the static side.

Page setup

Code Detects Severity
wcs/script-order @wcstack/devtools/auto loaded after @wcstack/state/auto: the DevTools timeline starts when it attaches (4.0 sends it the wiring that is there already) ℹ info
wcs/base-href-missing router/auto present without <base href> (basename would be mis-derived). Pinned URLs count (@wcstack/router@4/auto, jsDelivr's @wcstack/router@4.0.2/dist/auto.min.js), and so does the wcstack/auto bundle on a page that has a <wcs-router>. A synchronous <head> script that creates the <base> — document.createElement("base"), or <base given to document.write / writeln / insertAdjacentHTML; the router README's form for a locale in the basename (examples/router-i18n) — provides one: a classic inline script before </head>, not a module or an src script ⚠ warning
wcs/router-outlet-misplaced A <wcs-outlet> that is not right after a <wcs-router>, on a page where some router has no outlet right after it. A router uses only the element right after it and otherwise creates its own outlet there, so the routes render there and this outlet stays empty (docs/router-outlet-placement.md) ⚠ warning
wcs/link-query-key-ignored A <wcs-link> whose query-keys names none of the keys its to sets (to="/notices?cat=event" query-keys="page"). A link with query-keys compares only the keys it names, so its own query plays no part: it is current wherever those keys match, on every category, and tabs written this way are all current at once. Leaving some of to's keys out is not reported — a category tab to page 1, to="?cat=a&page=1" query-keys="cat", is current on every page of its category (docs/formal-methods-study.md §4.2) ⚠ warning
wcs/link-router-missing A <wcs-link to="/…"> on a page that loads the router (@wcstack/router, the wcstack bundle, or the autoloader covering the tag) and has no <wcs-router>: the link throws [@wcstack/router] wcs-link is not connected to a router. when it connects and stays hidden (display: none). Write <a href> on a page without the router, or add the <wcs-router>. Once per page, at the first such link, on a page that loads wcstack itself (as wcs/tag-package-missing): a fragment — a route's content, a layout file the router page includes — is not reported, nor a page that names wcs-router anywhere outside an HTML comment (a <wcs-router>, in a <template> too, or a script that makes one), nor a to that is a URL or a query (?page=2), nor one bound with attr.to: ⚠ warning
wcs/route-bare-mustache {{ }} in text directly under <wcs-route> (bound only on the landing route; a route entered by navigation shows it as written), or directly under a layout's <template> (not bound on a navigation). Wrap it in an element ⚠ warning
wcs/layout-slot-missing A <wcs-layout layout="X"> that holds content outside its named slots — the nested routes — while <template id="X"> has no default <slot>: the content is not shown. The outlet warns with the same code at runtime ⚠ warning
wcs/signals-dual-entry @wcstack/signals and @wcstack/signals/dom on the same page (duplicated reactive core) ❌ error
wcs/signals-dual-entry An import map that maps both @wcstack/signals and @wcstack/signals/dom to CDN bundles, though the page imports one: a module it loads (a sidecar .js) that imports @wcstack/signals gets a second core. Map only /dom (it exports the whole core) ⚠ warning
wcs/tag-package-missing A wcs-* tag of a wcstack package — an I/O node of the built-in tag catalog (<wcs-upload>, its helper <wcs-upload-header>), or a tag of @wcstack/state, router, autoloader or devtools — on a page that loads wcstack itself but no script of that package: the element is never defined, its bindings wait and nothing happens, without a word in the console. Once per package, at its first tag, with the /auto to load (at the version the page pins its other wcstack URLs, when it pins them all at one). A script counts when a <script src>, <link rel="modulepreload">, an import map key or value, or an import or a string in an inline script names @wcstack/<pkg> (any version, any CDN, a local path), /packages/<pkg>/dist/, or the wcstack bundle (state, router, fetch, storage, autoloader). A local script (./app.js, ../../dist/auto.min.js, and with the autoloader the module an @components/ entry gives one of the page's own custom elements) is read with the relative modules it imports: what it names counts, and so does a wcs-* tag in its strings (a bundle that defines it). Not reported on a page that names no wcstack script itself (a fragment, a bundler's page), for a tag an @components/ import map entry covers while the autoloader is there, or when a local script cannot be read (it may load the package). Always a bug where it is reported, so an error — a warning up to 2.15.0, which wcs-validate --errors-only hid ❌ error
wcs/lint-version-behind A URL on the page (a <script src>, an import map, an import in an inline script) pins @wcstack/<pkg>@X.Y[.Z] or wcstack@X.Y[.Z] with the same major as the validator's rules and a newer minor than the @wcstack/state it is built from — the version of @wcstack/lint (released in lockstep); this extension carries the same. That validator does not know the rules the newer minor added and can report its correct syntax as an error (4.2.0's lint gives wcs/filter-arity for 4.10's datetime(ja-JP,short,Asia/Tokyo)). Once per page, at the newest pin, saying to upgrade @wcstack/lint to that version. A URL without a version, a major-only pin (@4) and a validator newer than the page are not reported ⚠ warning

v2 migration

Code Detects Severity
wcs/named-state-deprecated Named states — <wcs-state name="x">, path@x, {{ path@x }} — removed in v2; the message points to <wcs-state mount="x"> and the prefixed path x.path ❌ error
wcs/mount-path-invalid mount= value the runtime rejects: empty, an empty segment, * anywhere in a segment, whitespace, or the reserved characters $ # @ ❌ error

Volumes, component mounts and roots (4.0)

Code Detects Severity
wcs/volume-declaration A declaration a volume (<wcs-state mount="…">) does not take — the lists are 4.0's scopes/volume.ts. $stream, $watch, $listKeys, $renderedCallback: the runtime refuses to graft the volume and reports it with console.error — the state is not on the tree (error). $commandTokens, $eventTokens, $on, $errorCallback: the runtime says so with console.warn and ignores the declaration — they belong to the root (warning). One level lower when the script cannot be parsed statically (a class state). The other keys the runtime refuses in a volume keep their own codes ($scan, $recursion, $behavior, $features, the old names $streams / $updatedCallback). A value of literal undefined is no declaration, as at runtime ❌ / ⚠
wcs/bind-component-source A <wcs-state bind-component> with a state / src / json attribute or an inline <script type="module">: a mounted component's state is the host element's property only, and the runtime refuses to load it (console.error; the component does not mount). Reported on the start tag; the script inside is not checked further, since the runtime never reads it ❌ error
wcs/second-root A second <wcs-state> without mount and bind-component in the document (outside <template>): there is one state tree per root, and the runtime refuses the one that loads second (console.error). Graft a subtree with <wcs-state mount="path">. Reported on each further start tag ❌ error

Sidecar manifest (wcstack.manifest.json)

All wcs/manifest-* and wcs/drift-* findings are errors, except wcs/manifest-namespace-version (warning) and wcs/manifest-override (info — an intentional, declared shadow). Codes: manifest-broken, manifest-schema-version, manifest-kind-invalid, manifest-unknown-keyword, manifest-external-ref, manifest-ref-cycle, manifest-ref-unresolved, manifest-namespace-version, manifest-tag-collision, manifest-filter-collision, manifest-state-collision, manifest-override, drift-missing-member, drift-event-mismatch.

One further code (wcs/path-reserved-name) is reserved in the code table but not emitted yet. The single source of truth for codes is src/core/diagnostics.ts.

The codes are the runtime's: a message the 4.0 runtime prints in the console carries the same [wcs/…] code. Without the diagnostics add-on (@wcstack/state/core alone) the runtime prints only a message number and the values — [@wcstack/state] [#203](https://github.com/wcstack/wcstack/issues/203) "outerHTML" (the hundreds of the number name the code: 2xx is wcs/template-syntax) — and the full auto bundle (which installs the add-on) prints the code and the sentence. Some runtime codes depend on what only the running page knows and have no static counterpart: wcs/feature-not-installed (which entry and installFeatures the page uses), wcs/recursion-context, and the wcs/template-syntax #204 case (a structural template at the top of content inserted later). The wcs/mount-dollar-declaration warning ($watch / $stream / $renderedCallback on a mounted component) has none either: that state is the component's JavaScript property, which the validator does not read — a script inside <wcs-state bind-component> is never loaded (wcs/bind-component-source).

JSDoc Type Validation

Validates consistency between @type annotations and initial values (wcs/type-annotation):

/** @type {string} */
label: null,        // ⚠ Type "null" is not compatible with @type {string}

/** @type {string|null} */
label: null,        // ✅ OK

The same @type also declares a shape. A list that starts as null (or []) and is filled by <wcs-fetch> or <wcs-storage> has no row to read its fields from, so its rows would be reported as wcs/binding-path-missing; with an object type for the rows, catalog.*.id and catalog.*.name exist (with their types), and a typo under them is still reported. Name the row type with a @typedef in the same script if you like:

/** @typedef {{ id: number, name: string, price: number }} Product */
export default {
  /** @type {Product[] | null} */
  catalog: null,                           // for: catalog → .id / .name / .price
  get products() { return this.catalog ?? []; },   // a getter's result keeps the shape
};

The types understood are a subset of TypeScript's JSDoc: names, object types ({ a: T; b?: U }), T[] / Array<T>, unions, ?T, and @typedef names (every @typedef of a comment block is read; a self-referencing typedef stops at the nesting limit). An index signature — { [key: string]: T }, Record<string, T>, Closure's Object<string, T> / Object.<string, T> — declares an object with any key: the paths under it are open and not reported, as under a stateSchema's open object (/** @returns {Record<string, boolean>} */ get soldOut() and soldOut.e12). Record<"a" | "b", T> declares the fields a and b, and Readonly<T> / Partial<T> / Required<T> the shape of T. A type the validator cannot read (a function type, another generic) declares no shape; any / unknown / * are not checked against the initial value.

Sidecar Manifest, stateSchema, and the CLI

Sidecar manifests. wcstack.manifest.json files are validated against the supported JSON-Schema subset: envelope / kind checks, cross-file package resolution, same-name tag/filter collision, forbidden override-after-collision, and drift against the live static wcBindable surface. The sidecar is tooling-only: it never overrides the runtime static wcBindable declaration, and a missing or stale file never changes runtime behavior. The normative schema and resolution rules live in docs/wcstack-manifest-schema.md.

stateSchema. An application manifest may declare the shape of a state (wcstack.application.states[<name>].stateSchema). The nearest wcstack.manifest.json above the HTML file is discovered automatically (one file, no merging). For a declared state, a missing path is reported as wcs/path-nonexistent (error) instead of wcs/binding-path-missing (warning), and for: on a schema-confirmed non-array is wcs/path-type-mismatch. Methods, getters, and $listKeys from the script count as existing even when absent from the schema; beneath a bare {} the validator stays silent. Write the schema by hand, or generate it from a TypeScript state file with wcs-schema from @wcstack/typescript — see docs/typescript.md. The same package's wcs-tsc type-checks inline <wcs-state> scripts across a project using this extension's language plugin in tsc mode.

CLI. A single validateDocument entry point drives both the in-editor diagnostics and the CLI, so the IDE and CI report identically for the same inputs. Both read the external state referenced via <wcs-state src="..."> (the root's and the volumes') and discover the nearest wcstack.manifest.json through the same file reader, relative to the HTML file. The IDE does so for a document saved on disk (a file: URI); an untitled or virtual document skips src (its paths are not reported, as for a src that cannot be read), and an external state file with unsaved edits is read as it is on disk. The script rules (wcs/nested-assign, wcs/array-mutation, wcs/on-handler-this, …) check a .js / .ts external state too: the IDE shows a finding in the file on the page's src value, with the file's line and column in front of the message and a link to the file; the CLI reports it in the file. The bundled wcs-validate CLI runs the same checks headlessly — over wcstack.manifest.json sidecars (any *.manifest.json argument) and/or HTML data-wcs bindings — and is distributed on npm as @wcstack/lint, a zero-dependency wrapper around the exact same CLI bundle:

npx @wcstack/lint [--attr=data-wcs] [--state-tag=wcs-state] [--lang=ja|en] [--errors-only] [--strict] <file> [<file> ...]
Option Effect
--attr=<name> Bind attribute name (default data-wcs)
--state-tag=<name> State element tag name (default wcs-state)
--lang=ja\|en Message language. Default: environment locale (LC_ALL / LC_MESSAGES / LANG, then the OS locale); codes and ranges do not depend on it
--errors-only (alias --quiet) Print only error-severity lines; warning / info counts and the exit code are unchanged
--strict Exit 1 on warnings too. Severities are unchanged — only the exit-code threshold moves. Use it to fail CI on a path typo (wcs/binding-path-missing is a warning)

A <file> argument that names no existing file and holds *, **, ?, […] or {a,b} is expanded by the CLI itself — cmd.exe and PowerShell (and npm scripts on Windows) pass a pattern through as it is. * stays in one directory and skips names that start with .; ** crosses directories but does not enter node_modules or a directory whose name starts with ..

Exit code: 0 no error (with --strict: no error or warning) · 1 at least one error (with --strict: error or warning) · 2 usage or file-read failure, or a pattern that matches no file.

When working on the validator itself, or in this repo's CI (the wcs-validate job runs it exactly this way), build from source and invoke the CLI with node:

# one-time build (from the repo root)
cd packages/vscode-wcs && npm ci && npm run build && cd ../..

node packages/vscode-wcs/dist/cli.cjs [--attr=data-wcs] [--state-tag=wcs-state] [--lang=ja|en] [--errors-only] [--strict] <file> [<file> ...]

Settings

Setting Default Description
wcstack.bindAttributeName "data-wcs" Bind attribute name
wcstack.stateTagName "wcs-state" Custom element tag name for state definition
wcstack.messageLanguage "auto" Language of diagnostic and hover messages: auto (VS Code display language; non-Japanese locales get English), ja, or en. Codes and ranges are language-independent

Requirements

  • VS Code 1.110+
  • HTML files containing <wcs-state> elements (tag completions and hover for wcs-* elements work in any HTML file)

Reporting Issues

Use the extension issue form — it asks for the extension and VS Code versions and a minimal <wcs-state> reproduction, and files the report under the @wcstack/vscode-wcs label.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft