From e0da896a456d4cf3afd81a3df6f6dce2c27ae575 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 24 Sep 2024 16:02:06 -0700 Subject: [PATCH 1/3] ci: enforce including .js extensions in type imports The local tsconfig using `moduleResolution: bundler` doesn't require it but consumers of these packages can have other moduleResolution configs that do --- .eslintrc.cjs | 8 ++++++-- package.json | 1 + yarn.lock | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index e0393d92518..eb6597b6b3f 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -75,8 +75,12 @@ module.exports = { tsconfigRootDir: __dirname, extraFileExtensions: ['.cjs'], }, - plugins: ['@typescript-eslint', 'prettier'], - extends: ['@agoric', 'plugin:ava/recommended'], + plugins: ['@typescript-eslint', 'prettier', 'require-extensions'], + extends: [ + '@agoric', + 'plugin:ava/recommended', + 'plugin:require-extensions/recommended', + ], // XXX false positive: Unused eslint-disable directive (no problems were reported from 'max-len') reportUnusedDisableDirectives: true, diff --git a/package.json b/package.json index 628a28fd66b..37dcb04b7ce 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "eslint-plugin-import": "^2.29.1", "eslint-plugin-jsdoc": "^48.5.2", "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-require-extensions": "^0.1.3", "lerna": "^5.6.2", "npm-run-all": "^4.1.5", "prettier": "^3.3.2", diff --git a/yarn.lock b/yarn.lock index 2dc7dd17b95..1d8c1669cfa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6021,6 +6021,11 @@ eslint-plugin-prettier@^5.0.0, eslint-plugin-prettier@^5.1.3: prettier-linter-helpers "^1.0.0" synckit "^0.8.6" +eslint-plugin-require-extensions@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-require-extensions/-/eslint-plugin-require-extensions-0.1.3.tgz#394aeab433f996797a6ceba0a3f75640d4846bc8" + integrity sha512-T3c1PZ9PIdI3hjV8LdunfYI8gj017UQjzAnCrxuo3wAjneDbTPHdE3oNWInOjMA+z/aBkUtlW5vC0YepYMZIug== + eslint-rule-docs@^1.1.5: version "1.1.231" resolved "https://registry.yarnpkg.com/eslint-rule-docs/-/eslint-rule-docs-1.1.231.tgz#648b978bc5a1bb740be5f28d07470f0926b9cdf1" From 37c7f50d30b5bc73fad830f9775b114b0d4ad5f9 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Tue, 24 Sep 2024 16:03:19 -0700 Subject: [PATCH 2/3] lint: fix including .js extensions --- packages/orchestration/src/exos/exo-interfaces.ts | 4 ++-- packages/zoe/src/zoeService/utils.test-d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/orchestration/src/exos/exo-interfaces.ts b/packages/orchestration/src/exos/exo-interfaces.ts index 9916556b9af..473403300df 100644 --- a/packages/orchestration/src/exos/exo-interfaces.ts +++ b/packages/orchestration/src/exos/exo-interfaces.ts @@ -1,8 +1,8 @@ import type { IBCConnectionID } from '@agoric/vats'; import type { Vow } from '@agoric/vow'; import type { IcaAccount } from '../cosmos-api.ts'; -import type { ICAChannelAddressOpts } from '../utils/address'; -import type { ICQConnection } from './icq-connection-kit'; +import type { ICAChannelAddressOpts } from '../utils/address.js'; +import type { ICQConnection } from './icq-connection-kit.js'; /** * Authority to make a Cosmos interchain account or an interchain query connection. diff --git a/packages/zoe/src/zoeService/utils.test-d.ts b/packages/zoe/src/zoeService/utils.test-d.ts index 90c61472899..121b9700f71 100644 --- a/packages/zoe/src/zoeService/utils.test-d.ts +++ b/packages/zoe/src/zoeService/utils.test-d.ts @@ -1,5 +1,5 @@ import { E } from '@endo/far'; -import type { StartedInstanceKit } from './utils'; +import type { StartedInstanceKit } from './utils.js'; const someContractStartFn = ( zcf: ZCF, From 6f7c5d4502937e87ac028cb85d106d07fa98dd50 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 25 Sep 2024 11:56:48 -0700 Subject: [PATCH 3/3] refactor: .ts to .js extension --- multichain-testing/scripts/pod-readiness.ts | 2 +- packages/orchestration/src/exos/exo-interfaces.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/multichain-testing/scripts/pod-readiness.ts b/multichain-testing/scripts/pod-readiness.ts index a5a583d6946..315980e0ffc 100644 --- a/multichain-testing/scripts/pod-readiness.ts +++ b/multichain-testing/scripts/pod-readiness.ts @@ -1,5 +1,5 @@ import { execa } from 'execa'; -import { sleep } from '../tools/sleep.ts'; +import { sleep } from '../tools/sleep.js'; const checkPodsReadiness = async (): Promise => { const { stdout } = await execa('kubectl', ['get', 'pods']); diff --git a/packages/orchestration/src/exos/exo-interfaces.ts b/packages/orchestration/src/exos/exo-interfaces.ts index 473403300df..41f321d11d1 100644 --- a/packages/orchestration/src/exos/exo-interfaces.ts +++ b/packages/orchestration/src/exos/exo-interfaces.ts @@ -1,6 +1,6 @@ import type { IBCConnectionID } from '@agoric/vats'; import type { Vow } from '@agoric/vow'; -import type { IcaAccount } from '../cosmos-api.ts'; +import type { IcaAccount } from '../cosmos-api.js'; import type { ICAChannelAddressOpts } from '../utils/address.js'; import type { ICQConnection } from './icq-connection-kit.js';