V07
Warning
Vocabulary
V07 — A number where CSS wants a length
width: {pct} with a number is a length with no unit, which the browser drops. Give it one: {pct}%.
What the compiler said
warning[V07]: `width: {pct}` is a number with no unit, which the browser drops --> src/App.wf:4:20 | 4 | Card { style { width: {pct} } } | ^^^^^^^^^^^^ = help: Give it one: `width: {pct}px` (or `%`, `rem`) = docs: https://webfluent.monzeromer.dev/errors/V07
Your editor offers this fix: Add px. wf fix --code V07 applies it to every place it fits.
The fix
Broken
page P(path: "/", title: "T", description: "D") {
state pct = 40
Heading("Progress").h1
Card { style { width: {pct} } }
}
Fixed
page P(path: "/", title: "T", description: "D") {
state pct = 40
Heading("Progress").h1
Card { style { width: {pct}% } }
}
Give it a unit: width: {pct}%.
Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).
Why this rule exists
Warning.
lints may lower it:
"lints": { "V07": "off" }
// wf-allow(V07)