diff --git a/.eslintrc.cjs b/.eslintrc.cjs index b0219d986..ae7644b57 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -25,9 +25,9 @@ module.exports = { // This prevents importing Node.js builtins. We currently use them in // our codebase, so this rule is disabled. This rule should be disabled // in `@metamask/eslint-config-nodejs` in the future. - 'import/no-nodejs-modules': 'off', + 'import-x/no-nodejs-modules': 'off', - 'import/no-useless-path-segments': [ + 'import-x/no-useless-path-segments': [ 'error', { // Enabling this causes false errors in ESM files. @@ -63,8 +63,8 @@ module.exports = { ecmaVersion: '2022', }, rules: { - 'import/extensions': 'off', - 'import/no-unassigned-import': 'off', + 'import-x/extensions': 'off', + 'import-x/no-unassigned-import': 'off', }, }, @@ -94,7 +94,7 @@ module.exports = { { files: ['*.d.ts'], rules: { - 'import/unambiguous': 'off', + 'import-x/unambiguous': 'off', }, }, diff --git a/package.json b/package.json index f38364c1d..3b413a28d 100644 --- a/package.json +++ b/package.json @@ -37,21 +37,21 @@ "@lavamoat/allow-scripts": "^3.0.4", "@lavamoat/preinstall-always-fail": "^2.0.0", "@metamask/auto-changelog": "^3.4.4", - "@metamask/eslint-config": "^12.2.0", - "@metamask/eslint-config-nodejs": "^12.1.0", - "@metamask/eslint-config-typescript": "^12.1.0", + "@metamask/eslint-config": "^13.0.0", + "@metamask/eslint-config-nodejs": "^13.0.0", + "@metamask/eslint-config-typescript": "^13.0.0", "@ts-bridge/cli": "^0.3.0", "@ts-bridge/shims": "^0.1.1", "@types/node": "^18.18.14", - "@typescript-eslint/eslint-plugin": "^5.43.0", - "@typescript-eslint/parser": "^5.43.0", + "@typescript-eslint/eslint-plugin": "^8.1.0", + "@typescript-eslint/parser": "^8.1.0", "@yarnpkg/types": "^4.0.0", "depcheck": "^1.4.3", - "eslint": "^8.56.0", + "eslint": "^8.57.0", "eslint-config-prettier": "^8.8.0", - "eslint-plugin-import": "~2.26.0", - "eslint-plugin-jsdoc": "^39.9.1", - "eslint-plugin-n": "^15.7.0", + "eslint-plugin-import-x": "^0.5.1", + "eslint-plugin-jsdoc": "^47.0.2", + "eslint-plugin-n": "^16.6.2", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-vitest": "^0.4.1", @@ -59,7 +59,7 @@ "prettier-plugin-packagejson": "^2.3.0", "rimraf": "^6.0.1", "typedoc": "^0.24.8", - "typescript": "~4.9.5", + "typescript": "~5.5.4", "vite": "^5.3.5", "vite-tsconfig-paths": "^4.3.2", "vitest": "^2.0.5" diff --git a/packages/extension/package.json b/packages/extension/package.json index 25d520d95..192af388f 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -46,7 +46,7 @@ "rimraf": "^6.0.1", "typedoc": "^0.24.8", "typedoc-plugin-missing-exports": "^2.0.0", - "typescript": "~4.9.5", + "typescript": "~5.5.4", "vite": "^5.3.5", "vite-plugin-static-copy": "^1.0.6", "vitest": "^2.0.5" diff --git a/packages/extension/src/background.ts b/packages/extension/src/background.ts index 1f4f9ff3d..b899e06a7 100644 --- a/packages/extension/src/background.ts +++ b/packages/extension/src/background.ts @@ -1,7 +1,7 @@ -/* eslint-disable import/no-unassigned-import */ +/* eslint-disable import-x/no-unassigned-import */ import './dev-console.js'; import './endoify.mjs'; -/* eslint-enable import/no-unassigned-import */ +/* eslint-enable import-x/no-unassigned-import */ import type { ExtensionMessage } from './shared.js'; import { Command, makeHandledCallback } from './shared.js'; @@ -28,11 +28,12 @@ chrome.action.onClicked.addListener(() => { /** * Send a message to the offscreen document. + * * @param type - The message type. * @param data - The message data. * @param data.name - The name to include in the message. */ -async function sendMessage(type: string, data?: string) { +async function sendMessage(type: string, data?: string): Promise { await provideOffScreenDocument(); await chrome.runtime.sendMessage({ @@ -45,7 +46,7 @@ async function sendMessage(type: string, data?: string) { /** * Create the offscreen document if it doesn't already exist. */ -async function provideOffScreenDocument() { +async function provideOffScreenDocument(): Promise { if (!(await chrome.offscreen.hasDocument())) { await chrome.offscreen.createDocument({ url: OFFSCREEN_DOCUMENT_PATH, @@ -83,7 +84,7 @@ chrome.runtime.onMessage.addListener( /** * Close the offscreen document if it exists. */ -async function closeOffscreenDocument() { +async function closeOffscreenDocument(): Promise { if (!(await chrome.offscreen.hasDocument())) { return; } diff --git a/packages/extension/src/dev-console.js b/packages/extension/src/dev-console.js index 275afbcb6..6f522febd 100644 --- a/packages/extension/src/dev-console.js +++ b/packages/extension/src/dev-console.js @@ -1,4 +1,4 @@ -/* eslint-disable import/unambiguous */ +/* eslint-disable import-x/unambiguous */ // We set this property on globalThis in the background before lockdown. Object.defineProperty(globalThis, 'kernel', { configurable: false, diff --git a/packages/extension/src/iframe-manager.test.ts b/packages/extension/src/iframe-manager.test.ts index 2a732124e..c2a00c5e5 100644 --- a/packages/extension/src/iframe-manager.test.ts +++ b/packages/extension/src/iframe-manager.test.ts @@ -1,10 +1,11 @@ +import type { makePromiseKit } from '@endo/promise-kit'; import * as snapsUtils from '@metamask/snaps-utils'; import { vi, beforeEach, describe, it, expect } from 'vitest'; import { Command } from './shared.js'; vi.mock('@endo/promise-kit', () => ({ - makePromiseKit: () => { + makePromiseKit: (): ReturnType => { let resolve: (value: unknown) => void, reject: (reason?: unknown) => void; const promise = new Promise((_resolve, _reject) => { resolve = _resolve; diff --git a/packages/extension/src/iframe-manager.ts b/packages/extension/src/iframe-manager.ts index cd6073cb0..4ccfd0f80 100644 --- a/packages/extension/src/iframe-manager.ts +++ b/packages/extension/src/iframe-manager.ts @@ -8,7 +8,7 @@ import { Command, isWrappedIframeMessage } from './shared.js'; const IFRAME_URI = 'iframe.html'; // The actual