Skip to content

Better cache handling of multiple (but different) prettier calls #13010

@HolgerJeromin

Description

@HolgerJeromin

Environments:

  • Prettier Version: 2.7.0
  • Running Prettier via: CLI
  • Operating System: Windows

After discussion #12800 (comment) you moved from default cache location .prettiercache (eslint style) to node_modules/.cache/prettier (ava style).

In #12800 (comment) you needed a use case for a --cache-location CLI param.

I have a script which formats and compiles many Visual Studio projects which shares one node_modules dir.
Compiling one project boosts the prettier call from 15s to 2s. 🎉

But every project has different files (surprise :-) so every prettier call finds new files and rebuilds (!) node_modules/.cache/prettier from scratch (which renders the cache useless in many situations).

It would be better if prettier would

  • expand the cached cache file with new found files (but when do we cleanup?) or
  • default to .prettiercache to be able to have a cache file per vs project or
  • readd --cache-location CLI param so I can configure the cache in my build script

cc @sosukesuzuki @fisker @7rulnik

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliIssues with Prettier's Command Line Interface

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions