Skip to content

Commit b52e0ca

Browse files
committed
[Fix] no-unknown-property: add dialog attributes
Fixes #3436
1 parent 8c9ec8a commit b52e0ca

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
55

66
## Unreleased
77

8+
### Fixed
9+
* [`no-unknown-property`]: add `dialog` attributes ([#3436][] @ljharb)
10+
11+
[#3436]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3436
12+
813
## [7.31.8] - 2022.09.08
914

1015
### Fixed

lib/rules/no-unknown-property.js

+3
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ const ATTRIBUTE_TAGS_MAP = {
7070
noModule: ['script'],
7171
// Media events allowed only on audio and video tags, see https://github.com/facebook/react/blob/256aefbea1449869620fb26f6ec695536ab453f5/CHANGELOG.md#notable-enhancements
7272
onAbort: ['audio', 'video'],
73+
onCancel: ['dialog'],
7374
onCanPlay: ['audio', 'video'],
7475
onCanPlayThrough: ['audio', 'video'],
76+
onClose: ['dialog'],
7577
onDurationChange: ['audio', 'video'],
7678
onEmptied: ['audio', 'video'],
7779
onEncrypted: ['audio', 'video'],
@@ -104,6 +106,7 @@ const ATTRIBUTE_TAGS_MAP = {
104106
poster: ['video'],
105107
preload: ['audio', 'video'],
106108
scrolling: ['iframe'],
109+
returnValue: ['dialog'],
107110
};
108111

109112
const SVGDOM_ATTRIBUTE_NAMES = {

tests/lib/rules/no-unknown-property.js

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ ruleTester.run('no-unknown-property', rule, {
128128
{ code: '<view id="one" viewBox="0 0 100 100" />' },
129129
{ code: '<hr align="top" />' },
130130
{ code: '<applet align="top" />' },
131+
{ code: '<dialog onClose={handler} open id="dialog" returnValue="something" onCancel={handler2} />' },
131132
{
132133
code: `
133134
<table align="top">

0 commit comments

Comments
 (0)