A JSX fragment wraps a single element or sits directly inside another element

tx0/ts:needless-fragmentstrictwarningstyle

What it finds

<><Header /></>, <div><>{title}</></div>: a fragment with a single element child, or with a single expression directly inside an element, groups nothing and only adds nesting.

A fragment around a single expression is left alone when it is the whole value of a component, since a component may need to return an element where the expression gives a string or array.

From the rule's source, needless_fragment.rs.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:needless-fragment" = "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:needless-fragment] reason="..."

tx0 explain tx0/ts:needless-fragment shows the same in the terminal. Found a false positive? Report it.