A JSX element rendered as part of a list has no key
What it finds
items.map((item) => <li>{item.name}</li>): React tells the elements of a list apart by their key. Without one, it matches old and new elements by position, so inserting, removing or reordering items mixes up their state, focus and animations, and React warns about it.
Reported are JSX elements returned from the callback of map, flatMap or Array.from, and JSX elements in an array literal with more than one, that have no key attribute and no spread attribute that could set one. A shorthand fragment <> in such a place cannot take a key and is reported too. JSX libraries other than React, as Solid, do not use keys, which is why the rule is recommended.
From the rule's source, list_item_without_key.rs.
Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:list-item-without-key" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:list-item-without-key] reason="..."tx0 explain tx0/ts:list-item-without-key shows the same in the terminal. Found a false positive? Report it.