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

Change Request: Eslintcache relative #16493

Open
1 task
brenelz opened this issue Nov 2, 2022 · 28 comments
Open
1 task

Change Request: Eslintcache relative #16493

brenelz opened this issue Nov 2, 2022 · 28 comments
Assignees
Labels
core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint needs design Important details about this change need to be discussed
Projects

Comments

@brenelz
Copy link

brenelz commented Nov 2, 2022

ESLint version

v8.26.0

What problem do you want to solve?

I am currently trying to use the .eslintcache file in our jenkins ci.

Is there anyway the cache can use relative file paths? In our instance each branch is in a seperate dir but I want to reuse the cache.

What do you think is the correct solution?

In order to move the .eslintcache around it would be great if the cache filePaths were relative

Participation

  • I am willing to submit a pull request for this change.

Additional comments

No response

@brenelz brenelz added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon labels Nov 2, 2022
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Nov 2, 2022
@mdjermanovic mdjermanovic removed the triage An ESLint team member will look at this issue soon label Nov 4, 2022
@mdjermanovic mdjermanovic moved this from Needs Triage to Triaging in Triage Nov 4, 2022
@mdjermanovic
Copy link
Member

Hi @brenelz, thanks for the issue!

I think this is generally doable. We'd need to discuss details, like whether this needs a new option and what should be the base path (directory to which the file paths would be relative; would it be the current working directory, or location of the cache file, or something else). This is a non-trivial change in the core, so I think it should go through the RFC process, but let's hear more opinions from the team first.

@mdjermanovic mdjermanovic moved this from Triaging to Blocked in Triage Nov 4, 2022
@mdjermanovic mdjermanovic moved this from Blocked to Feedback Needed in Triage Nov 4, 2022
@brenelz
Copy link
Author

brenelz commented Nov 5, 2022

If its a non-trivial change its probably not worth it. Seems like no one has really asked for it besides me. We were just trying to use the cache in our ci which I think we are unable to do currently.

@brenelz
Copy link
Author

brenelz commented Nov 5, 2022

Another option very specific to my use case would be if we could not include the path in hashOfConfig if that makes sense

@nzakas
Copy link
Member

nzakas commented Nov 8, 2022

Yeah, we’d need an RFC for this as it has the potential to break current cache file usage.

@nzakas nzakas added the needs design Important details about this change need to be discussed label Nov 8, 2022
@CSchulz
Copy link

CSchulz commented Dec 6, 2022

Who can initiate this rfc request? We are also struggling with caching.

Why not using a hybrid scenario for the paths? Cutting the absolute path to a relative path and always store the relative path for the future.
As long as nobody moves the workspace around there is no breaking change for the cache itself.

@nzakas
Copy link
Member

nzakas commented Dec 8, 2022

Anyone can initiate an RFC. Some people check in their cache file, so any change to the cache format is a breaking change. We can't know for sure where people are storing cache files or how else they might be used.

@CSchulz
Copy link

CSchulz commented Dec 9, 2022

I can't believe anyone is using absolute paths if people want to check in their cache files.
Otherwise to prevent some breaking changes, can we add a third strategy for the cache using relative paths?

@nzakas
Copy link
Member

nzakas commented Dec 9, 2022

@CSchulz you can feel free to propose whatever you want. As already stated, we would just need an RFC to consider it.

@aaronabf
Copy link

aaronabf commented Jan 4, 2023

If its a non-trivial change its probably not worth it. Seems like no one has really asked for it besides me. We were just trying to use the cache in our ci which I think we are unable to do currently.

I second this feature! I had opened an issue for this as well #16741.

@herzaso
Copy link

herzaso commented Jan 16, 2023

+1.
I wanted to use caching and check in the cache file so that other developers in my organization (and the CI) would use that cache, but it is currently not feasible.
The biggest problem is the CI - since we use docker to run the lint, it can't maintain the .eslintcache file so we have to check it in, but then I don't think that the CI should write anything to my repo

@majo44
Copy link

majo44 commented Feb 6, 2023

+1 on our big monorepo (500 packages) we also want to share the .eslintcache especially to save CI time.

@github-actions
Copy link

github-actions bot commented Mar 9, 2023

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Mar 9, 2023
@Rec0iL99
Copy link
Member

WIP. Don't close. @CSchulz has opened a RFC.

@Rec0iL99 Rec0iL99 removed the Stale label Mar 10, 2023
@github-actions
Copy link

github-actions bot commented Apr 9, 2023

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Apr 9, 2023
@github-actions
Copy link

This issue was auto-closed due to inactivity. While we wish we could keep responding to every issue, we unfortunately don't have the bandwidth and need to focus on high-value issues.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2023
@github-actions
Copy link

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Sep 30, 2023
@Rec0iL99 Rec0iL99 removed the Stale label Oct 1, 2023
@cs6cs6
Copy link

cs6cs6 commented Oct 2, 2023

I would like to see this proceed.

@brenelz
Copy link
Author

brenelz commented Oct 2, 2023

Personally I don't have a specific need for this anymore, but I think it would still be nice

@cs6cs6
Copy link

cs6cs6 commented Oct 3, 2023

I do. I'm prototyping it, and if it works I'll try to submit this back.


  • lib/options.js: Add the option to specify a non default estlintcache directory structure, around line 313:

   option: cachefolderstorage
   type: String
   enum: ["full", "relative"],
   default: "full"
   description: "Indicates how an eslintcache will internally store directories. "relative" allows for the same cache to be used at different directory paths. "full" is the legacy, default behavior where the full file path is encoded in the eslintcache.
 
  • conf/default-cli-options.js: Add the name "cachefolderstorage" with a default of "full" around line 25

  • eslint/eslint-hepers.js: Modify processOptions function around line 662 to have the field "cachefolderstorage" with a default of "full"

  • lib/eslibt/flat-eslint.js: add a debug printout to state what kind of directory struture is used. In function "lintFiles" which starts around line 733, the list of file directory paths is created from the pattern passed in on the cli. This list of files is ultimately what gets written to the eslintcache. Those file names are full path names.
    The easiest change here with the least side effects is likely just to change the way the result object is stored. On Line 871 the code looks like this:

     if (lintResultCache) {
                            lintResultCache.setCachedLintResults(filePath, config, result);
                        }

It would likely be best to look at the config option cachefolderstorage here, and see if filePath should be stored as a relative or a full path.

Some unit tests will definitely need to be added to the flat-eslint tests, and the option-parser tests.

Copy link

github-actions bot commented Nov 2, 2023

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Nov 2, 2023
@CSchulz
Copy link

CSchulz commented Nov 3, 2023

@cs6cs6 I am out of time at the moment, but I would suggest to take over my rfc request or we work together?

@nzakas
Copy link
Member

nzakas commented Nov 3, 2023

This isn't stale, we have an RFC open:
eslint/rfcs#114

@nzakas nzakas removed the Stale label Nov 3, 2023
Copy link

github-actions bot commented Dec 3, 2023

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Dec 3, 2023
@nzakas
Copy link
Member

nzakas commented Dec 8, 2023

We have an RFC that hasn't been updated in a bit. Will ping the author.

@github-actions github-actions bot removed the Stale label Dec 8, 2023
Copy link

github-actions bot commented Jan 8, 2024

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Jan 8, 2024
@nzakas
Copy link
Member

nzakas commented Jan 9, 2024

We are waiting on the RFC to be picked up.

@github-actions github-actions bot removed the Stale label Jan 10, 2024
Copy link

Oops! It looks like we lost track of this issue. What do we want to do here? This issue will auto-close in 7 days without an update.

@snitin315
Copy link
Contributor

Assigned it to the RFC author, to avoid stale-bot messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint needs design Important details about this change need to be discussed
Projects
Status: RFC Opened
Triage
Feedback Needed
Development

No branches or pull requests

10 participants