Set maxNodeModuleJsDepth for inferred projects#11603
Conversation
| this.compilerOptions.allowNonTsExtensions = true; | ||
| } | ||
|
|
||
| if (this.projectKind === ProjectKind.Inferred) { |
There was a problem hiding this comment.
should we check also that the project has .js files?
|
@zhengbli can you refresh this PR. |
|
@mhegazy updated with a new implementation. Now the inferred project has a property called "isJsInferredProject" which serves as compilerOptions-independent flag so "js inferred project" can have different behavior than the normal inferred projects. |
| private _isJsInferredProject = false; | ||
| set isJsInferredProject(newValue: boolean) { | ||
| if (newValue && !this._isJsInferredProject) { | ||
| this.setCompilerOptions(this.getCompilerOptions()); |
There was a problem hiding this comment.
also before calling setCompilerOptions this._isJsInferredProject is not yet set so I'm not sure how control flow should enter if statement below if this._isJsInferredProject was false
+ if (this._isJsInferredProject && typeof newOptions.maxNodeModuleJsDepth !== "number") {
+ newOptions.maxNodeModuleJsDepth = 2;
+ }
| }); | ||
| }); | ||
|
|
||
| describe("maxNodeModuleJsDepth for inferred projects", () => { |
There was a problem hiding this comment.
can you have a test that actually verifies the value of maxModuleDepth (i.e. that we are not looking into folders that are located deeper)
| })(); | ||
|
|
||
| private _isJsInferredProject = false; | ||
| set isJsInferredProject(newValue: boolean) { |
There was a problem hiding this comment.
personal nit: I'm not a big fan of set-only accessors, can you turn it into method instead?
Fixes #11116