question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider changing default location of `.eslintcache` to `node_modules/.cache`

See original GitHub issue

The version of ESLint you are using.

v7.14.0

The problem you want to solve.

The default location of .eslintcache in the project root is problematic because that directory is generally used to store configuration, not ephemeral files like this cache. By putting it in the project root, you’re forcing everyone wo enables that cache to put an entry for it in .gitignore.

Your take on the correct solution to problem.

Use find-cache-dir to locate the common cache directory and store the file there instead. This is a common pattern used by many other modules like babel-loader, terser-webpack-plugin and even eslint-loader. If there is no node_modules, fall back to a temporary directory.

Are you willing to submit a pull request to implement this change?

Yes

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:15
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
NMinhNguyencommented, Jan 6, 2021

For what it’s worth, this has been raised before and https://github.com/eslint/eslint/issues/11757#issuecomment-496945984 has examples of other popular projects using the node_modules/.cache convention.

1reaction
sztadiicommented, Dec 3, 2020

That’s the thing, nobody wants to extend .gitignore every time when creating a new project. Nobody will complain if other packages will not solve that problem in a more elegant way ( keeping it in node_modules/.cache ). So I think keeping the standard is not a bad idea.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to delete .eslintcache file in react?
I tried to delete it but it always comes back. I ran this command - "npm uninstall -g eslint --save" - to delete...
Read more >
VS Code ESLint extension - Visual Studio Marketplace
If executing ESLint in the terminal requires you to change the working directory in the terminal into a sub folder then it is...
Read more >
Caching is very slow for Node.JS projects - gitlab-runner
I think this would save quite a lot of time. Actually zipping the node modules folder isn't a good idea anyhow as all...
Read more >
ESLint CI cache issue
So we try to load a cache from .eslintcache and use content as cache ... file changes in the branch, eslint takes around...
Read more >
eslint-watch
Eslint Watch provides file watching and command line improvements to the ... Deprecated: use --cache-location - default: .eslintcache.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found