no-unused-class-component-members
Full Name in eslint-plugin-react-x
react-x/no-unused-class-component-members
Full Name in @eslint-react/eslint-plugin
@eslint-react/no-unused-class-component-members
Features
🔍
Presets
core
recommended
recommended-typescript
recommended-type-checked
What it does
Warns unused class component methods and properties.
Examples
Failing
import React from "react";
class Example extends React.Component {
handleClick() {} // Unused
render() {
return null;
}
}
Passing
import React from "react";
class Example extends React.Component {
static getDerivedStateFromError(error: React.ErrorInfo) {
return { hasError: true };
}
action() {}
componentDidMount() {
this.action();
}
render() {
return null;
}
}