fix(diagnostics): pretty defaults to true in TS 2.9+#372
fix(diagnostics): pretty defaults to true in TS 2.9+#372ezolenko merged 1 commit intoezolenko:masterfrom
pretty defaults to true in TS 2.9+#372Conversation
pretty defaults to true, not falsepretty defaults to true, not false (in TS 2.9+)
pretty defaults to true, not false (in TS 2.9+)pretty defaults to true in TS 2.9+
- per https://www.typescriptlang.org/tsconfig#pretty - TS 2.9 changed the default to `true`: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#--pretty-output-by-default - so this is a legacy remnant of older versions of TS - this is why `tsc` by default pretty prints, even when `pretty` is unset - only if it is _explicitly_ set to `false` does it not do that - so change rpt2's diagnostic printing to be `pretty` by default as well - I think this is a pretty _big_ DX improvement, to be honest - I always thought something was up with the error reporting, but saw that there was code for `pretty`, so didn't quite connect the dots until now - that while there was code for it, the default was wrong, and so unless I set `pretty: true`, I wasn't getting easier to read printing - and given that `pretty: true` is the default, that's a redundant / unnecessary option to set in `tsconfig` that I normally wouldn't ever re-set
0bbecce to
a903778
Compare
|
ah sh*t, while testing #345, it seems like this could result in duplicate errors... let me look into this before merging pl0x |
|
Ok that's not a duplicate error... or rather there's already a duplicate error: w/o w/ The error that causes Rollup to bail gets printed out once, then the |
|
Oh, I literally just reproduced #103 😅😮 |
|
So setting w/o w/ So if I'm understanding this correctly, I think Rollup re-throws an error from a plugin or something, causing this behavior. Changing the EDIT: Nope, the Note that it also removed the The only thing possible in not the prettiest though, and it disguises the stack trace too, which can be useful to track down bugs in rpt2 code from logs 😕 |
|
Ok, well I think I've figured it out, and this really is probably more a Rollup bug, but we can probably(?) workaround it. What Rollup is printing out at the end is the error So, with this code in this.error({ message: "rpt2 error (see below)", stack: err.stack });We get this log instead (no duplicate): So it prints
|
|
Added a fix for the duplicate error messages / #103 in #373 . That should be merged along with this PR as this PR makes it more noticeable, but that bug already exists without No changes are needed to this PR as the bug I discovered here is independent / already existed. |
Summary
Changes the default configuration of
pretty, so now pretty-printing is the default, as it is fortscand in the TSConfig Reference.Details
per https://www.typescriptlang.org/tsconfig#pretty
truethis is why
tscby default pretty prints, even whenprettyis unsetfalsedoes it not do thatso change rpt2's diagnostic printing to be
prettyby default as wellpretty, so didn't quite connect the dots until nowpretty: true, I wasn't getting easier to read printingpretty: trueis the default, that's a redundant / unnecessary option to set intsconfigthat I normally wouldn't ever re-setReview Notes
Only thing I'm not sure of is non-tty environments, that I didn't even think of until I read the TS 2.9 release notes (as linked above). Not exactly sure if TS will handle those automatically, or if we need to add a check for that as well... 🤔
It's also a bit hard to check as well... though first priority should be local dev in either case.
References
pretty: true? #47 , which I believe pre-dates TS 2.9