Skip to content

chore: clean up nx and other config #11226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
install:
name: Checkout and Install
runs-on: ubuntu-latest
env:
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -51,6 +53,8 @@ jobs:
name: Build All Packages
needs: [install]
runs-on: ubuntu-latest
env:
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -65,6 +69,8 @@ jobs:
name: Generate Configs
needs: [build]
runs-on: ubuntu-latest
env:
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -84,6 +90,8 @@ jobs:
strategy:
matrix:
lint-task: ['check-spelling', 'check-format', 'lint-markdown']
env:
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -103,6 +111,8 @@ jobs:
strategy:
matrix:
lint-task: ['lint', 'typecheck', 'knip']
env:
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -122,6 +132,8 @@ jobs:
name: Stylelint
needs: [install]
runs-on: ubuntu-latest
env:
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -137,6 +149,8 @@ jobs:
name: Run integration tests on primary Node.js version
needs: [build]
runs-on: ubuntu-latest
env:
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -179,8 +193,7 @@ jobs:
'visitor-keys',
]
env:
# Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app
NX_CLOUD_ENV_NAME: 'Node ${{ matrix.node-version }} -'
NX_CI_EXECUTION_ENV: '${{ matrix.os }} - Node ${{ matrix.node-version }}'
COLLECT_COVERAGE: false
steps:
- name: Checkout
Expand Down Expand Up @@ -225,7 +238,8 @@ jobs:
package:
['eslint-plugin', 'eslint-plugin-internal', 'typescript-estree']
env:
COLLECT_COVERAGE: false
NX_CI_EXECUTION_ENV: 'ubuntu-latest'
COLLECT_COVERAGE: false,
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { KnipConfig } from 'knip' with { 'resolution-mode': 'import' };

export default {
rules: {
binaries: 'off',
classMembers: 'off',
duplicates: 'off',
enumMembers: 'off',
Expand Down Expand Up @@ -54,11 +55,13 @@ export default {
},
},
'packages/eslint-plugin': {
entry: ['tools/**'],
ignore: [
'tests/fixtures/**',
'typings/eslint-rules.d.ts',
'typings/typescript.d.ts',
],
ignoreDependencies: ['tsx'], // used in nx target definitions
},
'packages/eslint-plugin-internal': {
ignore: ['tests/fixtures/**'],
Expand Down
79 changes: 7 additions & 72 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"plugins": [
{
"plugin": "@nx/js/typescript",
"exclude": [".", "packages/integration-tests/fixtures/**"],
"exclude": ["packages/integration-tests/fixtures/**"],
"options": {
"typecheck": {
"targetName": "typecheck"
Expand All @@ -17,17 +17,9 @@
},
{
"plugin": "@nx/vite/plugin",
"include": ["packages/*"],
"exclude": ["*"],
"options": {
"buildTargetName": "vite:build",
"testTargetName": "test",
"serveTargetName": "serve",
"devTargetName": "dev",
"previewTargetName": "preview",
"serveStaticTargetName": "serve-static",
"typecheckTargetName": "vite:typecheck",
"buildDepsTargetName": "vite:build-deps",
"watchDepsTargetName": "vite:watch-deps"
"testTargetName": "test"
}
},
{
Expand Down Expand Up @@ -59,64 +51,8 @@
}
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"inputs": ["production", "^production"],
"outputs": ["{projectRoot}/dist"],
"options": {
"cwd": "{projectRoot}"
},
"cache": true
},
"test": {
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/coverage"],
"cache": true
},
"@nx/vite:test": {
"dependsOn": ["^build"],
"inputs": [
"default",
"^production",
"{workspaceRoot}/vitest.config.mts",
"{workspaceRoot}/vitest.config.base.mts",
"{projectRoot}/vitest.config.mts"
],
"outputs": ["{projectRoot}/coverage"],
"cache": true,
"options": {
"config": "{projectRoot}/vitest.config.mts",
"watch": false
}
},
"@nx/eslint:lint": {
"dependsOn": ["eslint-plugin-internal:build", "typescript-eslint:build"],
"options": {
"noEslintrc": true,
"cache": true,
"eslintConfig": "{workspaceRoot}/eslint.config.mjs"
},
"outputs": ["{options.outputFile}"],
"cache": true
},
"lint": {
"executor": "@nx/eslint:lint",
"dependsOn": ["eslint-plugin-internal:build", "typescript-eslint:build"],
"inputs": [
"default",
"{workspaceRoot}/eslint.config.mjs",
{
"dependentTasksOutputFiles": "**/*.js",
"transitive": false
}
],
"outputs": ["{options.outputFile}"],
"cache": true
},
"typecheck": {
"dependsOn": ["types:copy-ast-spec"],
"outputs": ["{workspaceRoot}/dist"],
"cache": true
"outputs": ["{projectRoot}/coverage"]
}
},
"namedInputs": {
Expand All @@ -131,16 +67,15 @@
},
{
"runtime": "yarn -v"
},
"{workspaceRoot}/yarn.lock"
}
],
"production": [
"default",
"!{projectRoot}/**/?(*.)+(test).?(m|c)[jt]s?(x)?(.snap|.shot)",
"!{projectRoot}/tests",
"!{projectRoot}/tools",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/vitest.config.mts",
"!{projectRoot}/src/test-setup.[jt]s"
"!{projectRoot}/vitest.config.mts"
]
}
}
73 changes: 57 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@
},
"homepage": "https://typescript-eslint.io",
"scripts": {
"build": "nx run-many --target=build --exclude website --exclude website-eslint",
"build": "nx run-many -t build --exclude website website-eslint",
"check-clean-workspace-after-install": "git diff --quiet --exit-code",
"check-format": "prettier --check .",
"check-spelling": "cspell --config=.cspell.json \"**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}\" --no-progress --show-context --show-suggestions",
"clean": "nx run-many --target=clean --parallel=20",
"clean": "nx run-many -t clean --parallel=20",
"format": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --config=$PROJECT_CWD/.prettierrc.json --write $INIT_CWD",
"generate-breaking-changes": "nx run eslint-plugin:generate-breaking-changes",
"generate-configs": "nx generate-configs",
"generate-contributors": "nx generate-contributors",
"generate-lib": "nx generate-lib",
"generate-sponsors": "nx generate-sponsors",
"generate-configs": "tsx tools/scripts/generate-configs.mts",
"generate-contributors": "tsx tools/scripts/generate-contributors.mts",
"generate-lib": "tsx tools/scripts/generate-lib.mts",
"generate-sponsors": "tsx tools/scripts/generate-sponsors.mts",
"generate-website-dts": "nx run website:generate-website-dts",
"lint-fix": "yarn lint --fix",
"lint-markdown-fix": "yarn lint-markdown --fix",
"lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore",
"lint-stylelint": "nx lint website stylelint",
"lint": "nx run-many --target=lint",
"lint": "nx run-many -t lint",
"postinstall": "tsx tools/scripts/postinstall.mts",
"pre-commit": "lint-staged",
"release": "tsx tools/release/release.mts",
"start": "nx run website:start",
"test": "nx run-many --target=test --exclude integration-tests --exclude website --exclude website-eslint",
"test": "nx run-many -t test --exclude integration-tests website website-eslint",
"test-integration": "nx run integration-tests:test",
"typecheck": "nx run-many --target=typecheck"
"typecheck": "nx run-many -t typecheck"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
Expand All @@ -57,11 +57,11 @@
"@eslint/compat": "^1.2.4",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.26.0",
"@nx/devkit": "20.7.2",
"@nx/eslint": "20.7.2",
"@nx/js": "20.7.2",
"@nx/vite": "20.7.2",
"@nx/workspace": "20.7.2",
"@nx/devkit": "21.0.3",
"@nx/eslint": "21.0.3",
"@nx/js": "21.0.3",
"@nx/vite": "21.0.3",
"@nx/workspace": "21.0.3",
"@swc/core": "^1.4.12",
"@types/debug": "^4.1.12",
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
Expand Down Expand Up @@ -97,7 +97,7 @@
"knip": "^5.41.1",
"lint-staged": "^15.2.2",
"markdownlint-cli": "^0.44.0",
"nx": "20.7.2",
"nx": "21.0.3",
"prettier": "3.5.0",
"rimraf": "^5.0.5",
"semver": "7.7.0",
Expand All @@ -122,6 +122,47 @@
},
"packageManager": "yarn@3.8.2",
"nx": {
"includedScripts": []
"name": "repo",
"includedScripts": [
"generate-configs",
"generate-contributors",
"generate-lib",
"generate-sponsors"
],
"targets": {
"generate-configs": {
"dependsOn": [
"eslint-plugin:build"
]
},
"generate-lib": {
"dependsOn": [
"typescript-eslint:build",
"eslint-plugin-internal:build"
]
},
"// These targets are used for repo level utils and checking repo files which do not belong to specific published packages": {},
"typecheck": {
"command": "tsc -b tsconfig.repo-config-files.json",
"dependsOn": [
"types:copy-ast-spec"
],
"outputs": [
"{workspaceRoot}/dist"
],
"cache": true
},
"lint": {
"command": "eslint . --ignore-pattern=packages --cache",
"dependsOn": [
"typescript-eslint:build",
"eslint-plugin-internal:build"
],
"cache": false
},
"clean": {
"command": "rimraf dist/ coverage/ .eslintcache"
}
}
}
}
39 changes: 36 additions & 3 deletions packages/ast-spec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc -b tsconfig.build.json && api-extractor run --local --config=$INIT_CWD/api-extractor.json",
"//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.",
"build": "yarn run -BT nx build",
"clean": "rimraf dist/ coverage/",
"clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"",
"format": "yarn run -T format",
"lint": "yarn run -BT nx lint",
"test": "vitest --run --config=$INIT_CWD/vitest.config.mts",
"check-types": "yarn run -BT nx typecheck"
"test": "yarn run -BT nx test",
"typecheck": "yarn run -BT nx typecheck"
},
"funding": {
"type": "opencollective",
Expand All @@ -59,5 +60,37 @@
"rimraf": "*",
"typescript": "*",
"vitest": "^3.1.3"
},
"nx": {
"name": "ast-spec",
"implicitDependencies": [
"!typescript-estree"
],
"includedScripts": [
"clean",
"clean-fixtures"
],
"targets": {
"build": {
"command": "tsc -b tsconfig.build.json && api-extractor run --local --config=api-extractor.json",
"options": {
"cwd": "{projectRoot}"
},
"outputs": [
"{projectRoot}/dist/**/*.ts"
],
"cache": true
},
"typecheck": {
"dependsOn": [
"typescript-estree:build"
]
},
"test": {
"dependsOn": [
"typecheck"
]
}
}
}
}
Loading