base red: the old-host close-script test runs the script with node:vm, not new Function (tip web-lint red from 419a87a14791)
Summary
The feat-cmux-next tip (eb0bda4f10b3 and later) is red in web lint: vp lint and vp check --no-fmt --no-lint in webviews/ bun run check refuse the two new Function(...) calls that 419a87a14791 (#32704) added to webviews/test/native-session-info-toggle.test.tsx. The rule is Oxlint typescript(no-implied-eval). This is a lint finding, so the base autofix does not repair it.
The fix keeps the test's intent and does not change the lint config or add a disable comment. It uses node:vm, the pattern webviews/test/gallery-web-theme-bootstrap.test.ts already uses for host scripts:
new vm.Script(broken)still throwsSyntaxErrorfor the pre-#32673?.action?(form.new vm.Script(script).runInNewContext({ window: { cmuxAcpmuxSessionInfo: bridge } })runs the real host script against the page bridge.
Test-only. No product code changes.
Lint output
Before (base d4736b0d3b0, cd webviews && bun run check):
==> vp lint
test/native-session-info-toggle.test.tsx:249:16: warning typescript(no-implied-eval): Implied eval. Do not use the Function constructor to create functions.
test/native-session-info-toggle.test.tsx:251:15: warning typescript(no-implied-eval): Implied eval. Do not use the Function constructor to create functions.
==> vp check --no-fmt --no-lint
Found 0 errors and 2 warnings in 4034 files (9.4s, 360 threads)
2 red:
vp lint
vp check --no-fmt --no-lint
error: script "check" exited with code 1
After (this head):
==> vp lint
==> vp check --no-fmt --no-lint
pass: Found no type errors in 4034 files (14.7s, 360 threads)
==> bun run acpmux-protocol:check
acpmux protocol generated code is current
exit 0
scripts/web-lint.sh: web lint passed in 26.1s (webviews). python3 scripts/cmux-next/prepush-gate.py: no new violations.
Observed / Not run
Observed:
cd webviews && bun test test/native-session-info-toggle.test.tsx: 5 pass, 0 fail.- With
window: {}in place of the bridge, the close-script test fails (1 fail), so the test still proves the script reaches the page. bun run checkinwebviews/: exit 1 on the base, exit 0 on this head.
Not run: no Swift or app build (test-only change in webviews/test/).
Changelog
none
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the web-lint red on the feat-cmux-next tip by replacing new Function(...) calls in the old-host close-script test with node:vm.
new vm.Script still throws SyntaxError for the pre-#32673 ?.action?( form, and the real host script still runs against the page bridge via runInNewContext. Test-only change; no product code touched.