reactjs / reactjs/react-docgen

react-docgen is not compatible with react-like libraries

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

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

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

説明

There are some react-like libraries such as react-lite, preact-compat and other which use API of React for components including PropTypes. All react-docgen methods work well with these libraries. But [this module](react-docgen disables work with react-like libraries) disallows using it.

I have a preact-compat component:

import { h, Component, PropTypes } from 'preact-compat';

export default class MyComponent extends Component {
  render() {
    return <div>{this.props.children}</div>;
  }
}

MyComponent.propTypes = {
  myProp: PropTypes.func
};

Actual react-docgen returns this value for type of myProp:

{
  name: 'custom',
  raw: 'PropTypes.func'
}

If I add preact-compat to whitelist react-docgen returns expected result:

{
  type: 'func'
}

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

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

はじめの一歩

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

調査の方向性

まず、ホワイトリストによってReact系ライブラリを制限しているモジュールを見つけ、次に提供されたpreact-compatコンポーネントで問題を再現します。PropTypes.funcの既存の動作を確認し、期待される出力と比較します。React系ライブラリが明示的にホワイトリストに追加されていなくても同じ型情報を生成すれば完了です。

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

評価

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

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

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