From https://github.com/yannickcr/eslint-plugin-react/issues/2427#issuecomment-538432211, https://github.com/yannickcr/eslint-plugin-react/issues/2427#issuecomment-538437666.
The following autofixes are incorrect:
--- a/www/src/examples/Navbar/Brand.js
+++ b/www/src/examples/Navbar/Brand.js
@@ -28,7 +28,7 @@
height="30"
className="d-inline-block align-top"
/>
- {' React Bootstrap'}
+ React Bootstrap
</Navbar.Brand>
</Navbar>
</>;
- <React.Fragment key={idx}>
- {' / '}
- {crumb}
- </React.Fragment>
+ <React.Fragment key={idx}>/{crumb}</React.Fragment>
Are there any updates on this? seems to be an issue for some time now already.
Here's another reproduction:
<h1><span>Hello</span>{" & "}<span>goodbye</span></h1>
Gets autofixed to:
<h1>
<span>Hello</span>
&
<span>goodbye</span>
</h1>
which drops the spaces around the ampersand. Also the ampersand _ought_ to be escaped.
To expand @benjie's comment, if the ampersand remains within braces due to leading/trailing whitespace, then it shouldn't need to be escaped. However, if braces are removed because there is only the ampersand and no whitespace, then the autofix should escape it.
This should be fixed by #2448.
Most helpful comment
This should be fixed by #2448.