react/jsx-curly-brace-presence "children" "always" complains about whitespace
See original GitHub issue"eslint": "^4.18.2",
"eslint-plugin-react": "^7.6.1",
I have the prop: "react/jsx-curly-brace-presence":["error", { "props": "always", "children": "always" }],
in my .eslintrc
file because I’m trying to convert:
<div className="NameCapture_wrapper">
<p className="NameCapture__question">
What's your first name?
</p>
<NameCaptureNameInput/>
</div>
to:
<div className={`NameCapture_wrapper`}>
<p className={`NameCapture__question`}>
{`What's your first name?`}
</p>
<NameCaptureNameInput/>
</div>
but eslint is complaining about the whitespace:
10:44 error Need to wrap this literal in a JSX expression react/jsx-curly-brace-presence
13:49 error Need to wrap this literal in a JSX expression react/jsx-curly-brace-presence
14:56 error Need to wrap this literal in a JSX expression react/jsx-curly-brace-presence
17:53 error Need to wrap this literal in a JSX expression react/jsx-curly-brace-presence
18:45 error Need to wrap this literal in a JSX expression react/jsx-curly-brace-presence
19:23 error Need to wrap this literal in a JSX expression react/jsx-curly-brace-presence
Below is what fixes it but I shouldn’t have to put all of my JSX on one line right?
<div className={`NameCapture_wrapper`}><p className={`NameCapture__question`}>{`What's your first name?`}</p><NameCaptureNameInput/></div>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:13 (8 by maintainers)
Top Results From Across the Web
react/jsx-curly-brace-presence "children" "always" complains ...
Actually the oneliner fixes it because it assumes that the whitespace surrounding the literal is significant, so that's correct behavior, but ...
Read more >ESLint rule: react/jsx-curly-brace-presence
This issue is to consider enabling the rule for react/jsx-curly-brace-presence in our eslint config. This could be set up to catch two ...
Read more >Ruby Style Guide
Use spaces around operators, after commas, colons and semicolons. Whitespace might be (mostly) irrelevant to the Ruby interpreter, but its proper use is...
Read more >Harlowe 3.3.3 manual
This is a special version of the collapsing whitespace markup - an open curly brace { , followed by any number of =...
Read more >JSX: The Confusing Parts - React Training
In JSX we can use curly braces to inject variables: ... Whitespace in HTML is something that either causes us problems or helps...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ljharb You’re correct, it would only be a string.
I wasn’t aware that you are able to have interpolations directly:
Thanks for your responses!
I would expect both to warn or not warn the same.