-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix curly brace erroring on child text nodes (#133)
- Loading branch information
Ben Jervis
authored
Nov 15, 2023
1 parent
efb504e
commit 1a3c621
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
'eslint-config-seek': patch | ||
--- | ||
|
||
Prevents the new curly-brace-presence rule from affecting children. | ||
|
||
In the previous version, [react/jsx-curly-brace-presence][brace rule] was added to the eslint rules. | ||
This was primarily intended to catch unnecessarily using braces around string props. | ||
|
||
```diff | ||
- <Stack space={'medium'}> | ||
+ <Stack space="medium"> | ||
``` | ||
|
||
Because of the configuration we provided, this had the unintended side effect of removing curly braces inside child text that were being used to prevent the [unescaped entities rule]. | ||
|
||
```diff | ||
- <Text>The available props are {'"up"'} and {'"down"'}</Text> | ||
+ <Text>The available props are "up" and "down"</Text> | ||
// This is now an unescaped entity error | ||
``` | ||
|
||
To fix this, the curly brace rule will now ignore children, and only alert on prop values. | ||
|
||
[brace rule]: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md | ||
[unescaped entities rule]: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters