Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

no-array-constructor

Disallow genericArray constructors.

🔧

Some problems reported by this rule are automatically fixable by the--fix ESLint command line option.

🧱

This is an "extension" rule that replaces a core ESLint rule to work with TypeScript. SeeRules > Extension Rules.

This rule extends the baseno-array-constructor rule from ESLint core. It adds support for the generically typedArray constructor (new Array<Foo>()).

  • ❌ Incorrect
  • ✅ Correct
Array(0,1,2);
newArray(0,1,2);
Open in Playground

Options

Seeeslint/no-array-constructor's options.

How to Use

  • Flat Config
  • Legacy Config
eslint.config.mjs
exportdefault tseslint.config({
rules:{
// Note: you must disable the base rule as it can report incorrect errors
"no-array-constructor":"off",
"@typescript-eslint/no-array-constructor":"error"
}
});

Try this rule in the playground ↗

Resources

Taken with ❤️ fromESLint core.

[8]ページ先頭

©2009-2025 Movatter.jp