Revisit JSX syntax
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- javascript, ocaml
調査の方向性
ReScript JSX の相違点に関するドキュメントと、issue にリンクされている公式の JSX 仕様から始めてください。formatter と parser のエントリーポイントを追跡し、現在 JSX の子要素がどのように扱われているかを確認してください。プレーンテキスト、識別子、式、カスタムコンポーネントの子要素について、提案する formatter と parser の動作が定義され、網羅されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Proposal: Bring ReScript JSX Closer to the JavaScript JSX Spec
Currently, ReScript JSX differs from JavaScript’s JSX in a few key ways (docs).
I propose moving ReScript JSX closer to the official JSX spec in a future release.
Example
// Current
let foo = <p>{React.string("Hello")}</p>
// Proposed
let foo = <p>Hello</p>
Right now, Hello is treated as a React.element rather than as JSXText.
This means plain text inside JSX must be wrapped in React.string(...), unlike in JavaScript JSX.
Suggested Path Forward
Step 1: Formatter update
The formatter could automatically insert braces for identifiers used as children, making the output more consistent.
// Original
let foo = <p>children</p>
// After format
// (notice how there's no space before the opening curly brace and after the closing one)
let foo = <p>{children}</p>
Step 2: Parser update
Next, the parser could be extended to handle JSXText as valid child input—bringing ReScript JSX semantics in line with the JSX spec.
[!NOTE]
This change will only affect syntax and won't change the type of JSX children.
Inside curly braces you'll still need React.string:<div> {switch count { | 1 => "once" | n => `Int.toString(n) times` }->React.string} </div>This could also affect custom components where children are not typed as JSX element and that are often used with literals, eg before:
<Counter>6</Counter>after:
<Counter>{6}</Counter>
This is still an early-stage idea, so feedback is welcome. Don't hesitate to chime in if you think your codebase would be affected by this change.
Please use 👍 / 👎 / 👀 to indicate your opinion.
This is just a signal, not a binding vote.
- 主要言語
- OCaml
- スター
- 7.5k
- フォーク
- 485
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 55
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rescript-lang/rescript のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
rescript-lang/rescript#8659 · コメント 2 件 · リアクション 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
rescript-lang/rescript#8647 ·
-
rescript-lang/rescript#8632 · 担当者 1 名 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
rescript-lang/rescript#8624 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
rescript-lang/rescript#8596 · コメント 2 件 ·
rescript-lang/rescript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
JakeChampion/lang#10213 ·
-
bug language-server
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
purefunctor/purescript-iris#552 ·
-
enhancement good first issue needs testing
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
bradcypert/plum#58 ·