C02

Error

Components

C02 — A prop the component does not declare

Your own component is called with a prop it does not declare. Nothing in it reads the value, so the call does not do what it says; often a misspelling.

What the compiler said

error[C02]: `Badge2` declares no prop `colour` --> src/App.wf:4:19 | 4 | Badge2("New", colour: "red") | ^^^^^^ = help: It is passed anyway, but nothing in the component reads it = docs: https://webfluent.monzeromer.dev/errors/C02

The fix

Broken

wf

component Badge2(_ label: String) { Text(label) } page P(path: "/", title: "T", description: "D") { Heading("Badges").h1 Badge2("New", colour: "red") }

Fixed

wf

component Badge2(_ label: String, colour: String = "") { Text(label) } page P(path: "/", title: "T", description: "D") { Heading("Badges").h1 Badge2("New", colour: "red") }

Correct the spelling, or declare the prop on the component.

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": { "C02": "warn" } // wf-allow(C02)