Skip to content

build: update Nx to 24 - #11684

Merged
NathanWalker merged 8 commits into
mainfrom
chore/nx-24
Nov 28, 2026
Merged

NathanWalker merged 8 commits into
mainfrom
chore/nx-24

Conversation

@NathanWalker

@NathanWalker NathanWalker commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

#11588 (chore/typescript-6) moves the workspace to TypeScript 6.0.3 on Nx 22.7.12. This PR targets that branch to help finish it. It contains only the Nx 24 changes on top of it.

What is the new behavior?

Nx 22.7.12 → 24.0.7. TypeScript stays at 6.0.3; TypeScript 7 is out of scope. Everything from #11588 is kept, and its approach is kept too: no ignoreDeprecations anywhere.

Moving to Nx 24 brings two required changes:

  1. ESLint 9. @nx/eslint 23.1 and later require ESLint 9 or 10, so ESLint goes from 8.57 to 9.39 and the configs move to flat config.
  2. Inferred tasks. Nx 24 removes the @nx/eslint, @nx/jest and @nx/vitest executors, so lint and test become tasks inferred by Nx plugins.

Versions

Package Before After Why
nx, @nx/* 22.7.12 24.0.7 Goal of this PR. @nx/eslint is now a direct devDependency, because nx migrate only collects migrations for packages listed in package.json.
@nativescript/nx ^22.0.0 ^24.0.0 22.x requires nx ^22. 24.0.0 is the plugin release for Nx 24 (NativeScript/nx#90).
eslint ~8.57.0 ~9.39.5 Required by @nx/eslint 23.1+. ESLint 9 is the version the Nx migration targets; ESLint 10 is not used yet.
typescript-eslint (none) ^8.74.0 Required by the flat configs in @nx/eslint-plugin.
@typescript-eslint/eslint-plugin, @typescript-eslint/parser ^8.72.0 ^8.74.0 Kept in line with typescript-eslint.
jest 30.0.5 30.3.0 Package update from the Nx 24 migration (same major).

Notable resolved versions in the lockfile:

  • eslint and @eslint/js: 8.57.1 → 9.39.5
  • @eslint/eslintrc: 2.1.4 → 3.3.7
  • eslint-config-prettier: 10.1.5 → 10.1.8
  • @typescript-eslint/*: 8.72.0 → 8.74.0
  • jest, babel-jest, jest-environment-node and the other @jest/*: 30.0.5 → 30.3.0
  • @babel/core: 7.28.3 → 7.29.13
  • The nested TypeScript 5.9.3 under @nx/eslint is gone. The only remaining nested copy is the nativescript CLI's 5.7.3.

These did not change: vite 8.0.2, vitest 4.0.9, rolldown, esbuild, ts-jest 29.4.15, typescript 6.0.3.

About the lockfile: npm could not reconcile the old @nx/eslint 22 peer edges ("ERESOLVE … Conflicting peer dependency: @nx/eslint@24.0.7"). The same package.json resolves cleanly from scratch, so the 24 nx, @nx/* and @nativescript/nx lockfile entries were removed and re-resolved. Nothing else was regenerated, and there are no overrides or --legacy-peer-deps. Net lockfile change: 205 packages added, 47 removed, 123 changed.

Commits

  1. build: update Nx to 24.0.7: dependencies and lockfile, plus .nx/migrate-runs added to .gitignore (an Nx 23 migration).
  2. build: migrate ESLint to v9 flat config:
    • Each .eslintrc.json becomes an eslint.config.mjs written directly on the @nx/eslint-plugin flat configs, with the existing overrides. The FlatCompat / @eslint/eslintrc shim the generator produced is not used.
    • @typescript-eslint/ban-types is removed: typescript-eslint 8 dropped it, and its successors are already off.
    • packages/core intentionally has no eslint.config.mjs. The core build copies every *.mjs in the package to dist, and the vite HMR core bundle imports every top-level *.mjs. An eslint config there broke hmr/server/core-bundle.spec.ts and would have been published inside @nativescript/core. Core's ignores live in the root config instead. They also keep core's lint scope at TypeScript files and JS specs (the old lintFilePatterns).
    • The JSON override moved to tools/workspace-plugin, the only project that lints JSON.
  3. build: keep project-level nx affected selection: sets affected.legacy: true, the Nx 24 migration's default. secure_nx_release.yml relies on nx show projects --affected.
  4. build: move lint and test to Nx inferred tasks: adds an nx.json plugins block (@nx/eslint/plugin, @nx/vitest, @nx/jest/plugin).
    • Each plugin has an include list naming exactly the projects that had that target before.
    • The eslint plugin matches only each project's root files. Otherwise nested package.json folders (core's css/, easysax/ and global-polyfills/, and several apps/automated/src test folders) would become new projects.
    • @nx/vitest uses testMode: run, which keeps run-once vitest run. --watch still switches to watch mode.
    • The ci configuration and passWithNoTests from the old @nx/jest:jest target defaults moved onto workspace-plugin's project.json.
    • Result: project names, target names and configuration names are identical to the base branch.
  5. build(core): drop the Nx vite config helpers removed in Nx 24: nxViteTsPaths → resolve.tsconfigPaths. nxCopyAssetsPlugin(['*.md']) is removed rather than replaced: it only ran on a vite build, and core builds with @nx/js:tsc.
  6. build: load the workspace-plugin jest config as CommonJS: the inferred jest task runs the plain jest CLI. That CLI can't load an export default jest.config.ts in a CommonJS package, and its ts-node fallback fails on TypeScript 6's node10 deprecation. Switching to module.exports matches Nx's own convert-jest-config-to-cjs migration. It needs Node with type stripping (22.18+ or 23.6+).
  7. build: rename vitest.workspace.ts to vitest.config.ts: Vitest 4 no longer reads vitest.workspace.* files. A root npx vitest run now runs the core and vite projects again (209 files).

Migrations (run with nx migrate --run-migrations --agentic=false; migrations.json restored to the base version)

Code migrations that made changes:

  • @nx/eslint:update-23-1-0-convert-to-flat-config: rewritten by hand (see commit 2).
  • @nx/eslint:update-23-1-0-remove-removed-typescript-eslint-extension-rules: dropped @typescript-eslint/no-extra-semi from vite's config. Kept.
  • @nx/js:23-1-0-add-ignore-deprecations-for-ts6: added ignoreDeprecations: "6.0", esModuleInterop: false, noUncheckedSideEffectImports: false and types: ["*"] to 13 tsconfigs. Reverted entirely: build: update to TypeScript 6 #11588 fixes these deprecations rather than silencing them, and every build and test passes without them.
  • nx:24-0-0-enable-legacy-affected: kept (commit 3).
  • @nx/eslint, @nx/jest and @nx/vite remove-deprecated-executors: rewritten by hand (commit 4). The generators turned lintFilePatterns into args that eslint . ignored, reordered keys in every project.json, and left a redundant coverage.reportsDirectory override (vitest already sets it in its config).
  • @nx/vite:update-24-0-0-migrate-config-helpers: kept, then finished (commit 5).

No changes:

  • Import rewrites: devkit deep imports, @nx/* internal subpaths, createNodesV2 renames, the @nx/workspace typescript import.
  • nx:23-0-0-add-migrate-runs-to-git-ignore: already applied in commit 1.
  • @nx/js:23-1-0-set-tsconfig-root-dir-for-ts6.
  • @nx/vitest:update-23-2-0-use-import-meta-dirname.
  • nx:23-2-0-set-cache-on-executor-target-defaults.
  • The two pnpm cache-input migrations.
  • nx:24-0-0-move-custom-hashers-to-inputs.
  • nx:24-0-0-rename-ultracache-ignore-options.
  • @nx/jest: snapshot link update, setupFile and skipSetupFile migrations, jestProjectGenerator rewrite, set-ts-jest-isolated-modules (applies only to TypeScript < 6).
  • @nx/vite: rolldownOptions rename, vitest-package safety net, migrate-to-vitest-3 and migrate-to-vitest-4 generators, register-typescript-plugin-for-typecheck, add-ready-signal-plugin.
  • @nx/vitest:remove-deprecated-executors.
  • @nx/eslint:update-24-0-0-replace-set-parser-options-project.
  • @nx/web:update-24-0-0-add-ready-when-signal.

The 11 AI-prompt migrations:

Prompt Outcome
@nx/vite ai-instructions-for-vite-8 Not applicable: #11588's base is already on Vite 8, and there are no rollupOptions or other Vite 8 breaking patterns.
@nx/vite migrate-to-vitest-3 Not applicable: already on Vitest 4.
@nx/vite migrate-to-vitest-4 Applied: vitest.workspace.ts → vitest.config.ts (commit 7). No pool, deps, reporter or browser options to migrate, and no VITEST_MAX_* env vars in the workflows.
@nx/eslint convert-to-flat-config Applied by hand (commit 2). No rules were disabled to make lint pass; see the lint notes below.
@nx/jest verify-typecheck Not applicable: its generator only acts on TypeScript < 6.
@nx/eslint migrate-ban-types-rule Applied: ban-types removed; no-empty-object-type, no-unsafe-function-type and no-wrapper-object-types were already configured.
@nx/eslint finish-inferred-conversion Applied (commit 4).
@nx/jest finish-inferred-conversion Applied (commits 4 and 6).
@nx/vite finish-inferred-conversion Applied (commit 4).
@nx/vite migrate-config-helpers Applied (commit 5). No other config used the helpers.
@nx/vite finish-ready-signal-plugin Not applicable: apps/toolbox and apps/automated have @nativescript/vite configs, but @nx/vite/plugin is not registered, so they have no inferred dev/preview targets for nxReadySignal() to affect.

CI and the npm start menu

  • nx run-many --target=test --configuration=ci --projects=core behaves the same as on the base branch. Core's test target had no ci configuration before and still doesn't, so it runs core:test.
  • nx test apps-automated -c=android|ios is unchanged: it's an nx:run-commands target with the same configurations.
  • The secure_nx_release.yml commands still run, checked with dry runs:
    • nx show projects --projects "packages/*" --type lib --exclude … gives the same list.
    • nx release version prerelease --preid next --projects core --dry-run works.
    • nx release prerelease --preid next --projects vite --skip-publish --dry-run works.
  • Every nps menu target name still resolves. nx g @nstudio/focus:mode works.

Verification

Baseline is the untouched chore/typescript-6 branch after npm ci. All commands ran with --skip-nx-cache.

Check Baseline (Nx 22.7.12) This PR (Nx 24.0.7)
nx run-many -t build -p core,webpack5,vite pass pass
core:test 565 passed, 1 skipped 565 passed, 1 skipped
webpack5:test 16 failed / 65 passed 16 failed / 65 passed (the same 16, path-dependent snapshots)
vite:test 5 failed / 1924 passed 0 failed / 1929 passed (see note)
run-many --target=test --configuration=ci --projects=core 565 passed 565 passed
core:lint 0 errors, 22 warnings 0 errors, 23 warnings
vite:lint 3 errors the same 3 errors (2 no-fallthrough, 1 no-irregular-whitespace), plus 22 warnings
workspace-plugin:lint could not run (@nx/linter:eslint not installed) runs: 2 errors (@nx/dependency-checks), 1 warning
webpack5:lint failed: "Nothing to lint" (empty lintFilePatterns) runs: 23 errors (prefer-const)
apps-toolbox / apps-automated / apps-ui :lint failed: "All files … are ignored" run: 17 / 3230 / 335 errors
run-many -t lint aborted immediately (@nx/linter:eslint) runs every project
workspace-plugin:test pass (no tests) pass (no tests), also with -c ci
nx show projects / nx graph 15 projects the same 15 projects, target names and configurations
apps-toolbox:clean, nx prepare apps-toolbox android n/a pass (@nativescript/nx@24.0.0)
nx prepare apps-toolbox android n/a pass (webpack build, AARs built, "Project successfully prepared")

Notes:

  • vite tests: the 5 baseline failures are all in typescript-optional.spec.ts. They depend on the working directory, failing with The "paths[1]" argument must be of type string: the old executor ran vitest from the workspace root, while the inferred task runs it in packages/vite. Running npx vitest run from the root still shows the same 5 failures.
  • Lint warnings: the new warnings in core (+1) and vite (+22) are all "Unused eslint-disable directive". ESLint 9 turns reportUnusedDisableDirectives on by default. No rule was disabled.
  • Newly running lint targets: webpack5, the three apps and workspace-plugin are linted for the first time. Under ESLint 8 the root ignorePatterns: ["**/*"] (or a missing executor) meant they never actually linted anything. Their errors are existing violations: no-var and prefer-const from typescript-eslint's recommended set, and enforce-module-boundaries "lazy-loaded library" errors in apps/automated. They are not new failures introduced by ESLint 9. This PR doesn't touch source to satisfy them. They stay; the violations are fixed in the stacked follow-up style: fix lint violations surfaced by the Nx 24 lint targets #11685.
  • No iOS or Android device or emulator was available, so nx test apps-automated -c=android|ios and debug were not run.

Notes

  • @nativescript/nx uses the stable ^24.0.0 release (feat: migrate to Nx 24 nx#90), which installs and runs under Nx 24 (clean, prepare).
  • Merging main into chore/typescript-6: main is 74 commits ahead of build: update to TypeScript 6 #11588's base and did not touch the root package.json or package-lock.json. Merging it gives one content conflict, in packages/webpack5/src/loaders/native-class-downlevel-loader/index.ts. This PR does not merge main, to keep its diff to the Nx changes.
  • nx migrate in Nx 24 starts a "migrate run" that commits each step when it detects an AI agent. Pass --agentic=false to get the classic behavior.

@nx-cloud

nx-cloud Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 219185a

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 5s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-28 00:32:59 UTC

@pkg-pr-new

pkg-pr-new Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11684
npm i https://pkg.pr.new/@nativescript/vite@11684
npm i https://pkg.pr.new/@nativescript/webpack@11684

commit: 219185a

Base automatically changed from chore/typescript-6 to main November 28, 2026 00:30
- nx and @nx/* 22.7.12 -> 24.0.7; add @nx/eslint as a direct dependency
  so `nx migrate` collects its migrations.
- @nativescript/nx 23.0.0-rc.0 (peers nx >= 23).
- ESLint ~8.57 -> ~9.39.5: @nx/eslint >= 23.1 requires ESLint 9+.
  Add the typescript-eslint meta package used by Nx's flat configs and
  bump @typescript-eslint/* to ^8.74.0.
- jest 30.0.5 -> 30.3.0 (Nx 24 migration package update).
- Ignore .nx/migrate-runs (Nx 23 migration).

The nx, @nx/* and @nativescript/nx lockfile entries were dropped and
re-resolved; npm could not reconcile the old @nx/eslint 22 peer edges.
Nx 24 requires ESLint 9, which drops .eslintrc. Each .eslintrc.json is
replaced by an equivalent eslint.config.mjs built on @nx/eslint-plugin's
flat configs (which bundle eslint:recommended, typescript-eslint
recommended and eslint-config-prettier) plus the existing overrides.

- @typescript-eslint/ban-types is dropped: typescript-eslint 8 removed it
  and its three successors are already turned off.
- packages/core gets no eslint.config.mjs of its own: the core build
  copies every *.mjs in the package to dist, and the vite HMR core
  bundle imports them. Its ignores live in the root config, which also
  limits core to TypeScript and JS specs (the old lintFilePatterns).
- The JSON override moves from the root to tools/workspace-plugin, the
  only project that lints JSON.
- eslint.config.mjs is excluded from the production named input.
Nx 24 selects individual affected tasks by default. Set affected.legacy
(the Nx 24 migration default) so `nx affected` and
`nx show projects --affected`, used by the release workflow, keep
selecting whole projects.
Nx 24 removes the @nx/eslint, @nx/jest and @nx/vitest executors. Register
their inference plugins instead, each limited with `include` to the
projects that already had the target, so target names stay the same and
no project gains a new one:

- @nx/eslint/plugin: lint for core, vite, webpack5, workspace-plugin and
  the three apps (`eslint .` in the project root). Patterns match only
  each project's root files so nested package.json folders (core's
  css/, easysax/, the automated app's fixtures) don't become projects.
- @nx/vitest: test for core and vite, `testMode: run` to keep run-once
  `vitest run` (`--watch` still switches to watch mode).
- @nx/jest/plugin: test for workspace-plugin; the `ci` configuration and
  passWithNoTests from the old @nx/jest:jest target defaults move onto
  its project.json.

The executor-keyed target defaults are removed; the `test` and `lint`
target-name defaults still apply to the inferred targets. The
workspace-plugin lint target pointed at @nx/linter:eslint, which was
never installed, and now runs.
nxViteTsPaths and nxCopyAssetsPlugin are inert stubs in Nx 24. Path
aliases now come from Vite's native resolve.tsconfigPaths. The copy
plugin only copied *.md on a vite build, and core builds with
@nx/js:tsc, so it is removed rather than replaced.
The inferred @nx/jest target runs the jest CLI, which loads
jest.config.ts through Node type stripping (CommonJS package) or ts-node.
`export default` fails the first and TypeScript 6 rejects ts-node's
node10 module resolution, so use module.exports as Nx's own
convert-jest-config-to-cjs migration does.
Vitest 4 no longer reads vitest.workspace.* files. The file already uses
the `test.projects` form, so renaming it to the root vitest.config.ts is
enough for a root-level `vitest` run to pick up the core and vite
projects again (Nx's migrate-to-vitest-4 prompt).
Replaces the 23.0.0-rc.0 pin with ^24.0.0, the plugin release that targets Nx 24.
@NathanWalker
NathanWalker merged commit e3b20a9 into main Nov 28, 2026
13 checks passed
@NathanWalker
NathanWalker deleted the chore/nx-24 branch November 28, 2026 00:33
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.

1 participant