question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ESLint ignores its own cache

See original GitHub issue

Tell us about your environment

We have a Gitlab configured this way:

cache:
  key: $CI_COMMIT_REF_NAME
  paths:
    - .eslint

lint:
  stage: test
  script: DEBUG=eslint:cli-engine yarn lint:all

And package.json:

{
  "scripts": {
    "lint": "eslint --cache --cache-location .eslint/cache --fix --ignore-path .eslintignore",
    "lint:all": "yarn lint \"src/**/*.{js,jsx,ts,tsx}\"",
  }
}
  • ESLint Version: 7.2.0

What did you expect to happen?

I can see that the ESLint cache is being successfully created on previous job launches, e.g. a file .eslint/cache is present in Gitlab Cache archive. And I expect to see that cache is used:

  eslint:cli-engine Skipping file since it hasn't changed: /xxx/src/app/core/data/stores/utils.js +0ms

What actually happened? Please include the actual, raw output from ESLint.

Looks like the cache is not used because I see output like this (for ALL the files in the repo):

  eslint:cli-engine Lint /xxx/src/app/core/data/stores/utils.js +132ms
                    ^^^^
                    this means cache was not used

But like I said, I do see the ESLint cache file being extracted from the Gitlab’s cache.

Main question to ESLint is what can cause the cache file to be ignored?

Are you willing to submit a pull request to fix this bug?

Yes, if someone points where to look.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mdjermanoviccommented, Jul 22, 2020

Marking as “works as intended” since it isn’t a bug in the actual implementation.

I think we should improve this, probably by adding an option (e.g., as proposed in eslint/rfcs#63).

As for possible workarounds, it might be useful to track royriojas/file-entry-cache#14 (looks like it might be merged soon). It will allow for setting an env variable FILE_ENTRY_CACHE_USE_CHECKSUM which would be used directly from the file-entry-cache dependency.

1reaction
mdjermanoviccommented, Jul 22, 2020

Unfortunately, at the moment it does seem useless in this scenario. I hope we’ll be able to add better support for the use of eslint cache on CIs in some of the future versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Where is ESLint cache stored? - Stack Overflow
Open the command palette ( Ctrl + Shift + P ) and execute Reload Window command (type it in until it autocompletes, press...
Read more >
Command Line Interface - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Developers - ESLint ignores its own cache - - Bountysource
Tell us about your environment. We have a Gitlab configured this way: cache: key: $CI_COMMIT_REF_NAME paths: - .eslint lint: stage: test script: ...
Read more >
Caching Dependencies - CircleCI
This is referred to as a partial cache restore. Each line in the keys: list manages one cache (each line does not correspond...
Read more >
Master ESLint in 7 Minutes - Medium
That being said, use your own thought process and decide for yourself which options best suit ... Ignore ESLint warnings/ errors warning for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found