Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Revisit JSX syntax

オープン
#8,053 コメント 5 件 リアクション 12 件 担当者 0 名 GitHub で見る

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
javascript, ocaml

調査の方向性

ReScript JSX の相違点に関するドキュメントと、issue にリンクされている公式の JSX 仕様から始めてください。formatter と parser のエントリーポイントを追跡し、現在 JSX の子要素がどのように扱われているかを確認してください。プレーンテキスト、識別子、式、カスタムコンポーネントの子要素について、提案する formatter と parser の動作が定義され、網羅されていれば完了です。

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

説明

discussion
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

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

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

はじめの一歩

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

rescript-lang/rescript のほかの issue

rescript-lang/rescript の issue をすべて見る

似ている issue

Compilers の issue をもっと見る

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

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