From 0517c1992def2f147af219015aa5e1f3110cfd7e Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Sat, 24 Feb 2024 14:35:44 -0800 Subject: [PATCH 1/4] Switch to flat config --- eslint.config.js | 22 +++ package.json | 4 +- packages/chronus/.eslintrc.cjs | 16 -- packages/chronus/eslint.config.js | 3 + packages/chronus/package.json | 4 +- packages/github-pr-commenter/.eslintrc.cjs | 16 -- packages/github-pr-commenter/eslint.config.js | 3 + packages/github-pr-commenter/package.json | 4 +- pnpm-lock.yaml | 166 +++++++++++++++++- 9 files changed, 197 insertions(+), 41 deletions(-) create mode 100644 eslint.config.js delete mode 100644 packages/chronus/.eslintrc.cjs create mode 100644 packages/chronus/eslint.config.js delete mode 100644 packages/github-pr-commenter/.eslintrc.cjs create mode 100644 packages/github-pr-commenter/eslint.config.js diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..ad6a5de --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,22 @@ +// @ts-check +import eslint from "@eslint/js"; +import tsEslint from "typescript-eslint"; + +export default tsEslint.config( + { + ignores: ["dist/**/*"], + }, + eslint.configs.recommended, + ...tsEslint.configs.recommended, + { + rules: { + "no-console": "warn", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": [ + "warn", + { varsIgnorePattern: "^_", argsIgnorePattern: ".*", ignoreRestSiblings: true }, + ], + "prefer-const": "warn", + }, + }, +); diff --git a/package.json b/package.json index 28c592b..3ac02de 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "devDependencies": { "@actions/github": "^6.0.0", "@types/node": "^20.11.19", + "@typescript-eslint/utils": "^7.0.2", "cspell": "^8.4.0", "eslint": "^8.56.0", "eslint-plugin-import": "^2.29.1", @@ -49,7 +50,8 @@ "prettier-plugin-organize-imports": "^3.2.4", "rimraf": "^5.0.5", "syncpack": "^12.3.0", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "typescript-eslint": "^7.0.2" }, "syncpack": { "dependencyTypes": [ diff --git a/packages/chronus/.eslintrc.cjs b/packages/chronus/.eslintrc.cjs deleted file mode 100644 index 75fa7d5..0000000 --- a/packages/chronus/.eslintrc.cjs +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = { - root: true, - env: { browser: true, es2020: true }, - extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], - ignorePatterns: ["dist", ".eslintrc.cjs"], - parser: "@typescript-eslint/parser", - rules: { - "no-console": "warn", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "warn", - { varsIgnorePattern: "^_", argsIgnorePattern: ".*", ignoreRestSiblings: true }, - ], - "prefer-const": "warn", - }, -}; diff --git a/packages/chronus/eslint.config.js b/packages/chronus/eslint.config.js new file mode 100644 index 0000000..975a454 --- /dev/null +++ b/packages/chronus/eslint.config.js @@ -0,0 +1,3 @@ +import defaultConfig from "../../eslint.config.js"; + +export default defaultConfig; diff --git a/packages/chronus/package.json b/packages/chronus/package.json index 5ec1977..b0e49a3 100644 --- a/packages/chronus/package.json +++ b/packages/chronus/package.json @@ -16,8 +16,8 @@ "watch": "tsc -p ./tsconfig.build.json --watch", "build": "tsc -p ./tsconfig.build.json", "clean": "rimraf dist/ .temp/", - "lint": "eslint . --ext .ts --max-warnings=0", - "lint:fix": "eslint . --fix --ext .ts", + "lint": "eslint . --max-warnings=0", + "lint:fix": "eslint . --fix", "test": "vitest run", "test:watch": "vitest -w" }, diff --git a/packages/github-pr-commenter/.eslintrc.cjs b/packages/github-pr-commenter/.eslintrc.cjs deleted file mode 100644 index 75fa7d5..0000000 --- a/packages/github-pr-commenter/.eslintrc.cjs +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = { - root: true, - env: { browser: true, es2020: true }, - extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"], - ignorePatterns: ["dist", ".eslintrc.cjs"], - parser: "@typescript-eslint/parser", - rules: { - "no-console": "warn", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-unused-vars": [ - "warn", - { varsIgnorePattern: "^_", argsIgnorePattern: ".*", ignoreRestSiblings: true }, - ], - "prefer-const": "warn", - }, -}; diff --git a/packages/github-pr-commenter/eslint.config.js b/packages/github-pr-commenter/eslint.config.js new file mode 100644 index 0000000..975a454 --- /dev/null +++ b/packages/github-pr-commenter/eslint.config.js @@ -0,0 +1,3 @@ +import defaultConfig from "../../eslint.config.js"; + +export default defaultConfig; diff --git a/packages/github-pr-commenter/package.json b/packages/github-pr-commenter/package.json index d2323c3..a9c883b 100644 --- a/packages/github-pr-commenter/package.json +++ b/packages/github-pr-commenter/package.json @@ -11,8 +11,8 @@ "watch": "tsc -p ./tsconfig.build.json --watch", "build": "tsc -p ./tsconfig.build.json", "clean": "rimraf dist/ .temp/", - "lint": "eslint . --ext .ts --max-warnings=0", - "lint:fix": "eslint . --fix --ext .ts", + "lint": "eslint . --max-warnings=0", + "lint:fix": "eslint . --fix", "test": "vitest run", "test:watch": "vitest -w" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ce2275b..d47f7f2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,6 +18,9 @@ importers: '@types/node': specifier: ^20.11.19 version: 20.11.19 + '@typescript-eslint/utils': + specifier: ^7.0.2 + version: 7.0.2(eslint@8.56.0)(typescript@5.3.3) cspell: specifier: ^8.4.0 version: 8.4.0 @@ -26,7 +29,7 @@ importers: version: 8.56.0 eslint-plugin-import: specifier: ^2.29.1 - version: 2.29.1(eslint@8.56.0) + version: 2.29.1(@typescript-eslint/parser@7.0.2)(eslint@8.56.0) eslint-plugin-unicorn: specifier: ^51.0.1 version: 51.0.1(eslint@8.56.0) @@ -45,6 +48,9 @@ importers: typescript: specifier: ^5.3.3 version: 5.3.3 + typescript-eslint: + specifier: ^7.0.2 + version: 7.0.2(eslint@8.56.0)(typescript@5.3.3) packages/chronus: dependencies: @@ -1304,6 +1310,35 @@ packages: - supports-color dev: true + /@typescript-eslint/eslint-plugin@7.0.2(@typescript-eslint/parser@7.0.2)(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-/XtVZJtbaphtdrWjr+CJclaCVGPtOdBpFEnvtNf/jRV0IiEemRrL0qABex/nEt8isYcnFacm3nPHYQwL+Wb7qg==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + '@typescript-eslint/parser': ^7.0.0 + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@eslint-community/regexpp': 4.10.0 + '@typescript-eslint/parser': 7.0.2(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/scope-manager': 7.0.2 + '@typescript-eslint/type-utils': 7.0.2(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 7.0.2(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/visitor-keys': 7.0.2 + debug: 4.3.4 + eslint: 8.56.0 + graphemer: 1.4.0 + ignore: 5.3.0 + natural-compare: 1.4.0 + semver: 7.6.0 + ts-api-utils: 1.0.3(typescript@5.3.3) + typescript: 5.3.3 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/parser@7.0.1(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-8GcRRZNzaHxKzBPU3tKtFNing571/GwPBeCvmAUw0yBtfE2XVd0zFKJIMSWkHJcPQi0ekxjIts6L/rrZq5cxGQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -1325,6 +1360,27 @@ packages: - supports-color dev: true + /@typescript-eslint/parser@7.0.2(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-GdwfDglCxSmU+QTS9vhz2Sop46ebNCXpPPvsByK7hu0rFGRHL+AusKQJ7SoN+LbLh6APFpQwHKmDSwN35Z700Q==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/scope-manager': 7.0.2 + '@typescript-eslint/types': 7.0.2 + '@typescript-eslint/typescript-estree': 7.0.2(typescript@5.3.3) + '@typescript-eslint/visitor-keys': 7.0.2 + debug: 4.3.4 + eslint: 8.56.0 + typescript: 5.3.3 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/scope-manager@7.0.1: resolution: {integrity: sha512-v7/T7As10g3bcWOOPAcbnMDuvctHzCFYCG/8R4bK4iYzdFqsZTbXGln0cZNVcwQcwewsYU2BJLay8j0/4zOk4w==} engines: {node: ^16.0.0 || >=18.0.0} @@ -1333,6 +1389,14 @@ packages: '@typescript-eslint/visitor-keys': 7.0.1 dev: true + /@typescript-eslint/scope-manager@7.0.2: + resolution: {integrity: sha512-l6sa2jF3h+qgN2qUMjVR3uCNGjWw4ahGfzIYsCtFrQJCjhbrDPdiihYT8FnnqFwsWX+20hK592yX9I2rxKTP4g==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 7.0.2 + '@typescript-eslint/visitor-keys': 7.0.2 + dev: true + /@typescript-eslint/type-utils@7.0.1(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-YtT9UcstTG5Yqy4xtLiClm1ZpM/pWVGFnkAa90UfdkkZsR1eP2mR/1jbHeYp8Ay1l1JHPyGvoUYR6o3On5Nhmw==} engines: {node: ^16.0.0 || >=18.0.0} @@ -1353,11 +1417,36 @@ packages: - supports-color dev: true + /@typescript-eslint/type-utils@7.0.2(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-IKKDcFsKAYlk8Rs4wiFfEwJTQlHcdn8CLwLaxwd6zb8HNiMcQIFX9sWax2k4Cjj7l7mGS5N1zl7RCHOVwHq2VQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/typescript-estree': 7.0.2(typescript@5.3.3) + '@typescript-eslint/utils': 7.0.2(eslint@8.56.0)(typescript@5.3.3) + debug: 4.3.4 + eslint: 8.56.0 + ts-api-utils: 1.0.3(typescript@5.3.3) + typescript: 5.3.3 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/types@7.0.1: resolution: {integrity: sha512-uJDfmirz4FHib6ENju/7cz9SdMSkeVvJDK3VcMFvf/hAShg8C74FW+06MaQPODHfDJp/z/zHfgawIJRjlu0RLg==} engines: {node: ^16.0.0 || >=18.0.0} dev: true + /@typescript-eslint/types@7.0.2: + resolution: {integrity: sha512-ZzcCQHj4JaXFjdOql6adYV4B/oFOFjPOC9XYwCaZFRvqN8Llfvv4gSxrkQkd2u4Ci62i2c6W6gkDwQJDaRc4nA==} + engines: {node: ^16.0.0 || >=18.0.0} + dev: true + /@typescript-eslint/typescript-estree@7.0.1(typescript@5.3.3): resolution: {integrity: sha512-SO9wHb6ph0/FN5OJxH4MiPscGah5wjOd0RRpaLvuBv9g8565Fgu0uMySFEPqwPHiQU90yzJ2FjRYKGrAhS1xig==} engines: {node: ^16.0.0 || >=18.0.0} @@ -1380,6 +1469,28 @@ packages: - supports-color dev: true + /@typescript-eslint/typescript-estree@7.0.2(typescript@5.3.3): + resolution: {integrity: sha512-3AMc8khTcELFWcKcPc0xiLviEvvfzATpdPj/DXuOGIdQIIFybf4DMT1vKRbuAEOFMwhWt7NFLXRkbjsvKZQyvw==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 7.0.2 + '@typescript-eslint/visitor-keys': 7.0.2 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.3 + semver: 7.6.0 + ts-api-utils: 1.0.3(typescript@5.3.3) + typescript: 5.3.3 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/utils@7.0.1(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-oe4his30JgPbnv+9Vef1h48jm0S6ft4mNwi9wj7bX10joGn07QRfqIqFHoMiajrtoU88cIhXf8ahwgrcbNLgPA==} engines: {node: ^16.0.0 || >=18.0.0} @@ -1399,6 +1510,25 @@ packages: - typescript dev: true + /@typescript-eslint/utils@7.0.2(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-PZPIONBIB/X684bhT1XlrkjNZJIEevwkKDsdwfiu1WeqBxYEEdIgVDgm8/bbKHVu+6YOpeRqcfImTdImx/4Bsw==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^8.56.0 + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.7 + '@typescript-eslint/scope-manager': 7.0.2 + '@typescript-eslint/types': 7.0.2 + '@typescript-eslint/typescript-estree': 7.0.2(typescript@5.3.3) + eslint: 8.56.0 + semver: 7.6.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /@typescript-eslint/visitor-keys@7.0.1: resolution: {integrity: sha512-hwAgrOyk++RTXrP4KzCg7zB2U0xt7RUU0ZdMSCsqF3eKUwkdXUMyTb0qdCuji7VIbcpG62kKTU9M1J1c9UpFBw==} engines: {node: ^16.0.0 || >=18.0.0} @@ -1407,6 +1537,14 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /@typescript-eslint/visitor-keys@7.0.2: + resolution: {integrity: sha512-8Y+YiBmqPighbm5xA2k4wKTxRzx9EkBu7Rlw+WHqMvRJ3RPz/BMBO9b2ru0LUNmXg120PHUXD5+SWFy2R8DqlQ==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 7.0.2 + eslint-visitor-keys: 3.4.3 + dev: true + /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true @@ -2294,7 +2432,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.0(eslint-import-resolver-node@0.3.9)(eslint@8.56.0): + /eslint-module-utils@2.8.0(@typescript-eslint/parser@7.0.2)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0): resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} engines: {node: '>=4'} peerDependencies: @@ -2315,6 +2453,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: + '@typescript-eslint/parser': 7.0.2(eslint@8.56.0)(typescript@5.3.3) debug: 3.2.7 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 @@ -2322,7 +2461,7 @@ packages: - supports-color dev: true - /eslint-plugin-import@2.29.1(eslint@8.56.0): + /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.0.2)(eslint@8.56.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} peerDependencies: @@ -2332,6 +2471,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: + '@typescript-eslint/parser': 7.0.2(eslint@8.56.0)(typescript@5.3.3) array-includes: 3.1.7 array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 @@ -2340,7 +2480,7 @@ packages: doctrine: 2.1.0 eslint: 8.56.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(eslint-import-resolver-node@0.3.9)(eslint@8.56.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@7.0.2)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0) hasown: 2.0.0 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -4272,6 +4412,24 @@ packages: is-typedarray: 1.0.0 dev: true + /typescript-eslint@7.0.2(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-Nsb+Dfi897ErE3CtVJYBECBQWPGEpCXLqLCQarBhFtyJsHnhA7O39GmtAmN3dmZ6bIp8tP5T+AOUrEdE07SBVg==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^8.56.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/eslint-plugin': 7.0.2(@typescript-eslint/parser@7.0.2)(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/parser': 7.0.2(eslint@8.56.0)(typescript@5.3.3) + eslint: 8.56.0 + typescript: 5.3.3 + transitivePeerDependencies: + - supports-color + dev: true + /typescript@5.3.3: resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} engines: {node: '>=14.17'} From 7f41247a8f9b5fb77cd41bbb1ec506cd1b460365 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Sat, 24 Feb 2024 14:41:46 -0800 Subject: [PATCH 2/4] Simplify --- eslint.config.js | 2 +- packages/chronus/eslint.config.js | 3 --- packages/github-pr-commenter/eslint.config.js | 3 --- packages/github-pr-commenter/src/cli.ts | 1 - 4 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 packages/chronus/eslint.config.js delete mode 100644 packages/github-pr-commenter/eslint.config.js diff --git a/eslint.config.js b/eslint.config.js index ad6a5de..ab3516b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -4,7 +4,7 @@ import tsEslint from "typescript-eslint"; export default tsEslint.config( { - ignores: ["dist/**/*"], + ignores: ["**/dist/**/*"], }, eslint.configs.recommended, ...tsEslint.configs.recommended, diff --git a/packages/chronus/eslint.config.js b/packages/chronus/eslint.config.js deleted file mode 100644 index 975a454..0000000 --- a/packages/chronus/eslint.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import defaultConfig from "../../eslint.config.js"; - -export default defaultConfig; diff --git a/packages/github-pr-commenter/eslint.config.js b/packages/github-pr-commenter/eslint.config.js deleted file mode 100644 index 975a454..0000000 --- a/packages/github-pr-commenter/eslint.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import defaultConfig from "../../eslint.config.js"; - -export default defaultConfig; diff --git a/packages/github-pr-commenter/src/cli.ts b/packages/github-pr-commenter/src/cli.ts index b04d2af..38baecc 100644 --- a/packages/github-pr-commenter/src/cli.ts +++ b/packages/github-pr-commenter/src/cli.ts @@ -20,7 +20,6 @@ interface Context { } function getGithubContext(): Context | undefined { - // eslint-disable-next-line no-console console.log("Github context", githubActionContext); if ( From 98240b22cf53e032aebb59c0af065629e6953f3e Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Sat, 24 Feb 2024 14:43:52 -0800 Subject: [PATCH 3/4] Create feature-eslint-flat-config-2024-1-24-22-43-32.md --- .../feature-eslint-flat-config-2024-1-24-22-43-32.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .chronus/changes/feature-eslint-flat-config-2024-1-24-22-43-32.md diff --git a/.chronus/changes/feature-eslint-flat-config-2024-1-24-22-43-32.md b/.chronus/changes/feature-eslint-flat-config-2024-1-24-22-43-32.md new file mode 100644 index 0000000..345dae0 --- /dev/null +++ b/.chronus/changes/feature-eslint-flat-config-2024-1-24-22-43-32.md @@ -0,0 +1,9 @@ +--- +# Change versionKind to one of: breaking, feature, fix, internal +changeKind: internal +packages: + - "@chronus/chronus" + - "@chronus/github-pr-commenter" +--- + +Migrate to eslint flat config From 5a16da6f7bb5a22e8ce11130445ab9c5d9883249 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Sat, 24 Feb 2024 15:10:44 -0800 Subject: [PATCH 4/4] fix issues --- eng/prepare-release-branch.js | 2 ++ eslint.config.js | 9 ++++++++- package.json | 4 +++- .../src/apply-release-plan/apply-release-plan.ts | 2 +- packages/github-pr-commenter/src/cli.ts | 5 +++-- pnpm-lock.yaml | 11 +++++++++++ 6 files changed, 28 insertions(+), 5 deletions(-) diff --git a/eng/prepare-release-branch.js b/eng/prepare-release-branch.js index ca5d341..8a62968 100644 --- a/eng/prepare-release-branch.js +++ b/eng/prepare-release-branch.js @@ -1,3 +1,5 @@ +/* eslint-disable no-console */ +/* eslint-disable no-undef */ // @ts-check import { context, getOctokit } from "@actions/github"; import { execSync } from "child_process"; diff --git a/eslint.config.js b/eslint.config.js index ab3516b..35e9888 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -4,11 +4,17 @@ import tsEslint from "typescript-eslint"; export default tsEslint.config( { - ignores: ["**/dist/**/*"], + ignores: ["**/dist/**/*", "**/.temp/**/*"], }, eslint.configs.recommended, ...tsEslint.configs.recommended, { + languageOptions: { + parserOptions: { + project: "./tsconfig.json", + tsconfigRootDir: import.meta.dirname, + }, + }, rules: { "no-console": "warn", "@typescript-eslint/no-explicit-any": "off", @@ -17,6 +23,7 @@ export default tsEslint.config( { varsIgnorePattern: "^_", argsIgnorePattern: ".*", ignoreRestSiblings: true }, ], "prefer-const": "warn", + "@typescript-eslint/no-floating-promises": "error", }, }, ); diff --git a/package.json b/package.json index 3ac02de..2bbbcb7 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "watch": "tsc --build ./tsconfig.ws.json --watch", "build": "pnpm -r run build", "clean": "pnpm -r run clean && rimraf **/.temp/", - "lint": "pnpm -r run lint", + "lint": "eslint .", "format": "npm run -s prettier -- --write", "check-format": "npm run -s prettier -- --check", "check-version-mismatch": "syncpack list-mismatches", @@ -40,7 +40,9 @@ "homepage": "https://github.com/timotheeguerin/chronus#readme", "devDependencies": { "@actions/github": "^6.0.0", + "@eslint/js": "^8.57.0", "@types/node": "^20.11.19", + "@typescript-eslint/parser": "^7.0.1", "@typescript-eslint/utils": "^7.0.2", "cspell": "^8.4.0", "eslint": "^8.56.0", diff --git a/packages/chronus/src/apply-release-plan/apply-release-plan.ts b/packages/chronus/src/apply-release-plan/apply-release-plan.ts index 70bc70e..cccc72b 100644 --- a/packages/chronus/src/apply-release-plan/apply-release-plan.ts +++ b/packages/chronus/src/apply-release-plan/apply-release-plan.ts @@ -47,5 +47,5 @@ async function patchChangeDescription( ...change, packages: change.packages.filter((x) => !exclude.includes(x)), }; - writeChangeDescription(host, workspace, newChange); + await writeChangeDescription(host, workspace, newChange); } diff --git a/packages/github-pr-commenter/src/cli.ts b/packages/github-pr-commenter/src/cli.ts index 38baecc..13f7ca2 100644 --- a/packages/github-pr-commenter/src/cli.ts +++ b/packages/github-pr-commenter/src/cli.ts @@ -20,6 +20,7 @@ interface Context { } function getGithubContext(): Context | undefined { + // eslint-disable-next-line no-console console.log("Github context", githubActionContext); if ( @@ -116,14 +117,14 @@ async function main() { const existingComment = comments.data.find((x) => x.body?.includes(magicString)); if (existingComment) { - github.rest.issues.updateComment({ + await github.rest.issues.updateComment({ comment_id: existingComment.id, owner: context.repoOwner, repo: context.repoName, body: content, }); } else { - github.rest.issues.createComment({ + await github.rest.issues.createComment({ issue_number: context.prNumber, owner: context.repoOwner, repo: context.repoName, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d47f7f2..b2c7c6b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,9 +15,15 @@ importers: '@actions/github': specifier: ^6.0.0 version: 6.0.0 + '@eslint/js': + specifier: ^8.57.0 + version: 8.57.0 '@types/node': specifier: ^20.11.19 version: 20.11.19 + '@typescript-eslint/parser': + specifier: ^7.0.1 + version: 7.0.2(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/utils': specifier: ^7.0.2 version: 7.0.2(eslint@8.56.0)(typescript@5.3.3) @@ -769,6 +775,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /@eslint/js@8.57.0: + resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dev: true + /@fastify/busboy@2.1.0: resolution: {integrity: sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==} engines: {node: '>=14'}