diff --git a/benchmark/packages/timer/src/index.ts b/benchmark/packages/timer/src/index.ts index 2ea41af662..1c54e37276 100644 --- a/benchmark/packages/timer/src/index.ts +++ b/benchmark/packages/timer/src/index.ts @@ -27,7 +27,6 @@ export default function createIntegration(): AstroIntegration { setAdapter(getAdapter()); if (config.output === 'static') { - // eslint-disable-next-line no-console console.warn(`[@benchmark/timer] \`output: "server"\` is required to use this adapter.`); } }, diff --git a/benchmark/packages/timer/src/preview.ts b/benchmark/packages/timer/src/preview.ts index aa503c11bf..9659a26bea 100644 --- a/benchmark/packages/timer/src/preview.ts +++ b/benchmark/packages/timer/src/preview.ts @@ -9,7 +9,7 @@ const preview: CreatePreviewServer = async function ({ serverEntrypoint, host, p server.listen(port, host); enableDestroy(server); - // eslint-disable-next-line no-console + // biome-ignore lint/suspicious/noConsoleLog: allowed console.log(`Preview server listening on http://${host}:${port}`); // Resolves once the server is closed diff --git a/biome.json b/biome.json deleted file mode 100644 index 4714f3706b..0000000000 --- a/biome.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", - "files": { - "ignore": [ - "vendor", - "**/dist/**", - "**/smoke/**", - "**/fixtures/**", - "**/vendor/**", - "**/.vercel/**" - ], - "include": ["test/**", "e2e/**", "packages/**", "/scripts/**"] - }, - "formatter": { - "indentStyle": "tab", - "indentWidth": 2, - "lineWidth": 100, - "ignore": [ - "benchmark/projects/", - "benchmark/results/", - ".changeset", - "pnpm-lock.yaml", - "*.astro" - ] - }, - "organizeImports": { - "enabled": true - }, - "linter": { - "enabled": true, - "rules": { - "recommended": false, - "style": { - "useNodejsImportProtocol": "error", - "useImportType": "error" - } - } - }, - "javascript": { - "formatter": { - "trailingCommas": "all", - "quoteStyle": "single", - "semicolons": "always" - } - }, - "json": { - "parser": { - "allowComments": true, - "allowTrailingCommas": true - }, - "formatter": { - "indentStyle": "space", - "trailingCommas": "none" - } - }, - "overrides": [ - { - "include": ["package.json"], - "json": { - "formatter": { - "lineWidth": 1 - } - } - }, - { - "include": ["*.test.js"], - "linter": { - "rules": { - "suspicious": { - "noFocusedTests": "error" - } - } - } - } - ] -} diff --git a/biome.jsonc b/biome.jsonc new file mode 100644 index 0000000000..a949301439 --- /dev/null +++ b/biome.jsonc @@ -0,0 +1,139 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.3/schema.json", + "files": { + "ignore": [ + "vendor", + "**/dist/**", + "**/smoke/**", + "**/fixtures/**", + "**/vendor/**", + "**/.vercel/**", + ], + "include": ["test/**", "e2e/**", "packages/**", "/scripts/**"], + }, + "formatter": { + "indentStyle": "tab", + "indentWidth": 2, + "lineWidth": 100, + "ignore": [ + "benchmark/projects/", + "benchmark/results/", + ".changeset", + "pnpm-lock.yaml", + "*.astro", + ], + }, + "organizeImports": { + "enabled": true, + }, + "linter": { + "enabled": true, + "rules": { + "recommended": false, + "style": { + "useNodejsImportProtocol": "error", + // Enforce separate type imports for type-only imports to avoid bundling unneeded code + "useImportType": "error", + }, + "suspicious": { + // This one is specific to catch `console.log`. The rest of logs are permitted + "noConsoleLog": "warn", + }, + "correctness": { + "noUnusedVariables": "info", + "noUnusedFunctionParameters": "info", + }, + }, + }, + "javascript": { + "formatter": { + "trailingCommas": "all", + "quoteStyle": "single", + "semicolons": "always", + }, + }, + "json": { + "parser": { + "allowComments": true, + "allowTrailingCommas": true, + }, + "formatter": { + "indentStyle": "space", + "trailingCommas": "none", + }, + }, + "overrides": [ + { + // Workaround to format files like npm does + "include": ["package.json"], + "json": { + "formatter": { + "lineWidth": 1, + }, + }, + }, + { + // We don"t want to have node modules in code that should be runtime agnostic + "include": ["packages/astro/src/runtime/**/*.ts"], + "linter": { + "rules": { + "correctness": { + "noNodejsModules": "error", + }, + }, + }, + }, + { + "include": ["*.test.js"], + "linter": { + "rules": { + "suspicious": { + "noFocusedTests": "error", + "noConsole": "off", + }, + }, + }, + }, + { + "include": ["*.astro", "client.d.ts"], + "linter": { + "rules": { + "correctness": { + "noUnusedVariables": "off", + }, + }, + }, + }, + { + "include": ["packages/integrations/**/*.ts"], + "linter": { + "rules": { + "suspicious": { + "noConsole": { + "level": "error", + "options": { + "allow": ["warn", "error", "info", "debug"], + }, + }, + }, + }, + }, + }, + { + "include": [ + "packages/db/**/cli/**/*.ts", + "benchmark/**/*.js", + "packages/astro/src/cli/**/*.ts", + "packages/astro/astro.js", + ], + "linter": { + "rules": { + "suspicious": { + "noConsole": "off", + "noConsoleLog": "off", + }, + }, + }, + }, + ], +} diff --git a/eslint.config.js b/eslint.config.js index dbd379d276..c5fbf3fbc3 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,6 +1,5 @@ import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { builtinModules } from 'node:module'; import tseslint from 'typescript-eslint'; @@ -51,19 +50,11 @@ export default [ rules: { // These off/configured-differently-by-default rules fit well for us '@typescript-eslint/switch-exhaustiveness-check': 'error', - '@typescript-eslint/no-unused-vars': [ - 'error', - { - argsIgnorePattern: '^_', - varsIgnorePattern: '^_', - caughtErrorsIgnorePattern: '^_', - ignoreRestSiblings: true, - }, - ], '@typescript-eslint/no-shadow': 'error', - 'no-console': 'warn', + 'no-console': 'off', // Todo: do we want these? + '@typescript-eslint/no-unused-vars': 'off', '@typescript-eslint/array-type': 'off', '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/class-literal-property-style': 'off', @@ -95,16 +86,8 @@ export default [ '@typescript-eslint/unbound-method': 'off', '@typescript-eslint/no-explicit-any': 'off', - // Enforce separate type imports for type-only imports to avoid bundling unneeded code - '@typescript-eslint/consistent-type-imports': [ - 'error', - { - prefer: 'type-imports', - fixStyle: 'separate-type-imports', - disallowTypeAnnotations: false, - }, - ], - + // Used by Biome + '@typescript-eslint/consistent-type-imports': 'off', // These rules enabled by the preset configs don't work well for us '@typescript-eslint/await-thenable': 'off', 'prefer-const': 'off', @@ -115,20 +98,6 @@ export default [ 'regexp/prefer-regexp-test': 'warn', }, }, - - { - // Ensure Node builtins aren't included in Astro's server runtime - files: ['packages/astro/src/runtime/**/*.ts'], - rules: { - 'no-restricted-imports': [ - 'error', - { - paths: [...builtinModules], - patterns: ['node:*'], - }, - ], - }, - }, { files: ['packages/astro/src/runtime/client/**/*.ts'], languageOptions: { @@ -137,36 +106,6 @@ export default [ }, }, }, - { - files: ['packages/**/test/*.js', 'packages/**/*.js'], - languageOptions: { - globals: { - globalThis: false, // false means read-only - }, - }, - rules: { - 'no-console': 'off', - }, - }, - { - files: ['packages/integrations/**/*.ts'], - rules: { - 'no-console': ['error', { allow: ['warn', 'error', 'info', 'debug'] }], - }, - }, - { - files: ['benchmark/**/*.js'], - rules: { - '@typescript-eslint/no-unused-vars': 'off', - 'no-console': 'off', - }, - }, - { - files: ['packages/db/**/cli/**/*.ts'], - rules: { - 'no-console': 'off', - }, - }, { files: ['packages/astro/src/core/errors/errors-data.ts'], rules: { diff --git a/package.json b/package.json index 8bc271bda9..ecf688f19c 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "test:e2e:hosts": "turbo run test:hosted", "benchmark": "astro-benchmark", "lint": "biome lint && eslint . --report-unused-disable-directives", + "lint:fix": "biome lint --write --unsafe", "version": "changeset version && node ./scripts/deps/update-example-versions.js && pnpm install --no-frozen-lockfile && pnpm run format", "preinstall": "npx only-allow pnpm" }, @@ -53,7 +54,7 @@ }, "devDependencies": { "@astrojs/check": "^0.9.4", - "@biomejs/biome": "1.8.3", + "@biomejs/biome": "1.9.3", "@changesets/changelog-github": "^0.5.0", "@changesets/cli": "^2.27.9", "@types/node": "^18.17.8", diff --git a/packages/astro-prism/src/highlighter.ts b/packages/astro-prism/src/highlighter.ts index c0e58054e7..99810b435a 100644 --- a/packages/astro-prism/src/highlighter.ts +++ b/packages/astro-prism/src/highlighter.ts @@ -26,7 +26,6 @@ export function runHighlighterWithAstro(lang: string | undefined, code: string) } if (lang && !Prism.languages[lang]) { - // eslint-disable-next-line no-console console.warn(`Unable to load the language: ${lang}`); } diff --git a/packages/astro-prism/src/plugin.ts b/packages/astro-prism/src/plugin.ts index 057433f404..eed02a3043 100644 --- a/packages/astro-prism/src/plugin.ts +++ b/packages/astro-prism/src/plugin.ts @@ -8,7 +8,6 @@ export function addAstro(Prism: typeof import('prismjs')) { scriptLang = 'typescript'; } else { scriptLang = 'javascript'; - // eslint-disable-next-line no-console console.warn( 'Prism TypeScript language not loaded, Astro scripts will be treated as JavaScript.', ); diff --git a/packages/astro-rss/src/index.ts b/packages/astro-rss/src/index.ts index b84e81e739..33a8f66a02 100644 --- a/packages/astro-rss/src/index.ts +++ b/packages/astro-rss/src/index.ts @@ -70,7 +70,6 @@ const rssOptionsValidator = z.object({ .or(globResultValidator) .transform((items) => { if (!Array.isArray(items)) { - // eslint-disable-next-line console.warn( yellow( '[RSS] Passing a glob result directly has been deprecated. Please migrate to the `pagesGlobToRssItems()` helper: https://docs.astro.build/en/guides/rss/', diff --git a/packages/astro/astro-jsx.d.ts b/packages/astro/astro-jsx.d.ts index b26507d1db..f493ff941c 100644 --- a/packages/astro/astro-jsx.d.ts +++ b/packages/astro/astro-jsx.d.ts @@ -1,5 +1,4 @@ /// -/* eslint @typescript-eslint/no-unused-vars: off */ /** * Adapted from babel-plugin-react-html-attrs's TypeScript definition from DefinitelyTyped. * @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/babel-plugin-react-html-attrs/index.d.ts diff --git a/packages/astro/performance/content-benchmark.mjs b/packages/astro/performance/content-benchmark.mjs index 98ef5f0eac..c4081a9e9a 100644 --- a/packages/astro/performance/content-benchmark.mjs +++ b/packages/astro/performance/content-benchmark.mjs @@ -1,5 +1,3 @@ -/* eslint-disable no-console */ - import { fileURLToPath } from 'node:url'; import { parseArgs } from 'node:util'; import { bold, cyan, dim } from 'kleur/colors'; @@ -25,15 +23,15 @@ async function benchmark({ fixtures, templates, numPosts }) { ext: extByFixture[fixture], template: templates[fixture], }); - console.log(`[${fixture}] Generated posts`); + console.info(`[${fixture}] Generated posts`); const { build } = await loadFixture({ root, }); const now = performance.now(); - console.log(`[${fixture}] Building...`); + console.info(`[${fixture}] Building...`); await build(); - console.log(cyan(`[${fixture}] Built in ${bold(getTimeStat(now, performance.now()))}.`)); + console.info(cyan(`[${fixture}] Built in ${bold(getTimeStat(now, performance.now()))}.`)); } } @@ -57,7 +55,9 @@ async function benchmark({ fixtures, templates, numPosts }) { if (test.includes('simple')) { const fixtures = formats; - console.log(`\n${bold('Simple')} ${dim(`${numPosts} posts (${formatsToString(fixtures)})`)}`); + console.info( + `\n${bold('Simple')} ${dim(`${numPosts} posts (${formatsToString(fixtures)})`)}`, + ); process.env.ASTRO_PERFORMANCE_TEST_NAME = 'simple'; await benchmark({ fixtures, @@ -72,7 +72,7 @@ async function benchmark({ fixtures, templates, numPosts }) { if (test.includes('with-astro-components')) { const fixtures = formats.filter((format) => format !== 'md'); - console.log( + console.info( `\n${bold('With Astro components')} ${dim( `${numPosts} posts (${formatsToString(fixtures)})`, )}`, @@ -90,7 +90,7 @@ async function benchmark({ fixtures, templates, numPosts }) { if (test.includes('with-react-components')) { const fixtures = formats.filter((format) => format !== 'md'); - console.log( + console.info( `\n${bold('With React components')} ${dim( `${numPosts} posts (${formatsToString(fixtures)})`, )}`, diff --git a/packages/astro/performance/scripts/generate-posts.cli.mjs b/packages/astro/performance/scripts/generate-posts.cli.mjs index 30f22e7b7e..ee95ca34b9 100644 --- a/packages/astro/performance/scripts/generate-posts.cli.mjs +++ b/packages/astro/performance/scripts/generate-posts.cli.mjs @@ -1,5 +1,3 @@ -/* eslint-disable no-console */ - import { generatePosts } from './generate-posts.mjs'; (async () => { @@ -14,5 +12,5 @@ import { generatePosts } from './generate-posts.mjs'; await generatePosts({ postsDir, numPosts, ext, template }); - console.log(`${numPosts} ${ext} posts written to ${JSON.stringify(postsDir)} 🚀`); + console.info(`${numPosts} ${ext} posts written to ${JSON.stringify(postsDir)} 🚀`); })(); diff --git a/packages/astro/src/actions/runtime/middleware.ts b/packages/astro/src/actions/runtime/middleware.ts index bca110652d..a61e1652c8 100644 --- a/packages/astro/src/actions/runtime/middleware.ts +++ b/packages/astro/src/actions/runtime/middleware.ts @@ -22,7 +22,6 @@ export type Locals = { export const onRequest = defineMiddleware(async (context, next) => { if ((context as any)._isPrerendered) { if (context.request.method === 'POST') { - // eslint-disable-next-line no-console console.warn( yellow('[astro:actions]'), 'POST requests should not be sent to prerendered pages. If you\'re using Actions, disable prerendering with `export const prerender = "false".', diff --git a/packages/astro/src/actions/runtime/route.ts b/packages/astro/src/actions/runtime/route.ts index 16b53f945b..d10989614f 100644 --- a/packages/astro/src/actions/runtime/route.ts +++ b/packages/astro/src/actions/runtime/route.ts @@ -10,7 +10,6 @@ export const POST: APIRoute = async (context) => { baseAction = await getAction(url.pathname); } catch (e) { if (import.meta.env.DEV) throw e; - // eslint-disable-next-line no-console console.error(e); return new Response(e instanceof Error ? e.message : null, { status: 404 }); } diff --git a/packages/astro/src/actions/runtime/virtual/shared.ts b/packages/astro/src/actions/runtime/virtual/shared.ts index 8367710b94..e2787e7d01 100644 --- a/packages/astro/src/actions/runtime/virtual/shared.ts +++ b/packages/astro/src/actions/runtime/virtual/shared.ts @@ -57,8 +57,7 @@ const statusToCodeMap: Record = Object.entries(codeToSt // T is used for error inference with SafeInput -> isInputError. // See: https://github.com/withastro/astro/pull/11173/files#r1622767246 -// eslint-disable-next-line @typescript-eslint/no-unused-vars -export class ActionError extends Error { +export class ActionError<_T extends ErrorInferenceObject = ErrorInferenceObject> extends Error { type = 'AstroActionError'; code: ActionErrorCode = 'INTERNAL_SERVER_ERROR'; status = 500; diff --git a/packages/astro/src/assets/endpoint/generic.ts b/packages/astro/src/assets/endpoint/generic.ts index 5238f3721a..a87c986df5 100644 --- a/packages/astro/src/assets/endpoint/generic.ts +++ b/packages/astro/src/assets/endpoint/generic.ts @@ -73,7 +73,6 @@ export const GET: APIRoute = async ({ request }) => { }, }); } catch (err: unknown) { - // eslint-disable-next-line no-console console.error('Could not process image request:', err); return new Response(`Server Error: ${err}`, { status: 500 }); } diff --git a/packages/astro/src/assets/endpoint/node.ts b/packages/astro/src/assets/endpoint/node.ts index cb3ae7806e..859af83e2a 100644 --- a/packages/astro/src/assets/endpoint/node.ts +++ b/packages/astro/src/assets/endpoint/node.ts @@ -1,5 +1,5 @@ import { readFile } from 'node:fs/promises'; -/* eslint-disable no-console */ + import os from 'node:os'; import { isAbsolute } from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; diff --git a/packages/astro/src/assets/internal.ts b/packages/astro/src/assets/internal.ts index 38afbf19fc..4cc85799c1 100644 --- a/packages/astro/src/assets/internal.ts +++ b/packages/astro/src/assets/internal.ts @@ -80,7 +80,7 @@ export async function getImage( // Causing our generate step to think the image is used outside of the image optimization pipeline const clonedSrc = isESMImportedImage(resolvedOptions.src) ? // @ts-expect-error - clone is a private, hidden prop - resolvedOptions.src.clone ?? resolvedOptions.src + (resolvedOptions.src.clone ?? resolvedOptions.src) : resolvedOptions.src; resolvedOptions.src = clonedSrc; diff --git a/packages/astro/src/assets/services/squoosh.ts b/packages/astro/src/assets/services/squoosh.ts index b98f831d27..91c7bb6879 100644 --- a/packages/astro/src/assets/services/squoosh.ts +++ b/packages/astro/src/assets/services/squoosh.ts @@ -10,7 +10,6 @@ import { import { processBuffer } from './vendor/squoosh/image-pool.js'; import type { Operation } from './vendor/squoosh/image.js'; -// eslint-disable-next-line no-console console.warn( yellow( 'The Squoosh image service is deprecated and will be removed in Astro 5.x. We suggest migrating to the default Sharp image service instead, as it is faster, more powerful and better maintained.', diff --git a/packages/astro/src/assets/utils/imageKind.ts b/packages/astro/src/assets/utils/imageKind.ts index 7b42f9f701..e3e1b3341a 100644 --- a/packages/astro/src/assets/utils/imageKind.ts +++ b/packages/astro/src/assets/utils/imageKind.ts @@ -9,5 +9,5 @@ export function isRemoteImage(src: ImageMetadata | string): src is string { } export async function resolveSrc(src: UnresolvedImageTransform['src']) { - return typeof src === 'object' && 'then' in src ? (await src).default ?? (await src) : src; + return typeof src === 'object' && 'then' in src ? ((await src).default ?? (await src)) : src; } diff --git a/packages/astro/src/cli/add/index.ts b/packages/astro/src/cli/add/index.ts index 449deee5f3..869a867d1c 100644 --- a/packages/astro/src/cli/add/index.ts +++ b/packages/astro/src/cli/add/index.ts @@ -694,7 +694,6 @@ async function tryToInstallIntegrations({ spinner.fail(); logger.debug('add', 'Error installing dependencies', err); // NOTE: `err.stdout` can be an empty string, so log the full error instead for a more helpful log - // eslint-disable-next-line no-console console.error('\n', err.stdout || err.message, '\n'); return UpdateResult.failure; } diff --git a/packages/astro/src/cli/create-key/index.ts b/packages/astro/src/cli/create-key/index.ts index d9b9f08ffd..bc03c53572 100644 --- a/packages/astro/src/cli/create-key/index.ts +++ b/packages/astro/src/cli/create-key/index.ts @@ -23,7 +23,6 @@ ASTRO_KEY=${encoded}`, ); } catch (err: unknown) { if (err != null) { - // eslint-disable-next-line no-console console.error(err.toString()); } return 1; diff --git a/packages/astro/src/cli/index.ts b/packages/astro/src/cli/index.ts index 23486f938a..5f1cc75a95 100644 --- a/packages/astro/src/cli/index.ts +++ b/packages/astro/src/cli/index.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import * as colors from 'kleur/colors'; import yargs from 'yargs-parser'; import { ASTRO_VERSION } from '../core/constants.js'; diff --git a/packages/astro/src/cli/info/index.ts b/packages/astro/src/cli/info/index.ts index 9e9f06ea60..9da4414f1c 100644 --- a/packages/astro/src/cli/info/index.ts +++ b/packages/astro/src/cli/info/index.ts @@ -1,6 +1,5 @@ import { execSync } from 'node:child_process'; import { arch, platform } from 'node:os'; -/* eslint-disable no-console */ import * as colors from 'kleur/colors'; import prompts from 'prompts'; import type { AstroConfig, AstroUserConfig } from '../../@types/astro.js'; diff --git a/packages/astro/src/cli/preferences/index.ts b/packages/astro/src/cli/preferences/index.ts index 3811e7f487..c872938ca9 100644 --- a/packages/astro/src/cli/preferences/index.ts +++ b/packages/astro/src/cli/preferences/index.ts @@ -1,12 +1,9 @@ -/* eslint-disable no-console */ -import type { AstroSettings } from '../../@types/astro.js'; - import { fileURLToPath } from 'node:url'; -import { bgGreen, black, bold, dim, yellow } from 'kleur/colors'; - import { formatWithOptions } from 'node:util'; import dlv from 'dlv'; import { flattie } from 'flattie'; +import { bgGreen, black, bold, dim, yellow } from 'kleur/colors'; +import type { AstroSettings } from '../../@types/astro.js'; import { resolveConfig } from '../../core/config/config.js'; import { createSettings } from '../../core/config/settings.js'; import { collectErrorMetadata } from '../../core/errors/dev/utils.js'; @@ -335,7 +332,7 @@ function formatTable(object: Record, columnLabels: [stri const colALength = [colA, ...Object.keys(object)].reduce(longest, 0) + 3; const colBLength = [colB, ...Object.values(object).map(annotatedFormat)].reduce(longest, 0) + 3; function formatRow( - i: number, + _i: number, a: string, b: AnnotatedValue, style: (value: string | number | boolean) => string = (v) => v.toString(), diff --git a/packages/astro/src/cli/telemetry/index.ts b/packages/astro/src/cli/telemetry/index.ts index 276f00ef19..a854220c38 100644 --- a/packages/astro/src/cli/telemetry/index.ts +++ b/packages/astro/src/cli/telemetry/index.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import * as msg from '../../core/messages.js'; import { telemetry } from '../../events/index.js'; import { type Flags, createLoggerFromFlags } from '../flags.js'; diff --git a/packages/astro/src/cli/throw-and-exit.ts b/packages/astro/src/cli/throw-and-exit.ts index 1a8916ede9..b7821caa5d 100644 --- a/packages/astro/src/cli/throw-and-exit.ts +++ b/packages/astro/src/cli/throw-and-exit.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import { collectErrorMetadata } from '../core/errors/dev/index.js'; import { isAstroConfigZodError } from '../core/errors/errors.js'; import { createSafeError } from '../core/errors/index.js'; diff --git a/packages/astro/src/content/runtime.ts b/packages/astro/src/content/runtime.ts index 98d1c4fcdb..4e61acaafb 100644 --- a/packages/astro/src/content/runtime.ts +++ b/packages/astro/src/content/runtime.ts @@ -98,7 +98,6 @@ export function createGetCollection({ } return result; } else { - // eslint-disable-next-line no-console console.warn( `The collection ${JSON.stringify( collection, @@ -177,7 +176,6 @@ export function createGetEntryBySlug({ message: AstroErrorData.GetEntryDeprecationError.message(collection, 'getEntryBySlug'), }); } - // eslint-disable-next-line no-console console.warn(`The collection ${JSON.stringify(collection)} does not exist.`); return undefined; } @@ -221,7 +219,6 @@ export function createGetDataEntryById({ message: AstroErrorData.GetEntryDeprecationError.message(collection, 'getDataEntryById'), }); } - // eslint-disable-next-line no-console console.warn(`The collection ${JSON.stringify(collection)} does not exist.`); return undefined; } @@ -296,7 +293,6 @@ export function createGetEntry({ if (store.hasCollection(collection)) { const entry = store.get(collection, lookupId); if (!entry) { - // eslint-disable-next-line no-console console.warn(`Entry ${collection} → ${lookupId} was not found.`); return; } @@ -311,7 +307,6 @@ export function createGetEntry({ } if (!collectionNames.has(collection)) { - // eslint-disable-next-line no-console console.warn(`The collection ${JSON.stringify(collection)} does not exist.`); return undefined; } @@ -456,7 +451,6 @@ export async function renderEntry( renderEntryImport, }); } catch (e) { - // eslint-disable-next-line console.error(e); } } diff --git a/packages/astro/src/content/types-generator.ts b/packages/astro/src/content/types-generator.ts index aa5a75a2b7..e031293da0 100644 --- a/packages/astro/src/content/types-generator.ts +++ b/packages/astro/src/content/types-generator.ts @@ -473,7 +473,7 @@ async function writeContentFiles({ collection.type === 'unknown' ? // Add empty / unknown collections to the data type map by default // This ensures `getCollection('empty-collection')` doesn't raise a type error - collectionConfig?.type ?? 'data' + (collectionConfig?.type ?? 'data') : collection.type; const collectionEntryKeys = Object.keys(collection.entries).sort(); diff --git a/packages/astro/src/core/app/node.ts b/packages/astro/src/core/app/node.ts index f8ee397917..3d0c07ded2 100644 --- a/packages/astro/src/core/app/node.ts +++ b/packages/astro/src/core/app/node.ts @@ -122,7 +122,6 @@ export class NodeApp extends App { // an error in the ReadableStream's cancel callback, but // also because of an error anywhere in the stream. reader.cancel().catch((err) => { - // eslint-disable-next-line no-console console.error( `There was an uncaught error in the middle of the stream while rendering ${destination.req.url}.`, err, diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 7cd2aa91e3..a33df6efb8 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -333,14 +333,6 @@ function getInvalidRouteSegmentError( }); } -interface GeneratePathOptions { - pageData: PageBuildData; - linkIds: string[]; - scripts: { type: 'inline' | 'external'; value: string } | null; - styles: StylesheetAsset[]; - mod: ComponentInstance; -} - function addPageName(pathname: string, opts: StaticBuildOptions): void { const trailingSlash = opts.settings.config.trailingSlash; const buildFormat = opts.settings.config.build.format; diff --git a/packages/astro/src/core/build/internal.ts b/packages/astro/src/core/build/internal.ts index 5c28a4d40e..a346d26930 100644 --- a/packages/astro/src/core/build/internal.ts +++ b/packages/astro/src/core/build/internal.ts @@ -147,7 +147,7 @@ export function createBuildInternals(): BuildInternals { export function trackPageData( internals: BuildInternals, - component: string, + _component: string, pageData: PageBuildData, componentModuleId: string, componentURL: URL, diff --git a/packages/astro/src/core/build/pipeline.ts b/packages/astro/src/core/build/pipeline.ts index a009e6130f..38fd4dfe16 100644 --- a/packages/astro/src/core/build/pipeline.ts +++ b/packages/astro/src/core/build/pipeline.ts @@ -328,7 +328,7 @@ export class BuildPipeline extends Pipeline { async #getEntryForFallbackRoute( route: RouteData, - internals: BuildInternals, + _internals: BuildInternals, outFolder: URL, ): Promise { if (route.type !== 'fallback') { @@ -348,7 +348,7 @@ export class BuildPipeline extends Pipeline { async #getEntryForRedirectRoute( route: RouteData, - internals: BuildInternals, + _internals: BuildInternals, outFolder: URL, ): Promise { if (route.type !== 'redirect') { diff --git a/packages/astro/src/core/config/config.ts b/packages/astro/src/core/config/config.ts index c10066ce32..284ffb1d73 100644 --- a/packages/astro/src/core/config/config.ts +++ b/packages/astro/src/core/config/config.ts @@ -97,7 +97,6 @@ async function loadConfig( } catch (e) { const configPathText = configFile ? colors.bold(configFile) : 'your Astro config'; // Config errors should bypass log level as it breaks startup - // eslint-disable-next-line no-console console.error(`${colors.bold(colors.red('[astro]'))} Unable to load ${configPathText}\n`); throw e; } @@ -158,7 +157,6 @@ export async function resolveConfig( // Mark this error so the callee can decide to suppress Zod's error if needed. // We still want to throw the error to signal an error in validation. trackAstroConfigZodError(e); - // eslint-disable-next-line no-console console.error(formatConfigErrorMessage(e) + '\n'); telemetry.record(eventConfigError({ cmd: command, err: e, isFatal: true })); } diff --git a/packages/astro/src/core/cookies/cookies.ts b/packages/astro/src/core/cookies/cookies.ts index 852be913d6..f2679f23fd 100644 --- a/packages/astro/src/core/cookies/cookies.ts +++ b/packages/astro/src/core/cookies/cookies.ts @@ -156,7 +156,6 @@ class AstroCookies implements AstroCookiesInterface { 'Please make sure that Astro.cookies.set() is only called in the frontmatter of the main page.', ); warning.name = 'Warning'; - // eslint-disable-next-line no-console console.warn(warning); } let serializedValue: string; diff --git a/packages/astro/src/core/logger/console.ts b/packages/astro/src/core/logger/console.ts index ae7241447f..30368bd864 100644 --- a/packages/astro/src/core/logger/console.ts +++ b/packages/astro/src/core/logger/console.ts @@ -2,10 +2,8 @@ import { type LogMessage, type LogWritable, getEventPrefix, levels } from './cor export const consoleLogDestination: LogWritable = { write(event: LogMessage) { - // eslint-disable-next-line no-console let dest = console.error; if (levels[event.level] < levels['error']) { - // eslint-disable-next-line no-console dest = console.log; } if (event.label === 'SKIP_FORMAT') { diff --git a/packages/astro/src/core/messages.ts b/packages/astro/src/core/messages.ts index 8104d993b1..3081c0b6cf 100644 --- a/packages/astro/src/core/messages.ts +++ b/packages/astro/src/core/messages.ts @@ -380,6 +380,6 @@ export function printHelp({ message.push(linebreak(), `${description}`); } - // eslint-disable-next-line no-console + // biome-ignore lint/suspicious/noConsoleLog: allowed console.log(message.join('\n') + '\n'); } diff --git a/packages/astro/src/core/preview/vite-plugin-astro-preview.ts b/packages/astro/src/core/preview/vite-plugin-astro-preview.ts index a425807dcc..7f01e5a5e5 100644 --- a/packages/astro/src/core/preview/vite-plugin-astro-preview.ts +++ b/packages/astro/src/core/preview/vite-plugin-astro-preview.ts @@ -74,7 +74,7 @@ export function vitePluginAstroPreview(settings: AstroSettings): Plugin { return () => { // NOTE: the `base` is stripped from `req.url` for post middlewares - server.middlewares.use((req, res, next) => { + server.middlewares.use((req, _res, next) => { const pathname = cleanUrl(req.url!); // Vite doesn't handle /foo/ if /foo.html exists, we handle it anyways diff --git a/packages/astro/src/events/error.ts b/packages/astro/src/events/error.ts index fc8eddfd85..65e0cabb7e 100644 --- a/packages/astro/src/events/error.ts +++ b/packages/astro/src/events/error.ts @@ -101,7 +101,7 @@ function getSafeErrorMessage(message: string | Function): string { .slice(1, -1) .replace( /\$\{([^}]+)\}/g, - (str, match1) => + (_str, match1) => `${match1 .split(/\.?(?=[A-Z])/) .join('_') diff --git a/packages/astro/src/i18n/vite-plugin-i18n.ts b/packages/astro/src/i18n/vite-plugin-i18n.ts index 7aa4d327b2..0c89ea1a1f 100644 --- a/packages/astro/src/i18n/vite-plugin-i18n.ts +++ b/packages/astro/src/i18n/vite-plugin-i18n.ts @@ -29,7 +29,7 @@ export default function astroInternationalization({ return { name: 'astro:i18n', enforce: 'pre', - config(config, { command }) { + config(_config, { command }) { const i18nConfig: I18nInternalConfig = { base, format, diff --git a/packages/astro/src/jsx/babel.ts b/packages/astro/src/jsx/babel.ts index 648831481a..558de1efb3 100644 --- a/packages/astro/src/jsx/babel.ts +++ b/packages/astro/src/jsx/babel.ts @@ -284,7 +284,6 @@ export default function astroJSX(): PluginObj { if (t.isJSXAttribute(attr)) { const name = jsxAttributeToString(attr); if (name.startsWith('client:')) { - // eslint-disable-next-line console.warn( `You are attempting to render <${displayName} ${name} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`, ); diff --git a/packages/astro/src/jsx/rehype.ts b/packages/astro/src/jsx/rehype.ts index a93a92d5d8..3db1a3070b 100644 --- a/packages/astro/src/jsx/rehype.ts +++ b/packages/astro/src/jsx/rehype.ts @@ -50,7 +50,6 @@ export const rehypeAnalyzeAstroMetadata: RehypePlugin = () => { (attr) => attr.type === 'mdxJsxAttribute' && attr.name.startsWith('client:'), ) as MdxJsxAttribute | undefined; if (clientAttribute) { - // eslint-disable-next-line console.warn( `You are attempting to render <${node.name!} ${ clientAttribute.name diff --git a/packages/astro/src/prefetch/index.ts b/packages/astro/src/prefetch/index.ts index 3eb8cd5701..70f7052d36 100644 --- a/packages/astro/src/prefetch/index.ts +++ b/packages/astro/src/prefetch/index.ts @@ -2,7 +2,6 @@ NOTE: Do not add any dependencies or imports in this file so that it can load quickly in dev. */ -// eslint-disable-next-line no-console const debug = import.meta.env.DEV ? console.debug : undefined; const inBrowser = import.meta.env.SSR === false; // Track prefetched URLs so we don't prefetch twice diff --git a/packages/astro/src/runtime/client/dev-toolbar/settings.ts b/packages/astro/src/runtime/client/dev-toolbar/settings.ts index 2f5eabe6d3..85a1322c14 100644 --- a/packages/astro/src/runtime/client/dev-toolbar/settings.ts +++ b/packages/astro/src/runtime/client/dev-toolbar/settings.ts @@ -35,7 +35,6 @@ function getSettings() { } function log(message: string, level: 'log' | 'warn' | 'error' = 'log') { - // eslint-disable-next-line no-console console[level]( `%cAstro`, 'background: linear-gradient(66.77deg, #D83333 0%, #F041FF 100%); color: white; padding-inline: 4px; border-radius: 2px; font-family: monospace;', diff --git a/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts b/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts index c2869270de..a0969c18dd 100644 --- a/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts +++ b/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import type { ResolvedDevToolbarApp as DevToolbarAppDefinition } from '../../../@types/astro.js'; import { type ToolbarAppEventTarget, serverHelpers } from './helpers.js'; import { settings } from './settings.js'; diff --git a/packages/astro/src/runtime/client/dev-toolbar/ui-library/radio-checkbox.ts b/packages/astro/src/runtime/client/dev-toolbar/ui-library/radio-checkbox.ts index 79508cc694..a223bf1a84 100644 --- a/packages/astro/src/runtime/client/dev-toolbar/ui-library/radio-checkbox.ts +++ b/packages/astro/src/runtime/client/dev-toolbar/ui-library/radio-checkbox.ts @@ -14,7 +14,6 @@ export class DevToolbarRadioCheckbox extends HTMLElement { set radioStyle(value) { if (!styles.includes(value)) { - // eslint-disable-next-line no-console console.error(`Invalid style: ${value}, expected one of ${styles.join(', ')}.`); return; } diff --git a/packages/astro/src/runtime/server/astro-island.ts b/packages/astro/src/runtime/server/astro-island.ts index 252ed65c86..d9a13146e5 100644 --- a/packages/astro/src/runtime/server/astro-island.ts +++ b/packages/astro/src/runtime/server/astro-island.ts @@ -45,7 +45,7 @@ declare const Astro: { return Object.fromEntries(Object.entries(raw).map(([key, value]) => [key, reviveTuple(value)])); }; - // 🌊🏝️🌴 + // 🌊🏝🌴 class AstroIsland extends HTMLElement { public Component: any; public hydrator: any; @@ -127,7 +127,6 @@ declare const Astro: { this, ); } catch (e) { - // eslint-disable-next-line no-console console.error(`[astro-island] Error hydrating ${this.getAttribute('component-url')}`, e); } } @@ -179,7 +178,6 @@ declare const Astro: { componentName += ` (export ${componentExport})`; } - // eslint-disable-next-line no-console console.error( `[hydrate] Error parsing props for component ${componentName}`, this.getAttribute('props'), diff --git a/packages/astro/src/runtime/server/render/astro/instance.ts b/packages/astro/src/runtime/server/render/astro/instance.ts index 3246a7e1b2..2df412e81b 100644 --- a/packages/astro/src/runtime/server/render/astro/instance.ts +++ b/packages/astro/src/runtime/server/render/astro/instance.ts @@ -77,7 +77,6 @@ function validateComponentProps(props: any, displayName: string) { if (props != null) { for (const prop of Object.keys(props)) { if (prop.startsWith('client:')) { - // eslint-disable-next-line console.warn( `You are attempting to render <${displayName} ${prop} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`, ); diff --git a/packages/astro/src/runtime/server/render/component.ts b/packages/astro/src/runtime/server/render/component.ts index 449f58fbcc..c667cd2d3c 100644 --- a/packages/astro/src/runtime/server/render/component.ts +++ b/packages/astro/src/runtime/server/render/component.ts @@ -265,7 +265,6 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr : metadata.hydrateArgs; if (!clientOnlyValues.has(rendererName)) { // warning if provide incorrect client:only directive but find the renderer by guess - // eslint-disable-next-line no-console console.warn( `The client:only directive for ${metadata.displayName} is not recognized. The renderer ${renderer.name} will be used. If you intended to use a different renderer, please provide a valid client:only directive.`, ); diff --git a/packages/astro/src/runtime/server/render/util.ts b/packages/astro/src/runtime/server/render/util.ts index 67c0d84230..5dd428b9b1 100644 --- a/packages/astro/src/runtime/server/render/util.ts +++ b/packages/astro/src/runtime/server/render/util.ts @@ -76,7 +76,6 @@ export function addAttribute(value: any, key: string, shouldEscape = true) { // compiler directives cannot be applied dynamically, log a warning and ignore. if (STATIC_DIRECTIVES.has(key)) { - // eslint-disable-next-line no-console console.warn(`[astro] The "${key}" directive cannot be applied dynamically at runtime. It will not be rendered as an attribute. Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the dynamic spread syntax (\`{...{ "${key}": value }}\`).`); diff --git a/packages/astro/src/runtime/server/transition.ts b/packages/astro/src/runtime/server/transition.ts index 8887d3dae4..616237c05d 100644 --- a/packages/astro/src/runtime/server/transition.ts +++ b/packages/astro/src/runtime/server/transition.ts @@ -77,7 +77,7 @@ function reEncode(s: string) { codepoint < 0x80 ? codepoint === 95 ? '__' - : reEncodeValidChars[codepoint] ?? '_' + codepoint.toString(16).padStart(2, '0') + : (reEncodeValidChars[codepoint] ?? '_' + codepoint.toString(16).padStart(2, '0')) : String.fromCodePoint(codepoint); } } diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index 388f7a2cdb..ddce9ff216 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -543,7 +543,7 @@ async function transition( // This log doesn't make it worse than before, where we got error messages about uncaught exceptions, which can't be caught when the trigger was a click or history traversal. // Needs more investigation on root causes if errors still occur sporadically const err = e as Error; - // eslint-disable-next-line no-console + // biome-ignore lint/suspicious/noConsoleLog: allowed console.log('[astro]', err.name, err.message, err.stack); } } @@ -558,7 +558,6 @@ export async function navigate(href: string, options?: Options) { 'The view transitions client API was called during a server side render. This may be unintentional as the navigate() function is expected to be called in response to user interactions. Please make sure that your usage is correct.', ); warning.name = 'Warning'; - // eslint-disable-next-line no-console console.warn(warning); navigateOnServerWarned = true; } diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts index 58113891e8..30a6eda019 100644 --- a/packages/astro/src/vite-plugin-astro-server/route.ts +++ b/packages/astro/src/vite-plugin-astro-server/route.ts @@ -235,7 +235,7 @@ export async function handleRoute({ req({ url: pathname, method: incomingRequest.method, - statusCode: isRewrite ? response.status : status ?? response.status, + statusCode: isRewrite ? response.status : (status ?? response.status), isRewrite, reqTime: timeEnd - timeStart, }), diff --git a/packages/astro/src/vite-plugin-astro-server/vite.ts b/packages/astro/src/vite-plugin-astro-server/vite.ts index 1478539542..697174571f 100644 --- a/packages/astro/src/vite-plugin-astro-server/vite.ts +++ b/packages/astro/src/vite-plugin-astro-server/vite.ts @@ -27,7 +27,7 @@ export async function* crawlGraph( ? // "getModulesByFile" pulls from a delayed module cache (fun implementation detail), // So we can get up-to-date info on initial server load. // Needed for slower CSS preprocessing like Tailwind - loader.getModulesByFile(id) ?? new Set() + (loader.getModulesByFile(id) ?? new Set()) : // For non-root files, we're safe to pull from "getModuleById" based on testing. // TODO: Find better invalidation strategy to use "getModuleById" in all cases! new Set([loader.getModuleById(id)]); diff --git a/packages/astro/templates/env/module.mjs b/packages/astro/templates/env/module.mjs index d7637af157..648556cf12 100644 --- a/packages/astro/templates/env/module.mjs +++ b/packages/astro/templates/env/module.mjs @@ -26,7 +26,6 @@ const _internalGetSecret = (key) => { }; // used while generating the virtual module -// eslint-disable-next-line @typescript-eslint/no-unused-vars -setOnSetGetEnv((reset) => { +setOnSetGetEnv((_reset) => { // @@ON_SET_GET_ENV@@ }); diff --git a/packages/astro/test/0-css.test.js b/packages/astro/test/0-css.test.js index a582f9e719..65010f5803 100644 --- a/packages/astro/test/0-css.test.js +++ b/packages/astro/test/0-css.test.js @@ -75,7 +75,7 @@ describe('CSS', function () { assert.equal($('#no-scope').attr('class'), undefined); }); - it('Child inheritance', (t, done) => { + it('Child inheritance', (_t, done) => { for (const [key] of Object.entries($('#passed-in')[0].attribs)) { if (/^data-astro-cid-[A-Za-z\d-]+/.test(key)) { done(); diff --git a/packages/astro/test/alias-tsconfig-baseurl-only.test.js b/packages/astro/test/alias-tsconfig-baseurl-only.test.js index 20c2884ccb..ecf1dea240 100644 --- a/packages/astro/test/alias-tsconfig-baseurl-only.test.js +++ b/packages/astro/test/alias-tsconfig-baseurl-only.test.js @@ -13,7 +13,7 @@ describe('Aliases with tsconfig.json - baseUrl only', () => { function getLinks(html) { let $ = cheerio.load(html); let out = []; - $('link[rel=stylesheet]').each((i, el) => { + $('link[rel=stylesheet]').each((_i, el) => { out.push($(el).attr('href')); }); return out; diff --git a/packages/astro/test/alias-tsconfig.test.js b/packages/astro/test/alias-tsconfig.test.js index 86853baf23..958251dda1 100644 --- a/packages/astro/test/alias-tsconfig.test.js +++ b/packages/astro/test/alias-tsconfig.test.js @@ -13,7 +13,7 @@ describe('Aliases with tsconfig.json', () => { function getLinks(html) { let $ = cheerio.load(html); let out = []; - $('link[rel=stylesheet]').each((i, el) => { + $('link[rel=stylesheet]').each((_i, el) => { out.push($(el).attr('href')); }); return out; diff --git a/packages/astro/test/astro-assets-prefix-multi-cdn.test.js b/packages/astro/test/astro-assets-prefix-multi-cdn.test.js index 9dbf259b2d..52db4225fa 100644 --- a/packages/astro/test/astro-assets-prefix-multi-cdn.test.js +++ b/packages/astro/test/astro-assets-prefix-multi-cdn.test.js @@ -31,7 +31,7 @@ describe('Assets Prefix Multiple CDN - Static', () => { const html = await fixture.readFile('/index.html'); const $ = cheerio.load(html); const stylesheets = $('link[rel="stylesheet"]'); - stylesheets.each((i, el) => { + stylesheets.each((_i, el) => { assert.match(el.attribs.href, cssAssetsPrefixRegex); }); }); @@ -62,7 +62,7 @@ describe('Assets Prefix Multiple CDN - Static', () => { const html = await fixture.readFile('/markdown/index.html'); const $ = cheerio.load(html); const imgAssets = $('img'); - imgAssets.each((i, el) => { + imgAssets.each((_i, el) => { assert.match(el.attribs.src, defaultAssetsPrefixRegex); }); }); @@ -98,7 +98,7 @@ describe('Assets Prefix Multiple CDN, server', () => { const html = await response.text(); const $ = cheerio.load(html); const stylesheets = $('link[rel="stylesheet"]'); - stylesheets.each((i, el) => { + stylesheets.each((_i, el) => { assert.match(el.attribs.href, cssAssetsPrefixRegex); }); }); diff --git a/packages/astro/test/astro-assets-prefix.test.js b/packages/astro/test/astro-assets-prefix.test.js index 4987c64e19..3e2d5c0477 100644 --- a/packages/astro/test/astro-assets-prefix.test.js +++ b/packages/astro/test/astro-assets-prefix.test.js @@ -27,7 +27,7 @@ describe('Assets Prefix - Static', () => { const html = await fixture.readFile('/index.html'); const $ = cheerio.load(html); const stylesheets = $('link[rel="stylesheet"]'); - stylesheets.each((i, el) => { + stylesheets.each((_i, el) => { assert.match(el.attribs.href, assetsPrefixRegex); }); }); @@ -58,7 +58,7 @@ describe('Assets Prefix - Static', () => { const html = await fixture.readFile('/markdown/index.html'); const $ = cheerio.load(html); const imgAssets = $('img'); - imgAssets.each((i, el) => { + imgAssets.each((_i, el) => { assert.match(el.attribs.src, assetsPrefixRegex); }); }); @@ -91,7 +91,7 @@ describe('Assets Prefix - with path prefix', () => { const html = await fixture.readFile('/index.html'); const $ = cheerio.load(html); const stylesheets = $('link[rel="stylesheet"]'); - stylesheets.each((i, el) => { + stylesheets.each((_i, el) => { assert.match(el.attribs.href, /^\/starting-slash\/.*/); }); }); @@ -122,7 +122,7 @@ describe('Assets Prefix, server', () => { const html = await response.text(); const $ = cheerio.load(html); const stylesheets = $('link[rel="stylesheet"]'); - stylesheets.each((i, el) => { + stylesheets.each((_i, el) => { assert.match(el.attribs.href, assetsPrefixRegex); }); }); @@ -185,7 +185,7 @@ describe('Assets Prefix, with path prefix', () => { const html = await response.text(); const $ = cheerio.load(html); const stylesheets = $('link[rel="stylesheet"]'); - stylesheets.each((i, el) => { + stylesheets.each((_i, el) => { assert.match(el.attribs.href, /^\/starting-slash\/.*/); }); }); diff --git a/packages/astro/test/astro-component-code.test.js b/packages/astro/test/astro-component-code.test.js index 6124e60541..314a59306b 100644 --- a/packages/astro/test/astro-component-code.test.js +++ b/packages/astro/test/astro-component-code.test.js @@ -85,7 +85,7 @@ describe('', () => { assert.equal($('pre').attr('class'), 'astro-code css-variables'); assert.deepEqual( $('pre, pre span') - .map((i, f) => (f.attribs ? f.attribs.style : 'no style found')) + .map((_i, f) => (f.attribs ? f.attribs.style : 'no style found')) .toArray(), [ 'background-color:var(--astro-code-color-background);color:var(--astro-code-color-text); overflow-x: auto;', diff --git a/packages/astro/test/astro-dev-http2.test.js b/packages/astro/test/astro-dev-http2.test.js index 10521b8cb0..a4ea53b3ed 100644 --- a/packages/astro/test/astro-dev-http2.test.js +++ b/packages/astro/test/astro-dev-http2.test.js @@ -23,7 +23,6 @@ describe('Astro HTTP/2 support', () => { const result = await fixture.fetch('/'); assert.equal(result.status, 200); const html = await result.text(); - console.log(result.headers); const $ = cheerio.load(html); const urlString = $('main').text(); assert.equal(Boolean(urlString), true); diff --git a/packages/astro/test/astro-scripts.test.js b/packages/astro/test/astro-scripts.test.js index 001242d3be..7086c91ccc 100644 --- a/packages/astro/test/astro-scripts.test.js +++ b/packages/astro/test/astro-scripts.test.js @@ -172,7 +172,7 @@ describe('Scripts (hoisted and not)', () => { let found = 0; let moduleScripts = $('[type=module]'); - moduleScripts.each((i, el) => { + moduleScripts.each((_i, el) => { if ( $(el).attr('src').includes('Glob/GlobComponent.astro?astro&type=script&index=0&lang.ts') ) { @@ -188,7 +188,7 @@ describe('Scripts (hoisted and not)', () => { let $ = cheerio.load(html); let found = 0; let moduleScripts = $('[type=module]'); - moduleScripts.each((i, el) => { + moduleScripts.each((_i, el) => { if ($(el).attr('src').includes('?astro&type=script&index=0&lang.ts')) { found++; } @@ -202,7 +202,7 @@ describe('Scripts (hoisted and not)', () => { let $ = cheerio.load(html); let found = 0; let moduleScripts = $('[type=module]'); - moduleScripts.each((i, el) => { + moduleScripts.each((_i, el) => { if ($(el).attr('src').includes('@id/astro:scripts/page.js')) { found++; } diff --git a/packages/astro/test/content-layer.test.js b/packages/astro/test/content-layer.test.js index 78cde2bff2..d8bd7bd2d0 100644 --- a/packages/astro/test/content-layer.test.js +++ b/packages/astro/test/content-layer.test.js @@ -149,7 +149,6 @@ describe('Content Layer', () => { }); it('handles remote images in custom loaders', async () => { - console.log(json.images[1].data.image); assert.ok(json.images[1].data.image.startsWith('https://')); }); diff --git a/packages/astro/test/core-image.test.js b/packages/astro/test/core-image.test.js index 887a3a35de..98656f4f0d 100644 --- a/packages/astro/test/core-image.test.js +++ b/packages/astro/test/core-image.test.js @@ -562,7 +562,7 @@ describe('astro:image', () => { it('has proper sources for array of images', () => { let $img = $('#array-of-images img'); const imgsSrcs = []; - $img.each((i, img) => imgsSrcs.push(img.attribs['src'])); + $img.each((_i, img) => imgsSrcs.push(img.attribs['src'])); assert.equal($img.length, 2); assert.equal( imgsSrcs.every((img) => img.startsWith('/')), diff --git a/packages/astro/test/css-order-import.test.js b/packages/astro/test/css-order-import.test.js index 05b0614991..f8a9cf5b2b 100644 --- a/packages/astro/test/css-order-import.test.js +++ b/packages/astro/test/css-order-import.test.js @@ -22,7 +22,7 @@ describe('CSS ordering - import order', () => { function getLinks(html) { let $ = cheerio.load(html); let out = []; - $('link[rel=stylesheet]').each((i, el) => { + $('link[rel=stylesheet]').each((_i, el) => { out.push($(el).attr('href')); }); return out; @@ -31,7 +31,7 @@ describe('CSS ordering - import order', () => { function getStyles(html) { let $ = cheerio.load(html); let out = []; - $('style').each((i, el) => { + $('style').each((_i, el) => { out.push($(el).text()); }); return out; diff --git a/packages/astro/test/css-order-layout.test.js b/packages/astro/test/css-order-layout.test.js index 1871e812b7..c08c5be1c7 100644 --- a/packages/astro/test/css-order-layout.test.js +++ b/packages/astro/test/css-order-layout.test.js @@ -22,7 +22,7 @@ describe('CSS ordering - import order with layouts', () => { function getLinks(html) { let $ = cheerio.load(html); let out = []; - $('link[rel=stylesheet]').each((i, el) => { + $('link[rel=stylesheet]').each((_i, el) => { out.push($(el).attr('href')); }); return out; diff --git a/packages/astro/test/css-order.test.js b/packages/astro/test/css-order.test.js index e839ef744e..46bacd0f8c 100644 --- a/packages/astro/test/css-order.test.js +++ b/packages/astro/test/css-order.test.js @@ -8,7 +8,7 @@ describe('CSS production ordering', () => { function getLinks(html) { let $ = cheerio.load(html); let out = []; - $('link[rel=stylesheet]').each((i, el) => { + $('link[rel=stylesheet]').each((_i, el) => { out.push($(el).attr('href')); }); return out; diff --git a/packages/astro/test/page-format.test.js b/packages/astro/test/page-format.test.js index d6b98b4f71..3b12a79b1d 100644 --- a/packages/astro/test/page-format.test.js +++ b/packages/astro/test/page-format.test.js @@ -73,7 +73,6 @@ describe('build.format', () => { it('Astro.url points to right file', async () => { let html = await fixture.readFile('/nested/index.html'); let $ = cheerio.load(html); - console.log(html); assert.equal($('h2').text(), '/test/nested/'); }); }); diff --git a/packages/astro/test/rewrite.test.js b/packages/astro/test/rewrite.test.js index 26cdac5c04..273e11d073 100644 --- a/packages/astro/test/rewrite.test.js +++ b/packages/astro/test/rewrite.test.js @@ -331,8 +331,6 @@ describe('SSR rewrite, hybrid/server', () => { const html = await response.text(); const $ = cheerioLoad(html); - console.log(html); - assert.match($('h1').text(), /Title/); assert.match($('p').text(), /some-slug/); }); diff --git a/packages/astro/test/ssr-dynamic.test.js b/packages/astro/test/ssr-dynamic.test.js index b532ac9293..dc9037bb64 100644 --- a/packages/astro/test/ssr-dynamic.test.js +++ b/packages/astro/test/ssr-dynamic.test.js @@ -29,7 +29,6 @@ describe('Dynamic pages in SSR', () => { const entrypoint = fileURLToPath( new URL(`${root}.astro/test.astro`, import.meta.url), ); - console.log(entrypoint); mkdirSync(dirname(entrypoint), { recursive: true }); writeFileSync(entrypoint, '

Index

'); diff --git a/packages/astro/test/types/call-action.ts b/packages/astro/test/types/call-action.ts index 9161055858..644619132d 100644 --- a/packages/astro/test/types/call-action.ts +++ b/packages/astro/test/types/call-action.ts @@ -15,7 +15,6 @@ describe('Astro.callAction', () => { return { name }; }, }); - // eslint-disable-next-line @typescript-eslint/no-unused-vars const result = await context.callAction(action, { name: 'Ben' }); expectTypeOf().toEqualTypeOf>(); }); @@ -31,7 +30,6 @@ describe('Astro.callAction', () => { return { name }; }, }); - // eslint-disable-next-line @typescript-eslint/no-unused-vars const result = await context.callAction(action, new FormData()); expectTypeOf().toEqualTypeOf>(); }); @@ -47,7 +45,6 @@ describe('Astro.callAction', () => { return { name }; }, }); - // eslint-disable-next-line @typescript-eslint/no-unused-vars const result = await context.callAction(action.orThrow, new FormData()); expectTypeOf().toEqualTypeOf>(); }); diff --git a/packages/astro/test/vue-component.test.js b/packages/astro/test/vue-component.test.js index c7770281f9..afb0f604d4 100644 --- a/packages/astro/test/vue-component.test.js +++ b/packages/astro/test/vue-component.test.js @@ -34,7 +34,7 @@ describe.skip('Vue component build', { todo: 'This test currently times out, inv assert.equal($('my-button').length, 7); // test 5: components with identical render output and props have been deduplicated - const uniqueRootUIDs = $('astro-island').map((i, el) => $(el).attr('uid')); + const uniqueRootUIDs = $('astro-island').map((_i, el) => $(el).attr('uid')); assert.equal(new Set(uniqueRootUIDs).size, 5); // test 6: import public files work diff --git a/packages/create-astro/create-astro.mjs b/packages/create-astro/create-astro.mjs index f9df779d87..5e25e5e94a 100755 --- a/packages/create-astro/create-astro.mjs +++ b/packages/create-astro/create-astro.mjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -/* eslint-disable no-console */ + 'use strict'; const currentVersion = process.versions.node; diff --git a/packages/create-astro/src/index.ts b/packages/create-astro/src/index.ts index 9f2a50a8b6..fdd0aa32c6 100644 --- a/packages/create-astro/src/index.ts +++ b/packages/create-astro/src/index.ts @@ -18,7 +18,7 @@ process.on('SIGTERM', exit); export async function main() { // Add some extra spacing from the noisy npm/pnpm init output - // eslint-disable-next-line no-console + // biome-ignore lint/suspicious/noConsoleLog: allowed console.log(''); // NOTE: In the v7.x version of npm, the default behavior of `npm init` was changed // to no longer require `--` to pass args and instead pass `--` directly to us. This @@ -47,7 +47,7 @@ export async function main() { await step(ctx); } - // eslint-disable-next-line no-console + // biome-ignore lint/suspicious/noConsoleLog: allowed console.log(''); const labels = { diff --git a/packages/db/src/core/integration/index.ts b/packages/db/src/core/integration/index.ts index 2a5824c35b..6debb40176 100644 --- a/packages/db/src/core/integration/index.ts +++ b/packages/db/src/core/integration/index.ts @@ -134,7 +134,7 @@ function astroDBIntegration(): AstroIntegration { ...CONFIG_FILE_NAMES.map((c) => new URL(c, getDbDirectoryUrl(root))), ...configFileDependencies.map((c) => new URL(c, root)), ]; - server.watcher.on('all', (event, relativeEntry) => { + server.watcher.on('all', (_event, relativeEntry) => { const entry = new URL(relativeEntry, root); if (filesToWatch.some((f) => entry.href === f.href)) { server.restart(); diff --git a/packages/db/src/core/queries.ts b/packages/db/src/core/queries.ts index cf472d4236..e77578ac20 100644 --- a/packages/db/src/core/queries.ts +++ b/packages/db/src/core/queries.ts @@ -191,7 +191,7 @@ function getDefaultValueSql(columnName: string, column: DBColumnWithDefault): st try { stringified = JSON.stringify(column.schema.default); } catch { - // eslint-disable-next-line no-console + // biome-ignore lint/suspicious/noConsoleLog: allowed console.log( `Invalid default value for column ${bold( columnName, diff --git a/packages/db/test/integrations.test.js b/packages/db/test/integrations.test.js index fb68d20f42..b05b28d6a6 100644 --- a/packages/db/test/integrations.test.js +++ b/packages/db/test/integrations.test.js @@ -15,7 +15,6 @@ describe('astro:db with integrations', () => { let devServer; before(async () => { - console.log('starting dev server'); devServer = await fixture.startDevServer(); }); diff --git a/packages/integrations/markdoc/src/index.ts b/packages/integrations/markdoc/src/index.ts index dfc4ebe37d..d328d4a8d8 100644 --- a/packages/integrations/markdoc/src/index.ts +++ b/packages/integrations/markdoc/src/index.ts @@ -38,7 +38,7 @@ export default function markdocIntegration(options?: MarkdocIntegrationOptions): }); }, 'astro:server:setup': async ({ server }) => { - server.watcher.on('all', (event, entry) => { + server.watcher.on('all', (_event, entry) => { if (SUPPORTED_MARKDOC_CONFIG_FILES.some((f) => entry.endsWith(f))) { server.restart(); } diff --git a/packages/integrations/partytown/src/sirv.ts b/packages/integrations/partytown/src/sirv.ts index 9dc8f74a0e..f0ae94026c 100644 --- a/packages/integrations/partytown/src/sirv.ts +++ b/packages/integrations/partytown/src/sirv.ts @@ -89,7 +89,7 @@ function viaLocal(dir, isEtag, uri, extns) { } } -function is404(req, res) { +function is404(_req, res) { return (res.statusCode = 404), res.end(); } diff --git a/packages/integrations/react/test/react-component.test.js b/packages/integrations/react/test/react-component.test.js index 25a35f49db..fbe88d65f2 100644 --- a/packages/integrations/react/test/react-component.test.js +++ b/packages/integrations/react/test/react-component.test.js @@ -46,7 +46,7 @@ describe('React Components', () => { assert.equal($('astro-island[uid]').length, 9); // test 9: Check island deduplication - const uniqueRootUIDs = new Set($('astro-island').map((i, el) => $(el).attr('uid'))); + const uniqueRootUIDs = new Set($('astro-island').map((_i, el) => $(el).attr('uid'))); assert.equal(uniqueRootUIDs.size, 8); // test 10: Should properly render children passed as props diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts index 66cf00043f..5849f5799a 100644 --- a/packages/markdown/remark/src/index.ts +++ b/packages/markdown/remark/src/index.ts @@ -130,7 +130,6 @@ export async function createMarkdownProcessor( // Ensure that the error message contains the input filename // to make it easier for the user to fix the issue err = prefixError(err, `Failed to parse Markdown file "${vfile.path}"`); - // eslint-disable-next-line no-console console.error(err); throw err; }); diff --git a/packages/markdown/remark/src/shiki.ts b/packages/markdown/remark/src/shiki.ts index 0028ec927f..28f51c5e85 100644 --- a/packages/markdown/remark/src/shiki.ts +++ b/packages/markdown/remark/src/shiki.ts @@ -61,7 +61,6 @@ export async function createShikiHighlighter({ try { await highlighter.loadLanguage(lang as BundledLanguage); } catch (_err) { - // eslint-disable-next-line no-console console.warn( `[Shiki] The language "${lang}" doesn't exist, falling back to "plaintext".`, ); diff --git a/packages/markdown/remark/test/plugins.test.js b/packages/markdown/remark/test/plugins.test.js index dd0233baa4..c52955f839 100644 --- a/packages/markdown/remark/test/plugins.test.js +++ b/packages/markdown/remark/test/plugins.test.js @@ -10,7 +10,7 @@ describe('plugins', () => { const processor = await createMarkdownProcessor({ remarkPlugins: [ () => { - const transformer = (tree, file) => { + const transformer = (_tree, file) => { context = file; }; return transformer; diff --git a/packages/studio/src/core/tokens.ts b/packages/studio/src/core/tokens.ts index 43919ce7f3..0fb718e5d0 100644 --- a/packages/studio/src/core/tokens.ts +++ b/packages/studio/src/core/tokens.ts @@ -151,7 +151,6 @@ class ManagedRemoteAppToken implements ManagedAppToken { throw new Error(`Unexpected response: ${response.status} ${response.statusText}`); } } catch (error: any) { - // eslint-disable-next-line no-console console.error('Failed to delete token.', error?.message); } } @@ -187,17 +186,14 @@ export async function getManagedAppTokenOrExit(token?: string): Promise=6.9.0'} - '@biomejs/biome@1.8.3': - resolution: {integrity: sha512-/uUV3MV+vyAczO+vKrPdOW0Iaet7UnJMU4bNMinggGJTAnBPjCoLEYcyYtYHNnUNYlv4xZMH6hVIQCAozq8d5w==} + '@biomejs/biome@1.9.3': + resolution: {integrity: sha512-POjAPz0APAmX33WOQFGQrwLvlu7WLV4CFJMlB12b6ZSg+2q6fYu9kZwLCOA+x83zXfcPd1RpuWOKJW0GbBwLIQ==} engines: {node: '>=14.21.3'} hasBin: true - '@biomejs/cli-darwin-arm64@1.8.3': - resolution: {integrity: sha512-9DYOjclFpKrH/m1Oz75SSExR8VKvNSSsLnVIqdnKexj6NwmiMlKk94Wa1kZEdv6MCOHGHgyyoV57Cw8WzL5n3A==} + '@biomejs/cli-darwin-arm64@1.9.3': + resolution: {integrity: sha512-QZzD2XrjJDUyIZK+aR2i5DDxCJfdwiYbUKu9GzkCUJpL78uSelAHAPy7m0GuPMVtF/Uo+OKv97W3P9nuWZangQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [darwin] - '@biomejs/cli-darwin-x64@1.8.3': - resolution: {integrity: sha512-UeW44L/AtbmOF7KXLCoM+9PSgPo0IDcyEUfIoOXYeANaNXXf9mLUwV1GeF2OWjyic5zj6CnAJ9uzk2LT3v/wAw==} + '@biomejs/cli-darwin-x64@1.9.3': + resolution: {integrity: sha512-vSCoIBJE0BN3SWDFuAY/tRavpUtNoqiceJ5PrU3xDfsLcm/U6N93JSM0M9OAiC/X7mPPfejtr6Yc9vSgWlEgVw==} engines: {node: '>=14.21.3'} cpu: [x64] os: [darwin] - '@biomejs/cli-linux-arm64-musl@1.8.3': - resolution: {integrity: sha512-9yjUfOFN7wrYsXt/T/gEWfvVxKlnh3yBpnScw98IF+oOeCYb5/b/+K7YNqKROV2i1DlMjg9g/EcN9wvj+NkMuQ==} + '@biomejs/cli-linux-arm64-musl@1.9.3': + resolution: {integrity: sha512-VBzyhaqqqwP3bAkkBrhVq50i3Uj9+RWuj+pYmXrMDgjS5+SKYGE56BwNw4l8hR3SmYbLSbEo15GcV043CDSk+Q==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - '@biomejs/cli-linux-arm64@1.8.3': - resolution: {integrity: sha512-fed2ji8s+I/m8upWpTJGanqiJ0rnlHOK3DdxsyVLZQ8ClY6qLuPc9uehCREBifRJLl/iJyQpHIRufLDeotsPtw==} + '@biomejs/cli-linux-arm64@1.9.3': + resolution: {integrity: sha512-vJkAimD2+sVviNTbaWOGqEBy31cW0ZB52KtpVIbkuma7PlfII3tsLhFa+cwbRAcRBkobBBhqZ06hXoZAN8NODQ==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - '@biomejs/cli-linux-x64-musl@1.8.3': - resolution: {integrity: sha512-UHrGJX7PrKMKzPGoEsooKC9jXJMa28TUSMjcIlbDnIO4EAavCoVmNQaIuUSH0Ls2mpGMwUIf+aZJv657zfWWjA==} + '@biomejs/cli-linux-x64-musl@1.9.3': + resolution: {integrity: sha512-TJmnOG2+NOGM72mlczEsNki9UT+XAsMFAOo8J0me/N47EJ/vkLXxf481evfHLlxMejTY6IN8SdRSiPVLv6AHlA==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - '@biomejs/cli-linux-x64@1.8.3': - resolution: {integrity: sha512-I8G2QmuE1teISyT8ie1HXsjFRz9L1m5n83U1O6m30Kw+kPMPSKjag6QGUn+sXT8V+XWIZxFFBoTDEDZW2KPDDw==} + '@biomejs/cli-linux-x64@1.9.3': + resolution: {integrity: sha512-x220V4c+romd26Mu1ptU+EudMXVS4xmzKxPVb9mgnfYlN4Yx9vD5NZraSx/onJnd3Gh/y8iPUdU5CDZJKg9COA==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - '@biomejs/cli-win32-arm64@1.8.3': - resolution: {integrity: sha512-J+Hu9WvrBevfy06eU1Na0lpc7uR9tibm9maHynLIoAjLZpQU3IW+OKHUtyL8p6/3pT2Ju5t5emReeIS2SAxhkQ==} + '@biomejs/cli-win32-arm64@1.9.3': + resolution: {integrity: sha512-lg/yZis2HdQGsycUvHWSzo9kOvnGgvtrYRgoCEwPBwwAL8/6crOp3+f47tPwI/LI1dZrhSji7PNsGKGHbwyAhw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [win32] - '@biomejs/cli-win32-x64@1.8.3': - resolution: {integrity: sha512-/PJ59vA1pnQeKahemaQf4Nyj7IKUvGQSc3Ze1uIGi+Wvr1xF7rGobSrAAG01T/gUDG21vkDsZYM03NAmPiVkqg==} + '@biomejs/cli-win32-x64@1.9.3': + resolution: {integrity: sha512-cQMy2zanBkVLpmmxXdK6YePzmZx0s5Z7KEnwmrW54rcXK3myCNbQa09SwGZ8i/8sLw0H9F3X7K4rxVNGU8/D4Q==} engines: {node: '>=14.21.3'} cpu: [x64] os: [win32] @@ -11419,39 +11419,39 @@ snapshots: '@babel/helper-validator-identifier': 7.25.7 to-fast-properties: 2.0.0 - '@biomejs/biome@1.8.3': + '@biomejs/biome@1.9.3': optionalDependencies: - '@biomejs/cli-darwin-arm64': 1.8.3 - '@biomejs/cli-darwin-x64': 1.8.3 - '@biomejs/cli-linux-arm64': 1.8.3 - '@biomejs/cli-linux-arm64-musl': 1.8.3 - '@biomejs/cli-linux-x64': 1.8.3 - '@biomejs/cli-linux-x64-musl': 1.8.3 - '@biomejs/cli-win32-arm64': 1.8.3 - '@biomejs/cli-win32-x64': 1.8.3 + '@biomejs/cli-darwin-arm64': 1.9.3 + '@biomejs/cli-darwin-x64': 1.9.3 + '@biomejs/cli-linux-arm64': 1.9.3 + '@biomejs/cli-linux-arm64-musl': 1.9.3 + '@biomejs/cli-linux-x64': 1.9.3 + '@biomejs/cli-linux-x64-musl': 1.9.3 + '@biomejs/cli-win32-arm64': 1.9.3 + '@biomejs/cli-win32-x64': 1.9.3 - '@biomejs/cli-darwin-arm64@1.8.3': + '@biomejs/cli-darwin-arm64@1.9.3': optional: true - '@biomejs/cli-darwin-x64@1.8.3': + '@biomejs/cli-darwin-x64@1.9.3': optional: true - '@biomejs/cli-linux-arm64-musl@1.8.3': + '@biomejs/cli-linux-arm64-musl@1.9.3': optional: true - '@biomejs/cli-linux-arm64@1.8.3': + '@biomejs/cli-linux-arm64@1.9.3': optional: true - '@biomejs/cli-linux-x64-musl@1.8.3': + '@biomejs/cli-linux-x64-musl@1.9.3': optional: true - '@biomejs/cli-linux-x64@1.8.3': + '@biomejs/cli-linux-x64@1.9.3': optional: true - '@biomejs/cli-win32-arm64@1.8.3': + '@biomejs/cli-win32-arm64@1.9.3': optional: true - '@biomejs/cli-win32-x64@1.8.3': + '@biomejs/cli-win32-x64@1.9.3': optional: true '@bluwy/giget-core@0.1.0':