Open
Description
The rule react/no-unused-prop-types
doesn't seem to pick up that the component has unused props.
Environment:
Dependencies:
"typescript": "4.6.3",
"eslint-plugin-react": "7.30.1",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
eslintrc.js
module.exports = {
rules: [
'react/no-unused-prop-types': 'error',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 11,
project: './tsconfig.json',
},
tsconfig.json
Example Code
type Props = {
username: string;
}
const App: React.VFC<Props> = (props) => {
return <div></div>;
}
Expected Outcome
Lint error with message 'username' PropType is defined but prop is never used
.
Actual Outcome
No error message.
If I change the code to have import React from 'react'
at the top of the file, the rule works as expected.