diff --git a/.github/actions/bump-manifest-version.cjs b/.github/actions/bump-manifest-version.cjs index 36646d58..e02ac0a8 100644 --- a/.github/actions/bump-manifest-version.cjs +++ b/.github/actions/bump-manifest-version.cjs @@ -44,6 +44,6 @@ function bumpVersion(existingVersion, type) { case 'minor': return [major, minor + 1, 0, 0]; default: - throw new Error('Unknown bump type: ' + type); + throw new Error(`Unknown bump type: ${type}`); } } diff --git a/biome.json b/biome.json index c2ac71a3..0ba22db4 100644 --- a/biome.json +++ b/biome.json @@ -20,7 +20,7 @@ "rules": { "recommended": true, "style": { - "useTemplate": "off", + "useTemplate": "info", "noUnusedTemplateLiteral": "off", "noUselessElse": "off", "noNonNullAssertion": "off" diff --git a/esbuild/dev.ts b/esbuild/dev.ts index a1ee4b5b..b6641481 100644 --- a/esbuild/dev.ts +++ b/esbuild/dev.ts @@ -98,7 +98,7 @@ function liveReloadPlugin({ target }: { target: Target }): ESBuildPlugin { build.onLoad({ filter: /src\/background\/index\.ts$/ }, async (args) => { const contents = await readFile(args.path, 'utf8'); return { - contents: reloadScriptBackground + '\n' + contents, + contents: `${reloadScriptBackground}\n${contents}`, loader: 'ts' as const, }; }); @@ -108,7 +108,7 @@ function liveReloadPlugin({ target }: { target: Target }): ESBuildPlugin { async (args) => { const contents = await readFile(args.path, 'utf8'); return { - contents: contents + '\n\n\n' + reloadScriptPopup, + contents: `${contents}\n\n\n${reloadScriptPopup}`, loader: 'tsx' as const, }; }, @@ -116,14 +116,14 @@ function liveReloadPlugin({ target }: { target: Target }): ESBuildPlugin { build.onLoad({ filter: /src\/pages\/.+\/index.tsx$/ }, async (args) => { const contents = await readFile(args.path, 'utf8'); return { - contents: contents + '\n\n\n' + reloadScriptPages, + contents: `${contents}\n\n\n${reloadScriptPages}`, loader: 'tsx' as const, }; }); build.onLoad({ filter: /src\/content\// }, async (args) => { const contents = await readFile(args.path, 'utf8'); return { - contents: contents + '\n\n\n' + reloadScriptContent, + contents: `${contents}\n\n\n${reloadScriptContent}`, loader: 'ts' as const, }; }); diff --git a/esbuild/plugins.ts b/esbuild/plugins.ts index e810fa66..3f8f21f9 100644 --- a/esbuild/plugins.ts +++ b/esbuild/plugins.ts @@ -135,9 +135,9 @@ function processManifestPlugin({ } if (channel === 'preview') { - json.name = json.name + ' Preview'; + json.name = `${json.name} Preview`; } else if (channel === 'nightly') { - json.name = json.name + ' Nightly'; + json.name = `${json.name} Nightly`; } if (dev) { diff --git a/scripts/build.ts b/scripts/build.ts index 59ad74d3..61088d60 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -22,7 +22,7 @@ sade('build [target]', true) .option('--dev', 'Dev-mode (watch, live-reload)', false) .example('chrome --channel=nightly') .example('firefox --channel=stable') - .describe(['`target` should be one of ' + TARGETS.join(', ')]) + .describe([`\`target\` should be one of ${TARGETS.join(', ')}`]) .action(async (target: Target, opts: BuildArgs) => { const options = { ...opts, target }; if (!options.target && !options.dev) { @@ -36,11 +36,11 @@ sade('build [target]', true) } if (!TARGETS.includes(options.target)) { - console.warn('Invalid --target. Must be one of ' + TARGETS.join(', ')); + console.warn(`Invalid --target. Must be one of ${TARGETS.join(', ')}`); process.exit(1); } if (!CHANNELS.includes(options.channel)) { - console.warn('Invalid --channel. Must be one of ' + CHANNELS.join(', ')); + console.warn(`Invalid --channel. Must be one of ${CHANNELS.join(', ')}`); process.exit(1); } diff --git a/src/background/services/deduplicator.ts b/src/background/services/deduplicator.ts index d871b4e6..1f63bdb3 100644 --- a/src/background/services/deduplicator.ts +++ b/src/background/services/deduplicator.ts @@ -35,7 +35,7 @@ export class Deduplicator { if (entry) { this.logger.debug( - `Deduplicating function=${fn.name}, ${cacheFnArgs ? 'args=' + JSON.stringify(args) : 'without args'}`, + `Deduplicating function=${fn.name}, ${cacheFnArgs ? `args=${JSON.stringify(args)}` : 'without args'}`, ); return entry.promise as ReturnType; } diff --git a/src/background/services/openPayments.ts b/src/background/services/openPayments.ts index 79bed9ad..8d5e87eb 100644 --- a/src/background/services/openPayments.ts +++ b/src/background/services/openPayments.ts @@ -763,7 +763,7 @@ export class OpenPaymentsService { hash, authServer, }: VerifyInteractionHashParams): Promise { - const grantEndpoint = new URL(authServer).origin + '/'; + const grantEndpoint = `${new URL(authServer).origin}/`; const data = new TextEncoder().encode( `${clientNonce}\n${interactNonce}\n${interactRef}\n${grantEndpoint}`, ); diff --git a/src/content/keyAutoAdd/lib/keyAutoAdd.ts b/src/content/keyAutoAdd/lib/keyAutoAdd.ts index 673fb31a..cfb8a457 100644 --- a/src/content/keyAutoAdd/lib/keyAutoAdd.ts +++ b/src/content/keyAutoAdd/lib/keyAutoAdd.ts @@ -93,7 +93,7 @@ export class KeyAutoAdd { browser.runtime.getURL('pages/progress-connect/index.html'), ); const params = new URLSearchParams({ mode: size }); - iframeUrl.hash = '?' + params.toString(); + iframeUrl.hash = `?${params.toString()}`; if (this.ui.src !== iframeUrl.href && size !== 'hidden') { this.ui.src = iframeUrl.href; } diff --git a/src/content/polyfill.ts b/src/content/polyfill.ts index 0433a444..9439728f 100644 --- a/src/content/polyfill.ts +++ b/src/content/polyfill.ts @@ -31,7 +31,7 @@ import type { MonetizationEventPayload } from '@/shared/messages'; this.addEventListener('monetization', val); handlers.set(this, val); } else { - throw new Error('val must be a function, got ' + typeof val); + throw new Error(`val must be a function, got ${typeof val}`); } }, }; diff --git a/src/content/services/monetizationLinkManager.ts b/src/content/services/monetizationLinkManager.ts index f8c69826..403e2b6a 100644 --- a/src/content/services/monetizationLinkManager.ts +++ b/src/content/services/monetizationLinkManager.ts @@ -228,8 +228,7 @@ export class MonetizationLinkManager extends EventEmitter { url = new URL(href); if (url.protocol !== 'https:') { throw new WalletAddressFormatError( - `Wallet address URL must be specified as a fully resolved https:// url, ` + - `got ${JSON.stringify(href)} `, + `Wallet address URL must be specified as a fully resolved https:// url, got ${JSON.stringify(href)} `, ); } } catch (e) { @@ -517,9 +516,7 @@ export class MonetizationLinkManager extends EventEmitter { const details = this.monetizationLinks.get(link); if (!details) { throw new Error( - 'Could not find details for monetization node ' + - // node is removed, so the reference can not be displayed - link.outerHTML.slice(0, 200), + `Could not find details for monetization node ${link.outerHTML.slice(0, 200)}`, ); } diff --git a/src/pages/shared/lib/hooks.test.tsx b/src/pages/shared/lib/hooks.test.tsx index 53eb5fd3..89935368 100644 --- a/src/pages/shared/lib/hooks.test.tsx +++ b/src/pages/shared/lib/hooks.test.tsx @@ -36,7 +36,7 @@ describe('useLocalStorage', () => { diff --git a/tests/e2e/fixtures/base.ts b/tests/e2e/fixtures/base.ts index fb0256e4..bdf6db72 100644 --- a/tests/e2e/fixtures/base.ts +++ b/tests/e2e/fixtures/base.ts @@ -89,23 +89,17 @@ export const expect = test.expect.extend({ const message = pass ? () => - this.utils.matcherHint(assertionName, undefined, undefined, { + `${this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot, - }) + - '\n\n' + - `Expected: not ${this.utils.printExpected(expected)}\n` + - (matcherResult + })}\n\nExpected: not ${this.utils.printExpected(expected)}\n${matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` - : '') + : ''}` : () => - this.utils.matcherHint(assertionName, undefined, undefined, { + `${this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot, - }) + - '\n\n' + - `Expected: ${this.utils.printExpected(expected)}\n` + - (matcherResult + })}\n\nExpected: ${this.utils.printExpected(expected)}\n${matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` - : ''); + : ''}`; return { name: assertionName, diff --git a/tests/e2e/fixtures/helpers.ts b/tests/e2e/fixtures/helpers.ts index db930bdd..6a1e8850 100644 --- a/tests/e2e/fixtures/helpers.ts +++ b/tests/e2e/fixtures/helpers.ts @@ -175,7 +175,7 @@ export async function loadContext( } if (!context) { - throw new Error('Unknown browser: ' + browserName); + throw new Error(`Unknown browser: ${browserName}`); } // Note that loading this directly via config -> use({ storageState }) doesn't @@ -195,7 +195,7 @@ function getPathToExtension(browserName: string) { } else if (browserName === 'firefox') { pathToExtension = path.join(BUILD_DIR, 'firefox'); } else { - throw new Error('Unknown browser: ' + browserName); + throw new Error(`Unknown browser: ${browserName}`); } return pathToExtension; } @@ -227,7 +227,7 @@ export async function getBackground( // // } } else { - throw new Error('Unsupported browser: ' + browserName); + throw new Error(`Unsupported browser: ${browserName}`); } if (!background) { diff --git a/tests/e2e/helpers/testWallet.ts b/tests/e2e/helpers/testWallet.ts index 2330b4b9..75900a49 100644 --- a/tests/e2e/helpers/testWallet.ts +++ b/tests/e2e/helpers/testWallet.ts @@ -84,7 +84,7 @@ export async function revokeKey( credentials: 'include', }); if (!res.ok) { - throw new Error('Failed to revoke key: ' + (await res.text())); + throw new Error(`Failed to revoke key: ${await res.text()}`); } }, url); }