From 5be3fa1a1f0008281df4f53abab22c902d792098 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Sun, 7 Apr 2024 18:11:32 -0500 Subject: [PATCH 01/18] lint and typecheck top level --- .github/actions/wait-for-netlify/index.js | 30 ++++++++++------------- eslint.config.mjs | 2 ++ package.json | 4 +-- tools/release/release.mts | 1 + 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/actions/wait-for-netlify/index.js b/.github/actions/wait-for-netlify/index.js index f96f6bac7d0a..ae374d4bb382 100644 --- a/.github/actions/wait-for-netlify/index.js +++ b/.github/actions/wait-for-netlify/index.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ const core = require('@actions/core'); const github = require('@actions/github'); @@ -70,23 +71,17 @@ async function run() { }, MAX_TIMEOUT); }); - const isReady = new Promise(async (resolve, reject) => { - const checkReady = async () => { - try { - const readyDeployment = await getReadyDeploymentForCommitRef(); - if (readyDeployment) { - return resolve({ readyDeployment }); - } - console.log( - `Deployment is not ready yet. Retrying in ${RETRY_INTERVAL}ms based on the configured RETRY_INTERVAL...`, - ); - setTimeout(checkReady, RETRY_INTERVAL); - } catch (err) { - return reject(err); - } - }; - checkReady(); - }); + const checkReady = async () => { + const readyDeployment = await getReadyDeploymentForCommitRef(); + if (readyDeployment) { + return { readyDeployment }; + } + console.log( + `Deployment is not ready yet. Retrying in ${RETRY_INTERVAL}ms based on the configured RETRY_INTERVAL...`, + ); + setTimeout(checkReady, RETRY_INTERVAL); + }; + const isReady = checkReady(); return Promise.race([isReady, maxTimeout]); } @@ -98,6 +93,7 @@ async function run() { ); core.setOutput('deploy_id', readyDeployment.id); core.setOutput('url', readyDeployment.deploy_ssl_url); + // eslint-disable-next-line no-process-exit process.exit(0); }) .catch(error => { diff --git a/eslint.config.mjs b/eslint.config.mjs index 8783a4194f32..63b9cc4d064d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -53,6 +53,8 @@ export default tseslint.config( '**/__snapshots__/**', '**/.docusaurus/**', '**/build/**', + '.nx/cache', + '.yarn/*', // Files copied as part of the build 'packages/types/src/generated/**/*.ts', // Playground types downloaded from the web diff --git a/package.json b/package.json index f1260600cdbd..592113cafd9a 100644 --- a/package.json +++ b/package.json @@ -41,14 +41,14 @@ "lint-fix": "yarn lint --fix", "lint-markdown-fix": "yarn lint-markdown --fix", "lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore", - "lint": "npx nx lint eslint-plugin --skip-nx-cache && npx nx run-many --target=lint --parallel --exclude eslint-plugin", + "lint": "npx nx lint eslint-plugin --skip-nx-cache && npx nx run-many --target=lint --parallel --exclude eslint-plugin && eslint . --ignore-pattern=packages --cache", "postinstall": "npx nx run repo-tools:postinstall-script", "pre-commit": "yarn lint-staged", "release": "tsx tools/release/release.mts", "start": "npx nx run website:start", "test": "npx nx run-many --target=test --parallel --exclude integration-tests --exclude website --exclude website-eslint", "test-integration": "npx nx run integration-tests:test", - "typecheck": "npx nx run-many --target=typecheck --parallel" + "typecheck": "npx nx run-many --target=typecheck --parallel && tsc" }, "engines": { "node": "^18.18.0 || >=20.0.0" diff --git a/tools/release/release.mts b/tools/release/release.mts index 9ecdd34fd856..b70d8b8269f7 100644 --- a/tools/release/release.mts +++ b/tools/release/release.mts @@ -60,5 +60,6 @@ if (workspaceVersion === null) { dryRun: options.dryRun, verbose: options.verbose, }); + // eslint-disable-next-line no-process-exit process.exit(publishStatus); } From 04e4774c34011974d9f573fb0da62cc3b7c7c6c8 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Wed, 29 May 2024 17:36:47 -0500 Subject: [PATCH 02/18] move to repo-tools --- .github/actions/breaking-pr-check/action.yml | 2 +- .github/actions/wait-for-netlify/action.yml | 2 +- .github/workflows/semantic-breaking-change-pr.yml | 1 + package.json | 2 -- packages/repo-tools/package.json | 2 ++ .../repo-tools/src/actions/breaking-pr-check.js | 0 .../repo-tools/src/actions/waiting-for-netlify.js | 0 yarn.lock | 4 ++-- 8 files changed, 7 insertions(+), 6 deletions(-) rename .github/actions/breaking-pr-check/index.js => packages/repo-tools/src/actions/breaking-pr-check.js (100%) rename .github/actions/wait-for-netlify/index.js => packages/repo-tools/src/actions/waiting-for-netlify.js (100%) diff --git a/.github/actions/breaking-pr-check/action.yml b/.github/actions/breaking-pr-check/action.yml index f54443a4f433..9ba250ebd1c8 100644 --- a/.github/actions/breaking-pr-check/action.yml +++ b/.github/actions/breaking-pr-check/action.yml @@ -3,4 +3,4 @@ description: Validate breaking change PR title and description runs: using: node20 - main: index.js + main: ../../../node_modules/@typescript-eslint/repo-tools/actions/breaking-pr-check.js diff --git a/.github/actions/wait-for-netlify/action.yml b/.github/actions/wait-for-netlify/action.yml index 15111ea9c4d3..9182d9e15a86 100644 --- a/.github/actions/wait-for-netlify/action.yml +++ b/.github/actions/wait-for-netlify/action.yml @@ -12,4 +12,4 @@ inputs: runs: using: node20 - main: index.js + main: ../../../node_modules/@typescript-eslint/repo-tools/actions/wait-for-netlify.js diff --git a/.github/workflows/semantic-breaking-change-pr.yml b/.github/workflows/semantic-breaking-change-pr.yml index dcae58270de1..87f4546d8d1a 100644 --- a/.github/workflows/semantic-breaking-change-pr.yml +++ b/.github/workflows/semantic-breaking-change-pr.yml @@ -16,6 +16,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/prepare-install + - uses: ./.github/actions/prepare-build - uses: ./.github/actions/breaking-pr-check env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 3cd26d36ad29..83df0472ef84 100644 --- a/package.json +++ b/package.json @@ -55,8 +55,6 @@ "node": "^18.18.0 || >=20.0.0" }, "devDependencies": { - "@actions/core": "^1.10.1", - "@actions/github": "^6.0.0", "@babel/code-frame": "^7.24.2", "@babel/core": "^7.24.4", "@babel/eslint-parser": "^7.24.1", diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index 59932d66d585..97d0418caf04 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -16,6 +16,8 @@ "typecheck": "npx tsc --noEmit" }, "devDependencies": { + "@actions/core": "^1.10.1", + "@actions/github": "^6.0.0", "@jest/types": "29.6.3", "@nx/devkit": "*", "@typescript-eslint/eslint-plugin": "7.11.0", diff --git a/.github/actions/breaking-pr-check/index.js b/packages/repo-tools/src/actions/breaking-pr-check.js similarity index 100% rename from .github/actions/breaking-pr-check/index.js rename to packages/repo-tools/src/actions/breaking-pr-check.js diff --git a/.github/actions/wait-for-netlify/index.js b/packages/repo-tools/src/actions/waiting-for-netlify.js similarity index 100% rename from .github/actions/wait-for-netlify/index.js rename to packages/repo-tools/src/actions/waiting-for-netlify.js diff --git a/yarn.lock b/yarn.lock index 4c5db221cdfe..2eea41e827f4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5661,6 +5661,8 @@ __metadata: version: 0.0.0-use.local resolution: "@typescript-eslint/repo-tools@workspace:packages/repo-tools" dependencies: + "@actions/core": ^1.10.1 + "@actions/github": ^6.0.0 "@jest/types": 29.6.3 "@nx/devkit": "*" "@typescript-eslint/eslint-plugin": 7.11.0 @@ -5807,8 +5809,6 @@ __metadata: version: 0.0.0-use.local resolution: "@typescript-eslint/typescript-eslint@workspace:." dependencies: - "@actions/core": ^1.10.1 - "@actions/github": ^6.0.0 "@babel/code-frame": ^7.24.2 "@babel/core": ^7.24.4 "@babel/eslint-parser": ^7.24.1 From 73bdac9cf6f9ee93cc53a1a760ff8fed0b61fb74 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Fri, 31 May 2024 07:10:39 -0500 Subject: [PATCH 03/18] move breaking-pr-check to ts --- .github/actions/breaking-pr-check/action.yml | 2 +- .github/actions/wait-for-netlify/action.yml | 15 --- package.json | 1 - .../src/actions/waiting-for-netlify.js | 104 --------------- ...-check.js => breaking-pr-check-action.mts} | 36 +++--- packages/repo-tools/typings/process-env.d.ts | 5 + yarn.lock | 120 ------------------ 7 files changed, 24 insertions(+), 259 deletions(-) delete mode 100644 .github/actions/wait-for-netlify/action.yml delete mode 100644 packages/repo-tools/src/actions/waiting-for-netlify.js rename packages/repo-tools/src/{actions/breaking-pr-check.js => breaking-pr-check-action.mts} (64%) create mode 100644 packages/repo-tools/typings/process-env.d.ts diff --git a/.github/actions/breaking-pr-check/action.yml b/.github/actions/breaking-pr-check/action.yml index 9ba250ebd1c8..fdf4cb3a9f38 100644 --- a/.github/actions/breaking-pr-check/action.yml +++ b/.github/actions/breaking-pr-check/action.yml @@ -3,4 +3,4 @@ description: Validate breaking change PR title and description runs: using: node20 - main: ../../../node_modules/@typescript-eslint/repo-tools/actions/breaking-pr-check.js + main: ../../../node_modules/@typescript-eslint/repo-tools/breaking-pr-check-action.js diff --git a/.github/actions/wait-for-netlify/action.yml b/.github/actions/wait-for-netlify/action.yml deleted file mode 100644 index 9182d9e15a86..000000000000 --- a/.github/actions/wait-for-netlify/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Wait for the Netlify deployment for the current commit to be ready -description: Wait for the Netlify deployment for the current commit to be ready - -inputs: - netlify_token: - description: The value of secrets.NETLIFY_TOKEN - required: true - max_timeout: - description: The maximum length of time to keep retrying the Netlify api - retry_interval: - description: How long to wait between retries of the Netlify api - -runs: - using: node20 - main: ../../../node_modules/@typescript-eslint/repo-tools/actions/wait-for-netlify.js diff --git a/package.json b/package.json index 93252f369f01..2daa29dfd94a 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,6 @@ "make-dir": "^4.0.0", "markdownlint-cli": "^0.41.0", "ncp": "^2.0.0", - "netlify": "^13.1.14", "nx": "18.3.5", "prettier": "3.2.5", "pretty-format": "^29.7.0", diff --git a/packages/repo-tools/src/actions/waiting-for-netlify.js b/packages/repo-tools/src/actions/waiting-for-netlify.js deleted file mode 100644 index ae374d4bb382..000000000000 --- a/packages/repo-tools/src/actions/waiting-for-netlify.js +++ /dev/null @@ -1,104 +0,0 @@ -/* eslint-disable no-console */ -const core = require('@actions/core'); -const github = require('@actions/github'); - -const NETLIFY_SITE_ID = '128d21c7-b2fe-45ad-b141-9878fcf5de3a'; // https://app.netlify.com/sites/typescript-eslint/overview -const NETLIFY_TOKEN = core.getInput('netlify_token', { required: true }); -const MAX_TIMEOUT = core.getInput('max_timeout') || 300000; // 5 minutes -const RETRY_INTERVAL = core.getInput('retry_interval') || 5000; // 5 seconds - -const COMMIT_SHA = - github.context.eventName === 'pull_request' - ? github.context.payload.pull_request.head.sha - : github.context.sha; -const BRANCH = - github.context.eventName === 'pull_request' - ? github.context.payload.pull_request.head.ref - : github.context.ref_name; - -if (!COMMIT_SHA || !BRANCH) { - core.setFailed( - `Could not determine the full commit SHA and branch from the GitHub context: ${JSON.stringify( - github.context, - null, - 2, - )}`, - ); -} - -async function run() { - const { NetlifyAPI } = await import('netlify'); // ESM only, cannot be used with `require` - const client = new NetlifyAPI(NETLIFY_TOKEN); - - async function getReadyDeploymentForCommitRef() { - console.log( - `Checking if deployment for commit "${COMMIT_SHA}" on branch "${BRANCH}" has state "ready"...`, - ); - const deployments = await client.listSiteDeploys({ - site_id: NETLIFY_SITE_ID, - branch: BRANCH, - }); - console.log( - `Found ${deployments.length} deployments for this branch "${BRANCH}"`, - ); - const deploymentForCommit = deployments.find( - deployment => deployment.commit_ref === COMMIT_SHA, - ); - if (!deploymentForCommit) { - console.log( - `No deployment found yet for commit "${COMMIT_SHA}" on branch "${BRANCH}"`, - ); - return null; - } - if (deploymentForCommit.state !== 'ready') { - console.log( - `Resolve deployment for commit "${COMMIT_SHA}" on branch "${BRANCH}", but it is not ready yet. State: ${deploymentForCommit.state}`, - ); - return null; - } - return deploymentForCommit; - } - - async function waitUntilReadyDeployment() { - const maxTimeout = new Promise((_, reject) => { - const id = setTimeout(() => { - clearTimeout(id); - reject( - new Error( - `Error: Timed out in ${MAX_TIMEOUT}ms, based on the configured MAX_TIMEOUT.`, - ), - ); - }, MAX_TIMEOUT); - }); - - const checkReady = async () => { - const readyDeployment = await getReadyDeploymentForCommitRef(); - if (readyDeployment) { - return { readyDeployment }; - } - console.log( - `Deployment is not ready yet. Retrying in ${RETRY_INTERVAL}ms based on the configured RETRY_INTERVAL...`, - ); - setTimeout(checkReady, RETRY_INTERVAL); - }; - const isReady = checkReady(); - - return Promise.race([isReady, maxTimeout]); - } - - waitUntilReadyDeployment() - .then(({ readyDeployment }) => { - console.log( - `Resolved "ready" deployment with ID: ${readyDeployment.id}, URL: ${readyDeployment.deploy_ssl_url}`, - ); - core.setOutput('deploy_id', readyDeployment.id); - core.setOutput('url', readyDeployment.deploy_ssl_url); - // eslint-disable-next-line no-process-exit - process.exit(0); - }) - .catch(error => { - core.setFailed(error.message); - }); -} - -run(); diff --git a/packages/repo-tools/src/actions/breaking-pr-check.js b/packages/repo-tools/src/breaking-pr-check-action.mts similarity index 64% rename from packages/repo-tools/src/actions/breaking-pr-check.js rename to packages/repo-tools/src/breaking-pr-check-action.mts index f8e590c2f192..dbfb68e64927 100644 --- a/packages/repo-tools/src/actions/breaking-pr-check.js +++ b/packages/repo-tools/src/breaking-pr-check-action.mts @@ -1,11 +1,11 @@ -const core = require('@actions/core'); -const github = require('@actions/github'); +import core from '@actions/core'; +import github from '@actions/github'; -function raiseError(message) { +function raiseError(message: string): never { throw new Error(message); } -async function getPullRequest() { +async function getPullRequest(): Promise { const client = github.getOctokit(process.env.GITHUB_TOKEN); const pr = github.context.payload.pull_request; @@ -15,8 +15,9 @@ async function getPullRequest() { ); } - const owner = pr.base.user.login; - const repo = pr.base.repo.name; + const base = pr.base as { user: { login: string }; repo: { name: string } }; + const owner = base.user.login; + const repo = base.repo.name; const { data } = await client.rest.pulls.get({ owner, @@ -27,7 +28,7 @@ async function getPullRequest() { return data; } -function checkTitle(title) { +function checkTitle(title: string): void { if (/^[a-z]+(\([a-z-]+\))?!: /.test(title)) { raiseError( `Do not use exclamation mark ('!') to indicate breaking change in the PR Title.`, @@ -35,7 +36,10 @@ function checkTitle(title) { } } -function checkDescription(body, labels) { +function checkDescription( + body: string, + labels: (typeof pullRequest)['labels'], +): void { if (!labels.some(label => label.name === 'breaking change')) { return; } @@ -53,14 +57,10 @@ function checkDescription(body, labels) { } } -async function run() { - const pullRequest = await getPullRequest(); - try { - checkTitle(pullRequest.title); - checkDescription(pullRequest.body, pullRequest.labels); - } catch (e) { - core.setFailed(e.message); - } +const pullRequest = await getPullRequest(); +try { + checkTitle(pullRequest.title); + checkDescription(pullRequest.body ?? '', pullRequest.labels); +} catch (e) { + core.setFailed((e as Error).message); } - -run(); diff --git a/packages/repo-tools/typings/process-env.d.ts b/packages/repo-tools/typings/process-env.d.ts new file mode 100644 index 000000000000..086a2b28350a --- /dev/null +++ b/packages/repo-tools/typings/process-env.d.ts @@ -0,0 +1,5 @@ +declare namespace NodeJS { + interface ProcessEnv { + GITHUB_TOKEN: string; + } +} diff --git a/yarn.lock b/yarn.lock index e5749e1e9c12..0d988cc449ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3851,13 +3851,6 @@ __metadata: languageName: node linkType: hard -"@netlify/open-api@npm:^2.30.0": - version: 2.30.0 - resolution: "@netlify/open-api@npm:2.30.0" - checksum: 86fab5499dbe733037ea05c873dab8b839177dbb48c9cc3595014dabff0e2a3e654113dbdb9d7241658379727cfdedd660d79d0577f806fd8d8664ef58356193 - languageName: node - linkType: hard - "@nicolo-ribaudo/eslint-scope-5-internals@npm:5.1.1-v1": version: 5.1.1-v1 resolution: "@nicolo-ribaudo/eslint-scope-5-internals@npm:5.1.1-v1" @@ -5862,7 +5855,6 @@ __metadata: make-dir: ^4.0.0 markdownlint-cli: ^0.41.0 ncp: ^2.0.0 - netlify: ^13.1.14 nx: 18.3.5 prettier: 3.2.5 pretty-format: ^29.7.0 @@ -8665,13 +8657,6 @@ __metadata: languageName: node linkType: hard -"data-uri-to-buffer@npm:^4.0.0": - version: 4.0.1 - resolution: "data-uri-to-buffer@npm:4.0.1" - checksum: 0d0790b67ffec5302f204c2ccca4494f70b4e2d940fea3d36b09f0bb2b8539c2e86690429eb1f1dc4bcc9e4df0644193073e63d9ee48ac9fce79ec1506e4aa4c - languageName: node - linkType: hard - "data-view-buffer@npm:^1.0.1": version: 1.0.1 resolution: "data-view-buffer@npm:1.0.1" @@ -10462,16 +10447,6 @@ __metadata: languageName: node linkType: hard -"fetch-blob@npm:^3.1.2, fetch-blob@npm:^3.1.4": - version: 3.2.0 - resolution: "fetch-blob@npm:3.2.0" - dependencies: - node-domexception: ^1.0.0 - web-streams-polyfill: ^3.0.3 - checksum: f19bc28a2a0b9626e69fd7cf3a05798706db7f6c7548da657cbf5026a570945f5eeaedff52007ea35c8bcd3d237c58a20bf1543bc568ab2422411d762dd3d5bf - languageName: node - linkType: hard - "figures@npm:3.2.0": version: 3.2.0 resolution: "figures@npm:3.2.0" @@ -10743,15 +10718,6 @@ __metadata: languageName: node linkType: hard -"formdata-polyfill@npm:^4.0.10": - version: 4.0.10 - resolution: "formdata-polyfill@npm:4.0.10" - dependencies: - fetch-blob: ^3.1.2 - checksum: 82a34df292afadd82b43d4a740ce387bc08541e0a534358425193017bf9fb3567875dc5f69564984b1da979979b70703aa73dee715a17b6c229752ae736dd9db - languageName: node - linkType: hard - "forwarded@npm:0.2.0": version: 0.2.0 resolution: "forwarded@npm:0.2.0" @@ -13684,13 +13650,6 @@ __metadata: languageName: node linkType: hard -"lodash-es@npm:^4.17.21": - version: 4.17.21 - resolution: "lodash-es@npm:4.17.21" - checksum: 05cbffad6e2adbb331a4e16fbd826e7faee403a1a04873b82b42c0f22090f280839f85b95393f487c1303c8a3d2a010048bf06151a6cbe03eee4d388fb0a12d2 - languageName: node - linkType: hard - "lodash.curry@npm:^4.1.1": version: 4.1.1 resolution: "lodash.curry@npm:4.1.1" @@ -14350,13 +14309,6 @@ __metadata: languageName: node linkType: hard -"micro-api-client@npm:^3.3.0": - version: 3.3.0 - resolution: "micro-api-client@npm:3.3.0" - checksum: db0ad27df4c58bfb10eb4a6ad14d242d8abbae1bca623db3b23568dae6b146338ecbd62563a41a756b7a75ea155c950ddb5d633859ca728072d1852ed29dd1e2 - languageName: node - linkType: hard - "micromark-core-commonmark@npm:^2.0.0": version: 2.0.0 resolution: "micromark-core-commonmark@npm:2.0.0" @@ -15256,21 +15208,6 @@ __metadata: languageName: node linkType: hard -"netlify@npm:^13.1.14": - version: 13.1.16 - resolution: "netlify@npm:13.1.16" - dependencies: - "@netlify/open-api": ^2.30.0 - lodash-es: ^4.17.21 - micro-api-client: ^3.3.0 - node-fetch: ^3.0.0 - omit.js: ^2.0.2 - p-wait-for: ^4.0.0 - qs: ^6.9.6 - checksum: f9320f78ba7e3b1c48fde46d05b5cdc49d019332b492c3f57a6fcbc47587cb2ec76407b65b5f0d5e772c9620a3c7e639db285f3669d063cb2aaaddc00787170b - languageName: node - linkType: hard - "nise@npm:^5.1.4": version: 5.1.4 resolution: "nise@npm:5.1.4" @@ -15294,13 +15231,6 @@ __metadata: languageName: node linkType: hard -"node-domexception@npm:^1.0.0": - version: 1.0.0 - resolution: "node-domexception@npm:1.0.0" - checksum: ee1d37dd2a4eb26a8a92cd6b64dfc29caec72bff5e1ed9aba80c294f57a31ba4895a60fd48347cf17dd6e766da0ae87d75657dfd1f384ebfa60462c2283f5c7f - languageName: node - linkType: hard - "node-emoji@npm:^2.1.0": version: 2.1.3 resolution: "node-emoji@npm:2.1.3" @@ -15327,17 +15257,6 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^3.0.0": - version: 3.3.1 - resolution: "node-fetch@npm:3.3.1" - dependencies: - data-uri-to-buffer: ^4.0.0 - fetch-blob: ^3.1.4 - formdata-polyfill: ^4.0.10 - checksum: 62145fd3ba4770a76110bc31fdc0054ab2f5442b5ce96e9c4b39fc9e94a3d305560eec76e1165d9259eab866e02a8eecf9301062bb5dfc9f08a4d08b69d223dd - languageName: node - linkType: hard - "node-forge@npm:^1": version: 1.3.1 resolution: "node-forge@npm:1.3.1" @@ -15773,13 +15692,6 @@ __metadata: languageName: node linkType: hard -"omit.js@npm:^2.0.2": - version: 2.0.2 - resolution: "omit.js@npm:2.0.2" - checksum: 5d802b9fd7640250aada82f3b9b7243b554b38911f29b3de0d1066c00f24dd4ee72d3b9c94c582e373fb6511bd21e107917d419a7b2a04287f26c31133b48a15 - languageName: node - linkType: hard - "on-finished@npm:2.4.1": version: 2.4.1 resolution: "on-finished@npm:2.4.1" @@ -15962,13 +15874,6 @@ __metadata: languageName: node linkType: hard -"p-timeout@npm:^5.0.0": - version: 5.1.0 - resolution: "p-timeout@npm:5.1.0" - checksum: f5cd4e17301ff1ff1d8dbf2817df0ad88c6bba99349fc24d8d181827176ad4f8aca649190b8a5b1a428dfd6ddc091af4606835d3e0cb0656e04045da5c9e270c - languageName: node - linkType: hard - "p-try@npm:^2.0.0": version: 2.2.0 resolution: "p-try@npm:2.2.0" @@ -15976,15 +15881,6 @@ __metadata: languageName: node linkType: hard -"p-wait-for@npm:^4.0.0": - version: 4.1.0 - resolution: "p-wait-for@npm:4.1.0" - dependencies: - p-timeout: ^5.0.0 - checksum: 4f3ad4aa52b86d9f73ad558dcb00f9df6727a2c6c42dc1ba46e5ae2505898801f09016d753fd9ecb26eac925ba33ff7f8dbc0981856132c895d9df87dbb25d57 - languageName: node - linkType: hard - "package-json@npm:^8.1.0": version: 8.1.1 resolution: "package-json@npm:8.1.1" @@ -16995,15 +16891,6 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.9.6": - version: 6.11.2 - resolution: "qs@npm:6.11.2" - dependencies: - side-channel: ^1.0.4 - checksum: e812f3c590b2262548647d62f1637b6989cc56656dc960b893fe2098d96e1bd633f36576f4cd7564dfbff9db42e17775884db96d846bebe4f37420d073ecdc0b - languageName: node - linkType: hard - "queue-microtask@npm:^1.2.2": version: 1.2.3 resolution: "queue-microtask@npm:1.2.3" @@ -20191,13 +20078,6 @@ __metadata: languageName: node linkType: hard -"web-streams-polyfill@npm:^3.0.3": - version: 3.2.1 - resolution: "web-streams-polyfill@npm:3.2.1" - checksum: b119c78574b6d65935e35098c2afdcd752b84268e18746606af149e3c424e15621b6f1ff0b42b2676dc012fc4f0d313f964b41a4b5031e525faa03997457da02 - languageName: node - linkType: hard - "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" From a4f3f90eff94ff6592dd5bfe746df7443bd0bacb Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Fri, 31 May 2024 07:36:41 -0500 Subject: [PATCH 04/18] fix file extension --- .github/actions/breaking-pr-check/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/breaking-pr-check/action.yml b/.github/actions/breaking-pr-check/action.yml index fdf4cb3a9f38..8b746a1f224b 100644 --- a/.github/actions/breaking-pr-check/action.yml +++ b/.github/actions/breaking-pr-check/action.yml @@ -3,4 +3,4 @@ description: Validate breaking change PR title and description runs: using: node20 - main: ../../../node_modules/@typescript-eslint/repo-tools/breaking-pr-check-action.js + main: ../../../node_modules/@typescript-eslint/repo-tools/breaking-pr-check-action.mjs From 375001f4c8ea7512543e6b9225bde2a8e0d5dba6 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Sun, 2 Jun 2024 20:49:49 -0500 Subject: [PATCH 05/18] convert pipeline to tsx --- .github/actions/breaking-pr-check/action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/breaking-pr-check/action.yml b/.github/actions/breaking-pr-check/action.yml index 8b746a1f224b..02ae6d3a427a 100644 --- a/.github/actions/breaking-pr-check/action.yml +++ b/.github/actions/breaking-pr-check/action.yml @@ -2,5 +2,7 @@ name: Validate Breaking Change PR description: Validate breaking change PR title and description runs: - using: node20 - main: ../../../node_modules/@typescript-eslint/repo-tools/breaking-pr-check-action.mjs + using: 'composite' + steps: + - shell: bash + run: npx tsx ../../../packages/repo-tools/src/breaking-pr-action-check.mts From 6cbd50601205b1974e32b6b9fc21b612608843ac Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Sun, 2 Jun 2024 20:50:39 -0500 Subject: [PATCH 06/18] revert unnecessary built --- .github/workflows/semantic-breaking-change-pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/semantic-breaking-change-pr.yml b/.github/workflows/semantic-breaking-change-pr.yml index 87f4546d8d1a..dcae58270de1 100644 --- a/.github/workflows/semantic-breaking-change-pr.yml +++ b/.github/workflows/semantic-breaking-change-pr.yml @@ -16,7 +16,6 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/prepare-install - - uses: ./.github/actions/prepare-build - uses: ./.github/actions/breaking-pr-check env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a9186695441bd17e0cf0b730f85d09254a49aebc Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Mon, 3 Jun 2024 07:16:24 -0500 Subject: [PATCH 07/18] move more stuff inside repo-tools --- knip.ts | 2 +- package.json | 12 +++++------- packages/repo-tools/package.json | 4 +++- .../repo-tools/src}/dummypkg/README.md | 0 .../repo-tools/src}/dummypkg/index.d.ts | 0 .../repo-tools/src}/dummypkg/index.js | 0 .../repo-tools/src}/dummypkg/package.json | 0 .../repo-tools/src}/release/changelog-renderer.js | 0 .../repo-tools/src}/release/release.mts | 0 yarn.lock | 14 +++++++------- 10 files changed, 16 insertions(+), 16 deletions(-) rename {tools => packages/repo-tools/src}/dummypkg/README.md (100%) rename {tools => packages/repo-tools/src}/dummypkg/index.d.ts (100%) rename {tools => packages/repo-tools/src}/dummypkg/index.js (100%) rename {tools => packages/repo-tools/src}/dummypkg/package.json (100%) rename {tools => packages/repo-tools/src}/release/changelog-renderer.js (100%) rename {tools => packages/repo-tools/src}/release/release.mts (100%) diff --git a/knip.ts b/knip.ts index 25de69c9596b..16fd049538e5 100644 --- a/knip.ts +++ b/knip.ts @@ -58,6 +58,7 @@ export default { 'packages/parser': { ignore: ['tests/fixtures/**'], }, + 'packages/repo-tools/src/dummypkg': {}, 'packages/scope-manager': { ignore: ['tests/fixtures/**'], }, @@ -121,6 +122,5 @@ export default { 'src/mock/util.js', ], }, - 'tools/dummypkg': {}, }, } satisfies KnipConfig; diff --git a/package.json b/package.json index 2daa29dfd94a..de2dcd927644 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "lint": "npx nx lint eslint-plugin --skip-nx-cache && npx nx run-many --target=lint --parallel --exclude eslint-plugin && eslint . --ignore-pattern=packages --cache", "postinstall": "npx nx run repo-tools:postinstall-script", "pre-commit": "yarn lint-staged", - "release": "tsx tools/release/release.mts", + "release": "tsx packages/repo-tools/src/release/release.mts", "start": "npx nx run website:start", "test": "npx nx run-many --target=test --parallel --exclude integration-tests --exclude website --exclude website-eslint", "test-integration": "npx nx run integration-tests:test", @@ -79,7 +79,6 @@ "@types/node": "^20.12.5", "@types/semver": "^7.5.8", "@types/tmp": "^0.2.6", - "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin-internal": "workspace:^", "console-fail-test": "^0.2.3", "cross-fetch": "^4.0.0", @@ -115,17 +114,16 @@ "tmp": "^0.2.1", "tsx": "*", "typescript": ">=4.7.4 <5.5.0", - "typescript-eslint": "workspace:^", - "yargs": "17.7.2" + "typescript-eslint": "workspace:^" }, "resolutions": { "@jest/create-cache-key-function": "^29", "@jest/reporters": "^29", "@jest/test-result": "^29", "@microsoft/api-extractor@^7.38.0": "patch:@microsoft/api-extractor@npm%3A7.38.0#./.yarn/patches/@microsoft-api-extractor-npm-7.38.0-955f1e0725.patch", - "@types/eslint-scope": "link:./tools/dummypkg", - "@types/eslint": "link:./tools/dummypkg", - "@types/estree": "link:./tools/dummypkg", + "@types/eslint-scope": "link:./packages/repo-tools/src/dummypkg", + "@types/eslint": "link:./packages/repo-tools/src/dummypkg", + "@types/estree": "link:./packages/repo-tools/src/dummypkg", "@types/node": "^20.0.0", "@types/react": "^18.2.14", "eslint": "8.57.0", diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index 97d0418caf04..f1a91b64e02f 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -20,6 +20,7 @@ "@actions/github": "^6.0.0", "@jest/types": "29.6.3", "@nx/devkit": "*", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "7.11.0", "@typescript-eslint/scope-manager": "7.11.0", "@typescript-eslint/types": "7.11.0", @@ -30,6 +31,7 @@ "prettier": "^3.2.5", "rimraf": "*", "semver": "7.6.2", - "typescript": "*" + "typescript": "*", + "yargs": "^17.7.2" } } diff --git a/tools/dummypkg/README.md b/packages/repo-tools/src/dummypkg/README.md similarity index 100% rename from tools/dummypkg/README.md rename to packages/repo-tools/src/dummypkg/README.md diff --git a/tools/dummypkg/index.d.ts b/packages/repo-tools/src/dummypkg/index.d.ts similarity index 100% rename from tools/dummypkg/index.d.ts rename to packages/repo-tools/src/dummypkg/index.d.ts diff --git a/tools/dummypkg/index.js b/packages/repo-tools/src/dummypkg/index.js similarity index 100% rename from tools/dummypkg/index.js rename to packages/repo-tools/src/dummypkg/index.js diff --git a/tools/dummypkg/package.json b/packages/repo-tools/src/dummypkg/package.json similarity index 100% rename from tools/dummypkg/package.json rename to packages/repo-tools/src/dummypkg/package.json diff --git a/tools/release/changelog-renderer.js b/packages/repo-tools/src/release/changelog-renderer.js similarity index 100% rename from tools/release/changelog-renderer.js rename to packages/repo-tools/src/release/changelog-renderer.js diff --git a/tools/release/release.mts b/packages/repo-tools/src/release/release.mts similarity index 100% rename from tools/release/release.mts rename to packages/repo-tools/src/release/release.mts diff --git a/yarn.lock b/yarn.lock index 9e44615ec2c3..cd995abc781d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5041,9 +5041,9 @@ __metadata: languageName: node linkType: hard -"@types/eslint-scope@link:./tools/dummypkg::locator=%40typescript-eslint%2Ftypescript-eslint%40workspace%3A.": +"@types/eslint-scope@link:./packages/repo-tools/src/dummypkg::locator=%40typescript-eslint%2Ftypescript-eslint%40workspace%3A.": version: 0.0.0-use.local - resolution: "@types/eslint-scope@link:./tools/dummypkg::locator=%40typescript-eslint%2Ftypescript-eslint%40workspace%3A." + resolution: "@types/eslint-scope@link:./packages/repo-tools/src/dummypkg::locator=%40typescript-eslint%2Ftypescript-eslint%40workspace%3A." languageName: node linkType: soft @@ -5065,9 +5065,9 @@ __metadata: languageName: node linkType: hard -"@types/estree@link:./tools/dummypkg::locator=%40typescript-eslint%2Ftypescript-eslint%40workspace%3A.": +"@types/estree@link:./packages/repo-tools/src/dummypkg::locator=%40typescript-eslint%2Ftypescript-eslint%40workspace%3A.": version: 0.0.0-use.local - resolution: "@types/estree@link:./tools/dummypkg::locator=%40typescript-eslint%2Ftypescript-eslint%40workspace%3A." + resolution: "@types/estree@link:./packages/repo-tools/src/dummypkg::locator=%40typescript-eslint%2Ftypescript-eslint%40workspace%3A." languageName: node linkType: soft @@ -5658,6 +5658,7 @@ __metadata: "@actions/github": ^6.0.0 "@jest/types": 29.6.3 "@nx/devkit": "*" + "@types/yargs": ^17.0.32 "@typescript-eslint/eslint-plugin": 7.11.0 "@typescript-eslint/scope-manager": 7.11.0 "@typescript-eslint/types": 7.11.0 @@ -5669,6 +5670,7 @@ __metadata: rimraf: "*" semver: 7.6.2 typescript: "*" + yargs: ^17.7.2 languageName: unknown linkType: soft @@ -5828,7 +5830,6 @@ __metadata: "@types/node": ^20.12.5 "@types/semver": ^7.5.8 "@types/tmp": ^0.2.6 - "@types/yargs": ^17.0.32 "@typescript-eslint/eslint-plugin-internal": "workspace:^" console-fail-test: ^0.2.3 cross-fetch: ^4.0.0 @@ -5865,7 +5866,6 @@ __metadata: tsx: "*" typescript: ">=4.7.4 <5.5.0" typescript-eslint: "workspace:^" - yargs: 17.7.2 languageName: unknown linkType: soft @@ -20869,7 +20869,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:17.7.2, yargs@npm:^17.3.1, yargs@npm:^17.6.2": +"yargs@npm:^17.3.1, yargs@npm:^17.6.2, yargs@npm:^17.7.2": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: From 08f7d2794ce808c7c0b79dc9a342b12a7116beeb Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Mon, 3 Jun 2024 07:18:12 -0500 Subject: [PATCH 08/18] update paths --- knip.ts | 2 +- nx.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/knip.ts b/knip.ts index 16fd049538e5..90787811ee43 100644 --- a/knip.ts +++ b/knip.ts @@ -31,7 +31,7 @@ export default { // imported in eslint.config.js '@typescript-eslint/utils', ], - entry: ['tools/release/changelog-renderer.js'], + entry: ['packages/repo-tools/src/release/changelog-renderer.js'], ignoreBinaries: [ // https://github.com/webpro/knip/issues/433 'stylelint', diff --git a/nx.json b/nx.json index ff26dcf768d2..b20d0bfeda4f 100644 --- a/nx.json +++ b/nx.json @@ -6,10 +6,10 @@ "changelog": { "workspaceChangelog": { "createRelease": "github", - "renderer": "tools/release/changelog-renderer" + "renderer": "packages/repo-tools/src/release/changelog-renderer" }, "projectChangelogs": { - "renderer": "tools/release/changelog-renderer" + "renderer": "packages/repo-tools/src/release/changelog-renderer" } }, "version": { From c34477bca14e9678c965a4abdc2367cc06276af0 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Mon, 3 Jun 2024 07:22:56 -0500 Subject: [PATCH 09/18] include knip in TSConfig --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index cea4b651f67e..95169a092c73 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,7 @@ "eslint.config.mjs", "jest.config.base.js", "jest.config.js", - "jest.preset.js" + "jest.preset.js", + "knip.ts" ] } From 956d1c2e0a724d6336946c4787c5d835fdd86d29 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Fri, 14 Jun 2024 13:57:57 -0500 Subject: [PATCH 10/18] add to cspell --- .cspell.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.cspell.json b/.cspell.json index 73006b14fd39..8a6d8b54cc41 100644 --- a/.cspell.json +++ b/.cspell.json @@ -79,6 +79,7 @@ "destructures", "discoverability", "dprint", + "dummypkg", "errored", "erroring", "ESLint", From 7648cb8c5a02181807a38e4611b6435ee9b5aab1 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Fri, 14 Jun 2024 14:45:47 -0500 Subject: [PATCH 11/18] remove exaca --- .github/renovate.json5 | 2 -- package.json | 1 - yarn.lock | 25 ------------------------- 3 files changed, 28 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index d42567b92dd6..fd887aa92a1e 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -5,8 +5,6 @@ 'ajv', // globby is ESM so we can't go any higher right now 'globby', - // this dep is now ESM only - 'execa', // the nx packages get updated using the nx migrate CLI '@nrwl/cli', '@nx/cli', diff --git a/package.json b/package.json index 23b4dfd98132..06a2d0299cce 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,6 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-unicorn": "^50.0.1", - "execa": "7.2.0", "glob": "^10.3.12", "globals": "^15.0.0", "husky": "^9.0.0", diff --git a/yarn.lock b/yarn.lock index ee249a2e974f..ccccddbcc644 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5903,7 +5903,6 @@ __metadata: eslint-plugin-react-hooks: ^4.6.0 eslint-plugin-simple-import-sort: ^10.0.0 eslint-plugin-unicorn: ^50.0.1 - execa: 7.2.0 glob: ^10.3.12 globals: ^15.0.0 husky: ^9.0.0 @@ -10325,23 +10324,6 @@ __metadata: languageName: node linkType: hard -"execa@npm:7.2.0": - version: 7.2.0 - resolution: "execa@npm:7.2.0" - dependencies: - cross-spawn: ^7.0.3 - get-stream: ^6.0.1 - human-signals: ^4.3.0 - is-stream: ^3.0.0 - merge-stream: ^2.0.0 - npm-run-path: ^5.1.0 - onetime: ^6.0.0 - signal-exit: ^3.0.7 - strip-final-newline: ^3.0.0 - checksum: 14fd17ba0ca8c87b277584d93b1d9fc24f2a65e5152b31d5eb159a3b814854283eaae5f51efa9525e304447e2f757c691877f7adff8fde5746aae67eb1edd1cc - languageName: node - linkType: hard - "execa@npm:^5.0.0": version: 5.1.1 resolution: "execa@npm:5.1.1" @@ -11901,13 +11883,6 @@ __metadata: languageName: node linkType: hard -"human-signals@npm:^4.3.0": - version: 4.3.1 - resolution: "human-signals@npm:4.3.1" - checksum: 6f12958df3f21b6fdaf02d90896c271df00636a31e2bbea05bddf817a35c66b38a6fdac5863e2df85bd52f34958997f1f50350ff97249e1dff8452865d5235d1 - languageName: node - linkType: hard - "human-signals@npm:^5.0.0": version: 5.0.0 resolution: "human-signals@npm:5.0.0" From 2d6252b713e7496fc825754a1459d5afa50a052d Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Fri, 14 Jun 2024 15:09:55 -0500 Subject: [PATCH 12/18] add script --- .github/actions/breaking-pr-check/action.yml | 2 +- packages/repo-tools/package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/breaking-pr-check/action.yml b/.github/actions/breaking-pr-check/action.yml index 02ae6d3a427a..0ffc985fd350 100644 --- a/.github/actions/breaking-pr-check/action.yml +++ b/.github/actions/breaking-pr-check/action.yml @@ -5,4 +5,4 @@ runs: using: 'composite' steps: - shell: bash - run: npx tsx ../../../packages/repo-tools/src/breaking-pr-action-check.mts + run: cd ../../../packages/repo-tools && yarn breaking-pr-check-action diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index 40c97b51cf05..099d9940c2df 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -5,6 +5,7 @@ "//": "NOTE: intentionally no build step in this package", "scripts": { "apply-canary-version": "npx tsx ./src/apply-canary-version.mts", + "breaking-pr-check-action": "npx tsx ./src/breaking-pr-check-action.mts", "format": "npx prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "generate-configs": "npx tsx ./src/generate-configs.mts", "generate-contributors": "npx tsx ./src/generate-contributors.mts", From c631a863c78390b2f54874685d803015df6b0cfe Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Mon, 17 Jun 2024 07:00:43 -0500 Subject: [PATCH 13/18] one fewer knip error --- .github/actions/breaking-pr-check/action.yml | 3 ++- knip.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/breaking-pr-check/action.yml b/.github/actions/breaking-pr-check/action.yml index 0ffc985fd350..7e158a90869d 100644 --- a/.github/actions/breaking-pr-check/action.yml +++ b/.github/actions/breaking-pr-check/action.yml @@ -5,4 +5,5 @@ runs: using: 'composite' steps: - shell: bash - run: cd ../../../packages/repo-tools && yarn breaking-pr-check-action + run: yarn breaking-pr-check-action + working-directory: packages/repo-tools diff --git a/knip.ts b/knip.ts index 90787811ee43..bcfd69b75618 100644 --- a/knip.ts +++ b/knip.ts @@ -34,6 +34,7 @@ export default { entry: ['packages/repo-tools/src/release/changelog-renderer.js'], ignoreBinaries: [ // https://github.com/webpro/knip/issues/433 + 'breaking-pr-check-action', 'stylelint', ], }, From ea6d4b07ab65d63382b808fddd4f78e64789033e Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Mon, 17 Jun 2024 07:33:24 -0500 Subject: [PATCH 14/18] fix TS error --- packages/repo-tools/src/breaking-pr-check-action.mts | 5 +++-- packages/repo-tools/typings/process-env.d.ts | 5 ----- 2 files changed, 3 insertions(+), 7 deletions(-) delete mode 100644 packages/repo-tools/typings/process-env.d.ts diff --git a/packages/repo-tools/src/breaking-pr-check-action.mts b/packages/repo-tools/src/breaking-pr-check-action.mts index dbfb68e64927..647103327fd8 100644 --- a/packages/repo-tools/src/breaking-pr-check-action.mts +++ b/packages/repo-tools/src/breaking-pr-check-action.mts @@ -6,7 +6,8 @@ function raiseError(message: string): never { } async function getPullRequest(): Promise { - const client = github.getOctokit(process.env.GITHUB_TOKEN); + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const client = github.getOctokit(process.env.GITHUB_TOKEN!); const pr = github.context.payload.pull_request; if (!pr) { @@ -45,7 +46,7 @@ function checkDescription( } const [firstLine, secondLine] = body.split(/\r?\n/); - if (!firstLine || !/^BREAKING CHANGE:/.test(firstLine)) { + if (!firstLine || !firstLine.startsWith('BREAKING CHANGE:')) { raiseError( `Breaking change PR body should start with "BREAKING CHANGE:". See https://typescript-eslint.io/maintenance/releases#2-merging-breaking-changes.`, ); diff --git a/packages/repo-tools/typings/process-env.d.ts b/packages/repo-tools/typings/process-env.d.ts deleted file mode 100644 index 086a2b28350a..000000000000 --- a/packages/repo-tools/typings/process-env.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare namespace NodeJS { - interface ProcessEnv { - GITHUB_TOKEN: string; - } -} From b65577eaf6dd53fced3504923ddb0b18b22a1638 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Mon, 17 Jun 2024 20:24:45 -0500 Subject: [PATCH 15/18] add import attribute --- knip.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knip.ts b/knip.ts index bcfd69b75618..f3f21bcac245 100644 --- a/knip.ts +++ b/knip.ts @@ -1,4 +1,4 @@ -import type { KnipConfig } from 'knip'; +import type { KnipConfig } from 'knip' with { 'resolution-mode': 'import' }; export default { rules: { From 9d6601cee1dd4dffab1b0e405d9c6388ae1535e3 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Mon, 17 Jun 2024 20:28:03 -0500 Subject: [PATCH 16/18] lint --- packages/repo-tools/src/breaking-pr-check-action.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/repo-tools/src/breaking-pr-check-action.mts b/packages/repo-tools/src/breaking-pr-check-action.mts index 647103327fd8..510276744ec2 100644 --- a/packages/repo-tools/src/breaking-pr-check-action.mts +++ b/packages/repo-tools/src/breaking-pr-check-action.mts @@ -46,7 +46,7 @@ function checkDescription( } const [firstLine, secondLine] = body.split(/\r?\n/); - if (!firstLine || !firstLine.startsWith('BREAKING CHANGE:')) { + if (!firstLine.startsWith('BREAKING CHANGE:')) { raiseError( `Breaking change PR body should start with "BREAKING CHANGE:". See https://typescript-eslint.io/maintenance/releases#2-merging-breaking-changes.`, ); From 7a86edfcd3cb200bfbd30a6bf26a23d8d0224889 Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Tue, 18 Jun 2024 07:04:03 -0500 Subject: [PATCH 17/18] suppress --- packages/repo-tools/src/release/changelog-renderer.js | 1 + packages/repo-tools/src/release/release.mts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/repo-tools/src/release/changelog-renderer.js b/packages/repo-tools/src/release/changelog-renderer.js index d9fd0e8a1b28..2c37b4dcfc84 100644 --- a/packages/repo-tools/src/release/changelog-renderer.js +++ b/packages/repo-tools/src/release/changelog-renderer.js @@ -1,6 +1,7 @@ // @ts-check const { default: defaultChangelogRenderer, + // eslint-disable-next-line import/no-extraneous-dependencies } = require('nx/release/changelog-renderer'); const changelogRenderer = async ({ diff --git a/packages/repo-tools/src/release/release.mts b/packages/repo-tools/src/release/release.mts index b70d8b8269f7..03eced10233d 100644 --- a/packages/repo-tools/src/release/release.mts +++ b/packages/repo-tools/src/release/release.mts @@ -1,4 +1,5 @@ import { execaSync } from 'execa'; +// eslint-disable-next-line import/no-extraneous-dependencies import { releaseChangelog, releasePublish, releaseVersion } from 'nx/release'; import yargs from 'yargs'; From b5599b860d201ea2f0bcd48abb7611593d999d2e Mon Sep 17 00:00:00 2001 From: Abraham Guo Date: Tue, 18 Jun 2024 08:26:10 -0500 Subject: [PATCH 18/18] add to package.json --- packages/repo-tools/package.json | 1 + packages/repo-tools/src/release/changelog-renderer.js | 1 - packages/repo-tools/src/release/release.mts | 1 - yarn.lock | 1 + 4 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index 684e22336654..7bb57db50257 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -29,6 +29,7 @@ "@typescript-eslint/utils": "7.13.1", "cross-fetch": "*", "execa": "*", + "nx": "19.3.0-canary.20240611-1600875", "prettier": "^3.2.5", "rimraf": "*", "semver": "7.6.2", diff --git a/packages/repo-tools/src/release/changelog-renderer.js b/packages/repo-tools/src/release/changelog-renderer.js index 2c37b4dcfc84..d9fd0e8a1b28 100644 --- a/packages/repo-tools/src/release/changelog-renderer.js +++ b/packages/repo-tools/src/release/changelog-renderer.js @@ -1,7 +1,6 @@ // @ts-check const { default: defaultChangelogRenderer, - // eslint-disable-next-line import/no-extraneous-dependencies } = require('nx/release/changelog-renderer'); const changelogRenderer = async ({ diff --git a/packages/repo-tools/src/release/release.mts b/packages/repo-tools/src/release/release.mts index 03eced10233d..b70d8b8269f7 100644 --- a/packages/repo-tools/src/release/release.mts +++ b/packages/repo-tools/src/release/release.mts @@ -1,5 +1,4 @@ import { execaSync } from 'execa'; -// eslint-disable-next-line import/no-extraneous-dependencies import { releaseChangelog, releasePublish, releaseVersion } from 'nx/release'; import yargs from 'yargs'; diff --git a/yarn.lock b/yarn.lock index 382000fe8f22..16c9f1503c1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5720,6 +5720,7 @@ __metadata: "@typescript-eslint/utils": 7.13.1 cross-fetch: "*" execa: "*" + nx: 19.3.0-canary.20240611-1600875 prettier: ^3.2.5 rimraf: "*" semver: 7.6.2