Skip to content

fix(jsx-no-danger-with-children): account for ignored JSXText nodes#1400

Merged
marvinhagemeister merged 2 commits intomainfrom
jsx-danger-empty-child
Jan 27, 2025
Merged

fix(jsx-no-danger-with-children): account for ignored JSXText nodes#1400
marvinhagemeister merged 2 commits intomainfrom
jsx-danger-empty-child

Conversation

@marvinhagemeister
Copy link
Contributor

Technically, JSX children aren't empty in cases like this:

<div>
</div>

Under the hood there is still a single child that contains only whitespace and is typically dropped during rendering.

JSXText {
  text: "\n   "
}

I forgot about that when writing this rule.

Fixes #1398

@marvinhagemeister marvinhagemeister merged commit cdb19c2 into main Jan 27, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

jsx-no-danger-with-children should not error if children are empty

2 participants