new is applied to a name starting with a lower-case letter

tx0/ts:new-on-lowercase-namestrictwarningstyle

What it finds

By a convention that nearly all JavaScript follows, constructors and classes are named with a capital letter and other functions are not. new widget() breaks it, so either the function is a constructor with a misleading name or new is applied to a function that does not expect it, which then returns an empty object.

Reported are new expressions whose callee is a plain name starting with a lower-case letter.

From the rule's source, new_on_lowercase_name.rs.

Example from the rule's tests
declare function widget(): void;declare class Widget {}export const a = new widget();tx0 reports: widget is called with newexport const b = new Widget();
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 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:new-on-lowercase-name" = "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:new-on-lowercase-name] reason="..."

tx0 explain tx0/ts:new-on-lowercase-name shows the same in the terminal. Found a false positive? Report it.