Skip to content

Commit f9e0eb9

Browse files
authored
chore: clean up nx and other config (#11226)
1 parent 1c0e1ae commit f9e0eb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+422
-5019
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
install:
4040
name: Checkout and Install
4141
runs-on: ubuntu-latest
42+
env:
43+
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
4244
steps:
4345
- name: Checkout
4446
uses: actions/checkout@v4
@@ -51,6 +53,8 @@ jobs:
5153
name: Build All Packages
5254
needs: [install]
5355
runs-on: ubuntu-latest
56+
env:
57+
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
5458
steps:
5559
- name: Checkout
5660
uses: actions/checkout@v4
@@ -65,6 +69,8 @@ jobs:
6569
name: Generate Configs
6670
needs: [build]
6771
runs-on: ubuntu-latest
72+
env:
73+
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
6874
steps:
6975
- name: Checkout
7076
uses: actions/checkout@v4
@@ -84,6 +90,8 @@ jobs:
8490
strategy:
8591
matrix:
8692
lint-task: ['check-spelling', 'check-format', 'lint-markdown']
93+
env:
94+
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
8795
steps:
8896
- name: Checkout
8997
uses: actions/checkout@v4
@@ -103,6 +111,8 @@ jobs:
103111
strategy:
104112
matrix:
105113
lint-task: ['lint', 'typecheck', 'knip']
114+
env:
115+
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
106116
steps:
107117
- name: Checkout
108118
uses: actions/checkout@v4
@@ -122,6 +132,8 @@ jobs:
122132
name: Stylelint
123133
needs: [install]
124134
runs-on: ubuntu-latest
135+
env:
136+
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
125137
steps:
126138
- name: Checkout
127139
uses: actions/checkout@v4
@@ -137,6 +149,8 @@ jobs:
137149
name: Run integration tests on primary Node.js version
138150
needs: [build]
139151
runs-on: ubuntu-latest
152+
env:
153+
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
140154
steps:
141155
- name: Checkout
142156
uses: actions/checkout@v4
@@ -179,8 +193,7 @@ jobs:
179193
'visitor-keys',
180194
]
181195
env:
182-
# Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app
183-
NX_CLOUD_ENV_NAME: 'Node ${{ matrix.node-version }} -'
196+
NX_CI_EXECUTION_ENV: '${{ matrix.os }} - Node ${{ matrix.node-version }}'
184197
COLLECT_COVERAGE: false
185198
steps:
186199
- name: Checkout
@@ -225,7 +238,8 @@ jobs:
225238
package:
226239
['eslint-plugin', 'eslint-plugin-internal', 'typescript-estree']
227240
env:
228-
COLLECT_COVERAGE: false
241+
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
242+
COLLECT_COVERAGE: false,
229243
steps:
230244
- name: Checkout
231245
uses: actions/checkout@v4

knip.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { KnipConfig } from 'knip' with { 'resolution-mode': 'import' };
22

33
export default {
44
rules: {
5+
binaries: 'off',
56
classMembers: 'off',
67
duplicates: 'off',
78
enumMembers: 'off',
@@ -54,11 +55,13 @@ export default {
5455
},
5556
},
5657
'packages/eslint-plugin': {
58+
entry: ['tools/**'],
5759
ignore: [
5860
'tests/fixtures/**',
5961
'typings/eslint-rules.d.ts',
6062
'typings/typescript.d.ts',
6163
],
64+
ignoreDependencies: ['tsx'], // used in nx target definitions
6265
},
6366
'packages/eslint-plugin-internal': {
6467
ignore: ['tests/fixtures/**'],

nx.json

Lines changed: 7 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"plugins": [
55
{
66
"plugin": "@nx/js/typescript",
7-
"exclude": [".", "packages/integration-tests/fixtures/**"],
7+
"exclude": ["packages/integration-tests/fixtures/**"],
88
"options": {
99
"typecheck": {
1010
"targetName": "typecheck"
@@ -17,17 +17,9 @@
1717
},
1818
{
1919
"plugin": "@nx/vite/plugin",
20-
"include": ["packages/*"],
20+
"exclude": ["*"],
2121
"options": {
22-
"buildTargetName": "vite:build",
23-
"testTargetName": "test",
24-
"serveTargetName": "serve",
25-
"devTargetName": "dev",
26-
"previewTargetName": "preview",
27-
"serveStaticTargetName": "serve-static",
28-
"typecheckTargetName": "vite:typecheck",
29-
"buildDepsTargetName": "vite:build-deps",
30-
"watchDepsTargetName": "vite:watch-deps"
22+
"testTargetName": "test"
3123
}
3224
},
3325
{
@@ -59,64 +51,8 @@
5951
}
6052
},
6153
"targetDefaults": {
62-
"build": {
63-
"dependsOn": ["^build"],
64-
"inputs": ["production", "^production"],
65-
"outputs": ["{projectRoot}/dist"],
66-
"options": {
67-
"cwd": "{projectRoot}"
68-
},
69-
"cache": true
70-
},
7154
"test": {
72-
"dependsOn": ["^build"],
73-
"outputs": ["{projectRoot}/coverage"],
74-
"cache": true
75-
},
76-
"@nx/vite:test": {
77-
"dependsOn": ["^build"],
78-
"inputs": [
79-
"default",
80-
"^production",
81-
"{workspaceRoot}/vitest.config.mts",
82-
"{workspaceRoot}/vitest.config.base.mts",
83-
"{projectRoot}/vitest.config.mts"
84-
],
85-
"outputs": ["{projectRoot}/coverage"],
86-
"cache": true,
87-
"options": {
88-
"config": "{projectRoot}/vitest.config.mts",
89-
"watch": false
90-
}
91-
},
92-
"@nx/eslint:lint": {
93-
"dependsOn": ["eslint-plugin-internal:build", "typescript-eslint:build"],
94-
"options": {
95-
"noEslintrc": true,
96-
"cache": true,
97-
"eslintConfig": "{workspaceRoot}/eslint.config.mjs"
98-
},
99-
"outputs": ["{options.outputFile}"],
100-
"cache": true
101-
},
102-
"lint": {
103-
"executor": "@nx/eslint:lint",
104-
"dependsOn": ["eslint-plugin-internal:build", "typescript-eslint:build"],
105-
"inputs": [
106-
"default",
107-
"{workspaceRoot}/eslint.config.mjs",
108-
{
109-
"dependentTasksOutputFiles": "**/*.js",
110-
"transitive": false
111-
}
112-
],
113-
"outputs": ["{options.outputFile}"],
114-
"cache": true
115-
},
116-
"typecheck": {
117-
"dependsOn": ["types:copy-ast-spec"],
118-
"outputs": ["{workspaceRoot}/dist"],
119-
"cache": true
55+
"outputs": ["{projectRoot}/coverage"]
12056
}
12157
},
12258
"namedInputs": {
@@ -131,16 +67,15 @@
13167
},
13268
{
13369
"runtime": "yarn -v"
134-
},
135-
"{workspaceRoot}/yarn.lock"
70+
}
13671
],
13772
"production": [
13873
"default",
13974
"!{projectRoot}/**/?(*.)+(test).?(m|c)[jt]s?(x)?(.snap|.shot)",
14075
"!{projectRoot}/tests",
76+
"!{projectRoot}/tools",
14177
"!{projectRoot}/tsconfig.spec.json",
142-
"!{projectRoot}/vitest.config.mts",
143-
"!{projectRoot}/src/test-setup.[jt]s"
78+
"!{projectRoot}/vitest.config.mts"
14479
]
14580
}
14681
}

package.json

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,30 @@
2222
},
2323
"homepage": "https://typescript-eslint.io",
2424
"scripts": {
25-
"build": "nx run-many --target=build --exclude website --exclude website-eslint",
25+
"build": "nx run-many -t build --exclude website website-eslint",
2626
"check-clean-workspace-after-install": "git diff --quiet --exit-code",
2727
"check-format": "prettier --check .",
2828
"check-spelling": "cspell --config=.cspell.json \"**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}\" --no-progress --show-context --show-suggestions",
29-
"clean": "nx run-many --target=clean --parallel=20",
29+
"clean": "nx run-many -t clean --parallel=20",
3030
"format": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --config=$PROJECT_CWD/.prettierrc.json --write $INIT_CWD",
3131
"generate-breaking-changes": "nx run eslint-plugin:generate-breaking-changes",
32-
"generate-configs": "nx generate-configs",
33-
"generate-contributors": "nx generate-contributors",
34-
"generate-lib": "nx generate-lib",
35-
"generate-sponsors": "nx generate-sponsors",
32+
"generate-configs": "tsx tools/scripts/generate-configs.mts",
33+
"generate-contributors": "tsx tools/scripts/generate-contributors.mts",
34+
"generate-lib": "tsx tools/scripts/generate-lib.mts",
35+
"generate-sponsors": "tsx tools/scripts/generate-sponsors.mts",
3636
"generate-website-dts": "nx run website:generate-website-dts",
3737
"lint-fix": "yarn lint --fix",
3838
"lint-markdown-fix": "yarn lint-markdown --fix",
3939
"lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore",
4040
"lint-stylelint": "nx lint website stylelint",
41-
"lint": "nx run-many --target=lint",
41+
"lint": "nx run-many -t lint",
4242
"postinstall": "tsx tools/scripts/postinstall.mts",
4343
"pre-commit": "lint-staged",
4444
"release": "tsx tools/release/release.mts",
4545
"start": "nx run website:start",
46-
"test": "nx run-many --target=test --exclude integration-tests --exclude website --exclude website-eslint",
46+
"test": "nx run-many -t test --exclude integration-tests website website-eslint",
4747
"test-integration": "nx run integration-tests:test",
48-
"typecheck": "nx run-many --target=typecheck"
48+
"typecheck": "nx run-many -t typecheck"
4949
},
5050
"engines": {
5151
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -57,11 +57,11 @@
5757
"@eslint/compat": "^1.2.4",
5858
"@eslint/eslintrc": "^3.2.0",
5959
"@eslint/js": "^9.26.0",
60-
"@nx/devkit": "20.7.2",
61-
"@nx/eslint": "20.7.2",
62-
"@nx/js": "20.7.2",
63-
"@nx/vite": "20.7.2",
64-
"@nx/workspace": "20.7.2",
60+
"@nx/devkit": "21.0.3",
61+
"@nx/eslint": "21.0.3",
62+
"@nx/js": "21.0.3",
63+
"@nx/vite": "21.0.3",
64+
"@nx/workspace": "21.0.3",
6565
"@swc/core": "^1.4.12",
6666
"@types/debug": "^4.1.12",
6767
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
@@ -97,7 +97,7 @@
9797
"knip": "^5.41.1",
9898
"lint-staged": "^15.2.2",
9999
"markdownlint-cli": "^0.44.0",
100-
"nx": "20.7.2",
100+
"nx": "21.0.3",
101101
"prettier": "3.5.0",
102102
"rimraf": "^5.0.5",
103103
"semver": "7.7.0",
@@ -122,6 +122,47 @@
122122
},
123123
"packageManager": "[email protected]",
124124
"nx": {
125-
"includedScripts": []
125+
"name": "repo",
126+
"includedScripts": [
127+
"generate-configs",
128+
"generate-contributors",
129+
"generate-lib",
130+
"generate-sponsors"
131+
],
132+
"targets": {
133+
"generate-configs": {
134+
"dependsOn": [
135+
"eslint-plugin:build"
136+
]
137+
},
138+
"generate-lib": {
139+
"dependsOn": [
140+
"typescript-eslint:build",
141+
"eslint-plugin-internal:build"
142+
]
143+
},
144+
"// These targets are used for repo level utils and checking repo files which do not belong to specific published packages": {},
145+
"typecheck": {
146+
"command": "tsc -b tsconfig.repo-config-files.json",
147+
"dependsOn": [
148+
"types:copy-ast-spec"
149+
],
150+
"outputs": [
151+
"{workspaceRoot}/dist"
152+
],
153+
"cache": true
154+
},
155+
"lint": {
156+
"command": "eslint . --ignore-pattern=packages --cache",
157+
"dependsOn": [
158+
"typescript-eslint:build",
159+
"eslint-plugin-internal:build"
160+
],
161+
"cache": false
162+
},
163+
"clean": {
164+
"command": "rimraf dist/ coverage/ .eslintcache"
165+
}
166+
}
126167
}
127168
}

packages/ast-spec/package.json

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131
"main": "dist/index.js",
3232
"types": "dist/index.d.ts",
3333
"scripts": {
34-
"build": "tsc -b tsconfig.build.json && api-extractor run --local --config=$INIT_CWD/api-extractor.json",
34+
"//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.",
35+
"build": "yarn run -BT nx build",
3536
"clean": "rimraf dist/ coverage/",
3637
"clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"",
3738
"format": "yarn run -T format",
3839
"lint": "yarn run -BT nx lint",
39-
"test": "vitest --run --config=$INIT_CWD/vitest.config.mts",
40-
"check-types": "yarn run -BT nx typecheck"
40+
"test": "yarn run -BT nx test",
41+
"typecheck": "yarn run -BT nx typecheck"
4142
},
4243
"funding": {
4344
"type": "opencollective",
@@ -59,5 +60,37 @@
5960
"rimraf": "*",
6061
"typescript": "*",
6162
"vitest": "^3.1.3"
63+
},
64+
"nx": {
65+
"name": "ast-spec",
66+
"implicitDependencies": [
67+
"!typescript-estree"
68+
],
69+
"includedScripts": [
70+
"clean",
71+
"clean-fixtures"
72+
],
73+
"targets": {
74+
"build": {
75+
"command": "tsc -b tsconfig.build.json && api-extractor run --local --config=api-extractor.json",
76+
"options": {
77+
"cwd": "{projectRoot}"
78+
},
79+
"outputs": [
80+
"{projectRoot}/dist/**/*.ts"
81+
],
82+
"cache": true
83+
},
84+
"typecheck": {
85+
"dependsOn": [
86+
"typescript-estree:build"
87+
]
88+
},
89+
"test": {
90+
"dependsOn": [
91+
"typecheck"
92+
]
93+
}
94+
}
6295
}
6396
}

0 commit comments

Comments
 (0)