Skip to content

Commit

Permalink
[Fix] no-unknown-property: add dialog attributes
Browse files Browse the repository at this point in the history
Fixes #3436
  • Loading branch information
ljharb committed Sep 17, 2022
1 parent 8c9ec8a commit b52e0ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

## Unreleased

### Fixed
* [`no-unknown-property`]: add `dialog` attributes ([#3436][] @ljharb)

[#3436]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3436

## [7.31.8] - 2022.09.08

### Fixed
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ const ATTRIBUTE_TAGS_MAP = {
noModule: ['script'],
// Media events allowed only on audio and video tags, see https://github.com/facebook/react/blob/256aefbea1449869620fb26f6ec695536ab453f5/CHANGELOG.md#notable-enhancements
onAbort: ['audio', 'video'],
onCancel: ['dialog'],
onCanPlay: ['audio', 'video'],
onCanPlayThrough: ['audio', 'video'],
onClose: ['dialog'],
onDurationChange: ['audio', 'video'],
onEmptied: ['audio', 'video'],
onEncrypted: ['audio', 'video'],
Expand Down Expand Up @@ -104,6 +106,7 @@ const ATTRIBUTE_TAGS_MAP = {
poster: ['video'],
preload: ['audio', 'video'],
scrolling: ['iframe'],
returnValue: ['dialog'],
};

const SVGDOM_ATTRIBUTE_NAMES = {
Expand Down
1 change: 1 addition & 0 deletions tests/lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ ruleTester.run('no-unknown-property', rule, {
{ code: '<view id="one" viewBox="0 0 100 100" />' },
{ code: '<hr align="top" />' },
{ code: '<applet align="top" />' },
{ code: '<dialog onClose={handler} open id="dialog" returnValue="something" onCancel={handler2} />' },
{
code: `
<table align="top">
Expand Down

0 comments on commit b52e0ca

Please sign in to comment.