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

Find string literals as a part of BinaryExpressions in jsx-no-literals #1616

Merged
merged 4 commits into from
Jan 16, 2018

Conversation

jaaberg
Copy link
Contributor

@jaaberg jaaberg commented Dec 17, 2017

Fixes #1511

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - should we also add tests for template literals?

@jaaberg
Copy link
Contributor Author

jaaberg commented Dec 17, 2017

There exists tests for <Foo bar={`Test`} /> and <Foo>{\`Test\`}</Foo>, but we could add one for <Foo bar={`Test ${baz}`} /> to be explicit(?)

@ljharb
Copy link
Member

ljharb commented Dec 17, 2017

@jaaberg that'd be great; also {`foo` + 'bar'}, {`foo` + `bar`} and {'foo' + `bar`}?

@jaaberg
Copy link
Contributor Author

jaaberg commented Dec 18, 2017

@ljharb Great, the tests actually uncovered another bug. The rule should find all strings/literals, so {`foo` + 'bar'} should actually give two errors, one for foo and another one for bar.

Added tests in f27ebc2 and fixed in 28581df.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Copy link
Collaborator

@EvHaus EvHaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ljharb ljharb merged commit c2c7a2a into jsx-eslint:master Jan 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants