-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(cli): create initial, proof-of-concept CLI #4359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for the PR, @bradzacher! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
|
✔️ Deploy Preview for typescript-eslint ready! 🔨 Explore the source changes: 85efd19 🔍 Inspect the deploy log: https://app.netlify.com/sites/typescript-eslint/deploys/61d69af6d1916e000700497d 😎 Browse the preview: https://deploy-preview-4359--typescript-eslint.netlify.app |
6264383 to
3a64661
Compare
Codecov Report
@@ Coverage Diff @@
## main #4359 +/- ##
==========================================
- Coverage 94.26% 91.95% -2.32%
==========================================
Files 169 346 +177
Lines 9440 11622 +2182
Branches 2940 3298 +358
==========================================
+ Hits 8899 10687 +1788
- Misses 321 675 +354
- Partials 220 260 +40
Flags with carried forward coverage won't be shown. Click here to find out more.
|
3a64661 to
f0f062d
Compare
f0f062d to
2518e26
Compare
9ad2008 to
826d957
Compare
826d957 to
85efd19
Compare
|
Closing this old draft for housekeeping since there are merge conflicts and it's taking up space in the open PRs list. Nothing bad will happen in my housekeeping if this is re-opened. Don't mind me. 😄 |
PR Checklist
Overview
This adds an initial, proof-of-concept version of a typescript-eslint CLI.
It offers the following commands:
ts-eslint lint -p <tsconfig path>to lint one or more tsconfigsts-eslint envto dump package versions for issuesHelp Dump
Collapsed for brevity
$ yarn ts-eslint --help Usage: ts-eslint -p ./tsconfig.json Commands: ts-eslint env Prints information about your environment to provide when reporting an issue. [aliases: environment, env-info, support-info] ts-eslint lint Lint your project. Options: --version Show version number [boolean] --logLevel Control the log level [string] [default: "error"] --reporter Control how the console output is rendered [string] [default: "ink"] --help Show help [boolean] -p, --project, --projects Path to a tsconfig, relative to the CWD. Can also specify a glob pattern - ensure you wrap in quotes to prevent CLI expansion of the glob. [array] [required] --cwd The path to the current working directory to use for the run. [string] [default: "<your CWD here>"]$ yarn ts-eslint lint --help ts-eslint lint Lint your project. Options: --version Show version number [boolean] --logLevel Control the log level [string] [default: "error"] --reporter Control how the console output is rendered [string] [default: "ink"] --help Show help [boolean] -p, --project, --projects Path to a tsconfig, relative to the CWD. Can also specify a glob pattern - ensure you wrap in quotes to prevent CLI expansion of the glob. [array] [required] --cwd The path to the current working directory to use for the run. [string] [default: "<your CWD here>"]Performance Comparison
This repo - ~25% faster
vs
Initial testing shows a very good speedup on our repo! It consistently is ~15-20s faster than a pure ESLint run - which is a huge win, even on our (relatively) small repo.
tldraw - ~44% faster
Notes:
recommended-with-typecheckingconfigeslintrc.js I used
vs
Again - this shows a clear runtime win, though this time it is greater at ~34s.
chrome devtools-frontend - no significant wins
Notes:
vs
It's expected that there's no major change in lint time here as there is only one tsconfig being linted - meaning it cannot take advantage of parallelisation.
To test further - I added one tsconfig to the root of each of the "packages" and tried again
the tsconfig
{ "extends": "../tsconfig.json", "include": ["."], "exclude": ["third_party"] }Unfortunately - this did not yield any significant wins. Again, this is to be expected to some degree. Out of the 1590 files being linted - 1095 (68%) of them are in just one tsconfig - which ultimately takes the majority (or rather all) of the time collect type information for.
TODO:
envcommand to log the packages table for issueslintcommand to lint the codebasejest-worker-poption for specifying tsconfig paths--format)inkloggerStretch goals:
-foption for specifying files/folders/globsFileEnumeratorto gather the list of filestsconfig? Or maybe just rely on the pre-configuredparserOptions.projectfor the files?