Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: react/no-unknown-property doesn't recognize <template shadowrootmode=...> #3912

Closed
2 tasks done
alexeyr-ci2 opened this issue Mar 25, 2025 · 1 comment
Closed
2 tasks done

Comments

@alexeyr-ci2
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

shadowrootmode attribute of <template> is in Baseline 2024, so I expected eslint-plugin-react to recognize it.

Code:

package.json:

{
  "type": "module",
  "devDependencies": {
    "@eslint/js": "9.23.0",
    "eslint": "9.23.0",
    "eslint-plugin-react": "7.37.4",
    "react": "19.0.0"
  }
}

eslint.config.js:

import js from "@eslint/js";
import react from "eslint-plugin-react";
export default [
  js.configs.recommended,
  react.configs.flat.recommended,
  react.configs.flat['jsx-runtime'],
  {
    files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
    rules: {
      'react/no-unknown-property': 'error',
     },
  },
];

src/example.jsx:

export const Template = () => (
  <template shadowrootmode="open"></template>
);

results in

Unknown property 'shadowrootmode' found
(react/no-unknown-property)
[2:13-34]

Playground: https://eslint-online-playground.netlify.app/#eNqNUctugzAQ/JWVLyQRjztNoh76Cb3FOSBYUgheI9s0RBH/3rUDkVpFVSSwLc/Mznr2JqwpMxwL1XeYtnYUucCx18ZBqck6+ERGCoewg9UadntYSQLYuuXafhWVvhitndIV7qTQPZIU+222UPaS1m+SRCzQdg25lAvXzYnN2KtRwau1UButQIr3OylrrRSsmnGDRekWyp2R9N1waigJUODOfVdYF0Pn4OAbbe1sZ1ODpVYKqcIq9lAQPtCaW32Bcog4o8QM5BqF0TGwbn4BqJsObQ6HaLPJNumttTFTY8V7yb/z3zjNEi49BPasBYiCV0Y6GehM+kJJbzhK465RDhEao000S2EKB78e78H2RXkuTn5+mjjUUFQKd+1RipxPPBq2kyLopKjw+wN5TBVS2SAH/ejjd/5e6idoOd/Ze0n/X/DPaJ4yn2DhUZImMf0AvA3e4w==

Expected Behavior

shadowrootmode, shadowrootclonable, and shadowrootdelegatesfocus should be recognized (but probably not experimental shadowrootserializable).

eslint-plugin-react version

7.37.4

eslint version

9.23.0

node version

20.16.0

@ljharb
Copy link
Member

ljharb commented Mar 25, 2025

when fixing this, let's add all the shadow root attributes listed here

@ljharb ljharb closed this as completed in 3fd9b92 Mar 25, 2025
TildaDares pushed a commit to TildaDares/eslint-plugin-react that referenced this issue Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants