Can't normal recognize using flow props in static methods
See original GitHub issueGet error from [eslint] 'navigation' PropType is defined but prop is never used (react/no-unused-prop-types)
when declaring prop types via flow in static methods, but I used this variable in static method code.
import type { NavigationScreenProp } from 'react-navigation';
export default class ComponentName extends Component<{}> {
static navigationOptions = ({ navigation }: { navigation: NavigationScreenProp }) => ({ // error here
headerLeft: (<NavigationBtn onPress={() => navigation.goBack()} />),
})
//... other code here
}
Have this plugins in .eslintrc "plugins": ["react", "react-native", "flowtype", "flow"],
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Can't normal recognize using flow props in static methods
The real issue is that you're passing the entire props object around, which is both an antipattern and impossible to lint properly. If...
Read more >Static Methods and Properties - L3HarrisGeospatial.com
This statement executes the Calculate class method on the MyClass class, passing in two arguments a and b, as well as a keyword...
Read more >Static properties and methods
Usually, static methods are used to implement functions that belong to the class as a whole, but not to any particular object of...
Read more >Static and Instance Methods, Variables, and Initialization Code
Before an object of a class is created, all static member variables in a class are initialized, and all static initialization code blocks...
Read more >Why can't I define a static method in a Java interface?
Java 8 permits static interface methods. With Java 8, interfaces can have static methods. They can also have concrete instance methods, but not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
ahh i think i see the issue - you’re using render props, which are functions that return jsx, thus this plugin is considering them components.
I’m going to assume that our component detection has improved to the point where this is no longer a problem. If that’s incorrect, please file a new issue with a repro.