dprint / dprint-plugin-typescript

TypeScript and JavaScript code formatting plugin for dprint.
https://dprint.dev/plugins/typescript
MIT License
258 stars 57 forks source link

Add debug assertions for node and trivia ranges #652

Open dsherret opened 4 months ago

dsherret commented 4 months ago

Been bit by node ranges being incorrect in swc too many times. swc has a test suite for this (https://github.com/swc-project/swc/issues/583), but it's not great because people often just do UPDATE=1 and overwrite the expected outputs with incorrect information.

I think it would be good to add debug only assertions for this in dprint that gets inserted into the gen_node call for debugging then have the assertions in a separate file. It should also be done for comments and tokens.

https://github.com/dprint/dprint-plugin-typescript/issues/650