mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
chore: move lint rules to Biome (#12145)
* chore: move lint rules to Astro * better suppression system * revert * format code * address more linting files * address more linting files
This commit is contained in:
parent
91ecad2cc7
commit
2a1536d091
87 changed files with 244 additions and 311 deletions
|
@ -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.`);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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
|
||||
|
|
76
biome.json
76
biome.json
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
139
biome.jsonc
Normal file
139
biome.jsonc
Normal file
|
@ -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",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
|
@ -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: {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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}`);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.',
|
||||
);
|
||||
|
|
|
@ -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/',
|
||||
|
|
1
packages/astro/astro-jsx.d.ts
vendored
1
packages/astro/astro-jsx.d.ts
vendored
|
@ -1,5 +1,4 @@
|
|||
/// <reference lib="dom" />
|
||||
/* 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
|
||||
|
|
|
@ -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)})`,
|
||||
)}`,
|
||||
|
|
|
@ -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)} 🚀`);
|
||||
})();
|
||||
|
|
|
@ -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".',
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
|
|
@ -57,8 +57,7 @@ const statusToCodeMap: Record<number, ActionErrorCode> = 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<T extends ErrorInferenceObject = ErrorInferenceObject> extends Error {
|
||||
export class ActionError<_T extends ErrorInferenceObject = ErrorInferenceObject> extends Error {
|
||||
type = 'AstroActionError';
|
||||
code: ActionErrorCode = 'INTERNAL_SERVER_ERROR';
|
||||
status = 500;
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.',
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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<string, AnnotatedValue>, 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(),
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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<DataEntry>(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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -147,7 +147,7 @@ export function createBuildInternals(): BuildInternals {
|
|||
|
||||
export function trackPageData(
|
||||
internals: BuildInternals,
|
||||
component: string,
|
||||
_component: string,
|
||||
pageData: PageBuildData,
|
||||
componentModuleId: string,
|
||||
componentURL: URL,
|
||||
|
|
|
@ -328,7 +328,7 @@ export class BuildPipeline extends Pipeline {
|
|||
|
||||
async #getEntryForFallbackRoute(
|
||||
route: RouteData,
|
||||
internals: BuildInternals,
|
||||
_internals: BuildInternals,
|
||||
outFolder: URL,
|
||||
): Promise<SinglePageBuiltModule> {
|
||||
if (route.type !== 'fallback') {
|
||||
|
@ -348,7 +348,7 @@ export class BuildPipeline extends Pipeline {
|
|||
|
||||
async #getEntryForRedirectRoute(
|
||||
route: RouteData,
|
||||
internals: BuildInternals,
|
||||
_internals: BuildInternals,
|
||||
outFolder: URL,
|
||||
): Promise<SinglePageBuiltModule> {
|
||||
if (route.type !== 'redirect') {
|
||||
|
|
|
@ -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 }));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -2,10 +2,8 @@ import { type LogMessage, type LogWritable, getEventPrefix, levels } from './cor
|
|||
|
||||
export const consoleLogDestination: LogWritable<LogMessage> = {
|
||||
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') {
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -101,7 +101,7 @@ function getSafeErrorMessage(message: string | Function): string {
|
|||
.slice(1, -1)
|
||||
.replace(
|
||||
/\$\{([^}]+)\}/g,
|
||||
(str, match1) =>
|
||||
(_str, match1) =>
|
||||
`${match1
|
||||
.split(/\.?(?=[A-Z])/)
|
||||
.join('_')
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.`,
|
||||
);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;',
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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.`,
|
||||
);
|
||||
|
|
|
@ -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.`,
|
||||
);
|
||||
|
|
|
@ -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 }}\`).`);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}),
|
||||
|
|
|
@ -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)]);
|
||||
|
|
3
packages/astro/templates/env/module.mjs
vendored
3
packages/astro/templates/env/module.mjs
vendored
|
@ -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@@
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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\/.*/);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -85,7 +85,7 @@ describe('<Code>', () => {
|
|||
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;',
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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://'));
|
||||
});
|
||||
|
||||
|
|
|
@ -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('/')),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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/');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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/);
|
||||
});
|
||||
|
|
|
@ -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, '<h1>Index</h1>');
|
||||
|
||||
|
|
|
@ -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<typeof result>().toEqualTypeOf<ActionReturnType<typeof action>>();
|
||||
});
|
||||
|
@ -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<typeof result>().toEqualTypeOf<ActionReturnType<typeof action>>();
|
||||
});
|
||||
|
@ -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<typeof result>().toEqualTypeOf<ActionReturnType<(typeof action)['orThrow']>>();
|
||||
});
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
/* eslint-disable no-console */
|
||||
|
||||
'use strict';
|
||||
|
||||
const currentVersion = process.versions.node;
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -15,7 +15,6 @@ describe('astro:db with integrations', () => {
|
|||
let devServer;
|
||||
|
||||
before(async () => {
|
||||
console.log('starting dev server');
|
||||
devServer = await fixture.startDevServer();
|
||||
});
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ function viaLocal(dir, isEtag, uri, extns) {
|
|||
}
|
||||
}
|
||||
|
||||
function is404(req, res) {
|
||||
function is404(_req, res) {
|
||||
return (res.statusCode = 404), res.end();
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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".`,
|
||||
);
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('plugins', () => {
|
|||
const processor = await createMarkdownProcessor({
|
||||
remarkPlugins: [
|
||||
() => {
|
||||
const transformer = (tree, file) => {
|
||||
const transformer = (_tree, file) => {
|
||||
context = file;
|
||||
};
|
||||
return transformer;
|
||||
|
|
|
@ -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<ManagedA
|
|||
const sessionToken = await getSessionIdFromFile();
|
||||
if (!sessionToken) {
|
||||
if (ci.isCI) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(MISSING_SESSION_ID_CI_ERROR);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(MISSING_SESSION_ID_ERROR);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
const projectId = await getProjectIdFromFile();
|
||||
if (!projectId) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(MISSING_PROJECT_ID_ERROR);
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
/* eslint-disable no-console */
|
||||
|
||||
'use strict';
|
||||
|
||||
const currentVersion = process.versions.node;
|
||||
|
|
|
@ -16,8 +16,8 @@ importers:
|
|||
specifier: ^0.9.4
|
||||
version: 0.9.4(prettier-plugin-astro@0.14.1)(prettier@3.3.3)(typescript@5.6.2)
|
||||
'@biomejs/biome':
|
||||
specifier: 1.8.3
|
||||
version: 1.8.3
|
||||
specifier: 1.9.3
|
||||
version: 1.9.3
|
||||
'@changesets/changelog-github':
|
||||
specifier: ^0.5.0
|
||||
version: 0.5.0
|
||||
|
@ -5927,55 +5927,55 @@ packages:
|
|||
resolution: {integrity: sha512-vwIVdXG+j+FOpkwqHRcBgHLYNL7XMkufrlaFvL9o6Ai9sJn9+PdyIL5qa0XzTZw084c+u9LOls53eoZWP/W5WQ==}
|
||||
engines: {node: '>=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':
|
||||
|
|
Loading…
Reference in a new issue