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.

Expose listFilesToProcess() on CLIEngine

See original GitHub issue

The 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 globUtilsmodule, in which listFilesToProcess() is located. Reexporting listFilesToProcess() as a method of the CLIEngine might be an easy solution.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
not-an-aardvarkcommented, Feb 17, 2019

Users of the Node.js API can pass a cwd argument to CLIEngine, 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 using process.cwd() will still get the original CWD, potentially causing incorrect results.

1reaction
ljharbcommented, Mar 21, 2019

It’d be great to reopen this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use the eslint.CLIEngine function in eslint - Snyk
CLIEngine examples, based on popular ways it is used in public projects. ... it('should load properly base config', () => { const cli...
Read more >
Diff - 402e1b6e55e9041dfd1a93580e45e5c5dba1db55^!
'LICENSE' and f.lower() in ['license', 'license.txt', ... Update: Expose `getErrorResults` as a static method on `CLIEngine` (fixes #3242) ...
Read more >
git.viithiisys.com/sunny/meteor-projects/commit/db...
modules/startup'; - -Meteor.startup( () => startup() ); +Meteor.startup( ... test from 'tape'; -import { CLIEngine } from 'eslint'; -import eslintrc from '.
Read more >
eslint-plugin-import @ 2.19.1 .. 2.20.0 - Package Diff
and has been moved to eslint/lib/cli-engine/file-enumerator in version 6. let listFilesToProcess; ... + * Expose `debug()` as the module.
Read more >
WebStorm 2018.1.4 + ESLint: TypeError: this.CliEngine is not ...
WEB-38922 is fixed in 2019.1.3. The issue is with ESLint version 6.x. If upgrading Webstorm is not an option for you, you have...
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