-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
ESLint's cache can stop autofixing #10679
Comments
I should add: I like to verify a rule's configuration before running eslint with |
Hi @MayhemYDG, thanks for reporting this issue. The intent was that when a file is autofixed, it wouldn't be written in the cache. I think the problem is that the old cached file information from a previous (non-fix) run is not invalidated explicitly. I was hoping that the file's modification time would be sufficient to invalidate the cache, but maybe we got the sequence of events wrong. |
@platinumazure I think there might be a little misunderstanding: during the |
Oh, thanks for clarifying. I think I know what's going on. The cache info does not contain fix information because it was written when ESLint was run without autofix. When ESLint is run with autofix, it gets the cached lint results which don't have any autofix information, so ESLint decides there are no fixes to apply. I think the best approach here will be to read from the cache, and if there are errors/warnings and autofix is enabled, we need to ignore the cache results and let the file be linted normally. |
@MayhemYDG I've got a branch up in this repo: "fix-cache" (also represented in PR #10694). If you have a chance, I'd be grateful if you could take a look and see if it might fix this issue. I think I've figured it out, but an extra set of eyes never hurt. 😄 |
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
default or babel-eslint
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
'test'
What did you expect to happen?
ESLint should fix the fixable issues.
What actually happened? Please include the actual, raw output from ESLint.
ESLint does not autofix when the cache is populated. If I delete
.eslintcache
, then ESLint will autofix just fine.I believe this is a regression since 5.2.0 (81283d0).
ESLint, when autofixing, shouldn't ignore files that are cached, do not invalidate the cache, but are known to have issues.
The text was updated successfully, but these errors were encountered: