pattern rule · warning

require-empty-state

.map() rendering arrays without an empty branch.

What it flags

Add a fallback for when the array length is 0.

Examples

On system

items.length === 0 ? <Empty /> : <ul>{items.map(i => <li>{i}</li>)}</ul>

Flagged

<ul>{items.map(i => <li>{i}</li>)}</ul>

How to run it

Run npx windcraft check to run this and the other rules over your project. It ships at warning severity by default, and your AI tools can call it on a snippet over MCP through validate_component_code — so drift is caught as the code is written, not just in review.

Related

Catch design drift before it ships.