Skip to main content

array-type

Enforce a consistent array type syntax.

Targeted pattern scopeโ€‹

This rule targets TypeScript array type annotations.

What this rule reportsโ€‹

This rule reports array types that do not match the configured style.

Why this rule existsโ€‹

Mixing Array<T> and T[] makes signatures harder to scan and causes avoidable style churn.

โŒ Incorrectโ€‹

type Values = Array<string>;

โœ… Correctโ€‹

type Values = string[];

Behavior and migration notesโ€‹

This rule forwards options and behavior to @typescript-eslint/array-type.

Additional examplesโ€‹

// with default @typescript-eslint/array-type options
type Values = Array<string>;
// โŒ reported

type ValuesFixed = string[];
// โœ… valid

ESLint flat config exampleโ€‹

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/array-type": "error",
},
},
];

When not to use itโ€‹

Disable this rule if your project intentionally allows mixed array type styles.

Package documentationโ€‹

Rule catalog ID: R001

Further readingโ€‹

Adoption resourcesโ€‹

  • Start at warning level in CI, then move to error after cleanup.
  • Use focused codemods/autofix batches per package or directory.