目录

@typescript-eslint/no-array-constructor

Disallow generic Array constructors.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/no-array-constructor": "error"
  }
}

Options

This rule is not configurable.

Example of Correct Code

const length = 500;
Array(length);

export const newArr: number[] = new Array(['1'].length);

export const arr = ['0', '1', '2'];

export const createArray = (array: string) => new Array(array.length);

Example of Incorrect Code

Array();

Array('0', '1', '2');

new Array('0', '1', '2');

Rule Set

plugin:@typescript-eslint/all

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