-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[Fix] jsx-curly-brace-presence
: make unwrapping single-expression template literals configurable
#3608
Conversation
…emplate literals configurable Fixes jsx-eslint#3607
Codecov Report
@@ Coverage Diff @@
## master #3608 +/- ##
=======================================
Coverage 97.62% 97.62%
=======================================
Files 132 132
Lines 9295 9297 +2
Branches 3397 3399 +2
=======================================
+ Hits 9074 9076 +2
Misses 221 221
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, defer to owner to approve
@@ -20,7 +20,7 @@ You can pass in options to enforce the presence of curly braces on JSX props, ch | |||
|
|||
```js | |||
... | |||
"react/jsx-curly-brace-presence": [<enabled>, { "props": <string>, "children": <string>, "propElementValues": <string> }] | |||
"react/jsx-curly-brace-presence": [<enabled>, { "props": <string>, "children": <string>, "propElementValues": <string>, "unwrapTemplateLiterals": <boolean> }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe unwrapSingleExpressionOnlyTemplateLiterals
just to be more explicit ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the proper fix here is just to revert #3538, but keep the test cases (without the autofixes).
### `unwrapTemplateLiterals` | ||
|
||
- `true`: unwrap template literals that only have a single expression inside of them. | ||
Since template literals return strings, this may cause changes in semantics, or type errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes it an unsafe autofix, which means it can't ever exist.
Closing in favor of the revert #3611. |
Fixes #3607 (makes #3538 opt-in)
cc @taozhou-glean