Description
I have both react/jsx-curly-brace-presence
and react/jsx-no-comment-textnodes
enabled. I want to render the string /*
as the child of a component:
const Component2 = () => {
return <span>/*</span>;
};
This errors for react/jsx-no-comment-textnodes
as expected:
/sandbox/src/Component.jsx
8:16 error Comments inside children section of tag should be placed inside braces react/jsx-no-comment-textnodes
Per the docs for react/jsx-no-comment-textnodes
, I should be able to use curly braces to fix this:
const Component2 = () => {
return <span>{'/*'}</span>;
};
However, this now errors for react/jsx-curly-brace-presence
:
/sandbox/src/Component.jsx
4:16 error Curly braces are unnecessary here react/jsx-curly-brace-presence
Playing whack-a-mole with linter errors won't get me anywhere here. I could always disable one of the rules for this file, but ideally react/jsx-curly-brace-presence
could be smart enough to know that this is something that needs to be in curly braces because of other rules in play and not report this particular code as an error.
Codesandbox (fork and run yarn lint
from the terminal): https://codesandbox.io/s/cocky-darwin-1zfs5?file=/src/Component.jsx