jsx-eslint/eslint-plugin-react

prefer-stateless-function should not check a .d.ts for a Stateful Component

Open

#2,296 建立於 2019年5月31日

在 GitHub 查看
 (3 留言) (2 反應) (0 負責人)JavaScript (2,797 fork)batch import
bughelp wantedtypescript

倉庫指標

Star
 (8,630 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Imagine that we have a stateful react component and is about to creating a declaration file d.ts for the .js/.jsx file.

declare class StateCom extends React.Component<Props> {}
export default StateCom;

and error/warning occurs that: Component should be written as a pure function eslint(react/prefer-stateless-function)

How can we handle this since the component is a truly Component with state instead of a functional component?

貢獻者指南