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/prop-types doesn't work with fragment syntax #1694

Closed
bebraw opened this issue Feb 15, 2018 · 7 comments
Closed

react/prop-types doesn't work with fragment syntax #1694

bebraw opened this issue Feb 15, 2018 · 7 comments
Labels
enhancement help wanted todo: babel 7 Stuff to fix when babel 7 is actually released

Comments

@bebraw
Copy link

bebraw commented Feb 15, 2018

Example:

import React from "react";

const ForAttendees = ({ page }) => (
  <>
    <section className="intro intro_attendees">{page}</section>
    <div className="grid--5col">barfoo</div>
  </>
);

export default ForAttendees;

react/prop-types does not capture this. If you replace the fragment syntax with divs, it detects the case.

@ljharb
Copy link
Member

ljharb commented Feb 15, 2018

I suspect a lot of rules will need to be updated to support fragment syntax.

@ljharb
Copy link
Member

ljharb commented Feb 15, 2018

Related: #1579, #1661, #1706

@lencioni lencioni changed the title react/prop-types doesn't work with fragments react/prop-types doesn't work with fragment syntax Feb 28, 2018
@lencioni
Copy link
Collaborator

@bebraw in the meantime, does this work with <React.Fragment> instead of <>?

@bebraw
Copy link
Author

bebraw commented Mar 1, 2018

@lencioni Yeah, going with that fixes it.

@ljharb
Copy link
Member

ljharb commented Mar 1, 2018

Since babel 7 is required for <>, and is not yet released, let’s leave this open until it is, so we will be sure to fix it.

@ljharb ljharb added the todo: babel 7 Stuff to fix when babel 7 is actually released label Mar 1, 2018
alexzherdev added a commit to alexzherdev/eslint-plugin-react that referenced this issue Aug 27, 2018
@graingert
Copy link

FYI, babel 7 got released

@ljharb
Copy link
Member

ljharb commented Aug 30, 2018

See #1956

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted todo: babel 7 Stuff to fix when babel 7 is actually released
Development

No branches or pull requests

4 participants