danger / danger-js

⚠️ Stop saying "you forgot to …" in code review
http://danger.systems/js/
MIT License
5.24k stars 367 forks source link

feat: add support for tsconfig.json files that have an extends property #1361

Closed luchn49 closed 1 year ago

luchn49 commented 1 year ago

Follow up the PR https://github.com/danger/danger-js/pull/1313


Description copied from https://github.com/danger/danger-js/pull/1313:

What does the PR do?

Fixes issue https://github.com/danger/danger-js/issues/1283.

Following what was suggested in the issue to mimic what ts-node is doing to resolve the tsconfig.json here. Their method is quite a bit more complex since they need to resolve custom ts-node compiler options.

For our purposes, reading the config file using ts.readConfigFile and then parsing it with ts.parseJsonConfigFileContent produces the expected tsconfig.json even when it extends another one.

Tests

Added a test to confirm that danger resolves extended tsconfigs.