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

heading-has-content false positive for object spread #980

Open
wozitto opened this issue Apr 17, 2024 · 1 comment
Open

heading-has-content false positive for object spread #980

wozitto opened this issue Apr 17, 2024 · 1 comment

Comments

@wozitto
Copy link

wozitto commented Apr 17, 2024

The code throws an error.

const SectionTitle = (props) => (
  <h2 {...props} />
);

However, this code does not throw an error.

const SectionTitle = (props) => (
  <h2 {...props} >{props.children}</h2>
);

Both syntaxes produce the same output when rendered, which leads me to believe that the first syntax should not result in an error either.

Version: 6.8.0
スクリーンショット 2024-04-17 22 40 42

@ljharb
Copy link
Member

ljharb commented Apr 17, 2024

This is the natural limits of syntactic analysis - we can’t know if children is included in the props, so we have to require a syntactic children placement.

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

No branches or pull requests

2 participants