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 --list-target-files option

See original GitHub issue

The version of ESLint you are using.

5.7.0

The problem you want to solve.

I’m working on https://awesomecode.io, our users may not use eslint directly on their shell, we have a requirement to list target files so that our users can add ignore patterns properly.

Your take on the correct solution to problem.

We can add prefix DEBUG=eslint:linter to get target files, but it’s very slow and its output contains too many verbose text.

My solution is to add --list-target-files option, then it gets all target files without parsing files, so it’s super fast. Its output is straightforward, only lists the target filenames.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
not-an-aardvarkcommented, Oct 26, 2018

Have you tried using the CLIEngine#resolveFileGlobPatterns API. That should cover all of the ESLint-specific logic for resolving glob patterns, and then you would be able to use a general-purpose tool for resolving glob patterns to get a list of files.

At the moment, I’m not strongly opposed to adding an option, but I’m also not convinced that an option would be necessary/generally useful.

1reaction
not-an-aardvarkcommented, Oct 22, 2018

Hi, thanks for creating an issue.

If I’m understanding correctly, the problem you’re trying to solve is to figure out how ESLint resolves your globs and lints your files, for debugging purposes. It’s already somewhat possible to do this with the DEBUG environment variable. For example, if I run something like this:

DEBUG=eslint:linter eslint tools/

Then ESLint generates output like this:

Output
  eslint:linter Linting code for /path/to/tools/eslint-fuzzer.js (pass 1) +0ms
  eslint:linter Generating fixed text for /path/to/tools/eslint-fuzzer.js (pass 1) +189ms
  eslint:linter Linting code for /path/to/tools/fuzzer-runner.js (pass 1) +1ms
  eslint:linter Generating fixed text for /path/to/tools/fuzzer-runner.js (pass 1) +30ms
  eslint:linter Linting code for /path/to/tools/internal-rules/consistent-docs-description.js (pass 1) +1ms
  eslint:linter Generating fixed text for /path/to/tools/internal-rules/consistent-docs-description.js (pass 1) +66ms
  eslint:linter Linting code for /path/to/tools/internal-rules/consistent-docs-url.js (pass 1) +1ms
  eslint:linter Generating fixed text for /path/to/tools/internal-rules/consistent-docs-url.js (pass 1) +36ms
  eslint:linter Linting code for /path/to/tools/internal-rules/consistent-meta-messages.js (pass 1) +0ms
  eslint:linter Generating fixed text for /path/to/tools/internal-rules/consistent-meta-messages.js (pass 1) +29ms
  eslint:linter Linting code for /path/to/tools/internal-rules/multiline-comment-style.js (pass 1) +0ms
  eslint:linter Generating fixed text for /path/to/tools/internal-rules/multiline-comment-style.js (pass 1) +16ms
  eslint:linter Linting code for /path/to/tools/internal-rules/no-invalid-meta.js (pass 1) +1ms
  eslint:linter Generating fixed text for /path/to/tools/internal-rules/no-invalid-meta.js (pass 1) +50ms
  eslint:linter Linting code for /path/to/tools/internal-rules/no-useless-catch.js (pass 1) +1ms
  eslint:linter Generating fixed text for /path/to/tools/internal-rules/no-useless-catch.js (pass 1) +21ms
  eslint:linter Linting code for /path/to/tools/internal-testers/event-generator-tester.js (pass 1) +0ms
  eslint:linter Generating fixed text for /path/to/tools/internal-testers/event-generator-tester.js (pass 1) +17ms
  eslint:linter Linting code for /path/to/tools/internal-testers/test-parser.js (pass 1) +0ms
  eslint:linter Generating fixed text for /path/to/tools/internal-testers/test-parser.js (pass 1) +31ms
  eslint:linter Linting code for /path/to/tools/update-unicode-utils.js (pass 1) +1ms
  eslint:linter Generating fixed text for /path/to/tools/update-unicode-utils.js (pass 1) +21ms

In other words, I’m not sure adding a new command-line flag is necessary given that there’s already a way to do this. Does the ability above satisfy your use case?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic Usage :: RuboCop Docs
--init. Generate a .rubocop.yml file in the current directory. ; -l/--lint. Run only lint cops. ; -L/--list-target-files. List all files RuboCop will inspect....
Read more >
org.apache.hadoop.tools.CopyListing.buildListing java code ...
The interface to be implemented by sub-classes, to create the source/target file listing. getConf · setConf · setCredentials. set Credentials store, on which...
Read more >
Add list items - Microsoft Support
To attach one or more files to the list item, click Add attachments, locate the file, and then click Open. Hold down the...
Read more >
Class: RuboCop::Options Private - Doc Index
Creates a section of options in order to separate them visually when using --help . Instance Method Details. #add_additional_modes(opts) (private).
Read more >
File: README — Documentation for rubocop (0.36.0)
gem install rubocop ... -L/--list-target-files, List all files RuboCop will inspect. ... By adding the option --exclude-limit COUNT , e.g., ...
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