-
Notifications
You must be signed in to change notification settings - Fork 887
kind of undefined in canHaveLeadingTrivia #2330
Comments
Remove erronous parent access. Fixes: palantir/tslint#2330
I couldn't reproduce the error. Can you share a code snipped that could be used as a regression test? |
Great!
Sorry, I saw it in the logs in a larger project with format on save when I tried to investigated why format all (and therefore format on save) rarely works however I don't get it now. I might be able to reproduce it by jumping to older commits if there is some way I can see in at least which file it occurred? EDIT: Now I managed to reproduce it by a syntax error, that might have been it thanks to the combination of format on save and save on focus change and looking up some docs while coding. If you are interested even in a syntax error reproduction, here it is: const a =
<span /
>
</span> |
That's exactly what I was looking for. |
Bug Report
TypeScript code being linted
No minimal case, but I don't think it's needed here.
Actual behavior
The line
if (parent.parent.kind === ts.SyntaxKind.JsxClosingElement)
incanHaveLeadingTrivia
must guard for the node not having grandparents, something likeif (parent.parent && parent.parent.kind === ts.SyntaxKind.JsxClosingElement)
The text was updated successfully, but these errors were encountered: