Skip to content

Commit

Permalink
[Fix] jsx-curly-brace-presence: the string "never" defaults to `pro…
Browse files Browse the repository at this point in the history
…pElementValues` as `ignore`

Fixes #3228
  • Loading branch information
ljharb committed Feb 28, 2022
1 parent 9090999 commit d8602ac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

### Fixed
* [`no-unused-state`]: avoid a crash on type-only gDSFP declarations ([#3225][] @ljharb)
* [`jsx-curly-brace-presence`]: the string "never" defaults to `propElementValues` as `ignore` ([#3228][] @ljharb)

[#3228]: https://github.com/yannickcr/eslint-plugin-react/issues/3228
[#3225]: https://github.com/yannickcr/eslint-plugin-react/issues/3225

## [7.29.2] - 2022.02.25
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-curly-brace-presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module.exports = {
const HTML_ENTITY_REGEX = () => /&[A-Za-z\d#]+;/g;
const ruleOptions = context.options[0];
const userConfig = typeof ruleOptions === 'string'
? { props: ruleOptions, children: ruleOptions, propElementValues: ruleOptions }
? { props: ruleOptions, children: ruleOptions, propElementValues: OPTION_IGNORE }
: Object.assign({}, DEFAULT_CONFIG, ruleOptions);

function containsLineTerminators(rawStringValue) {
Expand Down
9 changes: 9 additions & 0 deletions tests/lib/rules/jsx-curly-brace-presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,15 @@ ruleTester.run('jsx-curly-brace-presence', rule, {
code: `
<script>{\`window.foo = "bar"\`}</script>
`,
},
{
code: `
<CollapsibleTitle
extra={<span className="activity-type">{activity.type}</span>}
/>
`,
features: ['no-ts'],
options: ['never'],
}
)),

Expand Down

0 comments on commit d8602ac

Please sign in to comment.