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

Further whitespace problems with jsx-curly-brace-presence #2454

Closed
taion opened this issue Oct 9, 2019 · 5 comments
Closed

Further whitespace problems with jsx-curly-brace-presence #2454

taion opened this issue Oct 9, 2019 · 5 comments

Comments

@taion
Copy link
Contributor

taion commented Oct 9, 2019

From #2427 (comment), #2427 (comment).

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>
@taion
Copy link
Contributor Author

taion commented Oct 9, 2019

Also #2434 (comment).

@SirCameron
Copy link

Are there any updates on this? seems to be an issue for some time now already.

@benjie
Copy link

benjie commented Oct 11, 2019

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.

@ryansully
Copy link

ryansully commented Oct 29, 2019

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.

@golopot
Copy link
Contributor

golopot commented Oct 30, 2019

This should be fixed by #2448.

@ljharb ljharb closed this as completed Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants