An empty {} or [] in a declaration binds no name

tx0/ts:pattern-binds-nothingdefaultwarningbug

What it finds

const { options: {} } = config or const [] = list: a destructuring pattern with nothing in it binds no names. Nested inside another pattern, it is usually a default value written with : instead of =, as { options = {} } was meant.

Empty patterns that are a whole parameter, as function Page({}: Props), are a common way to say that an argument is ignored and are left alone.

From the rule's source, pattern_binds_nothing.rs.

Example from the rule's tests
function read(config: any, list: number[]) {  const { options: {} } = config;tx0 reports: the pattern {} binds nothing  const [] = list;tx0 reports: the pattern [] binds nothing  const { options = {} } = config;  return options;}function Page({}: { title?: string }) {  return null;}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:pattern-binds-nothing" = "off"

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:pattern-binds-nothing] reason="..."

tx0 explain tx0/ts:pattern-binds-nothing shows the same in the terminal. Found a false positive? Report it.