jsx-eslint/eslint-plugin-react

no-unused-prop-types does not work if TypeScript interface is defined in another file

Open

#3.209 aberto em 17 de fev. de 2022

Ver no GitHub
 (5 comments) (1 reaction) (0 assignees)JavaScript (2.797 forks)batch import
help wantedtypescript

Métricas do repositório

Stars
 (8.630 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

in types.ts:

export interface SharedProps {
    className?: string;
}

In component.tsx:

import { SharedProps } from './types';

export interface TestComponentProps extends SharedProps {
  name: string;
  count: number;
}

export function TestComponent(props: TestComponentProps) {
  return (
    <div>Hello, {props.name}! {props.count}</div>
  )
}

no-unused-prop-types doesn't catch that className is unused in TestComponent.

Tested using most recent version of everything (eslint-plugin-react, etc)

Guia do colaborador