Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react/jsx-no-literals rule shows warning with template strings #1511

Closed
medialwerk opened this issue Nov 2, 2017 · 4 comments
Closed

react/jsx-no-literals rule shows warning with template strings #1511

medialwerk opened this issue Nov 2, 2017 · 4 comments

Comments

@medialwerk
Copy link

medialwerk commented Nov 2, 2017

Hello,

i'm using eslint@4.10.0 and eslint-plugin-react@7.4.0. The linter shows a warning if a join a string with "template strings", but not if I join it with the + operator:

<div className={'test' + name} />
// No warning
<div className={`test ${name}`} />
// Strings not allowed in JSX files (react/jsx-no-literals)

Is this a known issue?

Best regards

@ljharb
Copy link
Member

ljharb commented Nov 2, 2017

In this case it should indeed warn on both.

@mockdeep
Copy link

Just ran into this too. @ljharb why should it warn on the second case?

@mockdeep
Copy link

nm, my situation was different. I had a stray semi-colon after a jsx tag.

@ljharb
Copy link
Member

ljharb commented Nov 11, 2017

No literals includes template literals :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants