Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Revisit JSX syntax

Aberta
#8,053 5 comentários 12 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
38/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
javascript, ocaml
Domínio
compilers, frontend

Direção de pesquisa

Comece pela documentação sobre as divergências do ReScript JSX e pela especificação oficial do JSX vinculada na issue. Rastreie os pontos de entrada do formatter e do parser para determinar como os filhos JSX são tratados atualmente. O trabalho estará concluído quando o comportamento proposto do formatter e do parser estiver definido e coberto para texto simples, identificadores, expressões e filhos de componentes personalizados.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
OCaml
Estrelas
7.5k
Forks
485
Merge médio
1d 2h
PRs com merge (30d)
55

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de rescript-lang/rescript

Todas as issues de rescript-lang/rescript

Issues semelhantes

Mais issues de Compilers

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.