For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt, and this page is available as Markdown at https://rslint.rs/rules/eslint/no-new-symbol.md.
close

no-new-symbol

Added in v0.4.0

Configuration

rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-new-symbol': 'error',
    },
  },
]);

Rule Details

Disallows new Symbol(). Symbol is not intended to be used with the new operator, but to be called as a function. Calling new Symbol() throws a TypeError at runtime because Symbol is not a constructor.

Examples of incorrect code for this rule:

var foo = new Symbol('foo');
new Symbol();

Examples of correct code for this rule:

var foo = Symbol('foo');

Original Documentation