U01

Warning

Declared and never read

U01 — A state nothing reads

A state nothing in its page or component reads; an assignment alone does not read it.

What the compiler said

warning[U01]: `unused` is declared but never read --> src/App.wf:2:5 | 2 | state unused = 0 | ^^^^^ = help: Nothing reads the state; remove it, or name it `_unused` to keep it = docs: https://webfluent.monzeromer.dev/errors/U01

Your editor offers this fix: Remove unused. wf fix --code U01 applies it to every place it fits.

The fix

Broken

wf

page P(path: "/", title: "T", description: "D") { state unused = 0 Heading("Unused").h1 }

Fixed

wf

page P(path: "/", title: "T", description: "D") { Heading("Unused").h1 }

Remove it, read it, or name it _unused to keep it on purpose.

Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).

lints may lower it:

"lints": { "U01": "off" } // wf-allow(U01)