--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid.js --- # Input ```jsx var foo = new Symbol("foo"); function bar() { return function Symbol() {}; } var baz = new Symbol("baz"); var foo = new BigInt(9007199254740991); function bar() { return function BigInt() {}; } var baz = new BigInt(9007199254740991); ``` # Diagnostics ``` invalid.js:1:11 lint/correctness/noInvalidNewBuiltin FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Symbol cannot be called as a constructor. > 1 │ var foo = new Symbol("foo"); │ ^^^^^^^^^^^^^^^^^ 2 │ function bar() { 3 │ return function Symbol() {}; i Calling Symbol with the new operator throws a TypeError. i Unsafe fix: Remove new. 1 │ var·foo·=·new·Symbol("foo"); │ ---- ``` ``` invalid.js:5:11 lint/correctness/noInvalidNewBuiltin FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Symbol cannot be called as a constructor. 3 │ return function Symbol() {}; 4 │ } > 5 │ var baz = new Symbol("baz"); │ ^^^^^^^^^^^^^^^^^ 6 │ 7 │ var foo = new BigInt(9007199254740991); i Calling Symbol with the new operator throws a TypeError. i Unsafe fix: Remove new. 5 │ var·baz·=·new·Symbol("baz"); │ ---- ``` ``` invalid.js:7:11 lint/correctness/noInvalidNewBuiltin FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! BigInt cannot be called as a constructor. 5 │ var baz = new Symbol("baz"); 6 │ > 7 │ var foo = new BigInt(9007199254740991); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8 │ function bar() { 9 │ return function BigInt() {}; i Calling BigInt with the new operator throws a TypeError. i Unsafe fix: Remove new. 7 │ var·foo·=·new·BigInt(9007199254740991); │ ---- ``` ``` invalid.js:11:11 lint/correctness/noInvalidNewBuiltin FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! BigInt cannot be called as a constructor. 9 │ return function BigInt() {}; 10 │ } > 11 │ var baz = new BigInt(9007199254740991); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 12 │ i Calling BigInt with the new operator throws a TypeError. i Unsafe fix: Remove new. 11 │ var·baz·=·new·BigInt(9007199254740991); │ ---- ```