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: (Consider moving .eslintcache to node_modules/.cache) #18245

Open
1 task
recallwei opened this issue Mar 29, 2024 · 7 comments
Open
1 task
Labels
breaking This change is backwards-incompatible core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion

Comments

@recallwei
Copy link

ESLint version

v8.0.0

What problem do you want to solve?

Now, I should add .eslintcache to .gitignore manually.
Also, this file should not be in the project root dir.

What do you think is the correct solution?

Like Prettier, Store in node_modules/.cache seems a great solution.

image

Participation

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

Additional comments

No response

@recallwei recallwei added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint labels Mar 29, 2024
@aladdin-add
Copy link
Member

aladdin-add commented Mar 29, 2024

I'm 👍 to this. However, it's a breaking change, so we cannot accept it in v9(it's in rc). I think we can change it in v10.

Would like to hear from other team members. @eslint/eslint-team

@aladdin-add aladdin-add added the evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion label Mar 29, 2024
@nzakas
Copy link
Member

nzakas commented Mar 29, 2024

I don't think there's a good reason to change the location of the cache file. Some users actually do check in .eslintcache to their repository for CI purposes, so I don't think it's safe to either assume that most people don't want that or to put it into a location that is always gitignored by default.

@JoshuaKGoldberg
Copy link
Contributor

Some users actually do check in .eslintcache to their repository for CI purposes

🤔 is that... advisable? My impression was that the slice of users who'd want to do such a thing is pretty small. This is all anecdotal and I'd want to know if I'm wrong anywhere:

  • Most repositories that include artifacts don't check them in, based on the reasoning that they can clutter changes (e.g. tsconfig.tsbuildinfo)
  • Most repositories that have performance issues get it from cross-file linting such as eslint-plugin-import or typescript-eslint type-checked rules. Given that caching doesn't work well with cross-file lint rules (e.g. Docs: explain whether type-aware linting is safe to use with eslint --cache typescript-eslint/typescript-eslint#4694), that swathe of repositories likely shouldn't be using it at all
    • This, in particular, I would like to be corrected on if I'm wrong 🙂

I believe the ecosystem norm is to put artifacts in node_modules/.cache or some similar location. If that's right, then my instinct would be that the default for caching should be the ecosystem norm, with an opt-in option to move to a new location like .eslint-cache.

@nzakas
Copy link
Member

nzakas commented Apr 1, 2024

🤔 is that... advisable?

Folks do this to speed up their CI. There's even an RFC aimed at making this easier:
eslint/rfcs#114

@nzakas nzakas added the breaking This change is backwards-incompatible label Apr 1, 2024
@recallwei
Copy link
Author

Most of the projects do not use cache and CI. Is it possible to add some custom config to specify the location of the cache file?

@nzakas
Copy link
Member

nzakas commented Apr 2, 2024

@recallwei I don't think you can make any assertion about what most projects do, and even if you could, that doesn't mean we don't consider those use cases.

There is already a --cache-location flag that you can use to place the cache file into node_modules if you want.

@fasttime
Copy link
Member

fasttime commented Apr 7, 2024

So, if the directory where eslint runs does not contain a package.json file or a node_modules directory, what should happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change is backwards-incompatible core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion
Projects
Status: Feedback Needed
Development

No branches or pull requests

5 participants