目录

@performance/object-creation-check (Deprecated)

Use literals to create objects. This rule applies only to .ts files, but not .ets files. This rule is deprecated since 5.0.3.500.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@performance/object-creation-check": "suggestion",
  }
}

Options

This rule is not configurable.

Example of Correct Code

// Test.ts
// Create an array.
let arr: number[] = [];
// Create a common object.
let obj = {};          
// Create a regular expression object.
let reg = /../; 

Example of Incorrect Code

// Test.ts
// Create an array.
let arr: number[] = new Array(); 
// Create a common object.
let obj = new Object();          
// Create a regular expression object.
let reg = new RegExp('..');    

Rule Set

plugin:@performance/all

For details about how to configure Code Linter check rules, see Code Linter.