Expose listFilesToProcess() on CLIEngine
See original GitHub issueThe version of ESLint you are using. v5.11
The problem you want to solve. I want to be able to get a list of files ESLint is going to lint. This list is needed for a preprocessing in benmosher/eslint-plugin-import#1142. In this rule all files need to be analyzed to detect all exports and imports of a project. This analysis has to take place before the first linting is done.
listFilesToProcess()
is already in use for this rule, but it is not imported using the official API. Instead it is imported using a try/catch
to cover different ESLint versions.
See #11206 for further information.
Your take on the correct solution to problem.
Exposing listFilesToProcess()
on the CLIEngine would allow the rule mentioned above resolving the same files ESLint resolves internally by using an official part of the ESLint API.
Furthermore it might also solve #11005.
https://github.com/eslint/eslint/blob/master/lib/cli-engine.js is already importing the globUtils
module, in which listFilesToProcess()
is located. Reexporting listFilesToProcess()
as a method of the CLIEngine might be an easy solution.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:11 (7 by maintainers)
Top GitHub Comments
Users of the Node.js API can pass a
cwd
argument toCLIEngine
, to make ESLint work as if it was run from a particular CWD independently from what the actual CWD of the Node process happens to be. However, rules usingprocess.cwd()
will still get the original CWD, potentially causing incorrect results.It’d be great to reopen this.