gajus / gajus/eslint-plugin-flowtype

React.ComponentType<any> flagged as unused when used as a param type in a method.

Open
#482 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
1.1k
Forks
151
PR merge metrics
No merged PRs in 30d

Description

```
function renderTab(Tab: React.ComponentType): null {
return null;
}

class Foo extends React.Component {
renderTab(Tab: React.ComponentType): null { // 'ComponentType' is not defined. eslint(no-undef)
return null;
}
}
```
`eslint` only complains about the use of `ComponentType` when used as a param type in a method, but functions are fine.

This is using 5.7.2 of eslint-plugin-flowtype.

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with the standalone function and class method snippets using eslint-plugin-flowtype 5.7.2, then trace the rule handling Flow parameter annotations in methods. Done means React.ComponentType is not falsely reported as undefined in the method case while the existing function behavior remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript, react
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.