-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
feat: relative cache support #106
Closed
Closed
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
- Repo: eslint/eslint | ||
- Start Date: 2023-02-14 | ||
- RFC PR: <https://github.com/eslint/rfcs/pull/106> | ||
- Authors: Christian Schulz (@cschulz) | ||
|
||
# Relative cache location strategy | ||
|
||
## Summary | ||
|
||
To be able to share the created eslint cache between different systems f.e. local machine and CI, there is a need for a relative path stored in the cache. | ||
|
||
## Motivation | ||
|
||
The overall motivation for doing this is performance during the eslint process. | ||
|
||
Most people are running eslint on local developer machine and additional on the CI workers. | ||
In high changing repositories there are several pull requests at the same time changing different files requiring linting all the time. | ||
This is a time consuming process depending on the enabled rules like type checking rules. | ||
|
||
If the CI worker is able to cache its last run, it can just pick this cache up and use it. | ||
Also developers can reuse this cache or commit it as part of a repository for the CI. | ||
|
||
## Detailed Design | ||
|
||
The LintResultCache takes a file path as parameter to find or store a file cache entry. | ||
|
||
One approach would be to truncate the given absolute path of the file by the path of the cache location. | ||
|
||
Another approach to get a relative path is to use the parent eslint config file if we are thinking about config hierarchies. | ||
|
||
The configuration should be done by CLI flags like the cache strategy option itself. | ||
|
||
## Documentation | ||
|
||
Add the new CLI flag to the CLI documentation. | ||
|
||
## Drawbacks | ||
|
||
No. | ||
|
||
## Backwards Compatibility Analysis | ||
CSchulz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Existing caches needs to be depleted, because there is no cache version entry existing. | ||
|
||
Another way would be to ignore existing absolute paths and write the new relative path if enabled. | ||
|
||
## Alternatives | ||
|
||
A CLI tool which translates the existing cache to the current folder structure. | ||
|
||
## Open Questions | ||
|
||
No. | ||
|
||
## Help Needed | ||
|
||
TBD | ||
|
||
## Frequently Asked Questions | ||
|
||
TBD | ||
|
||
## Related Discussions | ||
|
||
[Change Request: Eslintcache relative #16493](https://github.com/eslint/eslint/issues/16493) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We need more details in this section. It should be written in such a way that someone else would be able to implement it. Please reference filenames, classes, etc., and what would have to change so we can get an idea of the implementation complexity. We'd like your recommendation for the best way to implement your suggestion. As-is, there's not enough detail here to comment on.
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.
@nzakas Can you help me out here? I am not so familar with the code to answer such questions in this detail level.
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.
@CSchulz I completely understand. Part of the RFC process is to have you get familiar with the code to see how plausible it is to implement (otherwise, we will have to do that for every RFC and there's just not enough time for that).
For this change, start by looking in
lib/eslint/flat-eslint.js
.