Skip to content

JSX automatic mode as default #6552

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 4 commits into from
Jan 9, 2024
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 @@ -25,6 +25,7 @@
#### :nail_care: Polish

- Format docstrings. https://github.com/rescript-lang/rescript-compiler/pull/6417
- JSX v4 automatic mode as the default mode https://github.com/rescript-lang/rescript-compiler/pull/6552

# 11.0.0-rc.8

Expand Down
4 changes: 2 additions & 2 deletions docs/JSXV4.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Another example is a V4 project that also uses `"rescript-react-native", "rescri

### Classic and Automatic Mode

Classic mode is the default and generates calls to `React.createElement` just as with V3.
Classic mode generates calls to `React.createElement` just as with V3.

```json
"jsx": {
Expand All @@ -52,7 +52,7 @@ Classic mode is the default and generates calls to `React.createElement` just as
}
```

Automatic mode is an experimental mode that generate calls to `_jsx` functions (similar to TypeScript's `react-jsx` mode)
Automatic mode is the default and generates calls to `_jsx` functions (similar to TypeScript's `react-jsx` mode)

```json
"jsx": {
Expand Down
2 changes: 1 addition & 1 deletion jscomp/common/js_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let force_cmi = ref false
let force_cmj = ref false
let jsx_version = ref None
let jsx_module = ref React
let jsx_mode = ref Classic
let jsx_mode = ref Automatic
let js_stdout = ref true
let all_module_aliases = ref false
let no_stdlib = ref false
Expand Down
2 changes: 1 addition & 1 deletion jscomp/gentype/ImportPath.mli
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open GenTypeCommon
type t

val bsCurryPath : config:Config.t -> t
val chopExtensionSafe : t -> t
val chopExtensionSafe : t -> t [@@live]
val dump : t -> string
val emit : t -> string
val fromModule : dir:string -> importExtension:string -> ModuleName.t -> t
Expand Down
4 changes: 2 additions & 2 deletions jscomp/syntax/cli/res_cli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ end = struct
let interface = ref false
let jsxVersion = ref (-1)
let jsxModule = ref "react"
let jsxMode = ref "classic"
let jsxMode = ref "automatic"
let file = ref ""
let typechecker = ref false

Expand Down Expand Up @@ -215,7 +215,7 @@ end = struct
"Specify the jsx module. Default: react" );
( "-jsx-mode",
Arg.String (fun txt -> jsxMode := txt),
"Specify the jsx mode, classic or automatic. Default: classic" );
"Specify the jsx mode, classic or automatic. Default: automatic" );
( "-typechecker",
Arg.Unit (fun () -> typechecker := true),
"Parses the ast as it would be passed to the typechecker and not the \
Expand Down