Skip to content

Commit

Permalink
[Fix] no-unknown-property: support popover, popovertarget, `pop…
Browse files Browse the repository at this point in the history
…overtargetaction` attributes

Fixes #3707
  • Loading branch information
ljharb committed Mar 12, 2024
1 parent a920463 commit 1aa653d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
* [`boolean-prop-naming`]: detect TS interfaces ([#3701][] @developer-bandi)
* [`boolean-prop-naming`]: literalType error fix ([#3704][] @developer-bandi)
* [`boolean-prop-naming`]: allow TSIntersectionType ([#3705][] @developer-bandi)
* [`no-unknown-property`]: support `popover`, `popovertarget`, `popovertargetaction` attributes ([#3707][] @ljharb)

### Changed
* [`boolean-prop-naming`]: improve error message (@ljharb)

[#3707]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3707
[#3705]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3705
[#3704]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3704
[#3701]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3701
Expand Down
2 changes: 2 additions & 0 deletions lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ const DOM_PROPERTY_NAMES_ONE_WORD = [
'results', 'security',
// Video specific
'controls',
// popovers
'popover', 'popovertarget', 'popovertargetaction',
];

const DOM_PROPERTY_NAMES_TWO_WORDS = [
Expand Down
9 changes: 9 additions & 0 deletions tests/lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ ruleTester.run('no-unknown-property', rule, {
</div>
`,
},
{
code: `
<div>
<button popovertarget="my-popover" popovertargetaction="toggle">Open Popover</button>
<div popover id="my-popover">Greetings, one and all!</div>
</div>
`,
}
]),
invalid: parsers.all([
{
Expand Down

0 comments on commit 1aa653d

Please sign in to comment.