Skip to content

Commit e3b20a9

Browse files
authored
build: update Nx to 24 (#11684)
Updates Nx 22.7.12 to 24.0.7 and keeps TypeScript at 6.0.3. `@nativescript/nx` goes to ^24.0.0, ESLint 8.57 to 9.39 (required by `@nx/eslint` 23.1+), and jest to 30.3. Every `.eslintrc.json` becomes an `eslint.config.mjs` flat config built on `@nx/eslint-plugin`. Nx 24 removes the `@nx/eslint`, `@nx/jest` and `@nx/vitest` executors, so `lint` and `test` are now tasks inferred by plugins in `nx.json`, scoped to the projects that had those targets. Project-level `nx affected` selection is kept. Also: core drops the Nx vite config helpers that Nx 24 removed, the workspace-plugin jest config loads as CommonJS, and `vitest.workspace.ts` becomes `vitest.config.ts`. [skip ci]
1 parent 83bb917 commit e3b20a9

21 files changed

Lines changed: 10629 additions & 8205 deletions

‎.eslintrc.json‎

Lines changed: 0 additions & 69 deletions
This file was deleted.

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,5 @@ CLAUDE.local.md
101101
.env.local
102102
.env.*.local
103103
.envrc
104+
105+
.nx/migrate-runs

‎apps/automated/project.json‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@
6565
"clean": {
6666
"executor": "@nativescript/nx:clean",
6767
"options": {}
68-
},
69-
"lint": {
70-
"executor": "@nx/eslint:lint",
71-
"options": {
72-
"lintFilePatterns": ["apps/automated/**/*.ts", "apps/automated/src/**/*.html"]
73-
}
7468
}
7569
},
7670
"implicitDependencies": ["webpack5", "vite"]

‎apps/toolbox/project.json‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@
5555
"clean": {
5656
"executor": "@nativescript/nx:clean",
5757
"options": {}
58-
},
59-
"lint": {
60-
"executor": "@nx/eslint:lint",
61-
"options": {
62-
"lintFilePatterns": ["apps/toolbox/**/*.ts", "apps/toolbox/src/**/*.html"]
63-
}
6458
}
6559
},
6660
"implicitDependencies": ["webpack5", "vite"]

‎apps/ui/project.json‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@
4949
"clean": {
5050
"executor": "@nativescript/nx:clean",
5151
"options": {}
52-
},
53-
"lint": {
54-
"executor": "@nx/eslint:lint",
55-
"options": {
56-
"lintFilePatterns": ["apps/ui/**/*.ts", "apps/ui/src/**/*.html"]
57-
}
5852
}
5953
},
6054
"implicitDependencies": ["webpack5"]

‎eslint.config.mjs‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import nx from '@nx/eslint-plugin';
2+
3+
export default [
4+
...nx.configs['flat/base'],
5+
...nx.configs['flat/typescript'],
6+
...nx.configs['flat/javascript'],
7+
{
8+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
9+
rules: {
10+
'@nx/enforce-module-boundaries': [
11+
'error',
12+
{
13+
enforceBuildableLibDependency: true,
14+
allow: [],
15+
depConstraints: [
16+
{
17+
sourceTag: '*',
18+
onlyDependOnLibsWithTags: ['*'],
19+
},
20+
],
21+
},
22+
],
23+
},
24+
},
25+
{
26+
files: ['**/*.ts', '**/*.tsx'],
27+
rules: {
28+
'no-empty': 'off',
29+
'no-useless-escape': 'off',
30+
'no-inner-declarations': 'off',
31+
'no-prototype-builtins': 'off',
32+
'@typescript-eslint/no-empty-interface': 'off',
33+
'@typescript-eslint/no-var-requires': 'off',
34+
'@typescript-eslint/no-empty-function': 'off',
35+
'@typescript-eslint/ban-ts-comment': 'off',
36+
'@typescript-eslint/no-unused-vars': 'off',
37+
'@typescript-eslint/no-explicit-any': 'off',
38+
'@typescript-eslint/no-this-alias': 'warn',
39+
'@typescript-eslint/no-namespace': 'off',
40+
'@typescript-eslint/no-inferrable-types': 'off',
41+
'@typescript-eslint/no-empty-object-type': 'off',
42+
'@typescript-eslint/no-unsafe-function-type': 'off',
43+
'@typescript-eslint/no-wrapper-object-types': 'off',
44+
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
45+
'@typescript-eslint/no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
46+
'no-extra-semi': 'off',
47+
},
48+
},
49+
{
50+
files: ['**/*.js', '**/*.jsx'],
51+
rules: {
52+
'no-extra-semi': 'off',
53+
},
54+
},
55+
{
56+
files: ['**/references.d.ts'],
57+
rules: {
58+
'@typescript-eslint/triple-slash-reference': 'off',
59+
},
60+
},
61+
{
62+
// Not in packages/core: its build and the HMR core bundle ship every *.mjs.
63+
ignores: ['packages/core/**/global-types.d.ts', 'packages/core/**/node_modules/**/*', 'packages/core/**/__tests__/**/*', 'packages/core/**/platforms/**/*', 'packages/core/**/css/lib/**/*', 'packages/core/**/vite.config.*.timestamp*', 'packages/core/**/vitest.config.*.timestamp*', 'packages/core/**/*.{js,jsx,mjs,cjs,mts,cts}', '!packages/core/**/*.spec.{js,jsx}'],
64+
},
65+
];

‎nx.json‎

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"namedInputs": {
7272
"default": ["{projectRoot}/**/*", "sharedGlobals"],
7373
"sharedGlobals": ["{workspaceRoot}/workspace.json", "{workspaceRoot}/tsconfig.json", "{workspaceRoot}/nx.json"],
74-
"production": ["default", "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", "!{projectRoot}/tsconfig.spec.json", "!{projectRoot}/jest.config.[jt]s", "!{projectRoot}/src/test-setup.[jt]s"]
74+
"production": ["default", "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", "!{projectRoot}/tsconfig.spec.json", "!{projectRoot}/jest.config.[jt]s", "!{projectRoot}/src/test-setup.[jt]s", "!{projectRoot}/eslint.config.mjs"]
7575
},
7676
"targetDefaults": {
7777
"build": {
@@ -94,28 +94,11 @@
9494
"e2e": {
9595
"cache": true
9696
},
97-
"@nx/jest:jest": {
98-
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
99-
"cache": true,
100-
"options": {
101-
"passWithNoTests": true
102-
},
103-
"configurations": {
104-
"ci": {
105-
"ci": true,
106-
"codeCoverage": true
107-
}
108-
}
109-
},
11097
"nx-release-publish": {
11198
"dependsOn": ["build"],
11299
"options": {
113100
"packageRoot": "{workspaceRoot}/dist/packages/{projectName}"
114101
}
115-
},
116-
"@nx/vitest:test": {
117-
"cache": true,
118-
"inputs": ["default", "^production"]
119102
}
120103
},
121104
"useDaemonProcess": false,
@@ -146,5 +129,32 @@
146129
"nxCloudId": "680a89d49c76d63ce41eb397",
147130
"tui": {
148131
"enabled": false
149-
}
132+
},
133+
"affected": {
134+
"legacy": true
135+
},
136+
"plugins": [
137+
{
138+
"plugin": "@nx/eslint/plugin",
139+
"options": {
140+
"targetName": "lint"
141+
},
142+
"include": ["eslint.config.mjs", "apps/automated/*", "apps/toolbox/*", "apps/ui/*", "packages/core/*", "packages/vite/*", "packages/webpack5/*", "tools/workspace-plugin/*"]
143+
},
144+
{
145+
"plugin": "@nx/jest/plugin",
146+
"options": {
147+
"targetName": "test"
148+
},
149+
"include": ["tools/workspace-plugin/**/*"]
150+
},
151+
{
152+
"plugin": "@nx/vitest",
153+
"options": {
154+
"testMode": "run",
155+
"testTargetName": "test"
156+
},
157+
"include": ["packages/core/**/*", "packages/vite/**/*"]
158+
}
159+
]
150160
}

0 commit comments

Comments
 (0)