Skip to content

Commit b87bf7c

Browse files
authored
Merge branch 'master' into prop-types-componentpropswithref
2 parents 76a0e35 + e6b5b41 commit b87bf7c

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
77

88
## Unreleased
99

10+
## [7.37.4] - 2025.01.12
11+
12+
### Fixed
13+
* [`no-unknown-property`]: support `onBeforeToggle`, `popoverTarget`, `popoverTargetAction` attributes ([#3865][] @acusti)
14+
* [types] fix types of flat configs ([#3874][] @ljharb)
15+
16+
[7.37.4]: https://github.com/jsx-eslint/eslint-plugin-react/compare/v7.37.3...v7.37.4
17+
[#3874]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3874
18+
[#3865]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3865
19+
1020
## [7.37.3] - 2024.12.23
1121

1222
### Fixed

index.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,21 @@ const configs = {
9090
'react/jsx-uses-react': SEVERITY_OFF,
9191
},
9292
},
93+
flat: /** @type {Record<string, ReactFlatConfig>} */ ({
94+
__proto__: null,
95+
}),
9396
};
9497

9598
/** @typedef {{ plugins: { react: typeof plugin }, rules: import('eslint').Linter.RulesRecord, languageOptions: { parserOptions: import('eslint').Linter.ParserOptions } }} ReactFlatConfig */
9699

97-
/** @type {{ deprecatedRules: typeof deprecatedRules, rules: typeof allRules, configs: typeof configs & { flat?: Record<string, ReactFlatConfig> }}} */
100+
/** @type {{ deprecatedRules: typeof deprecatedRules, rules: typeof allRules, configs: typeof configs & { flat: Record<string, ReactFlatConfig> }}} */
98101
const plugin = {
99102
deprecatedRules,
100103
rules: allRules,
101104
configs,
102105
};
103106

104-
/** @type {Record<string, ReactFlatConfig>} */
105-
configs.flat = {
107+
Object.assign(configs.flat, {
106108
recommended: {
107109
plugins: { react: plugin },
108110
rules: configs.recommended.rules,
@@ -118,6 +120,6 @@ configs.flat = {
118120
rules: configs['jsx-runtime'].rules,
119121
languageOptions: { parserOptions: configs['jsx-runtime'].parserOptions },
120122
},
121-
};
123+
});
122124

123125
module.exports = plugin;

lib/rules/no-unknown-property.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
259259
'onCompositionUpdate', 'onCut', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave',
260260
'onError', 'onFocus', 'onInput', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onLoad', 'onWheel', 'onDragOver',
261261
'onDragStart', 'onDrop', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver',
262-
'onMouseUp', 'onPaste', 'onScroll', 'onSelect', 'onSubmit', 'onToggle', 'onTransitionEnd', 'radioGroup', 'readOnly', 'referrerPolicy',
263-
'rowSpan', 'srcDoc', 'srcLang', 'srcSet', 'useMap', 'fetchPriority',
262+
'onMouseUp', 'onPaste', 'onScroll', 'onSelect', 'onSubmit', 'onBeforeToggle', 'onToggle', 'onTransitionEnd', 'radioGroup',
263+
'readOnly', 'referrerPolicy', 'rowSpan', 'srcDoc', 'srcLang', 'srcSet', 'useMap', 'fetchPriority',
264264
// SVG attributes
265265
// See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
266266
'crossOrigin', 'accentHeight', 'alignmentBaseline', 'arabicForm', 'attributeName',
@@ -317,9 +317,11 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
317317
'onMouseMoveCapture', 'onMouseOutCapture', 'onMouseOverCapture', 'onMouseUpCapture',
318318
// Video specific
319319
'autoPictureInPicture', 'controlsList', 'disablePictureInPicture', 'disableRemotePlayback',
320+
// popovers
321+
'popoverTarget', 'popoverTargetAction',
320322
];
321323

322-
const DOM_PROPERTIES_IGNORE_CASE = ['charset', 'allowFullScreen', 'webkitAllowFullScreen', 'mozAllowFullScreen', 'webkitDirectory'];
324+
const DOM_PROPERTIES_IGNORE_CASE = ['charset', 'allowFullScreen', 'webkitAllowFullScreen', 'mozAllowFullScreen', 'webkitDirectory', 'popoverTarget', 'popoverTargetAction'];
323325

324326
const ARIA_PROPERTIES = [
325327
// See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-react",
3-
"version": "7.37.3",
3+
"version": "7.37.4",
44
"author": "Yannick Croissant <[email protected]>",
55
"description": "React specific linting rules for ESLint",
66
"main": "index.js",
@@ -57,7 +57,7 @@
5757
},
5858
"devDependencies": {
5959
"@babel/core": "^7.26.0",
60-
"@babel/eslint-parser": "^7.25.9",
60+
"@babel/eslint-parser": "^7.26.5",
6161
"@babel/plugin-syntax-decorators": "^7.25.9",
6262
"@babel/plugin-syntax-do-expressions": "^7.25.9",
6363
"@babel/plugin-syntax-function-bind": "^7.25.9",

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

+9
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ ruleTester.run('no-unknown-property', rule, {
188188
</div>
189189
`,
190190
},
191+
{
192+
code: `
193+
<div>
194+
<button popoverTarget="my-popover" popoverTargetAction="toggle">Open Popover</button>
195+
196+
<div id="my-popover" onBeforeToggle={this.onBeforeToggle} popover>Greetings, one and all!</div>
197+
</div>
198+
`,
199+
},
191200
]),
192201
invalid: parsers.all([
193202
{

0 commit comments

Comments
 (0)