Stylelint "Could not find a config" - Fix Missing Config in CI
Stylelint could not find a configuration to run, or could not load a config named in extends. There is no .stylelintrc, or a shareable config like stylelint-config-standard is referenced but not installed.
What this error means
Stylelint fails with No configuration provided or Could not find "stylelint-config-standard". Do you need to install it?. Nothing lints because the config cannot be assembled.
Error: Could not find "stylelint-config-standard". Do you need a `configBasedir`?
# or:
No configuration provided for /app/src/styles.cssCommon causes
No config file present
There is no .stylelintrc.*/stylelint.config.js (or stylelint key in package.json) where Stylelint runs, so it has no configuration.
Shareable config not installed
A config named in extends (e.g. stylelint-config-standard) is missing from node_modules - not declared, or dropped by a clean install.
How to fix it
Add a config and install the shareable config
Create a config that extends an installed shareable config.
npm install -D stylelint stylelint-config-standard
# .stylelintrc.json
# { "extends": "stylelint-config-standard" }Point Stylelint at the right config
- Ensure a
.stylelintrc.*exists at the project root (or pass--config). - Declare every
extendsconfig indevDependencies. - Run Stylelint from a directory where it can discover the config.
How to prevent it
- Commit a
.stylelintrcand declare shareable configs indevDependencies. - Install with
npm ciso the Stylelint toolchain is reproducible. - Run Stylelint from a consistent directory in CI.