Skip to content

build: migrate Nx to 23.1.1 and fix all lint errors - #6

Merged
BioPhoton merged 8 commits into
mainfrom
migrate-nx-to-latest
Aug 18, 2026
Merged

build: migrate Nx to 23.1.1 and fix all lint errors#6
BioPhoton merged 8 commits into
mainfrom
migrate-nx-to-latest

Conversation

@BioPhoton

Copy link
Copy Markdown
Contributor

Migrates the workspace from Nx 21.0.3 to 23.1.1 and brings nx run-many -t lint to zero errors across all 14 projects.

Commits

  • 54048a3 build: migrate nx 21.0.3 to 23.1.1
  • 74acee0 fix(lint): resolve all eslint errors across workspace

Lint fixes

Auto-fixed via --fix: prefer-const, no-inferrable-types, and @nx/dependency-checks in the four @dummy/pkg-* projects.

By hand:

Issue Fix
no-empty-function (nx-perf) Dropped () => {} callback defaults, call sites use optional chaining
no-empty-function (test setup) mockImplementation(() => undefined)
functional/no-let "rule not found" Removed stale disable comments — eslint-plugin-functional is not installed
no-unused-expressions a && b()if blocks / optional calls
{} empty-object type CommandModule<object, …>
no-control-regex Single removeColorCodes helper with one disable, matching the existing idiom in testing-utils
no-useless-escape Unescaped " inside a regex
Parsing error on testing/utils/vitest.unit.config.ts Added vitest config globs to tsconfig.spec.json
@nx/enforce-module-boundaries Relative cross-project imports rewritten to package names

Two things worth reviewing

The --fix for @nx/dependency-checks made a bad call on cpu-prof — it promoted vitest, vite, and @push-based/testing-vitest-setup into the published package's runtime dependencies because they are only used in vitest config files. That was reverted; instead vitest.*.config.* is added to ignoredFiles in packages/cpu-prof/eslint.config.mjs. The fix did correctly drop the genuinely-unused strip-ansi.

Fixing the module boundaries exposed a latent bug. The testing/* packages were never listed in npm workspaces, so @push-based/testing-* never linked into node_modules — the rewritten imports failed to resolve, and so did a pre-existing @push-based/testing-utils import in cpu-prof's unit test. This PR registers testing/* as workspaces and aligns those packages' vitest/typescript versions with the root (they pinned vitest@^1.3.1 and typescript@5.6.3, which installed stale nested copies and broke testing-vitest-setup:typecheck). Requires the lockfile change and an nx sync for TS project references.

Verification

  • Lint: 0 errors, 14/14 projects (48 warnings remain, all pre-existing no-explicit-any / no-unused-vars)
  • Build: 10/10 projects succeed
  • Unit tests: 142/142 pass
  • Typecheck: 58 errors vs. a 59-error pre-existing baseline (diffed against a stashed tree) — zero new, one fixed. Typecheck was already broken on this branch; those failures are not addressed here.

Pre-existing issues found but left alone

  • The e2e suite's include glob is src/**/*.e2e.test.ts but its tests live in test/the e2e tests never run. Import rewrites there were verified by importing the packages directly instead.
  • testing/utils and cpu-prof-e2e declare "executor": "@nx/vitest:vitest", which does not exist (valid name is @nx/vitest:test), so nx run-many -t unit-test fails to resolve.

Run `nx migrate latest` and apply 32 automated migrations.

- @nx/* -> 23.1.1, typescript -> 6.0.3, vite -> 8.2.1, jest -> 30.3.0
- bump @types/node, esbuild and typescript-eslint to satisfy the new
  peer ranges required by vite 8 and typescript 6
- replace vitest.workspace.ts with vitest.config.ts test.projects
- add ignoreDeprecations: "6.0" and explicit rootDir to tsconfigs
- sync typescript project references via `nx sync`

Fix a pre-existing bad reference path in testing/vitest-setup that
resolved outside the repo, and regenerate the merged-profile snapshot
for the new pretty-format trailing-comma output (content unchanged).

Build, unit tests and integration tests pass. Pre-existing typecheck
and lint failures in cpu-prof and dummy/app-1 are unaffected.
Bring `nx run-many -t lint` to zero errors across all 14 projects.

Code fixes:
- drop no-op callback defaults in nx-perf, use optional chaining
- replace empty arrow mock implementations with `() => undefined`
- remove stale `functional/no-let` disables (plugin is not installed)
- convert `a && b()` statements to if-blocks / optional calls
- widen `CommandModule<{}, T>` to `CommandModule<object, T>`
- unescape needless quotes, centralise the ANSI-stripping regex
- rewrite relative cross-project imports to package names

Config fixes:
- include vitest config files in testing/utils tsconfig.spec.json so the
  type-aware parser can resolve them
- ignore vitest.*.config.* in cpu-prof dependency-checks instead of
  promoting vitest/vite into the published package's dependencies
- register testing/* as npm workspaces so @push-based/testing-* actually
  link into node_modules, and align their vitest/typescript versions with
  the root to avoid stale nested installs

Verified: lint 0 errors, build 10/10, unit tests 142/142, typecheck
unchanged at the pre-existing 59-error baseline (58, no new errors).
Copilot AI lite review requested due to automatic review settings August 18, 2026 21:40
actions/checkout v4 -> v7, actions/setup-node v4 -> v7 and
nrwl/nx-set-shas v4 -> v5. The v4 releases run on the deprecated
Node.js 20 action runtime and were being force-run on Node.js 24 by
the runner.

Note: the node-version: 20 input is the Node the build itself runs
on, which is a separate concern and left unchanged.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request migrates the monorepo to Nx 23.1.1 and updates related tooling (Vitest/Vite/TypeScript configs) while applying a workspace-wide lint autofix + targeted lint corrections to reach zero lint errors.

Changes:

  • Upgrade Nx (and related tooling) to 23.1.1 and update workspace configuration/migrations.
  • Update TypeScript/Vitest/Vite configuration across packages (including TS6 ignoreDeprecations, Vitest config/workspace changes, and Vite 8 rolldownOptions migration).
  • Resolve eslint errors and update cross-project imports to use workspace package names.

Reviewed changes

Copilot reviewed 92 out of 95 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vitest.workspace.ts Remove legacy Vitest workspace file.
vitest.config.ts Add root Vitest config with workspace projects globs.
tsconfig.json Add TS6 ignoreDeprecations at root.
tsconfig.base.json Update base TS compiler options for TS6 migration.
testing/vitest-setup/vite.config.ts Migrate Vite build option to rolldownOptions.
testing/vitest-setup/tsconfig.spec.json Fix TS references and add TS6 rootDir.
testing/vitest-setup/tsconfig.lib.json Add TS6 ignoreDeprecations.
testing/vitest-setup/tsconfig.json Add TS6 ignoreDeprecations.
testing/vitest-setup/package.json Align Vitest version; add development export condition.
testing/utils/vitest.unit.config.ts Switch to workspace package import for shared config.
testing/utils/vitest.integration.config.mts Switch to workspace package import for shared config.
testing/utils/vite.config.ts Migrate Vite build option to rolldownOptions.
testing/utils/tsconfig.spec.json Include vitest config globs; add TS6 rootDir.
testing/utils/tsconfig.lib.json Add TS6 ignoreDeprecations.
testing/utils/tsconfig.json Add TS6 ignoreDeprecations and adjust references.
testing/utils/src/lib/execute-process.ts Optional-call cleanup; remove stale eslint disables.
testing/utils/package.json Bump TypeScript dependency; (still contains Nx vitest executors).
testing/setup/tsconfig.spec.json Add TS6 rootDir.
testing/setup/tsconfig.lib.json Add TS6 ignoreDeprecations.
testing/setup/tsconfig.json Add TS6 ignoreDeprecations.
testing/setup/src/console.setup-file.ts Replace empty mock fns with () => undefined.
testing/setup/package.json Align Vitest version.
packages/nx-perf/tsconfig.spec.json Add TS6 rootDir + ignoreDeprecations.
packages/nx-perf/tsconfig.lib.json Add TS6 ignoreDeprecations.
packages/nx-perf/tsconfig.json Add TS6 ignoreDeprecations.
packages/nx-perf/src/utils.ts Remove empty default callbacks; use optional chaining calls.
packages/cpu-prof/vitest.unit.config.ts Switch to workspace package import for shared config.
packages/cpu-prof/vitest.integration.config.ts Switch to workspace package import for shared config.
packages/cpu-prof/tsconfig.tsbuildinfo Remove generated TS build info from repo.
packages/cpu-prof/tsconfig.lib.json Add TS6 ignoreDeprecations; add new project references.
packages/cpu-prof/tsconfig.json Add TS6 ignoreDeprecations; adjust references.
packages/cpu-prof/src/lib/merge-cpuprofile-files.unit.test.ts Replace empty mock with () => undefined.
packages/cpu-prof/src/lib/execute-process.ts Remove stale eslint disables for let.
packages/cpu-prof/src/lib/snapshots/merge-cpu-profile-files-merged-profile.json Update file snapshot formatting/content.
packages/cpu-prof/src/index.ts Export execute-process from package entrypoint.
packages/cpu-prof/src/cli/utils.ts Prefer-const/no-inferrable-types lint fix.
packages/cpu-prof/src/cli/commands/trace-reduce/index.ts Use CommandModule<object, …> for empty object type rule.
packages/cpu-prof/src/cli/commands/merge/index.ts Use CommandModule<object, …> for empty object type rule.
packages/cpu-prof/src/cli/commands/merge/args-processor.ts Prefer const destructure.
packages/cpu-prof/src/cli/commands/measure/builder.ts Use CommandModule<object, …> for empty object type rule.
packages/cpu-prof/src/cli/commands/cpu-merge/index.ts Use CommandModule<object, …> for empty object type rule.
packages/cpu-prof/src/cli/commands/cpu-merge/handler.ts Replace unused expressions with explicit if blocks.
packages/cpu-prof/src/cli/commands/cpu-merge/args-processor.ts Prefer const destructure.
packages/cpu-prof/src/cli/commands/cpu-measure/handler.ts Prefer const for derived error message.
packages/cpu-prof/src/cli/commands/cpu-measure/builder.ts Use CommandModule<object, …> for empty object type rule.
packages/cpu-prof/package.json Switch to @nx/vitest:test; drop unused strip-ansi.
packages/cpu-prof/eslint.config.mjs Ignore vitest.* config files for dependency checks.
packages/cpu-prof-e2e/vitest.e2e.config.ts Switch to workspace package import for shared config.
packages/cpu-prof-e2e/tsconfig.spec.json Add TS6 rootDir + ignoreDeprecations.
packages/cpu-prof-e2e/tsconfig.lib.json Add TS6 ignoreDeprecations.
packages/cpu-prof-e2e/tsconfig.json Add TS6 ignoreDeprecations; adjust references.
packages/cpu-prof-e2e/test/help-command.e2e.test.ts Import from package; regex escape cleanup.
packages/cpu-prof-e2e/test/cpu-merge-command.e2e.test.ts Import from package.
packages/cpu-prof-e2e/test/cpu-measure-command.e2e.test.ts Import from package; centralize color-code stripping.
package.json Upgrade Nx toolchain; add testing/* workspaces.
nx.json Reformat inputs; update vitest target defaults (executor still needs fix).
migrations.json Update Nx migrations list to 23.1.1 migration set.
dummy/pkg-4/vite.config.ts Migrate Vite build option to rolldownOptions.
dummy/pkg-4/tsconfig.spec.json Add TS6 rootDir + ignoreDeprecations.
dummy/pkg-4/tsconfig.lib.json Add TS6 ignoreDeprecations.
dummy/pkg-4/tsconfig.json Add TS6 ignoreDeprecations.
dummy/pkg-4/package.json Add tslib dependency.
dummy/pkg-3/tsconfig.spec.json Add TS6 rootDir + ignoreDeprecations.
dummy/pkg-3/tsconfig.lib.json Add TS6 ignoreDeprecations.
dummy/pkg-3/tsconfig.json Add TS6 ignoreDeprecations.
dummy/pkg-3/package.json Add tslib dependency.
dummy/pkg-3/jest.config.ts Remove blanket eslint-disable header.
dummy/pkg-2/tsconfig.spec.json Add TS6 rootDir + ignoreDeprecations.
dummy/pkg-2/tsconfig.lib.json Add TS6 ignoreDeprecations.
dummy/pkg-2/tsconfig.json Add TS6 ignoreDeprecations.
dummy/pkg-2/package.json Swap runtime helper dependency to tslib.
dummy/pkg-2/jest.config.ts Remove blanket eslint-disable header.
dummy/pkg-1/tsconfig.spec.json Add TS6 rootDir + ignoreDeprecations.
dummy/pkg-1/tsconfig.lib.json Add TS6 ignoreDeprecations.
dummy/pkg-1/tsconfig.json Add TS6 ignoreDeprecations.
dummy/pkg-0/vite.config.ts Migrate Vite build option to rolldownOptions.
dummy/pkg-0/tsconfig.spec.json Add TS6 rootDir + ignoreDeprecations.
dummy/pkg-0/tsconfig.lib.json Add TS6 ignoreDeprecations.
dummy/pkg-0/tsconfig.json Add TS6 ignoreDeprecations.
dummy/pkg-0/package.json Add tslib dependency.
dummy/pkg-0/jest.config.ts Remove blanket eslint-disable header.
dummy/app-1/tsconfig.json Add TS6 ignoreDeprecations.
dummy/app-1/tsconfig.app.json Add TS6 ignoreDeprecations.
dummy/app-0/tsconfig.spec.json Add TS6 rootDir + ignoreDeprecations.
dummy/app-0/tsconfig.json Add TS6 ignoreDeprecations.
dummy/app-0/tsconfig.app.json Add TS6 ignoreDeprecations.
dummy/app-0/jest.config.ts Remove blanket eslint-disable header.
dummy/app-0-e2e/tsconfig.json Add TS6 rootDir + ignoreDeprecations.
dummy/app-0-e2e/src/support/test-setup.ts Remove blanket eslint-disable header.
dummy/app-0-e2e/src/support/global-teardown.ts Remove blanket eslint-disable header.
dummy/app-0-e2e/jest.config.ts Remove blanket eslint-disable header.
.prettierignore Ignore new Nx self-healing folder.
.gitignore Ignore Nx/Claude migration artifacts folders.
Suppressed comments (2)

nx.json:88

  • @nx/vitest:vitest is not a valid executor (the vitest target executor is @nx/vitest:test). This will cause integration-test to fail to resolve/run via Nx.
    nx.json:93
  • @nx/vitest:vitest is not a valid executor (the vitest target executor is @nx/vitest:test). This will cause e2e-test to fail to resolve/run via Nx.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread nx.json Outdated
Comment thread testing/utils/package.json Outdated
Adds a `test` job running `nx affected -t unit-test integration-test`.

Two fixes were required to make those targets runnable at all:

- testing-utils and cpu-prof-e2e declared the executor
  `@nx/vitest:vitest`, which does not exist, so the targets failed to
  resolve. Corrected to `@nx/vitest:test`.
- testing-utils passed its vitest configs as project-relative paths, but
  the executor resolves `config` from the workspace root. Prefixed both
  with `testing/utils/`.

Also drops `test` from the main job's affected list: no project defines
a `test` target, so it silently matched nothing and no tests ever ran in
CI.

Verified after a clean `npm ci`: unit-test and integration-test pass for
cpu-prof (142 + 4) and testing-utils (5).
- Replace invalid @nx/vitest:vitest executor with @nx/vitest:test in
  unit-test, integration-test and e2e-test target defaults (nx.json)
- Pin typescript to exact 6.0.3 in testing/utils to match root and
  avoid nested TypeScript installs

Addresses Copilot review comments on PR #6.
Folds the test targets into the existing affected run rather than
standing up a separate job, so they share the one checkout, install and
SHA setup:

  npx nx affected -t lint unit-test integration-test build

Replaces the separate `test` job added in ff873cf.
The unit-test, integration-test and e2e-test targetDefaults reference a
`testFixtures` input that was never declared in namedInputs, so every
run of those targets aborted with "testFixtures is an invalid fileset".
Declares it as {projectRoot}/mocks/**/*.

Also refreshes package-lock.json for the exact typescript pin in
testing/utils.
Add a `nx format:check` step (id: format-check) to the main CI job so
formatting drift fails the pipeline.

The `/__snapshots__` entry in .prettierignore was root-anchored, so it
never matched nested snapshot dirs. `nx format:write` therefore
reformatted packages/cpu-prof/src/lib/__snapshots__, breaking the
toMatchFileSnapshot assertion. Drop the leading slash so it matches at
any depth, and apply the resulting formatting to the remaining files.
@BioPhoton
BioPhoton merged commit 5019417 into main Aug 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants