Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Linter · Rules

no-new-symbol

Disallow new Symbol()

Symbol starts with a capital letter but isn't a constructor. new Symbol("id") throws a TypeError when it runs. Call it without new.

ESLint has deprecated this rule. Use no-new-native-nonconstructor instead, which also covers BigInt.

Examples

Reported:

const id = new Symbol("id");

Not reported:

const id = Symbol("id");