This repository was archived by the owner on Jan 19, 2019. It is now read-only.
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
False positive react/no-unescaped-entities
on whitespace with newlines inside JSX. #278
Closed
Description
What version of TypeScript are you using?
2.3.2
What version of typescript-eslint-parser
are you using?
3.0.0
What code were you trying to parse?
Code is closed-source, but the gist is this:
<SomeComponent>
{children}
</SomeComponent>
What did you expect to happen?
No react/no-unescaped-entities
warning.
What happened?
False positive react/no-unescaped-entities
on whitespace with newlines inside JSX.
https://github.com/yannickcr/eslint-plugin-react/blob/f0dcaca92418bb791f585e867d720a96dd43a277/lib/rules/no-unescaped-entities.js#L72
The code gets parsed as:
JSXElement: '<SomeComponent>'
Literal: '\n '
...
and react/no-unescaped-entities
tells me to escape something there, likely the newline character.
After converting the code to:
<SomeComponent>{children}</SomeComponent>
the warning goes away.
Originally submitted here: #266 (comment)