Skip to content

Proposal: Lint for entities appearing in JSX #680

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

Closed
pfhayes opened this issue Jul 15, 2016 · 3 comments
Closed

Proposal: Lint for entities appearing in JSX #680

pfhayes opened this issue Jul 15, 2016 · 3 comments
Labels

Comments

@pfhayes
Copy link
Contributor

pfhayes commented Jul 15, 2016

Example:

<MyComponent
  name={name}
  type={"string"}
  foo=bar>  {/* oops! */}
  x=y>
  Body Text
</MyComponent>

Now, when this renders, the body text will be "x=y>Body Text". This is almost certainly not what the developer intended.

It seems like any > that appears in the body of a react tag is probably an error. If the user wants this they should do >, or perhaps {'>'}. We could go further and also suggest that other HTML special characters are replaced with the correct entities.

Is there already a rule for this? I'm happy to look into adding this.

@pfhayes
Copy link
Contributor Author

pfhayes commented Jul 15, 2016

Here is a PR: #681

@pfhayes
Copy link
Contributor Author

pfhayes commented Jul 27, 2016

Here is another potential error that this rule might catch (from the PR):

<MyComponent>
  {'Text'}}  {/* oops, there is an extra closing brace! */}
</MyComponent>

Any feedback on this rule? I think it is very useful and it has caught several subtle errors in my project, and would help others similarly

@alexzherdev
Copy link
Contributor

Closed via #681?

@ljharb ljharb closed this as completed Aug 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants