Skip to content

Commit 1826ded

Browse files
AmirrezaASafaeirad
authored andcommitted
feat: add @eslint-react/no-unused-props rule
1 parent 14e5589 commit 1826ded

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/modules/react.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ import reactPlugin from '@eslint-react/eslint-plugin';
22
import a11yPlugin from 'eslint-plugin-jsx-a11y';
33
import hooksPlugin from 'eslint-plugin-react-hooks';
44

5+
import { predicate } from '../utils/conditions.mjs';
6+
57
/** @return { import('eslint').Linter.Config } */
68
function react(options = {}) {
9+
const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
10+
711
return {
812
plugins: {
913
...reactPlugin.configs.all.plugins,
@@ -82,7 +86,9 @@ function react(options = {}) {
8286
'@eslint-react/no-unstable-default-props': 'error',
8387
'@eslint-react/no-unused-class-component-members': 'warn',
8488
'@eslint-react/no-unused-state': 'warn',
85-
'@eslint-react/no-unused-props': 'off',
89+
...predicate(projectService, {
90+
'@eslint-react/no-unused-props': 'warn',
91+
}),
8692
'@eslint-react/no-useless-forward-ref': 'off',
8793
'@eslint-react/no-useless-fragment': 'warn',
8894
'@eslint-react/no-use-context': 'warn',

0 commit comments

Comments
 (0)