Skip to content

Commit 8f6fa9e

Browse files
committed
[Fix] no-unknown-property : allow CSS transition event handlers
1 parent 012ec39 commit 8f6fa9e

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
2424
* [`jsx-key`]: detect missing keys in logical expressions ([#3986][] @yalperg)
2525
* [`display-name`]: avoid false positive when React is shadowed ([#3926][] @hyeonbinHur)
2626
* [`no-unused-prop-types`]: detect used props in nested components ([#3955][] @avaice)
27+
* [`no-unknown-property`]: add missing CSS transition event handlers ([#4001][] @baevm)
2728

2829
### Changed
2930
* [Docs] [`no-array-index-key`]: add template literal examples ([#3978][] @akahoshi1421)
3031

32+
[#4001]: https://github.com/jsx-eslint/eslint-plugin-react/pull/4001
3133
[#3986]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3986
3234
[#3978]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3978
3335
[#3958]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3958

lib/rules/no-unknown-property.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
265265
'onCompositionUpdate', 'onCut', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave',
266266
'onError', 'onFocus', 'onInput', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onLoad', 'onWheel', 'onDragOver',
267267
'onDragStart', 'onDrop', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver',
268-
'onMouseUp', 'onPaste', 'onScroll', 'onScrollEnd', 'onSelect', 'onSubmit', 'onBeforeToggle', 'onToggle', 'onTransitionEnd', 'radioGroup',
268+
'onMouseUp', 'onPaste', 'onScroll', 'onScrollEnd', 'onSelect', 'onSubmit', 'onBeforeToggle', 'onToggle',
269+
'onTransitionCancel', 'onTransitionEnd', 'onTransitionRun', 'onTransitionStart', 'radioGroup',
269270
'readOnly', 'referrerPolicy', 'rowSpan', 'srcDoc', 'srcLang', 'srcSet', 'useMap', 'fetchPriority',
270271
// SVG attributes
271272
// See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
@@ -316,7 +317,7 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
316317
'onPlayingCapture', 'onProgressCapture', 'onRateChangeCapture', 'onSeekedCapture', 'onSeekingCapture', 'onStalledCapture', 'onSuspendCapture',
317318
'onTimeUpdateCapture', 'onVolumeChangeCapture', 'onWaitingCapture', 'onSelectCapture', 'onTouchCancelCapture', 'onTouchEndCapture',
318319
'onTouchMoveCapture', 'onTouchStartCapture', 'onScrollCapture', 'onScrollEndCapture', 'onWheelCapture', 'onAnimationEndCapture', 'onAnimationIteration',
319-
'onAnimationStartCapture', 'onTransitionEndCapture',
320+
'onAnimationStartCapture', 'onTransitionCancelCapture', 'onTransitionEndCapture', 'onTransitionRunCapture', 'onTransitionStartCapture',
320321
'onAuxClick', 'onAuxClickCapture', 'onClickCapture', 'onContextMenuCapture', 'onDoubleClickCapture',
321322
'onDragCapture', 'onDragEndCapture', 'onDragEnterCapture', 'onDragExitCapture', 'onDragLeaveCapture',
322323
'onDragOverCapture', 'onDragStartCapture', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ ruleTester.run('no-unknown-property', rule, {
5050
{ code: '<div onMouseDown={this._onMouseDown}></div>;' },
5151
{ code: '<div onScrollEnd={this._onScrollEnd}></div>;' },
5252
{ code: '<div onScrollEndCapture={this._onScrollEndCapture}></div>;' },
53+
{ code: '<div onTransitionCancel={this._onTransitionCancel} onTransitionEnd={this._onTransitionEnd} onTransitionRun={this._onTransitionRun} onTransitionStart={this._onTransitionStart} onTransitionCancelCapture={this._onTransitionCancelCapture} onTransitionEndCapture={this._onTransitionEndCapture} onTransitionRunCapture={this._onTransitionRunCapture} onTransitionStartCapture={this._onTransitionStartCapture}></div>;' },
5354
{ code: '<a href="someLink" download="foo">Read more</a>' },
5455
{ code: '<area download="foo" />' },
5556
{ code: '<img src="cat_keyboard.jpeg" alt="A cat sleeping on a keyboard" align="top" fetchPriority="high" />' },

0 commit comments

Comments
 (0)