reactjs / reactjs/react-docgen

Stateless function components without React.createElement or JSX?

オープン
#70 コメント 4 件 リアクション 7 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
3.8k
フォーク
316
平均マージ
5時間 7分
マージ済み PR(30日)
4

説明

react-docgen is unable to find stateless function components that don't contain JSX or React.createElement call expressions.

This might be the case when some helper library is used. This will also fail if the official React.DOM helpers are used (https://github.com/reactjs/react-docgen/pull/71). Another failing case would be if only React components are returned, but React.createElement was never called because the components were wrapped in React.createFactory.

What about adding support for another heuristic, such as having a propTypes property (and to be even more specific, a propTypes property with an object containing React.PropTypes entries).

I'm happy to implement this and add tests if this sounds reasonable to the maintainers.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、react-docgen における既存のステートレス関数コンポーネントの検出を追跡し、React.createElement を使用するコンポーネントのテストを確認します。提案された propTypes ヒューリスティックを React.DOM ヘルパーおよび React.createFactory のケースと比較します。これらのコンポーネントが既存の検出動作を壊すことなく検出され、テストでサポートされるパターンがカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react, typescript
領域
tooling
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。