1 # Disallow Symbol Constructor (no-new-symbol)
3 `Symbol` is not intended to be used with the `new` operator, but to be called as a function.
6 var foo = new Symbol("foo");
9 This throws a `TypeError` exception.
13 This rule is aimed at preventing the accidental calling of `Symbol` with the `new` operator.
17 Examples of **incorrect** code for this rule:
20 /*eslint no-new-symbol: "error"*/
23 var foo = new Symbol('foo');
26 Examples of **correct** code for this rule:
29 /*eslint no-new-symbol: "error"*/
32 var foo = Symbol('foo');
35 // Ignores shadowed Symbol.
36 function bar(Symbol) {
37 const baz = new Symbol("baz");
44 This rule should not be used in ES3/5 environments.
48 * [Symbol Objects specification](https://www.ecma-international.org/ecma-262/6.0/#sec-symbol-objects)