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.