Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

babel: Type-check Babel configuration.

Anders Kaseorg7157a424a838
diff --git a/package.json b/package.json
index 3d503574f8c..542a7cae9dd 100644
--- a/package.json
+++ b/package.json
@@ -102,6 +102,8 @@
"@formatjs/cli": "^6.0.0",
"@giphy/js-types": "^5.1.0",
"@types/autosize": "^4.0.1",
+ "@types/babel__core": "^7.20.5",
+ "@types/babel__preset-env": "^7.10.0",
"@types/blueimp-md5": "^2.18.0",
"@types/co-body": "^6.1.3",
"@types/confusing-browser-globals": "^1.0.3",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2c1943b45eb..7210f8d4192 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -327,6 +327,12 @@ importers:
'@types/autosize':
specifier: ^4.0.1
version: 4.0.3
+ '@types/babel__core':
+ specifier: ^7.20.5
+ version: 7.20.5
+ '@types/babel__preset-env':
+ specifier: ^7.10.0
+ version: 7.10.0
'@types/blueimp-md5':
specifier: ^2.18.0
version: 2.18.2
@@ -2673,6 +2679,9 @@ packages:
resolution: {integrity: sha512-FcLBBPXInqKfULB2nvOBskQPcnSMZ0s1Y2q76u9H1NPPWaLcTeq38xBeKfF/RBUECK333qeaqRdYoPSwW7rTNQ==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-LS8hRb/8TQir2f8W9/s5enDtrRS2F/6fsdkVw5ePHp6Q8SrSJHOGtWnP93ryaYMmg2du03vOsiGrl5mllz4uDA==}
+
resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==}
@@ -12312,6 +12321,8 @@ snapshots:
dependencies:
'@types/babel__core': 7.20.5
+ '@types/[email protected]': {}
+
dependencies:
'@babel/parser': 7.28.3
diff --git a/version.py b/version.py
index 772afc2a7ba..91da392550b 100644
--- a/version.py
+++ b/version.py
@@ -49,4 +49,4 @@ API_FEATURE_LEVEL = 425
# historical commits sharing the same major version, in which case a
# minor version bump suffices.
-PROVISION_VERSION = (347, 3) # bumped 2025-09-09 to add @types/eslint-config-prettier
+PROVISION_VERSION = (347, 4) # bumped 2025-09-09 to add @types/babel__core, @types/babel__preset-env
diff --git a/web/babel.config.js b/web/babel.config.js
index af7ef6fc978..498502fb718 100644
--- a/web/babel.config.js
+++ b/web/babel.config.js
@@ -1,22 +1,20 @@
+// @ts-check
+
+/** @type {import("babel-plugin-formatjs/types").Options} */
+const formatJsOptions = {
+ additionalFunctionNames: ["$t", "$t_html"],
+ overrideIdFn: (_id, defaultMessage) => defaultMessage ?? "",
+};
+
+/** @type {import("@babel/preset-env").Options} */
+const presetEnvOptions = {
+ corejs: "3.45",
+ shippedProposals: true,
+ useBuiltIns: "usage",
+};
+
+/** @type {import("@babel/core").TransformOptions} */
export default {
- plugins: [
- [
- "formatjs",
- {
- additionalFunctionNames: ["$t", "$t_html"],
- overrideIdFn: (_id, defaultMessage) => defaultMessage,
- },
- ],
- ],
- presets: [
- [
- "@babel/preset-env",
- {
- corejs: "3.45",
- shippedProposals: true,
- useBuiltIns: "usage",
- },
- ],
- "@babel/typescript",
- ],
+ plugins: [["formatjs", formatJsOptions]],
+ presets: [["@babel/preset-env", presetEnvOptions], "@babel/typescript"],
};