Make CLIEngine and supporting functions async via Promises
See original GitHub issueThe version of ESLint you are using. 5.1.0
The problem you want to solve. CLIEngine is synchronous in nature, and I would like it to be asynchronous/promisfied
Your take on the correct solution to problem.
Instead of using fs
calls that are synchronous
, use the async ones, as well as allowing long running calls like executeOnFiles
to return a Promise
instead of an object. Upon resolution of the promise, pass the object via a resolve
. This allows code using CLIEngine
to not have to block. It also allows for things like Observables since we can use the from
function to wrap the Promise
and monitor output.
I also just noticed this, which seems to be in line with this request: https://www.bountysource.com/issues/26284182-lint-multiple-files-in-parallel
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:22 (10 by maintainers)
Top GitHub Comments
Thanks @nzakas . I’ve opened a thread in the google group to start the process before doing a full fledge RFC write up.
To those in this thread who are interested in seeing this through, please feel free to post comments and ideas here https://groups.google.com/forum/#!topic/eslint/di7l6__w2jk
Hi @Aghassi, have you checked out the
--cache
CLI option and/or thecache: true
CLIEngine constructor option? This does most of what you are suggesting 😄