Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.eslintcache constantly generated #10161

Closed
dominikabieder opened this issue Nov 27, 2020 · 75 comments · Fixed by #9977
Closed

.eslintcache constantly generated #10161

dominikabieder opened this issue Nov 27, 2020 · 75 comments · Fixed by #9977

Comments

@dominikabieder
Copy link

dominikabieder commented Nov 27, 2020

Is there a way of disabling .eslintcache generation? I'm struggling to find the answer in the documentation.

@Adam-Ross
Copy link

Same... This just started happening to me today.

@Safnaj
Copy link

Safnaj commented Nov 28, 2020

Same for me as well. Couldn't find the answer anywhere else.

@nrayburn-tech
Copy link

It's part of v4, I think. There's a PR to have it moved into the node_modules folder, which I believe is consistent with some other caches.

It's there to help speed up the linting during both development runs and production builds. It can mostly be ignored, but I don't think there's any way to disable it right now.

@sajid-khan-afridi
Copy link

same here

@sajid-khan-afridi
Copy link

put in .gitignore file

@sajid-khan-afridi

This comment has been minimized.

@Safnaj
Copy link

Safnaj commented Nov 29, 2020

Same for me as well. Couldn't find the answer anywhere else.

put in .gitignore file

adding it to the .gitignore file only disables its tracking. The file is annoying me and i want to get rid of this.
Its still keep generating.

@cseas
Copy link

cseas commented Nov 29, 2020

This cache file dependency is not only annoying, but it's also a hurdle in trying to deploy the application as a non-root user in a container. Here's the related StackOverflow thread.

@Poolshark
Copy link

same...

@ricardodanaya
Copy link

same here

@vlad2710
Copy link

same here...

@silverwind
Copy link

I think it should be be put into node_modules/.cache/.eslintcache so it's out of sight like other caches (e.g. babel's).

@Blazekla
Copy link

This file is generated with react-scripts 4.0.1. If you change the version to 4.0.0 you won't have this issue for now. This might get changed in a future release.

@Ogglas
Copy link

Ogglas commented Dec 1, 2020

Update:

It has now started to cause compile errors as well:

image

EBUSY: resource busy or locked, open 'C:\Users\Oscar\source\repos\<>\ClientApp\.eslintcache'

Original:

eslint --cache false should work but I don't know how to inject that. I saw nothing about this under Configuring ESLint or Create React App Custom Environment Variables

https://eslint.org/docs/user-guide/configuring

https://create-react-app.dev/docs/adding-custom-environment-variables/

https://eslint.org/docs/user-guide/command-line-interface#options

You could also specify another cache location if you find a way to inject the command:

--cache-location
Path to the cache location. Can be a file or a directory. If none specified .eslintcache will be used. The file will be created in the directory where the eslint command is executed.

https://eslint.org/docs/2.0.0/user-guide/command-line-interface#caching

@falinsky
Copy link

falinsky commented Dec 1, 2020

It seems that cache was enabled on purpose here: #9911

@Safnaj
Copy link

Safnaj commented Dec 1, 2020

It seems that cache was enabled on purpose here: #9911

Yes bt as @silverwind said it should be there in the node_modules/.cache/.eslintcache

@silverwind
Copy link

I think the main issue is a bad default location coming from eslint, see eslint/eslint#13897.

falinsky added a commit to falinsky/create-react-app that referenced this issue Dec 1, 2020
fixes facebook#10161

No need to generate eslint cache due to performance boost
gained in eslint-webpack-plugin 2.4.1
@webdev778
Copy link

same for me.

@dominikabieder
Copy link
Author

dominikabieder commented Dec 2, 2020

Not only is it annoying, it also wastes time on debugging. My app kept showing an error for the line of code that was no longer there. I tried everything and only deleting .eslintcache solved the problem.

@Motii1
Copy link

Motii1 commented Dec 2, 2020

This file is generated with react-scripts 4.0.1. If you change the version to 4.0.0 you won't have this issue for now. This might get changed in a future release.

Still generates

@StraightOuttaCrompton
Copy link

A fix seems to be in progress #9977. Looks like the plan is to move .eslintcache into node_modules/.cache

@falinsky
Copy link

falinsky commented Dec 2, 2020

A fix seems to be in progress #9977. Looks like the plan is to move .eslintcache into node_modules/.cache

As far as I understand that fix has nothing to do with an issue described by @dominikabieder

Not only it is annoying, it wastes time on debugging. My app kept showing an error for the line of code that was no longer there. I tried everything and only deleting .eslintcache solved the problem.

@joescharf
Copy link

Having similar issue to @dominikabieder - Seems like when eslint fixes are applied by vscode, the .eslintcache isn't updated and eslint still complains of errors when run outside of vscode.

@silverwind
Copy link

Those sound like eslint/vscode bugs, you should report them there.

@joescharf
Copy link

Will do. In the meantime, in case anyone wanders by looking, if you're using nuxt and @nuxtjs/eslint-module, you can turn off the eslint cache in nuxt.config.js with

  eslint: {
    cache: false,
  },

@ruvesh
Copy link

ruvesh commented Feb 3, 2021

This file is generated with react-scripts 4.0.1. If you change the version to 4.0.0 you won't have this issue for now. This might get changed in a future release.

Still generates

Try running npm install after changing the version. That worked for me.

@TroySchmidt
Copy link

I am having the build fail in Azure DevOps randomly with this cache file. I have added the gitignore so that it isn't in the repo. But still randomly an issue. So not sure that merely moving the location of the file is going to fix the random issue. Which feels like a race condition and back to react-scripts 0.9.2 issue.

@rafaelperozin
Copy link

put in .gitignore file

This works, but .gitignore only ignores files that are not part of the repository yet. If you already git added some files, their changes will still be tracked.

So, in this case, to ignore a file already tracked you also need to run git rm --cached .eslintcache

@VenkataJanapareddy
Copy link

VenkataJanapareddy commented Feb 16, 2021

We still have this issue after upgrading react-scripts from 4.0.1 to 4.0.2. We are downgrading to 4.0.0 until it's fixed.

@albert-schilling
Copy link

albert-schilling commented Feb 18, 2021

It is possible to disable the cache with a cli flag (--cache=false), but I can't seem to find a resource that explains how to disable the cache in the package.json or in a .eslintrc.json. Has anyone an idea?
These links did not help so far:

@howlettt
Copy link

howlettt commented Mar 6, 2021

To avoid wasting any more time debugging issues caused by this file I went with the hand grenade approach in package.json:

  "scripts": {
    "start": "del .eslintcache && react-scripts start",

@Devansh-Singh-Parmar
Copy link

Same!

@jovylle
Copy link

jovylle commented Jul 2, 2021

Same on my end. so I am forced now to uninstall it.

marwinburesch added a commit to marwinburesch/vite-boilerplate that referenced this issue Aug 24, 2021
@jcollum
Copy link

jcollum commented Sep 2, 2021

This seems like an eslint issue, not a create-react-app issue.

@jovylle
Copy link

jovylle commented Sep 7, 2021

Yeah, same, I removed the eslint for now.

@jcollum
Copy link

jcollum commented Sep 7, 2021

@dominikabieder you may have better luck getting this resolved if you copypaste it to the eslint issues

@Probug
Copy link

Probug commented Sep 10, 2021

mine is almost the same but a funny twist. when deployed, I get this:
Screenshot from 2021-09-10 10-06-20
Failed to compile

EACCES: permission denied, open '/home/site/wwwroot/node_modules/.cache/.eslintcache'

i have searched the web over and over again, i don't seem to find a solution to this error

@JESii
Copy link
Contributor

JESii commented Sep 18, 2021

This really too bad; if I have a typo in my code and save it, then .eslintcache doesn't get cleared and the error continues to appear in the server. The only way to remove the error is to delete .eslintcache. This is a major productivity-killer!

@mrlinnth
Copy link

Maybe related to this bug or may not. Just wanna share my experience for those having permission denied/read-only .cache/.eslintcache issue.

I also got this error just now. Looked around and found this thread, didn't really find any solution.

I tried to remove node_modules folder entirely by running 'rm -rf' which also gave same permission error.

Then I remembered that I didn't properly shut down my PC last night when I was booted into Windows.

So I boot into Windows
Did disk analyze and optimize (just to be safe, probably not needed)
Restart my PC
Boot into Linux

Fixed and no more issue for me. Just my 2cents.

@chicken-suop
Copy link

Has this really not been solved?

@jovylle
Copy link

jovylle commented Mar 22, 2022

I just managed to add it to .gitignore

@chicken-suop
Copy link

I just managed to add it to .gitignore

Yes, but as everyone says it's still being generated

@jovylle
Copy link

jovylle commented Mar 23, 2022

I have this trick I used before to block a auto generated file.

make a folder/directory
that is named ".eslintcache"
this worked on windows and that file will not proceed on generating if that folder exist.

I know this is crazy idea.

@JESii
Copy link
Contributor

JESii commented Jul 2, 2022

This is a HUGE time suck -- I keep having to re-edit/re-save my file (multiple times) and or remove that .eslintcache file (note that adding it to .gitignore does nothing to solve the problem -- the file still keeps getting generated).
NOTE: react-scripts on V4.0.0 did NOT fix the problem for me
ALSO NOTE: the directory hack mentioned above does not work
EISDIR: illegal operation on a directory, open '/Users/jseidel/ppg/hall/winter-spa/.eslintcache'
I would imagine the hours wasted by developers over this thing is mind-boggling.

@Replayattack
Copy link

Replayattack commented Jul 13, 2022

mine is almost the same but a funny twist. when deployed, I get this: Screenshot from 2021-09-10 10-06-20 Failed to compile

EACCES: permission denied, open '/home/site/wwwroot/node_modules/.cache/.eslintcache'

i have searched the web over and over again, i don't seem to find a solution to this error

Hello, update your Node version in Azure to the 16 version and the error will disappear.

@thebeyondr
Copy link

thebeyondr commented Jul 15, 2022

🚨 Here's what worked for me

ESLint offers the option to set the cache location.

pnpx eslint "src/**/*.js" --cache --cache-location "/path/to/wherever"

Example to send that bizzatch to the shadow realm (node-modules). from a script in package.json:

{
...
"lint:fix": "eslint --cache --fix './src/**/*.{js,jsx,ts,tsx,json}' --cache-location './node_modules/@eslint/.eslintcache/'",
...
}

For 10x galaxy brain billionaire devs

ℹ️ The script above lints everything in src that's staged, keeping track of those files in a .eslintcache file we've sent to node_modules/@eslint

⚡ I use pnpm so if you use yarn, npm or whatever-package-manager-comes-out-in-the-next-half-hour your node_modules folder might look different - just find the eslint folder in there and just use that path for ---cache-location homie 🤘🏽

Gotta blast! 🚀

anadis504 added a commit to rage/factor-analysis-exercise-service that referenced this issue Oct 15, 2022
anadis504 added a commit to rage/factor-analysis-exercise-service that referenced this issue Oct 15, 2022
* fix configurations

* fix generated .eslintcahce file in root folder facebook/create-react-app#10161

* Update code-style.yml
anadis504 added a commit to rage/factor-analysis-exercise-service that referenced this issue Oct 29, 2022
* staging workflow

* fix tests (1st try)

* fix tests (2nd try)

* clean up the mess

* generate new lock.files

* fix select overflow

* fix configurations

* fix generated .eslintcahce file in root folder facebook/create-react-app#10161

* Update code-style.yml

* also update the shared module

* Fix broken stylongs and update shared-modules

* ignore tsconfig.tsbuildinfo

* fixx

* fix test configuration

* fix gh actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet