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-brace-presence conflicts with no-unescaped-entities #3214

Closed
ntkoopman opened this issue Feb 22, 2022 · 5 comments
Closed

jsx-curly-brace-presence conflicts with no-unescaped-entities #3214

ntkoopman opened this issue Feb 22, 2022 · 5 comments
Labels

Comments

@ntkoopman
Copy link

With both jsx-curly-brace-presence and no-unescaped-entities turned on

<script>{`window.foo = "bar"`}</script>

is fixed into

<script>window.foo = "bar"</script>

which works fine, but will give a warning/error on no-unescaped-entities.

It is my understanding that jsx-curly-brace-presence should not be triggering on this code, since the documentation says:

If the rule is set to get rid of unnecessary curly braces(JSX expression) and there are characters that need to be escaped in its JSX form, such as quote characters, forbidden JSX text characters, escaped characters and anything that looks like HTML entity names, the code will not be warned because the fix may make the code less readable.

https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md

@aprilmintacpineda
Copy link

This is still happening though.

image

After fixing the jsx-curly-brace-presence error

image

@ljharb
Copy link
Member

ljharb commented Feb 13, 2023

@aprilmintacpineda can you be sure you’re on the latest version, and file a new issue if it’s still a problem?

@musjj
Copy link

musjj commented Aug 13, 2024

It looks like that the special casing only considers backticks but not normal quotes.

This triggers a lint error:

<p>{"'"}</p>

But this doesn't:

<p>{`'`}</p>

@ljharb
Copy link
Member

ljharb commented Aug 13, 2024

@musjj thanks, can you file a new issue for that one?

@musjj
Copy link

musjj commented Aug 14, 2024

Made a new issue: #3801

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants