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.

Add support for --cache

See original GitHub issue

Hi! This has been discussed before: #99

However there are 3 problems with that solution:

  • Cache is not persisted to disc
  • It involves effort on the user, where one would expect just to set up a simple cache: true variable
  • Eslint command line already does it in a well defined .eslintcache

Thank you!

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:3
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
adametrycommented, Jan 20, 2016

While ESLint’s CLI has the responsibility of finding and reading files for linting, gulp-eslint relies on the Gulp stream to manage file sources. If a file should not be linted, it should not be passed to gulp-eslint in the stream.

The cached-lint example demonstrates how caching could be managed for a gulp stream; though, is not intended to be a direct implementation of ESLint’s CLI cache option, nor is it the only way to avoid needless file linting.

Fortunately, it is possible to persist a file/content cache to disc in a gulp stream (see gulp-cache-money or gulp-file-cache). However, I’m not aware a gulp plugin based on file-entry-cache (the cache package used by ESLint). If another file-based cache plugin doesn’t work in its place, perhaps creating a gulp plugin based on file-entry-cache would be useful with gulp-eslint as well as many other gulp plugins.

Though cache:true would be an easy option to configure, its simplicity is due to assumptions that must be made about the environment and use case. ESLint’s CLI acts as an independent tool, run directly against the file system. Because of this, a simple --cache option for a file-based cache is a stable and practical solution. On the other hand, Gulp’s virtual files may come from a range of sources and may be composed of a series of tools/plugins. For a plugin, it is uncertain whether a virtual file’s origin (if there is one) will match it’s destination (if there is one) or how the content may be transformed along the way. However, caching can be considered when composing a gulp task, where the expectations are certain.

0reactions
aciertocommented, Dec 26, 2018

You can find here a solution how to overcome that issue: https://dzone.com/articles/how-to-improve-performance-of-eslint-in-gulp

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cache.add() - Web APIs - MDN Web Docs
The add() method of the Cache interface takes a URL, retrieves it, and adds the resulting response object to the given cache.
Read more >
Caching - web.dev
Cache storage is a powerful tool. It makes your apps less dependent on network conditions. With good use of caches you can make...
Read more >
A Guide To Caching in Spring - Baeldung
The getAddress() call will first check the cache addresses before actually invoking the method and then caching the result. While in most cases ......
Read more >
Add support for caching GET requests · Issue #31 · axios/axios
Heh, I was just looking into this! I thought that an interceptor could be used or a transformer that'll immediately resolve with a...
Read more >
Set up content caching on Mac - Apple Support
Click the Cache pop-up menu, then choose the content you want cached. All Content: Store software updates and apps downloaded from Apple, and...
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