close

no-new-object

Configuration

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

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

Rule Details

Disallow Object constructors. The object literal notation {} is preferable.

Examples of incorrect code for this rule:

var myObject = new Object();

new Object();

Examples of correct code for this rule:

var myObject = {};

var myObject = new CustomObject();

var foo = new foo.Object();

Original Documentation

https://eslint.org/docs/latest/rules/no-new-object