jsx-eslint/eslint-plugin-react

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

Open

#3,209 创建于 2022年2月17日

在 GitHub 查看
 (5 评论) (1 反应) (0 负责人)JavaScript (8,630 star) (2,797 fork)batch import
help wantedtypescript

描述

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)

贡献者指南