-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
New: Add option to allow use of file contents for cache #63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the alternative approach (jaredwray/file-entry-cache#14) will be merged soon.
If that is the case, IMO this one will be a better choice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea, and I think it would be helpful to include more details in the detailed design section explaining how it would be implemented.
|
||
## Detailed Design | ||
|
||
This RFC adds a `--cache-strategy` CLI option. Users can specify the option to be: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please describe the details of the implementation here? Which files would be changed?
I don't feel setting environmental variable to control a library is a good idea. i.e. Having an environmental variable to control eslint is fine, but having an environmental variable to control a library consumed by eslint maybe inappropriate from my opinion. |
Thanks for the input. personally, I don't think there is any downside of controlling the library Let me know if I am missing anything. |
I agree with @fa93hws - setting environment variables to control how a dependency works is a bit too magical. ESLint should control how it works on its own. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a fairly simple implementation for a big win. I'm in favor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
I also agree with @fa93hws. jaredwray/file-entry-cache#14 looks like a nice workaround in the absence of ESLint's option, but as a permanent solution - would we document If not, users will be unaware of it. If yes, things will be complicated if we'll need to switch to some other cache lib at some point (for whatever reason). |
I don’t see that as a viable solution. End users shouldn’t know or care about which dependencies ESLint uses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
Can this be moved to the final commenting phase? |
Per the last comment, moving into the Final Commenting phase. |
It seems that the In particular, I don't think this should be a blocker for this feature, but some unexpected results could happen if user switches between cache strategies, but doesn't delete the cache file, since a combination of the stored metadata and stored linting results might be invalid. To reproduce:
|
@mdjermanovic that's a good point, and I think we can probably address that either by detecting the type of cache file in use and invalidating it if the cache strategy has changed or we just add a field into the cache file that explicitly states which strategy was used. |
Good idea! I'm not sure if |
Just to note that in addition to any comparisons If that's relevant for this RFC, it means that the same cache file still cannot be reused between different Node versions, even if |
Summary
This RFC proposes improving cache for CI by providing an option to use a hash (instead of
mtime
andfsize
) comparison to determine whether a file has changed.Related Issues
--cache-strategy
CLI option (refs #11319) eslint#11487