Skip to content

Commit 3fd9b92

Browse files
committed
[Fix] no-unknown-property: allow shadow root attrs on <template>
Fixes #3912
1 parent addad46 commit 3fd9b92

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

CHANGELOG.md

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

88
## Unreleased
99

10+
### Fixed
11+
* [`no-unknown-property`]: allow shadow root attrs on `<template>` ([#3912][] @ljharb)
12+
1013
### Changed
1114
* [Docs] [`button-has-type`]: clean up phrasing ([#3909][] @hamirmahal)
1215

16+
[#3912]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3912
1317
[#3909]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3909
1418

1519
## [7.37.4] - 2025.01.12

lib/rules/no-unknown-property.js

+4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ const ATTRIBUTE_TAGS_MAP = {
118118
scrolling: ['iframe'],
119119
returnValue: ['dialog'],
120120
webkitDirectory: ['input'],
121+
shadowrootmode: ['template'],
122+
shadowrootclonable: ['template'],
123+
shadowrootdelegatesfocus: ['template'],
124+
shadowrootserializable: ['template'],
121125
};
122126

123127
const SVGDOM_ATTRIBUTE_NAMES = {

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

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ ruleTester.run('no-unknown-property', rule, {
7979
{ code: '<table border="1" />' },
8080
{ code: '<th abbr="abbr" />' },
8181
{ code: '<td abbr="abbr" />' },
82+
{ code: '<template shadowrootmode="open" shadowrootclonable shadowrootdelegatesfocus shadowrootserializable />' },
8283
{
8384
code: '<div allowTransparency="true" />',
8485
settings: {

0 commit comments

Comments
 (0)