Skip to content

Commit 7c60fe0

Browse files
authoredOct 29, 2024··
Disable react/no-unknown-property in .ts and .tsx files (#456)
1 parent a6fd433 commit 7c60fe0

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed
 

‎index.js

+21-3
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,6 @@ const configArray = [
902902
// 2022)
903903
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md
904904
'react/no-invalid-html-attribute': 'error',
905-
// Warn on usage of `class` prop instead of `className`
906-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
907-
'react/no-unknown-property': ['warn', { ignore: ['css'] }],
908905
// Error on creating components within components
909906
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
910907
'react/no-unstable-nested-components': 'error',
@@ -978,11 +975,32 @@ const configArray = [
978975
'upleveled/no-unnecessary-for-and-id': 'warn',
979976
},
980977
},
978+
{
979+
files: [
980+
'**/*.js',
981+
'**/*.jsx',
982+
'**/*.cjs',
983+
'**/*.mjs',
984+
],
985+
rules: {
986+
// Warn on usage of `class` prop instead of `className`
987+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
988+
//
989+
// Enable react/no-unknown-property only in JavaScript / JSX files to:
990+
// 1. Avoid duplicate checks https://github.com/Rel1cx/eslint-react/issues/85#:~:text=members%C2%A0%23234-,The%20following%20can%20be%20enforced%20by%20TypeScript%2C%20no%20need%20to%20implement%20them,-react/jsx%2Dno
991+
// 2. Prevent false positives in @react-three/fiber
992+
// - https://github.com/jsx-eslint/eslint-plugin-react/issues/3423
993+
// - https://github.com/Rel1cx/eslint-react/issues/846
994+
'react/no-unknown-property': ['warn', { ignore: ['css'] }],
995+
},
996+
},
981997
{
982998
files: [
983999
'app/**/layout.js',
1000+
'app/**/layout.jsx',
9841001
'app/**/layout.tsx',
9851002
'app/**/page.js',
1003+
'app/**/page.jsx',
9861004
'app/**/page.tsx',
9871005
],
9881006
rules: {

0 commit comments

Comments
 (0)
Please sign in to comment.