prefer-stylelint-plugins-array
Prefer array form for top-level Stylelint plugins declarations.
Targeted pattern scopeโ
This rule targets Stylelint config modules such as stylelint.config.ts, stylelint.config.mjs, and .stylelintrc.js.
It focuses on top-level exported config objects, including configs wrapped in defineConfig(...).
What this rule reportsโ
Reports plugins when it is defined as a single string instead of an array.
Why this rule existsโ
Array form makes plugin composition deterministic and easier to maintain in shared configuration.
โ Incorrectโ
export default {
plugins: "stylelint-order",
rules: {},
};
โ Correctโ
export default {
plugins: ["stylelint-order"],
rules: {},
};
Behavior and migration notesโ
This rule auto-fixes scalar string form to a single-entry array.
ESLint flat config exampleโ
import stylelint2 from "eslint-plugin-stylelint-2";
export default [stylelint2.configs.configuration];
When not to use itโ
Do not use this rule if your repository intentionally enforces scalar plugins syntax.
Package documentationโ
Stylelint package documentation:
Rule catalog ID: R022