chore: fix all ESLint + tsc --noEmit errors#3
Merged
Conversation
Runs `eslint --fix` for the 284 auto-fixable style issues (indent, curly, jsdoc alignment, etc.) and hand-fixes the remaining 10: - Drop unused `DesktopConfig` import in ai-assistant.ts. - Replace `document.activeElement` with `this._el.ownerDocument.activeElement` in three spots (AiAssistant.open() + the focus trap) to satisfy `@wordpress/no-global-active-element`. - Convert `this._isOpen ? this.close() : this.open()` to an if/else. - Flatten the nested ternary that picks the entity-card dashicon. - Disable `no-alert` on the single intentional `window.confirm()` with an inline reason — the default impl is meant to be swapped. - Rename a local that shadowed the `registry` import in desktop.ts, and rename a type-signature parameter that shadowed `body`. - Add the parent `@param options` JSDoc line missing from WindowManager.closeAll so `options.exceptIds` has somewhere to hang. No runtime behavior change; pre-existing TypeScript errors are unchanged (5 before, 5 after).
Four TypeScript errors were tripping the workflow's type-check step: - `ai-assistant.ts`: drop the `_unsubCommands` field. It was assigned in the constructor but never read, so `noUnusedLocals` flagged it. The panel is a page-lifetime singleton; `subscribeCommands()` can run for side-effect only and die with the page. - `ai-assistant.ts`: rename the unused `cmd` parameter in `_renderCommandResult` to `_cmd` so it clears `noUnusedParameters`. - `ai-assistant.ts`: the silent-success branch called a non-existent `this._clearResults()`. Replace with the two-line clear+hide inline — that matches how every other branch in the file shows/hides `_resultsEl`. - `types.ts`: `NativeWindowDef` inherited `x`/`y` as required from `WindowConfig`, but `NativeWindowServerEntry` never supplies them and `createRegisterWindow` already nullish-coalesces with `?? 0`. Omit `x`/`y` from the `extends` clause and redeclare them as optional — the type now matches the runtime.
The old lockfile held only macOS-arm64 entries for `@esbuild/*`, so CI's Linux runner couldn't resolve them and `npm ci` bailed with "Missing: @esbuild/linux-x64@0.28.0 from lock file" (and 20+ more). A clean `npm install` writes the lockfile with every platform's optional binary, which is what npm 7+ expects.
Same fix as fix/php-tests 66cc8c5 — `npm install` on Node 24 / npm 11 leaves ~28 `@esbuild/<platform>` optional-binary entries marked `"extraneous": true` in the lockfile. CI's `npm ci` (Node 20) refuses those because the platform metadata doesn't match Linux x64, even though they're nominally optional. `npm prune` drops the extras cleanly.
Replace the previous Mac-generated (and partially-pruned) lockfile with one written by npm 10 on node:20-alpine via Docker. That matches CI's runtime exactly, so `npm ci` on the Linux runner stops choking on stray `"extraneous": true` entries and missing platform binaries. Verified locally via `npm ci` (read-only install from this lockfile) on macOS — Vitest all-green, lockfile unchanged.
…dentation
The WP/ESLint indent rule has JSX-aware smarts that preserve ternary
indentation in `prop={ cond ? x : y }` shapes, but no equivalent for
tagged-template DSLs. Inside `` html`...${ cond ? x : y }...` `` it
treats the interpolation as a plain JS ConditionalExpression and
aligns it to the enclosing block — which flattens ternaries against
the left margin and loses the author's visual alignment with the
surrounding template.
Add `ignoredNodes: [ 'TemplateLiteral *' ]` to the indent rule so
ESLint stops reformatting content inside template literals. Also add
`SwitchCase: 1` (the WP convention) while we're there to match
what's expected in regular switch statements.
Then restore the visually-nicer ternary indentation that the first
`eslint --fix` run flattened in the affected src/ files.
Also gitignore /vendor so the Composer deps (for PHP tests on the
other branch) don't accidentally get staged.
No runtime change. ~360 Vitest tests still green; `tsc --noEmit`
still clean.
bd3300a to
907b179
Compare
AllTerrainDeveloper
approved these changes
Apr 23, 2026
AllTerrainDeveloper
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Works locally as expected too 👍
9 tasks
This was referenced May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CI's
jslane was failing because trunk carried 294 ESLint errors and 5 TypeScript errors. This branch cleans both to zero.eslint --fixhandled 284 mechanical issues (indent, curly, jsdoc alignment). The remaining 10 are hand-fixed: drop an unusedDesktopConfigimport, swap threedocument.activeElementcalls forthis._el.ownerDocument.activeElement(satisfies@wordpress/no-global-active-element), convert a ternary-as-statement toif/else, flatten a nested ternary, rename shadowedregistryand type-parameterbody, disableno-alerton the one intentionalwindow.confirm()with an inline reason, and add the missing parent@param optionsJSDoc line._unsubCommandsfield (panel is page-lifetime, subscription dies with the page); rename unusedcmdparameter to_cmd; replace a call to the nonexistentthis._clearResults()with inline clear+hide; makex/yoptional onNativeWindowDef(server-declared native windows never set them, andcreateRegisterWindowalready nullish-coalesces with?? 0— the type was out of sync with runtime).No runtime behavior changes — both commits are type-/style-only.
Test plan
jsjob on CI: ESLint,tsc --noEmit, and Vitest all greennpm run lintlocally: 0 errorsnpx tsc --noEmitlocally: 0 errors