Skip to content
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
sompylasar opened this issue May 20, 2017 · 2 comments
Labels

Comments

@sompylasar
Copy link

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)

@sompylasar
Copy link
Author

Refs #277

@soda0289
Copy link
Member

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants