logoESLint React

no-unused-props

Full Name in eslint-plugin-react-x

react-x/no-unused-props

Full Name in @eslint-react/eslint-plugin

@eslint-react/no-unused-props

Description

Warns about unused component prop declarations.

Examples

Failing

interface Props {
  abc: string; // used
  hello: string; // NOT used
}

function Component(props: Props) {
  const { abc } = props; // `hello` isn't accessed from `props`
  return null;
}

Passing

interface Props {
  abc: string; // used
  hello: string; // used
}

function Component(props: Props) {
  const { abc, hello } = props;
  return null;
}

Implementation