From 5c5e72da7afd24e9957692c57a2c2442487967f7 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 21 Aug 2026 22:28:58 +0200 Subject: [PATCH] chore(deps): bump js-yaml to 5.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Supersedes #12345, which only moves the version and so is red on `build`, `lint`, `test` and `config-examples`. v5 is a breaking release and the two call sites have to move with it. `scripts/validate-config-examples.mjs` now imports js-yaml as a namespace. v5 dropped the CommonJS default export, so `import yaml from 'js-yaml'` failed to load at all. That was also behind the three test failures: `yaml` was `undefined`, `yaml.load` threw a `TypeError`, the script caught it and reported "invalid YAML", so an example that should have failed AJV schema validation failed at the parse step instead. All three pass on the import fix alone — no v5 parsing behaviour change is involved. `OptionsTable.tsx` drops `noCompatMode: true`, which v5 removed. It suppressed YAML-1.1-compat quoting of `yes`/`no`/`on`/`off` and base-60 values. None of the 136 defaults in the schema are one of those, so this is a no-op today; v5 quotes them by default and offers no way to opt out, so a future default of `no` would start rendering as `"no"`. `OptionsTable.tsx` also renames `quotingType: '"'` to `quoteStyle: 'double'`, and this is the reason the bump is not mechanical. v5 renamed that option *and* flipped its default to `'single'`, so just deleting the two options `tsc` rejects silently reflows four published defaults. The worst is `post_check.title`, whose value contains single quotes: before "'{{ check_rule_name }}'{% if check_status == 'success' %} …" after '''{{ check_rule_name }}''{% if check_status == ''success'' %} …' Equivalent YAML, unreadable in a table people copy-paste from. `@types/js-yaml` is dropped rather than bumped: v5 ships its own types, so the stub is now a mismatched duplicate. This goes to 5.3.0 rather than the 5.2.3 in #12345 because `^5.2.3` resolves to 5.3.0 anyway, and 5.3.0 only adds a custom-tag API this repo does not touch — `dump` output is byte-identical between the two. Verification: built the site on `main` and on this branch and diffed the output — all 385 pages are byte-identical, so nothing readers see moves. Every schema default also renders identically through `dumpDefault`. `pnpm check`, `pnpm test` (172), `pnpm check:config-examples` (122 examples) and `pnpm check:internal-leaks` are green, and a full build with OG generation on produces 137 cards, same as `main`. Change-Id: I67baaa318cc15d45ff7f1d6dcf4e8bff693a2cb2 --- package.json | 3 +-- pnpm-lock.yaml | 20 ++++++++++---------- scripts/validate-config-examples.mjs | 2 +- src/components/Tables/OptionsTable.tsx | 6 ++++-- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index c514913b9a..ef644e70c7 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "@iconify-json/lucide": "^1.2.123", "@types/hast": "^3.0.5", "@types/html-escaper": "^3.0.4", - "@types/js-yaml": "^4.0.9", "@types/mdast": "^4.0.4", "@types/node": "^26.2.0", "@types/viz.js": "^2.1.5", @@ -95,7 +94,7 @@ "cheerio": "^1.2.0", "classnames": "^2.5.1", "dotenv": "^17.4.2", - "js-yaml": "^4.3.1", + "js-yaml": "^5.3.0", "jsonpointer": "^5.0.1", "react": "^19.2.8", "react-dom": "^19.2.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 07a5d556ee..5d0ea54e7e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -74,8 +74,8 @@ importers: specifier: ^17.4.2 version: 17.4.2 js-yaml: - specifier: ^4.3.1 - version: 4.3.1 + specifier: ^5.3.0 + version: 5.3.0 jsonpointer: specifier: ^5.0.1 version: 5.0.1 @@ -173,9 +173,6 @@ importers: '@types/html-escaper': specifier: ^3.0.4 version: 3.0.4 - '@types/js-yaml': - specifier: ^4.0.9 - version: 4.0.9 '@types/mdast': specifier: ^4.0.4 version: 4.0.4 @@ -1913,9 +1910,6 @@ packages: '@types/is-empty@1.2.3': resolution: {integrity: sha512-4J1l5d79hoIvsrKh5VUKVRA1aIdsOb10Hu5j3J2VfP/msDnfTdGPmNp2E1Wg+vs97Bktzo+MZePFFXSGoykYJw==} - '@types/js-yaml@4.0.9': - resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==} - '@types/jsesc@2.5.1': resolution: {integrity: sha512-9VN+6yxLOPLOav+7PwjZbxiID2bVaeq0ED4qSQmdQTdjnXJSaCVKTR58t15oqH1H5t8Ng2ZX1SabJVoN9Q34bw==} @@ -3506,6 +3500,10 @@ packages: resolution: {integrity: sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==} hasBin: true + js-yaml@5.3.0: + resolution: {integrity: sha512-muutsYr+e2+d3rTgUGslq5rxbBlUy3cJ61IsHag2QNDQV+7zXWjkUpmALIajhrlLlrgRUiymj6U3zUr/TMK84Q==} + hasBin: true + jsesc@3.1.0: resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==} engines: {node: '>=6'} @@ -7220,8 +7218,6 @@ snapshots: '@types/is-empty@1.2.3': {} - '@types/js-yaml@4.0.9': {} - '@types/jsesc@2.5.1': {} '@types/json-schema@7.0.15': {} @@ -9325,6 +9321,10 @@ snapshots: dependencies: argparse: 2.0.1 + js-yaml@5.3.0: + dependencies: + argparse: 2.0.1 + jsesc@3.1.0: {} json-buffer@3.0.1: {} diff --git a/scripts/validate-config-examples.mjs b/scripts/validate-config-examples.mjs index cc6bc839f1..f8cdbb2c06 100644 --- a/scripts/validate-config-examples.mjs +++ b/scripts/validate-config-examples.mjs @@ -33,7 +33,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import Ajv2020 from 'ajv/dist/2020.js'; -import yaml from 'js-yaml'; +import * as yaml from 'js-yaml'; const ROOT = path.resolve(fileURLToPath(import.meta.url), '..', '..'); const SCHEMA_PATH = path.join(ROOT, 'public', 'mergify-configuration-schema.json'); diff --git a/src/components/Tables/OptionsTable.tsx b/src/components/Tables/OptionsTable.tsx index c7b0654a07..6f88b2d98b 100644 --- a/src/components/Tables/OptionsTable.tsx +++ b/src/components/Tables/OptionsTable.tsx @@ -25,9 +25,11 @@ export function defToIdPrefix(def: string): string { function dumpDefault(value: unknown): string { return yaml .dump(value, { - noCompatMode: true, lineWidth: -1, - quotingType: '"', + // Not the default ('single'): these dumps are copy-pasted into configs, and + // double quotes keep Jinja templates like "{{ title }} '{{ name }}'" readable + // without escaping the inner single quotes. + quoteStyle: 'double', noRefs: true, }) .replace(/\n$/, '');