Skip to content

Remove obsolete jsx options #7633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

- Remove internal/unused `-bs-v` flag. https://github.com/rescript-lang/rescript/pull/7627
- Remove unused `-bs-D` and `-bs-list-conditionals` flags. https://github.com/rescript-lang/rescript/pull/7631
- Remove obsolete jsx options. https://github.com/rescript-lang/rescript/pull/7633

# 12.0.0-beta.1

Expand Down
1 change: 0 additions & 1 deletion analysis/examples/example-project/bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"number": "-32-26-27-33"
},
"bs-dependencies": ["reason-react"],
"reason": { "react-jsx": 3 },
"namespace": "my-namespace",
"reanalyze": {
"analysis": ["dce", "exception"]
Expand Down
1 change: 0 additions & 1 deletion analysis/examples/larger-project/bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
},
"name": "sample-typescript-app",
"bsc-flags": ["-bs-super-errors -w a"],
"reason": { "react-jsx": 3 },
"bs-dependencies": ["@rescript/react", "@glennsl/bs-json"],
"sources": [
{
Expand Down
6 changes: 2 additions & 4 deletions compiler/bsb/bsb_build_schemas.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(* Copyright (C) 2017 - Hongbo Zhang, Authors of ReScript
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -17,7 +17,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
Expand Down Expand Up @@ -46,8 +46,6 @@ let type_ = "type"
let export_all = "all"
let export_none = "none"
let external_stdlib = "external-stdlib"
let reason = "reason"
let react_jsx = "react-jsx"
let jsx = "jsx"
let jsx_version = "version"
let jsx_module = "module"
Expand Down
11 changes: 4 additions & 7 deletions compiler/bsc/rescript_compiler_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ let[@inline] string_list_add s : Bsc_args.spec = String (String_list_add s)

(* mostly common used to list in the beginning to make search fast
*)
let buckle_script_flags : (string * Bsc_args.spec * string) array =
let command_line_flags : (string * Bsc_args.spec * string) array =
[|
( "-I",
string_list_add Clflags.include_dirs,
Expand Down Expand Up @@ -258,8 +258,7 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
"*internal* <module> Opens the module <module> before typing" );
( "-bs-jsx",
string_call (fun i ->
if i <> "3" && i <> "4" then
Bsc_args.bad_arg (" Not supported jsx version : " ^ i);
if i <> "4" then Bsc_args.bad_arg ("Unsupported jsx version: " ^ i);
Js_config.jsx_version :=
Js_config.jsx_version_of_int @@ int_of_string i),
"*internal* Set jsx version" );
Expand Down Expand Up @@ -446,7 +445,7 @@ let file_level_flags_handler (e : Parsetree.expression option) =
Location.raise_errorf ~loc:e.pexp_loc "string literal expected"))
in
try
Bsc_args.parse_exn ~start:0 ~argv:args buckle_script_flags
Bsc_args.parse_exn ~start:0 ~argv:args command_line_flags
(fun ~rev_args:_ -> ())
~usage
with _ ->
Expand All @@ -460,9 +459,7 @@ let _ : unit =
let flags = "flags" in
Ast_config.add_structure flags file_level_flags_handler;
Ast_config.add_signature flags file_level_flags_handler;
try
Bsc_args.parse_exn ~argv:Sys.argv buckle_script_flags anonymous ~usage
with
try Bsc_args.parse_exn ~argv:Sys.argv command_line_flags anonymous ~usage with
| Bsc_args.Bad msg ->
Format.eprintf "%s@." msg;
exit 2
Expand Down
3 changes: 0 additions & 3 deletions compiler/syntax/src/jsx_ppx.mli
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
a ReasonReact-specific function call. Aka, this is a macro, using OCaml's ppx
facilities; https://whitequark.org/blog/2014/04/16/a-guide-to-extension-
points-in-ocaml/
You wouldn't use this file directly; it's used by ReScript's
rescript.json. Specifically, there's a field called `react-jsx` inside the
field `reason`, which enables this ppx through some internal call in bsb
*)

val rewrite_implementation :
Expand Down
5 changes: 0 additions & 5 deletions docs/docson/build-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@
},
"additionalProperties": false
},
"react-jsx-version": {
"title": "jsx-version",
"type": "number",
"description": "backward compatible mode, true means on with the default to be version 1 (the default value is subject to change)"
},
"ppx-specs": {
"type": "array",
"items": {
Expand Down
8 changes: 0 additions & 8 deletions rewatch/CompilerConfigurationSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ This document contains a list of all bsconfig parameters with remarks, and wheth
| generators | array of Rule-Generator | | [_] |
| cut-generators | boolean | | [_] |
| jsx | JSX | | [x] |
| uncurried | boolean | | [x] |
| reason | Reason | | [x] |
| gentypeconfig | Gentype | | [_] |
| bsc-flags | array of string | | [x] |
| warnings | Warnings | | [x] |
Expand Down Expand Up @@ -144,12 +142,6 @@ enum: "commonjs" | "es6" | "es6-global"

enum: ".js" | ".mjs" | ".cjs" | ".bs.js" | ".bs.mjs" | ".bs.cjs"

### Reason

| Parameter | JSON type | Remark | Implemented? |
| --------- | --------- | ------ | :----------: |
| react-jsx | number | | [x] |

### Target-Item

Not really usable by ReScript, likely to be removed.
Expand Down
1 change: 0 additions & 1 deletion rewatch/src/build/packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,6 @@ mod test {
bs_dev_dependencies: Some(build_dev_deps),
ppx_flags: None,
bsc_flags: None,
reason: None,
namespace: None,
jsx: None,
gentype_config: None,
Expand Down
24 changes: 3 additions & 21 deletions rewatch/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,6 @@ pub struct Warnings {
pub error: Option<Error>,
}

#[derive(Deserialize, Debug, Clone, PartialEq, Hash)]
#[serde(untagged)]
pub enum Reason {
Versioned {
#[serde(rename = "react-jsx")]
react_jsx: i32,
},
Unversioned(bool),
}

#[derive(Deserialize, Debug, Clone)]
#[serde(untagged)]
pub enum NamespaceConfig {
Expand Down Expand Up @@ -212,7 +202,6 @@ pub struct Config {
pub ppx_flags: Option<Vec<OneOrMore<String>>>,
#[serde(rename = "bsc-flags", alias = "compiler-flags")]
pub bsc_flags: Option<Vec<OneOrMore<String>>>,
pub reason: Option<Reason>,
pub namespace: Option<NamespaceConfig>,
pub jsx: Option<JsxSpecs>,
#[serde(rename = "gentypeconfig")]
Expand Down Expand Up @@ -373,22 +362,15 @@ impl Config {
}
}
pub fn get_jsx_args(&self) -> Vec<String> {
match (self.reason.to_owned(), self.jsx.to_owned()) {
(_, Some(jsx)) => match jsx.version {
match self.jsx.to_owned() {
Some(jsx) => match jsx.version {
Some(version) if version == 3 || version == 4 => {
vec!["-bs-jsx".to_string(), version.to_string()]
}
Some(_version) => panic!("Unsupported JSX version"),
None => vec![],
},
(Some(Reason::Versioned { react_jsx }), None) => {
vec!["-bs-jsx".to_string(), format!("{}", react_jsx)]
}
(Some(Reason::Unversioned(true)), None) => {
// If Reason is 'true' - we should default to the latest
vec!["-bs-jsx".to_string()]
}
_ => vec![],
None => vec![],
}
}

Expand Down
5 changes: 1 addition & 4 deletions rewatch/testrepo/bsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@
"@testrepo/namespace-casing",
"@testrepo/with-dev-deps",
"@testrepo/compiled-by-legacy"
],
"reason": {
"react-jsx": 3
}
]
}
2 changes: 0 additions & 2 deletions tests/ounit_tests/ounit_bsb_regex_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ let suites =
"sources": [
"src"
],
"reason" : { "react-jsx" : true},
"bs-dependencies" : [
]
}
Expand All @@ -49,7 +48,6 @@ let suites =
"sources": [
"src"
],
"reason" : { "react-jsx" : true},
"bs-dependencies" : [
]
}
Expand Down