babel: Type-check Babel configuration.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2025-09-09 17:19:41 -07:00
committed by Tim Abbott
parent 2975c1bc62
commit 7157a424a8
4 changed files with 33 additions and 22 deletions

View File

@@ -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",

11
pnpm-lock.yaml generated
View File

@@ -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:
'@types/babel__helper-plugin-utils@7.10.3':
resolution: {integrity: sha512-FcLBBPXInqKfULB2nvOBskQPcnSMZ0s1Y2q76u9H1NPPWaLcTeq38xBeKfF/RBUECK333qeaqRdYoPSwW7rTNQ==}
'@types/babel__preset-env@7.10.0':
resolution: {integrity: sha512-LS8hRb/8TQir2f8W9/s5enDtrRS2F/6fsdkVw5ePHp6Q8SrSJHOGtWnP93ryaYMmg2du03vOsiGrl5mllz4uDA==}
'@types/babel__template@7.4.4':
resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==}
@@ -12312,6 +12321,8 @@ snapshots:
dependencies:
'@types/babel__core': 7.20.5
'@types/babel__preset-env@7.10.0': {}
'@types/babel__template@7.4.4':
dependencies:
'@babel/parser': 7.28.3

View File

@@ -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

View File

@@ -1,22 +1,20 @@
export default {
plugins: [
[
"formatjs",
{
// @ts-check
/** @type {import("babel-plugin-formatjs/types").Options} */
const formatJsOptions = {
additionalFunctionNames: ["$t", "$t_html"],
overrideIdFn: (_id, defaultMessage) => defaultMessage,
},
],
],
presets: [
[
"@babel/preset-env",
{
overrideIdFn: (_id, defaultMessage) => defaultMessage ?? "",
};
/** @type {import("@babel/preset-env").Options} */
const presetEnvOptions = {
corejs: "3.45",
shippedProposals: true,
useBuiltIns: "usage",
},
],
"@babel/typescript",
],
};
/** @type {import("@babel/core").TransformOptions} */
export default {
plugins: [["formatjs", formatJsOptions]],
presets: [["@babel/preset-env", presetEnvOptions], "@babel/typescript"],
};