Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes linting across the monorepo (moving to ESLint v9 flat config) and applies a wide set of formatting/type-import fixes, with a few refactors in React hooks/components to satisfy stricter lint rules.
Changes:
- Introduces shared ESLint flat-config (
eslint.base.mjs) and per-packageeslint.config.mjs, plus workspacelintscripts. - Applies repo-wide lint-driven edits (type-only imports, trailing commas, object key ordering, arrow-function conversions, etc.).
- Refactors parts of
uix-host-reacthooks/components to address React hook dependency and lint constraints.
Reviewed changes
Copilot reviewed 70 out of 73 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/uix-host/src/utils/comparePackagesVersions.ts | Formatting changes to satisfy lint rules (expanded if blocks). |
| packages/uix-host/src/utils/compareExtensions.ts | Type-only imports + stable string sorting with localeCompare. |
| packages/uix-host/src/port.ts | Lint/format updates; minor refactors (regex exec, arrow typeguards, parameter commas). |
| packages/uix-host/src/port.test.ts | Lint/format updates and import reordering for mocked connectIframe. |
| packages/uix-host/src/metrics.ts | Lint cleanup and minor refactors in metrics wrapper + runtime polling formatting. |
| packages/uix-host/src/host.ts | Type-only imports and formatting; minor statement/arg ordering adjustments. |
| packages/uix-host/src/extensions-provider/mute.ts | Type-only import + trailing comma to satisfy lint rules. |
| packages/uix-host/src/extensions-provider/extension-registry.ts | Type-only imports + formatting; minor lint suppressions. |
| packages/uix-host/src/extensions-provider/extension-registry.test.ts | Test formatting changes and lint suppression for require. |
| packages/uix-host/src/extensions-provider/composition.ts | Type-only imports + simplified arrow return. |
| packages/uix-host/src/dom-utils/iframe-normalizers.ts | Type-only imports split + formatting adjustments. |
| packages/uix-host/src/dom-utils/iframe-normalizers.test.ts | Formatting fixes (trailing commas, blank lines). |
| packages/uix-host/src/dom-utils/attribute-normalizers.ts | Minor formatting (padding lines). |
| packages/uix-host/src/dom-utils/attribute-normalizers.test.ts | Import reordering + formatting. |
| packages/uix-host/src/debug-host.ts | Type-only imports split + formatting updates. |
| packages/uix-host/package.json | Adds lint script for package-local eslint runs. |
| packages/uix-host/eslint.config.mjs | Adds package ESLint flat-config entrypoint. |
| packages/uix-host-react/src/hooks/useHost.ts | Converts to export const + type-only import cleanup. |
| packages/uix-host-react/src/hooks/useExtensions.ts | Refactors memo/deps handling, subscriptions, and unload handling to satisfy hooks lint. |
| packages/uix-host-react/src/hooks/useExtensions.test.tsx | Import cleanup and formatting updates for lint. |
| packages/uix-host-react/src/hooks/useExtensionListFetched.ts | Converts to export const + type-only import cleanup. |
| packages/uix-host-react/src/extension-context.ts | Type-only import cleanup + formatting. |
| packages/uix-host-react/src/components/GuestUIFrame.tsx | Refactors connection/resizing effects; removes default export; adds memo/callback refs. |
| packages/uix-host-react/src/components/ExtensibleWrapper/UrlExtensionProvider.ts | Type-only imports + functional style conversions; formatting updates. |
| packages/uix-host-react/src/components/ExtensibleWrapper/UrlExtensionProvider.test.ts | Test updates (https URLs, formatting, import changes). |
| packages/uix-host-react/src/components/ExtensibleWrapper/ExtensionManagerProvider.ts | Type-only imports + functional style conversions; formatting updates. |
| packages/uix-host-react/src/components/ExtensibleWrapper/ExtensionManagerProvider.test.ts | Test restructuring/formatting + global fetch mocking adjustments. |
| packages/uix-host-react/src/components/ExtensibleWrapper/ExtensibleWrapper.tsx | Type-only imports + formatting; adjusts scope typing to Record<string,string>. |
| packages/uix-host-react/src/components/ExtensibleComponentBoundary.tsx | Type-only import cleanup + minor component formatting; react-refresh lint suppression. |
| packages/uix-host-react/src/components/Extensible.tsx | Refactors helper + effects/deps to satisfy hooks lint; removes default export. |
| packages/uix-host-react/src/components/Extensible.test.tsx | Formatting + lint suppressions (max-lines-per-function) and minor mock reshaping. |
| packages/uix-host-react/package.json | Adds lint script (with --fix). |
| packages/uix-host-react/eslint.config.mjs | Adds React-enabled package ESLint flat-config entrypoint. |
| packages/uix-guest/src/index.ts | Import ordering/type-only adjustments + formatting. |
| packages/uix-guest/src/guest.ts | Formatting + changes around timeouts and postMessage payload ordering. |
| packages/uix-guest/src/guest-ui.ts | Import splitting (type vs value) + formatting + declare ordering. |
| packages/uix-guest/src/guest-server.ts | Import ordering/type-only tweaks. |
| packages/uix-guest/src/debug-guest.ts | Type-only import split + formatting. |
| packages/uix-guest/package.json | Adds lint script for package-local eslint runs. |
| packages/uix-guest/eslint.config.mjs | Adds package ESLint flat-config entrypoint. |
| packages/uix-core/src/value-assertions.ts | Formatting + trailing commas. |
| packages/uix-core/src/types.ts | Formatting + trailing commas + generic formatting. |
| packages/uix-core/src/tunnel/tunnel.ts | Refactors cleanup placement + adds lint suppressions (random, ignored exceptions). |
| packages/uix-core/src/tunnel/tunnel.test.ts | Formatting + minor data object key ordering. |
| packages/uix-core/src/tunnel/tunnel-messenger.ts | Safer hasOwnProperty usage + type-only imports split + formatting. |
| packages/uix-core/src/tunnel/tunnel-messenger.test.ts | Formatting + trailing commas. |
| packages/uix-core/src/rpc/call-sender.ts | Formatting + adds max-params suppression; minor ordering changes. |
| packages/uix-core/src/rpc/call-sender.test.ts | Import cleanup + formatting; avoids deprecated matcher style warnings. |
| packages/uix-core/src/rpc/call-receiver.ts | Formatting + argument ordering in response tickets. |
| packages/uix-core/src/rpc/call-receiver.test.ts | Import cleanup + formatting. |
| packages/uix-core/src/remote-subject.ts | Import order/type-only adjustments + formatting. |
| packages/uix-core/src/promises/timed.ts | Formatting + trailing commas. |
| packages/uix-core/src/promises/promise-wrappers.test.ts | Formatting + avoids deprecated matcher style warnings. |
| packages/uix-core/src/object-walker.ts | Type cleanup and formatting; refines function type constraints. |
| packages/uix-core/src/object-simulator.ts | Refactors receiver/sender creation; adjusts binding/caching logic; formatting/lint suppressions. |
| packages/uix-core/src/object-simulator.test.ts | Snapshot/test updates due to simulator changes + formatting. |
| packages/uix-core/src/namespace-proxy.ts | Type-only import + formatting + minor key ordering. |
| packages/uix-core/src/message-wrapper.ts | Formatting + trailing commas. |
| packages/uix-core/src/logging-formatters.ts | Adds explicit ignored-exception suppression; formatting. |
| packages/uix-core/src/emitter.ts | Switches to type-only import + formatting + trailing commas. |
| packages/uix-core/src/debuglog.ts | Formatting and some property ordering changes; minor refactors. |
| packages/uix-core/src/debug-emitter.ts | Type-only imports split + formatting and payload ordering change. |
| packages/uix-core/src/cross-realm-object.ts | Formatting + explicit function casting; trailing commas. |
| packages/uix-core/src/mocks/mock-finalization-registry.ts | Adds jest global comment + lint suppression for static mock. |
| packages/uix-core/src/helpers/jest.messagechannel.cjs | Adds eslint-disable header for CJS require + node globals. |
| packages/uix-core/package.json | Adds lint script for package-local eslint runs. |
| packages/uix-core/eslint.config.mjs | Adds package ESLint flat-config entrypoint. |
| package.json | Adds workspace lint runner + upgrades eslint/prettier toolchain deps to support flat config. |
| eslint.base.mjs | New shared ESLint flat configuration factory used by packages. |
| e2e/all-versions/host-app/package-lock.json | Updates resolved registry URLs for e2e lockfile dependencies. |
| e2e/all-versions/guest-app/package-lock.json | Updates resolved registry URLs for e2e lockfile dependencies. |
| .eslintrc.cjs | Removes legacy ESLint config in favor of flat config. |
Files not reviewed (2)
- e2e/all-versions/guest-app/package-lock.json: Language not supported
- e2e/all-versions/host-app/package-lock.json: Language not supported
Comments suppressed due to low confidence (2)
packages/uix-guest/src/guest.ts:263
invokeAwaiter()sets a timeout whose callback returnsPromise.reject(...), but that rejection is not wired to the returned promise (and can become an unhandled rejection when the timer fires). As written, the timeout never rejects the operation. Implement this as a real timeout (e.g.,Promise.racebetweeninvokeChecker(...)and a promise that rejects in the timer, with properclearTimeoutinfinally), or remove this timer iftimeoutPromisealready enforces the desired limit.
packages/uix-host/src/extensions-provider/extension-registry.ts:149extensionRegistryExtensionsProvider()has an unreachablereturn Promise.resolve({});after already returning thefetchExtensionsFromRegistry(...).then(...)chain. This is dead code and can be removed to avoid confusion (and potential lint warnings about unreachable code).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const depsKey = JSON.stringify(deps); | ||
| const { | ||
| requires, | ||
| provides, | ||
| requires, | ||
| updateOn = "each", | ||
| } = useMemo(() => configFactory(host), baseDeps); | ||
|
|
||
| } = useMemo( | ||
| () => | ||
| host | ||
| ? configFactory(host) | ||
| : ({} as UseExtensionsConfig<Incoming, Outgoing>), | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps | ||
| [host, depsKey], | ||
| ); |
There was a problem hiding this comment.
depsKey is derived via JSON.stringify(deps), which can throw on circular values and also collapses non-serializable deps (e.g., functions become null in arrays). That can cause the hook to stop re-running configFactory when deps actually change, or crash at runtime for certain deps. Prefer using the deps array directly in the dependency list (and require callers to pass stable deps), or compute a safe/stable key that won't throw (e.g., join of primitives) and document the constraint.
| ); | ||
|
|
||
| this.subject.onOutOfScope(fnTicket, cleanup); | ||
| this.receiverTicketCache.set(boundFunction, fnTicket); |
There was a problem hiding this comment.
makeReceiver() looks up receiverTicketCache using the original fn, but stores the ticket using boundFunction as the key. When parent is provided, subsequent visits will call get(fn) again (miss) and create a new ticket each time, which breaks stability/caching of function IDs and can create multiple receivers for the same method. Either always cache by the original fn, or if binding is required, compute the cache key consistently (e.g., look up/store using the same boundFunction value).
| this.receiverTicketCache.set(boundFunction, fnTicket); | |
| this.receiverTicketCache.set(fn, fnTicket); |
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: