intlc
intlc copied to clipboard
Print more error context
Off the back of #114/#115, it'd be great to have more lines/context around errors. Example:
./x-all.json:6:21:
|
6 | "message": "{x, bad}"
| ^^^^^^
unexpected "bad}"<newline> },<newline> "
expecting "boolean", "date", "number", "plural", "select", "selectordinal", "time", or white space
I can see the line number and the problem itself, which is good, however ideally it'd also show the line above with the translation name. In an ideal world we would always show everything in the object:
./x-all.json:6:21:
|
5 | "f": {
6 | "message": "{x, bad}"
| ^^^^^^
7 | }
|
unexpected "bad}"<newline> },<newline> "
expecting "boolean", "date", "number", "plural", "select", "selectordinal", "time", or white space
This is relevant to linting output as well as of #179.
It's unclear how well this would scale. The object may be large and the message mayn't be at the top.