(fix): parse tsconfig extends, trailing commas, and comments#489
(fix): parse tsconfig extends, trailing commas, and comments#489agilgur5 merged 1 commit intojaredpalmer:masterfrom
Conversation
ab0e3f9 to
e65e317
Compare
e65e317 to
b62312c
Compare
|
Fix conflicts |
d670c4b to
21860c1
Compare
|
Done. |
21860c1 to
eede53d
Compare
|
Welp, so since I merged #468 , I switched to use that fixture, which actually does something different than the default, i.e. sets Turns out Seems like the same issue encountered in kulshekhar/ts-jest#245 (comment) , the solution to which is non-trivial... welppppp. investigating alternatives right now |
eede53d to
7758560
Compare
|
Ok, some links I went through to figure this out:
So ended up using that last one |
- use ts.readConfigFile to properly parse a commas and comments from
tsconfig instead of just trying to readJSON
- use ts.parseJsonConfigFileContent to properly parse `extends` and
get recursive compilerOptions
- add tests for all of the above use cases
- add them to build-withTsconfig which changes declarationDir;
should only work if TSDX properly parses the tsconfig
NOTE: this is only necessary for internal, TSDX-specific parsing of
tsconfig.json. rollup-plugin-typescript2 already handles these options,
but internal options like esModuleInterop etc are also used & parsed
independently of rpts2
7758560 to
f2ae526
Compare
agilgur5
left a comment
There was a problem hiding this comment.
LGTM. I reduced the necessary changes for extends to just a few lines, so there wasn't much to review.
I'm still a bit skeptical of the './' for ts.parseJsonConfigFileContent's third argument, basePath, but this passed all of my manual tests too. I'm most concerned about usage with custom tsconfig path #436 especially since we don't have tests for that. Will have to add some soon.
…lmer#489) - use ts.readConfigFile to properly parse a commas and comments from tsconfig instead of just trying to readJSON - use ts.parseJsonConfigFileContent to properly parse `extends` and get recursive compilerOptions - add tests for all of the above use cases - add them to build-withTsconfig which changes declarationDir; should only work if TSDX properly parses the tsconfig NOTE: this is only necessary for internal, TSDX-specific parsing of tsconfig.json. rollup-plugin-typescript2 already handles these options, but internal options like esModuleInterop etc are also used & parsed independently of rpts2
use ts.readConfigFile to properly parse a commas and comments from
tsconfig instead of just trying to readJSON
use ts.parseJsonConfigFileContent to properly parse
extendsandget recursive compilerOptions
add tests for all of the above use cases
should only work if TSDX properly parses the tsconfig
NOTE: this is only necessary for internal, TSDX-specific parsing of
tsconfig.json. rollup-plugin-typescript2 already handles these options,
but internal options like esModuleInterop etc are also used & parsed
independently of rpts2
Fixes #483
with its own suggestion, eventually getting to facebook/create-react-app#7248 as the solutionEDIT: that only solved commas and comments,extendsneeded more work, see below comments.Also fixes #484 as it's the same parser that does both. Still need to add tests for this case, thinking of just having all test fixtures extend a base fixture and then override it?
This is built on top of #436 , please merge that first.