Bug: [email protected] only detects english component names
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- javascript, react
調査の方向性
issue でリンクされている isComponentName メソッドの周辺にある packages/eslint-plugin-react-hooks/src/RulesOfHooks.js から始め、ÄndraVärde のようなコンポーネントを使って lint エラーを再現します。英語以外の大文字が受け入れられるようにコンポーネント名のチェックを更新し、再現した hook の警告が発生しなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
説明
React version: [email protected]
Steps To Reproduce
- Create a functional component with a name such as
ÄndraVärdethat starts with a non english upper case letter - Run the linter
The current behavior
Sample error:
23:20 error React Hook "useSelectedState" is called in function "ÄndraVärde" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use" react-hooks/rules-of-hooks
The expected behavior
The linting should allow non english component names, React does.
The problem
Version 5.0.0 included the changes made in #25162 which modified the following method:
https://github.com/facebook/react/blob/e1378902bbb322aa1fe1953780f4b2b5f80d26b1/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js#L43-L50
This code only allows english upper case letters A-Z which is not enough.
Proposed solution
Use .toUpperCase() and compare the result:
function isComponentName(node) {
return node.type === 'Identifier' && node.name[0] == node.name[0].toUpperCase();
}
This should work with a lot more languages at least.
- 主要言語
- JavaScript
- スター
- 251k
- フォーク
- 51.4k
- 平均マージ
- 1日 17時間
- マージ済み PR(30日)
- 43
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react/react のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
Mintplex-Labs/anything-llm#6490 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
[quality] workflow-scripts guard reads test:unit:coverage as skipping the unit suite, blocking #632 オープンagent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
area-clientside-dartpad
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100