Skip to content

Commit ba9623b

Browse files
smithjw1claude
andauthored
chore(deps-dev): bump @wordpress/scripts to 37 in core and the checklist (#187)
* chore(deps-dev): bump @wordpress/scripts to 37 in core and the checklist Both packages move from ^31.7.0 to ^37.1.0 together. Peers rise only where npm requires it: @wordpress/theme to ^3 (not 4, which moves the PostCSS and stylelint plugin paths) and, in core, @wordpress/e2e-test-utils-playwright to ^3.2, the version scripts' own Playwright setup uses. Runtime @wordpress/* packages are unchanged. ESLint 10 drops eslintrc, so .eslintrc.js becomes eslint.config.cjs on top of the scripts flat config. The default now applies Vitest rules to every test file; unit tests get Jest rules and e2e specs get Playwright rules instead. The quality gate treats eslint.config.* as a rules file. wp-scripts test-unit-js now runs Vitest, so the suite moves to test-unit-jest with Jest 30 and a jest.config.js reproducing the defaults scripts used to supply. quality.mjs runs each package's test:unit:js script rather than calling test-unit-js itself. Same 123 suites and 1861 tests as before; one test now awaits its popover so the positioning update no longer leaks into the next test. The vendored design-token CSS is refreshed from @wordpress/theme 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style: reformat for Prettier 3.9 and drop stale eslint-disable comments Mechanical only. @wordpress/scripts 37 ships a newer Prettier, and ESLint 10 reports disable comments that suppress nothing. Every removed comment named a rule that was off (import/first, no-await-in-loop) or already allowed the call (no-console on console.warn/error). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: clear the errors ESLint 10 adds - Unused catch bindings become optional catch bindings; no-unused-vars now checks caught errors by default. - KanbanCard and KanbanColumn keep their named inner functions, which React DevTools shows for the memoized components, with the new no-shadow report disabled and the reason noted. - The four best-effort networkidle waits before style audits keep their behavior, with playwright/no-networkidle disabled and the reason noted. - One Prettier fix in the checklist's PostCSS config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(e2e): point test-playwright at the tests environment config @wordpress/scripts 37 exports WP_BASE_URL from the wp-env config before Playwright starts. Without a config path it reads the development config, whose port is 8888, so login and storage state would target the dev site. Passing --wp-env-config=../.wp-env.tests.json keeps the run on the tests environment's 8889 locally and in CI. The release packaging check now also refuses eslint.config.* and jest.config.*, as it already did .eslintrc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(deps-dev): clear the remaining npm audit findings Transitive packages with in-range fixes are updated in both lockfiles. npm audit fix would also have moved runtime @wordpress/* packages and the bundled date-fns, so only the vulnerable packages were updated; direct dependencies are unchanged and the built JS is byte-identical. The rest get scoped overrides, each kept only because the tool that pulls it in still passes and the build output does not change: - serialize-javascript under copy-webpack-plugin: the build still copies the DataViews and design-token CSS. - minimatch 10 under ESLint and typescript-eslint: lint covers the same 336 files with the same findings. - glob 10 and 13 under Jest: the same 123 suites and 1861 tests run, and coverage still works. - js-yaml, smol-toml and katex under markdownlint-cli: lint-md-docs still lints and reports. - uuid 9 in the checklist, which does not bundle it. Two advisories remain. deepmerge has no fixed release. In core, the uuid override changed the built JS, so it is left for a runtime dependency update rather than slipped into a toolchain change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(review): flag jest and vitest config edits as gate-rule changes A narrowed jest.config.js can shrink the blocking unit gate, so editing it now triggers the same "gate rules modified" warning as eslint.config.*. vitest.config.* is included for when a package moves to Vitest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: record accepted audit advisories and the overrides npm audit still reports deepmerge and, in core, uuid on purpose. The new reference says why each is not reachable, what would let it go, and which override clears every other advisory, with the check that kept it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: note the glob override applies to rimraf 5 only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(review): list the adm-zip override and the new gate-rule files The dependency audit record now includes the root adm-zip override, and the quality-gate README names jest.config.* and vitest.config.* among the files that trigger the gate-rules warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style: format the claim and release tests for Prettier 3.9 They landed on main (#169) after the reformat, so they kept the old continuation indent and three import/first directives ESLint 10 reports as unused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 131c1f8 commit ba9623b

115 files changed

Lines changed: 16329 additions & 18272 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.loupe/tokens/wpds-design-tokens.css‎

Lines changed: 250 additions & 246 deletions
Large diffs are not rendered by default.

‎docs/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- [Quick reference](reference/quick-reference.md)
2323
- [Sequence schema](reference/sequence-schema.md) — the field-by-field reference for authoring a workflow config.
2424
- [Stage-agent verdict threat model](reference/stage-agent-verdict-threat-model.md)
25+
- [Dependency audit](reference/dependency-audit.md) — accepted npm audit advisories and the overrides that clear the rest.
2526

2627
## Guides
2728

‎docs/reference/dependency-audit.md‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Dependency audit: accepted advisories and overrides
2+
3+
What `npm audit` still reports on purpose, and which npm `overrides` hold the rest down. The [security review rubric](../guides/security-sweep-rubric.md) asks for an owner, a review trigger and a rationale for every accepted advisory; this is that record. Update it whenever an override is added or removed, or an accepted advisory changes.
4+
5+
Owner: VIP Workflows maintainers.
6+
7+
## Accepted advisories
8+
9+
Both ship in the core plugin's built JavaScript, through `@wordpress/*` packages that `@wordpress/scripts` bundles rather than loads from WordPress core. Neither can be fixed without changing shipped code, so neither is fixed inside a toolchain change. In `workflow-tool-checklist`, `deepmerge` is only a build and test dependency and does not ship.
10+
11+
| Package | Advisory | Packages | How it arrives | Why it is not reachable | Review again when |
12+
| --- | --- | --- | --- | --- | --- |
13+
| `deepmerge` 4.3.1 | [GHSA-gcqx-w48m-w2h4](https://github.com/advisories/GHSA-gcqx-w48m-w2h4) (low): `mergeObject()` lets a `__proto__` key set the prototype of the returned object | `vip-workflows` (shipped), `workflow-tool-checklist` (build only) | `@wordpress/dataviews` pins it exactly and is bundled by design | The bundled call sites are DataForm's panel modal and form-validity hook, which merge the signed-in user's own form state in their browser. The plugin renders `DataViews` only, never DataForm. No fixed `deepmerge` release exists. | `@wordpress/dataviews` is updated, or `deepmerge` publishes a fix |
14+
| `uuid` 9.0.1 | [GHSA-w5hq-g745-h8pq](https://github.com/advisories/GHSA-w5hq-g745-h8pq) (moderate): missing buffer bounds check in v3, v5 and v6 when a `buf` argument is passed | `vip-workflows` | Requested by `@wordpress/components` 32 (`^9.0.1`); overriding it changes the built JS | The bundle contains only `uuid`'s v4 function, and it is not called with a buffer | `@wordpress/components` is updated to a release on `uuid` 11.1.1 or later |
15+
16+
`workflow-tool-checklist` overrides `uuid` (below) because it does not bundle it, so the override leaves its build output unchanged.
17+
18+
## Overrides
19+
20+
Each override lifts a dev or build tool's transitive dependency to a patched release. Each was kept only because the tool that pulls it in still passed its own checks and the built JavaScript stayed byte-identical. Remove an override once the parent package's own range admits a fixed version; `npm ls <package>` shows whether it still applies.
21+
22+
| Package | Override | Clears | Parent | Checked with |
23+
| --- | --- | --- | --- | --- |
24+
| root | `adm-zip` ^0.6.1 | adm-zip advisory | `@wordpress/env` | Predates this record; wp-env still downloads and unpacks sources |
25+
| root | `@wp-playground/storage` › `isomorphic-git` ^1.44.12 | isomorphic-git path traversal advisories | `@wordpress/env` › `@wp-playground/cli` | wp-env boots and runs the integration suites |
26+
| root | `express` › `qs` ^6.17.1 | qs denial-of-service advisories | `@wordpress/env` › `@wp-playground/cli` | wp-env boots; express parses query strings |
27+
| root | `rimraf@^5` › `glob` ^14.0.4 | glob advisory | `@wordpress/env` › `rimraf` | wp-env's `rimraf( path )` calls delete as before |
28+
| `vip-workflows`, `workflow-tool-checklist` | `copy-webpack-plugin` › `serialize-javascript` ^7.1.4 | serialize-javascript advisories | `@wordpress/scripts` webpack config | The build still copies the DataViews and design-token CSS |
29+
| `vip-workflows`, `workflow-tool-checklist` | `markdownlint-cli` › `js-yaml` ^5.5.0, `smol-toml` ^1.9.1 | js-yaml and smol-toml advisories | `@wordpress/scripts` › `markdownlint-cli` | `wp-scripts lint-md-docs` still lints and reports |
30+
| `vip-workflows`, `workflow-tool-checklist` | `micromark-extension-math` › `katex` ^0.18.2 | katex advisory | `markdownlint-cli` › `markdownlint` | As above |
31+
| `vip-workflows`, `workflow-tool-checklist` | `minimatch@^10.0.0` → ^11.0.7 | minimatch ReDoS advisory | ESLint config loading, typescript-eslint | Lint covers the same files with the same findings |
32+
| `vip-workflows`, `workflow-tool-checklist` | `glob@^10.0.0` → ^14.0.4 | glob advisory | Jest coverage, typescript-eslint | Jest runs the same suites; coverage still works |
33+
| `vip-workflows` | `glob@^13.0.0` → ^14.0.4 | glob advisory | Jest 30 (`jest-config`, `jest-runtime`, `@jest/reporters`) | As above |
34+
| `workflow-tool-checklist` | `uuid@^9.0.0` → ^11.1.1 | uuid advisory | `@wordpress/components` 32 | Build output byte-identical |
35+
36+
## Checking
37+
38+
From each of the repository root, `vip-workflows/` and `workflow-tool-checklist/`:
39+
40+
```sh
41+
npm audit
42+
npm audit --omit=dev
43+
```
44+
45+
The full audit should list only the accepted advisories above. When it lists something else, either fix it or add it here with the same detail.

‎tools/code-quality/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ A directive without a rule id or a reason, or a blanket form, is itself a
265265

266266
**Rewriting the gate's rules isn't silent.** Any change under
267267
`tools/code-quality/`, to `loupe.config.json` or anything under `.loupe/`, a
268-
`.phpcs.xml.dist`, or an eslint/stylelint config prints `⚠ gate rules modified —
269-
human review required`. A change to loupe's config or `.loupe/` also runs loupe
268+
`.phpcs.xml.dist`, an eslint/stylelint config, or a `jest.config.*` or
269+
`vitest.config.*` prints `⚠ gate rules modified — human review required`. A change to loupe's config or `.loupe/` also runs loupe
270270
over the whole repo.
271271

272272
---

‎tools/code-quality/quality.mjs‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,10 @@ function recordBaseline() {
457457
}
458458

459459
// ── test (fast unit suites only) ───────────────────────────────────────────────
460-
function runUnit(label, bin, args, cwd) {
461-
if (!existsSync(bin)) {
460+
// `probe` is the installed file whose absence means setup has not run; it
461+
// defaults to `bin`, and differs when the suite runs through a package script.
462+
function runUnit(label, bin, args, cwd, probe = bin) {
463+
if (!existsSync(probe)) {
462464
note(`⚠ test(${label}): dependencies missing — run \`npm run setup\`; skipped.`);
463465
return true;
464466
}
@@ -477,7 +479,8 @@ function runUnit(label, bin, args, cwd) {
477479
* Capability-probe a plugin's available unit suites. Config-driven so wiring up
478480
* an extension's tests never requires editing this file: PHP needs a
479481
* phpunit.xml.dist + installed phpunit (run via its `unit` suite); JS needs a
480-
* `test:unit:js` package script + installed wp-scripts.
482+
* `test:unit:js` package script + installed wp-scripts, and runs that script,
483+
* so the package decides which runner (Jest or Vitest) its suite uses.
481484
* @param want {php, js} — which file types changed (so we only run relevant suites).
482485
*/
483486
function pluginUnitSuites(plugin, want) {
@@ -488,7 +491,13 @@ function pluginUnitSuites(plugin, want) {
488491
suites.push({ label: `${plugin} php`, bin: phpunit, args: ['--testsuite', 'unit'], cwd: dir });
489492
}
490493
if (want.js && jsonHasScript(join(dir, 'package.json'), 'test:unit:js') && existsSync(wpScripts(plugin))) {
491-
suites.push({ label: `${plugin} js`, bin: wpScripts(plugin), args: ['test-unit-js'], cwd: dir });
494+
suites.push({
495+
label: `${plugin} js`,
496+
bin: 'npm',
497+
args: ['run', '--silent', 'test:unit:js'],
498+
cwd: dir,
499+
probe: wpScripts(plugin),
500+
});
492501
}
493502
return suites;
494503
}
@@ -527,7 +536,7 @@ function test(mode, files) {
527536
}
528537
for (const s of suites) {
529538
ranAny = true;
530-
ok = runUnit(s.label, s.bin, s.args, s.cwd) && ok;
539+
ok = runUnit(s.label, s.bin, s.args, s.cwd, s.probe) && ok;
531540
}
532541
}
533542
if (ok && !ranAny) out('✓ test: nothing to run.');
@@ -740,7 +749,7 @@ const loupeMode = scope === 'changed' && files.length ? 'all' : mode;
740749

741750
// Loudly surface any change to the gate's own rules — weakening a linter to pass
742751
// is legitimate sometimes, but it must never be silent. Not blocking; just seen.
743-
const RULE_FILES = /^(tools\/code-quality\/|.*\.phpcs\.xml\.dist$|.*\.eslintrc|.*\.stylelintrc)/;
752+
const RULE_FILES = /^(tools\/code-quality\/|.*\.phpcs\.xml\.dist$|.*\.eslintrc|(.*\/)?(eslint|jest|vitest)\.config\.[cm]?js$|.*\.stylelintrc)/;
744753
const touchedRules = files.filter((f) => [RULE_FILES, LOUPE_CONFIG].some((re) => re.test(f.split('\\').join('/'))));
745754
if (touchedRules.length) {
746755
note('⚠ gate rules modified — human review required:');

‎tools/package-plugin.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ FORBIDDEN_OUTSIDE_VENDOR="
7272
/composer\\.json
7373
/composer\\.lock
7474
/\\.eslintrc
75+
/eslint\\.config\\.
76+
/jest\\.config\\.
7577
/\\.phpcs
7678
"
7779

‎vip-workflows/.eslintrc.js‎

Lines changed: 0 additions & 39 deletions
This file was deleted.

‎vip-workflows/eslint.config.cjs‎

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/**
2+
* Local ESLint config.
3+
*
4+
* Extends the @wordpress/scripts default flat config (which `wp-scripts
5+
* lint-js` would otherwise apply on its own) and layers project-specific
6+
* overrides on top.
7+
*
8+
* - globals.browser: this is browser-targeted React code, so `localStorage`,
9+
* `navigator`, `FileReader`, `alert`, etc. are valid globals (clears
10+
* no-undef for them; `alert`/`confirm` are still governed by no-alert).
11+
* - jsdoc/no-undefined-types: register a few valid types the jsdoc plugin
12+
* doesn't recognize out of the box — `JSX` (React's JSX namespace, used in
13+
* `@return {JSX.Element}`) and the DOM globals `Node`/`ClipboardEvent`.
14+
* - no-console: allow `warn`/`error` (intentional diagnostics in catch
15+
* blocks); `console.log` debug calls are still disallowed.
16+
* - @wordpress/no-unsafe-wp-apis: off. Several controls we rely on are still
17+
* `__experimental*`-prefixed in @wordpress/components@32 (e.g.
18+
* `__experimentalToggleGroupControl` for segmented controls). We accept the
19+
* API-stability risk rather than hand-roll equivalents; revisit when these
20+
* stabilize.
21+
*
22+
* Test files: the default config applies Vitest rules to every `*.test.*` and
23+
* `*.spec.*` file. The unit suite runs on Jest (`wp-scripts test-unit-jest`)
24+
* and the e2e suite on Playwright, so each gets its own rules instead.
25+
*/
26+
const { createRequire } = require( 'module' );
27+
28+
const scriptsConfig = require( '@wordpress/scripts/config/eslint.config.cjs' );
29+
30+
// Resolve the lint plugins the way the default config does, through
31+
// @wordpress/scripts, rather than relying on npm hoisting them to the top.
32+
const fromScripts = createRequire(
33+
require.resolve( '@wordpress/scripts/package.json' )
34+
);
35+
const wpPlugin = fromScripts( '@wordpress/eslint-plugin' );
36+
const fromWpPlugin = createRequire(
37+
fromScripts.resolve( '@wordpress/eslint-plugin' )
38+
);
39+
const globals = fromWpPlugin( 'globals' );
40+
const jestPlugin = fromWpPlugin( 'eslint-plugin-jest' );
41+
42+
const UNIT_TESTS = [ 'tests/unit-js/**/*.js', 'src/**/*.test.js' ];
43+
const E2E_TESTS = [ 'tests/e2e/**/*.js' ];
44+
45+
// Every `vitest/*` rule the default config turns on, switched off.
46+
const vitestRulesOff = Object.fromEntries(
47+
scriptsConfig
48+
.flatMap( ( config ) => Object.keys( config.rules || {} ) )
49+
.filter( ( rule ) => rule.startsWith( 'vitest/' ) )
50+
.map( ( rule ) => [ rule, 'off' ] )
51+
);
52+
53+
module.exports = [
54+
...scriptsConfig,
55+
{
56+
languageOptions: {
57+
globals: globals.browser,
58+
},
59+
rules: {
60+
'jsdoc/no-undefined-types': [
61+
'error',
62+
{ definedTypes: [ 'JSX', 'Node', 'ClipboardEvent' ] },
63+
],
64+
'no-console': [ 'error', { allow: [ 'warn', 'error' ] } ],
65+
'@wordpress/no-unsafe-wp-apis': 'off',
66+
},
67+
},
68+
{
69+
files: UNIT_TESTS,
70+
...jestPlugin.configs[ 'flat/recommended' ],
71+
rules: {
72+
...vitestRulesOff,
73+
...jestPlugin.configs[ 'flat/recommended' ].rules,
74+
},
75+
},
76+
...wpPlugin.configs[ 'test-playwright' ].map( ( config ) => ( {
77+
...config,
78+
files: E2E_TESTS,
79+
} ) ),
80+
{
81+
files: E2E_TESTS,
82+
rules: vitestRulesOff,
83+
},
84+
];

‎vip-workflows/jest.config.js‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Jest config for the JS unit suite.
3+
*
4+
* `wp-scripts test-unit-js` runs Vitest from @wordpress/scripts 36 on, and
5+
* `wp-scripts test-unit-jest` hands over to this project's own Jest with no
6+
* WordPress defaults. This reproduces the config @wordpress/scripts used to
7+
* supply: the WordPress Jest preset (jsdom, the jest-console checks that fail
8+
* a test on an unexpected `console.error`, and its test file matching), with
9+
* Babel transforming JSX and ESM through the WordPress Babel preset.
10+
*/
11+
module.exports = {
12+
preset: '@wordpress/jest-preset-default',
13+
transform: {
14+
'\\.[jt]sx?$': [
15+
'babel-jest',
16+
{ presets: [ '@wordpress/babel-preset-default' ] },
17+
],
18+
},
19+
};

0 commit comments

Comments
 (0)