Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`@@jsxConfig({version: 3})` silently disables the JSX transform

未关闭 适合新手
#9,132 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
74/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
ocaml
领域
compilers

调研方向

阅读 compiler/syntax/src/jsx_ppx.ml,重点查看第 53–56 行对 @@jsxConfig 版本的处理,以及第 107 行和第 124 行的转换检查。先检查附近的验证逻辑和 JSX 配置测试。添加测试,证明不支持的版本(例如 3)会在 version 字段报告错误;当无效配置不再导致 JSX 悄无声息地未被转换时,即为完成。

由索引模型根据 Issue 内容生成。

描述

@@jsxConfig accepts any version and stores it without checking (compiler/syntax/src/jsx_ppx.ml:53-56). The transform only runs when the version is 4 (jsx_ppx.ml:107, :124). Any other value, e.g. a leftover version: 3 from the JSX v3 days, silently turns the JSX transform off for the rest of the file. There is no error or warning.

@@jsxConfig({version: 3})

module C = {
  @react.component
  let make = () => React.null
}

let x = <div />

bsc -bs-jsx 4 -dsource on master (6ea63e5a91) shows the file untransformed: make keeps its @react.component attribute, there is no props type, and <div /> stays a JSX node. With version: 4, the same file is transformed as expected (type props, React.component, ReactDOM.jsx).

Expected: an error for unsupported JSX versions (only 4 exists since v11/v12), pointing at the version field. JSX v3 support is gone, so this should not fall through to an untransformed AST.

Possibly related cleanup: since only v4 remains, Jsx_common.version could become an enabled flag, and the no-op -bs-jsx-mode flag could go in v13.

主要语言
OCaml
星标
7.5k
派生
484
平均合并
21 小时 9 分钟
30 天内合并 PR
255

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rescript-lang/rescript 的其他 Issue

查看 rescript-lang/rescript 的全部 Issue

相似的 Issue

更多 Compilers Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。