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

jsx-curly-braces: make an exception for a single space #1422

Open
andrejcremoznik opened this issue Feb 25, 2025 · 0 comments
Open

jsx-curly-braces: make an exception for a single space #1422

andrejcremoznik opened this issue Feb 25, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@andrejcremoznik
Copy link

Lint Name

jsx-curly-braces

Code Snippet

// 2 inline elements in single line can be separated by a space which will leave a text node in dom
<foo /> <bar />
// But the same 2 elements put on new lines will have the text node stripped
<foo />
<bar />
// To separate them in the same way as before, a space has to be forced like so
<foo />
{' '}
<bar />

Expected Result

{' '} doesn't produce a linter warning

Actual Result

Found curly braces around JSX child literal

Additional Info

When you enforce a line length, {' '} becomes a pretty common case concatenating long strings with JSX elements. The most common case is probably having a word in a sentence wrapped in a link where the value of href often causes the link to stand on its own line and then you have to force spaces around.

Version

deno 2.2.2 (stable, release, x86_64-unknown-linux-gnu)
v8 13.4.114.9-rusty
typescript 5.7.3
@andrejcremoznik andrejcremoznik added the bug Something isn't working label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant