refactor: consolidate diagnostics funcs into single file #416
refactor: consolidate diagnostics funcs into single file #416ezolenko merged 3 commits intoezolenko:masterfrom
diagnostics funcs into single file #416Conversation
- move `IDiagnostic` and `convertDiagnostic` from `tscache` to `print-diagnostics`, then rename it to `diagnostics.ts`
- the diagnostic funcs being in `tscache` always felt like a strange place for them
- especially when `parse-tsconfig` or `print-diagnostics` would import them from `tscache`, which sounded like an unrelated file
- may want to move `diagnostics-format-host` into this file as well, as it is _only_ used in this file
- leaving as is for now, limiting this change to a smaller one
- this was previously only covered in integration tests
- since unit tests don't currently touch `index` or `tscache`, and `convertDiagnostic` was previously in `tscache`
- another reason why consolidating these functions into one file made sense
7072019 to
2d3cfe3
Compare
- since new lines are host OS specific - this fixes the `convertDiagnostic` test on Windows too, where it was failing
Well this was pretty ironic -- the unit test I added actually fails on Windows without this fix (and a test adjustment). Given that I'm on Mac, I literally didn't see this until it hit CI after I wrote up the PR. Turns out the test confirms this behavior! |
|
@ezolenko friendly ping in case you just hadn't seen this PR (since you merged some others, but not this one) I also think we should be good to release There's a couple more things that I'm working on, but those will probably take some time (not spending as much time on rpt2 anymore since I've fixed the vast majority of issues! 🙂), so don't want to hold back releasing #406 because of that, since it's a big fix for what is probably the single most common issue in this repo. |
Summary
diagnosticsfuncs into a single file nameddiagnostics.tscheck-tsconfigwithparse-tsconfig#413)convertDiagnostic\n->formatHost.getNewLine()Details
refactor:
move
IDiagnosticandconvertDiagnosticfromtscachetoprint-diagnostics, then rename it todiagnostics.tstscachealways felt like a strange place for themparse-tsconfigorprint-diagnosticswould import them fromtscache, which sounded like an unrelated filemay want to move
diagnostics-format-hostinto this file as well, as it is only used in this filetest: add unit test for
convertDiagnosticindexortscache, andconvertDiagnosticwas previously intscachefix(diagnostics): use
formatHost.getNewLine()instead of\n