disallow-stylelint-ignore-files
Disallow configuring Stylelint's top-level ignoreFiles option inside authored Stylelint config files.
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โ
This rule reports Stylelint config objects that include a top-level ignoreFiles property.
Why this rule existsโ
ignoreFiles changes lint coverage at the config level and can accidentally hide files from linting across editor, CI, and local workflows.
Stylelint also documents that ignoreFiles is not efficient for broad ignore coverage and can override default node_modules ignore behavior. In shared configs, ignore scope is usually clearer in .stylelintignore or invocation-level file globs.
โ Incorrectโ
export default {
ignoreFiles: ["**/vendor/**/*.css"],
rules: {},
};
โ Correctโ
export default {
rules: {},
};
Behavior and migration notesโ
- This rule removes the top-level
ignoreFilesproperty. - It preserves the rest of the config object.
- Move ignore patterns to
.stylelintignore(preferred for file-scope ignores) or to explicit invocation globs in scripts.
Additional examplesโ
โ Correct โ ignore scope moved out of shared configโ
// package.json
{
"scripts": {
"lint:css": "stylelint \"src/**/*.{css,scss}\""
}
}
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 team intentionally controls all Stylelint ignore patterns directly in the committed config object and accepts that coupling.
Package documentationโ
Stylelint package documentation:
Rule catalog ID: R010