-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Lint to ensure CompilerOptions and options in commandLineParser are synchronized #58312
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
base: main
Are you sure you want to change the base?
Conversation
| }, | ||
| "compilerOptions": {}, | ||
| "compilerOptions": { | ||
| "allowNonTsExtensions": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LS sets allowNonTsExtensions for any project with js and any inferred project forcibly - this wasn't reflected in telemetry (and all these baselines), since without an options declaration, the serializer couldn't serialize the option.
f494cc6 to
d5b24f8
Compare
|
This PR no longer has any functional changes, and instead just has a lint rule to check that Running it exposed a couple more internal compiler options we didn't have option definitions for that I didn't already know about. |
| internal: true, | ||
| extraValidation() { | ||
| return [Diagnostics.Unknown_compiler_option_0, "allowNonTsExtensions"]; | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an option is marked internal, can extraValidation always just issue this wherever that func is called? Or is that too annoying? Seems like this is copy/pasted a bunch, but I guess not for anything outside this block?
|
It feels a little weird to enforce this via a lint rule, but I guess if it's too annoying to do statically... |
|
we have testcase
affectsSemanticDiagnostics are marked as affectsBuildInfo as well. May be some test case like that would be better than lint rule
|
The perk of the lint rule is that it has an autofixer (that adds the missing declarations to whichever side of the pair of declarations is missing one) - not so for a test. |
A number of our
@internaloptions were missing from our option definitions incommandLineParser.ts, which in turn causes us to elide them from telemetry, even though we may forcibly set them in the language service.This PR adds a lint rule that compares the
CompilerOptionsinterface and the option definitions incommandLineParser.tsand ensures their state is synchronized. It also adds aninternalfield to command line option definitions whose only purpose is tracking which options are@internalannotated. This is currently unused but should be a good runtime indicator to anyone looking over our option definitions which ones aren't meant to be used publicly. This field is also synchronized by the lint.