quick-lint / quick-lint-js

quick-lint-js finds bugs in JavaScript programs
https://quick-lint-js.com
GNU General Public License v3.0
1.54k stars 192 forks source link

feature request(cli): option to pass file containing filenames to lint #1166

Open vegerot opened 9 months ago

vegerot commented 9 months ago

Problem: I want to run quick-lint on a large project (120k files, 6m SLoC).

Approaches tried:

Recommendation: quick-lint CLI option that accepts the path to a file containing the paths of many files to check. This file can contain many more files than NCARGS.

$ fd --extension=.js --extension=.mjs --extension=.jsx --extension=.ts --extension=.tsx > allfiles.txt
$ quick-lint-js --file-with-filenames=allfiles.txt

Out of scope:

vegerot commented 9 months ago

note: #1167 would be an alternative solution if quick-lint respected .gitignore. However, since that proposal does not, this proposal is better.

vegerot commented 9 months ago

I accept this task.

strager commented 9 months ago

Why not use xargs?

vegerot commented 9 months ago

So something like

$ fd --extension=.js --extension=.jsx --extension=.ts --extension=.tsx | xargs -n999999999 quick-lint-js

? Because that makes too much sense.

vegerot commented 9 months ago

think of the microseconds saved from quick-lint being able to do it all itself!

vegerot commented 9 months ago

xargs was the first thing I looked into when I played with this idea this week (after fd's builtin exec). The problem I ran into was not being able to tell xargs to wrap quotes around every argument

❯ echo "apps/us/e2e/full-regression/src/glass-orders/tc196-tiered -fast-refund -order.test.ts" | xargs -J{} quick-lint-js {}
error: unrecognized option: -fast-refund

That's when I tried the other solutions I mentioned in the OP and forgot I had tried this! My bad

strager commented 9 months ago

@vegerot You should look at the -0 option of both fd and xargs. -0 on both will cause file names to be transferred without space splitting.

strager commented 9 months ago

Typical command: find . -name '*.ts' -print0 | xargs -0 quick-lint-js --