Skip to content

Commit dd8cea6

Browse files
committed
build: move lint and test to Nx inferred tasks
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.
1 parent c4105d7 commit dd8cea6

8 files changed

Lines changed: 32 additions & 78 deletions

File tree

‎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"]

‎nx.json‎

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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,
@@ -149,5 +132,29 @@
149132
},
150133
"affected": {
151134
"legacy": true
152-
}
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+
]
153160
}

‎packages/core/project.json‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
"production": ["!{projectRoot}/**/*.spec.ts"]
1010
},
1111
"targets": {
12-
"lint": {
13-
"executor": "@nx/eslint:lint",
14-
"options": {
15-
"lintFilePatterns": ["packages/core/**/*.ts", "packages/core/references.d.ts", "packages/core/**/*.spec.ts", "packages/core/**/*.spec.tsx", "packages/core/**/*.spec.js", "packages/core/**/*.spec.jsx", "packages/core/**/*.d.ts"]
16-
}
17-
},
1812
"build": {
1913
"executor": "@nx/js:tsc",
2014
"inputs": ["default", "^production"],
@@ -56,13 +50,6 @@
5650
]
5751
},
5852
"dependsOn": ["^build"]
59-
},
60-
"test": {
61-
"executor": "@nx/vitest:test",
62-
"outputs": ["{options.reportsDirectory}"],
63-
"options": {
64-
"reportsDirectory": "{workspaceRoot}/coverage/packages/core"
65-
}
6653
}
6754
}
6855
}

‎packages/vite/project.json‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
"production": ["!{projectRoot}/**/*.spec.ts"]
1010
},
1111
"targets": {
12-
"lint": {
13-
"executor": "@nx/eslint:lint",
14-
"options": {
15-
"lintFilePatterns": ["packages/vite/**/*.ts", "packages/vite/**/*.spec.ts", "packages/vite/**/*.spec.tsx", "packages/vite/**/*.d.ts"]
16-
}
17-
},
1812
"build": {
1913
"executor": "@nx/js:tsc",
2014
"inputs": ["default", "^production"],
@@ -27,13 +21,6 @@
2721
"assets": ["{workspaceRoot}/LICENSE", "{projectRoot}/README.md", "{projectRoot}/bin/cli.cjs"]
2822
},
2923
"dependsOn": ["^build"]
30-
},
31-
"test": {
32-
"executor": "@nx/vitest:test",
33-
"outputs": ["{options.reportsDirectory}"],
34-
"options": {
35-
"reportsDirectory": "{workspaceRoot}/coverage/packages/vite"
36-
}
3724
}
3825
}
3926
}

‎packages/webpack5/project.json‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
"projectType": "library",
66
"generators": {},
77
"targets": {
8-
"lint": {
9-
"executor": "@nx/eslint:lint",
10-
"options": {
11-
"lintFilePatterns": []
12-
}
13-
},
148
"build": {
159
"executor": "@nx/js:tsc",
1610
"inputs": ["default", "^production"],

‎tools/workspace-plugin/project.json‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,15 @@
3636
]
3737
}
3838
},
39-
"lint": {
40-
"executor": "@nx/linter:eslint",
41-
"outputs": ["{options.outputFile}"],
42-
"options": {
43-
"lintFilePatterns": ["tools/workspace-plugin/**/*.ts", "tools/workspace-plugin/package.json", "tools/workspace-plugin/generators.json"]
44-
}
45-
},
4639
"test": {
47-
"executor": "@nx/jest:jest",
48-
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
4940
"options": {
50-
"jestConfig": "tools/workspace-plugin/jest.config.ts"
41+
"passWithNoTests": true
42+
},
43+
"configurations": {
44+
"ci": {
45+
"ci": true,
46+
"coverage": true
47+
}
5148
}
5249
}
5350
}

0 commit comments

Comments
 (0)