Description
After certain changes, a large number of type errors and lint errors can appear in the codebase at once.
- When adding
noUncheckedIndexedAccess to tsconfig.json
- When doing a bulk find-and-replace across the codebase
In these situations, it's more efficient to fix type errors first. Type errors can cause lint errors, so fixing them may resolve lint errors automatically. By fixing type errors first and lint errors second, you can reduce the overall amount of work.
Suggested solution
To support this workflow, I'd like a vp typecheck command — a command that runs only type checking, without format or lint.
Alternative
One workaround is to use vp exec tsgo. While this works, having a dedicated command would be more approachable for beginners.
Additional context
There is already a vp lint command. By default it runs only lint, but setting lint.options.typeCheck to true also runs type checking alongside lint. So the current behavior is:
- When
lint.options.typeCheck is true:
vp check: runs format, lint, and type check
vp format: runs format only
vp lint: runs lint and type check
vp typecheck: runs type check only
- When
lint.options.typeCheck is false:
vp check: runs format, lint, and type check
vp format: runs format only
vp lint: runs lint only
vp typecheck: runs type check only
Since vp format runs only format and vp typecheck would run only type check, users would naturally expect vp lint to run only lint as well. Having vp lint run more than just lint when lint.options.typeCheck: true feels inconsistent and unintuitive.
Here are some possible ways to address this, though each comes with trade-offs:
- Deprecate the
lint.options.typeCheck option and make vp lint always run lint only. However, this would be a breaking change for existing users.
- Add a
--type-check flag to vp lint so users can opt in to type checking via the command line. However, the interaction with lint.options.typeCheck: false may be confusing.
I'd love to hear if there are better ideas for solving this.
Validations
Description
After certain changes, a large number of type errors and lint errors can appear in the codebase at once.
noUncheckedIndexedAccesstotsconfig.jsonIn these situations, it's more efficient to fix type errors first. Type errors can cause lint errors, so fixing them may resolve lint errors automatically. By fixing type errors first and lint errors second, you can reduce the overall amount of work.
Suggested solution
To support this workflow, I'd like a
vp typecheckcommand — a command that runs only type checking, without format or lint.Alternative
One workaround is to use
vp exec tsgo. While this works, having a dedicated command would be more approachable for beginners.Additional context
There is already a
vp lintcommand. By default it runs only lint, but settinglint.options.typeChecktotruealso runs type checking alongside lint. So the current behavior is:lint.options.typeCheckistrue:vp check: runs format, lint, and type checkvp format: runs format onlyvp lint: runs lint and type checkvp typecheck: runs type check onlylint.options.typeCheckisfalse:vp check: runs format, lint, and type checkvp format: runs format onlyvp lint: runs lint onlyvp typecheck: runs type check onlySince
vp formatruns only format andvp typecheckwould run only type check, users would naturally expectvp lintto run only lint as well. Havingvp lintrun more than just lint whenlint.options.typeCheck: truefeels inconsistent and unintuitive.Here are some possible ways to address this, though each comes with trade-offs:
lint.options.typeCheckoption and makevp lintalways run lint only. However, this would be a breaking change for existing users.--type-checkflag tovp lintso users can opt in to type checking via the command line. However, the interaction withlint.options.typeCheck: falsemay be confusing.I'd love to hear if there are better ideas for solving this.
Validations