WindowsmacOSLinux

Where Does Stylelint Store Its Cache File?

Stylelint writes --cache results to .stylelintcache in the working directory. Cache semantics and the --cache-location move.

Last updated

Stylelint caches only with --cache on, writing .stylelintcache into the directory where the command ran. Later runs skip unchanged files, the whole payoff on large style codebases. Like its JS cousin, running once without the flag deletes the file as potentially stale.

Point --cache-location at a file or folder to centralize caches across projects; directories get hash-named files per working directory. Remember the trailing slash (or backslash on Windows) for directory targets, or the path parses as a filename. Plugin upgrades never invalidate the cache, so delete it manually after those.

Where Stylelint stores this, by platform

Windows
.stylelintcache

In the working directory of the stylelint run. Directory targets for --cache-location need a trailing backslash. Gitignore it alongside lint output.

macOS
.stylelintcache

Same working-directory rule. Shared directory targets collect .cache_hashOfCWD files per project. Running bare after cached runs deletes the file.

Linux
.stylelintcache

Mirrors macOS with trailing-slash directory syntax. CI lint steps should cache this file keyed on lockfiles to actually save time.

Frequently asked questions

Why did Stylelint delete my cache file?

You ran it without --cache after a cached run. That is deliberate invalidation, not a bug. Pin --cache-location somewhere stable if you want deletion strictly on your own schedule.

Stylelint passes after a plugin update it should catch, why?

The cache keys file contents, not plugin versions. Delete .stylelintcache after every plugin or config upgrade, then rerun with --cache to rebuild from the new rules.

Notice an outdated path? Let us know.