-
Notifications
You must be signed in to change notification settings - Fork 117
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
Add support for --cache #132
Comments
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 |
I agree with that, and it all makes perfect sense from a gulp/implementation point of view. From a user point of view, however, you are to expect a solution since if you come from straight To mitigate this we have the following choices:
In short: its either about being more on the gulp native way, or eslint native way of doing things. |
Note: I'm ok with both of the solutions, however if we look at the path that For example: This would be only feasible with an |
Grunt is a file-based task runner (each task acts upon a file query and works directly with files). Like with ESLint CLI, it makes sense to use a file-based cache. For the reasons explained previously, Gulp manages files in a different way. Gulp-eslint is a plugin to lint files passing through a gulp stream, not a way of using Gulp as a trigger for running the ESLint CLI against a separate file system. If you want it to just work like ESLint, it makes more sense to use ESLint's CLI or, if needed, a gulp plugin that is designed for triggering CLI (e.g., gulp-shell, gulp-exec). Using ESLint already ignores any file path (even when using |
From a gulp's way gulp-eslint point of view then, the following solution would make sense, right?
|
No need to create a new one. Various file cache plugins already exist. |
Hey all, been trying to get eslint work with a file based cached. I want to run my lint task on manual start (no watch task, so no in memory cache possible). If been reading the topics around here on the subject of eslint cache. Based on the examples @adametry has provided, I think something like below should work. I'm using gulp-asset-cache for this matter. Option 1
Option 2
Now... it's a shame, but i can't get both to work. Option 1 has troubles with the gulp-if. Although the condition is cleary true or false based on the errorCount, it seems like the condition is always true, because all files (even the ones with errors) are added to the cache. Option 2 seems to never call the cache function, or not in the right way, because the cache is not created. Any suggestions? Thanks!!! |
You can find here a solution how to overcome that issue: https://dzone.com/articles/how-to-improve-performance-of-eslint-in-gulp |
Hi! This has been discussed before: #99
However there are 3 problems with that solution:
cache: true
variable.eslintcache
Thank you!
The text was updated successfully, but these errors were encountered: