0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

chore: bump typescript-eslint to v8 (#11649)

This commit is contained in:
Josh Goldberg ✨ 2024-08-08 05:54:04 -04:00 committed by GitHub
parent 9aaf58c133
commit 4c1b769bcf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 177 additions and 183 deletions

View file

@ -83,10 +83,13 @@ export default [
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/only-throw-error': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/prefer-optional-chain': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'off',
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',

View file

@ -67,7 +67,7 @@
"prettier-plugin-astro": "^0.14.1",
"turbo": "^1.13.4",
"typescript": "~5.5.4",
"typescript-eslint": "^7.18.0"
"typescript-eslint": "^8.0.1"
},
"pnpm": {
"packageExtensions": {

View file

@ -28,7 +28,7 @@ export function isValidURL(url: string): boolean {
try {
new URL(url);
return true;
} catch (e) {}
} catch {}
return false;
}

View file

@ -14,7 +14,6 @@ declare namespace astroHTML.JSX {
export type Children = Child | Child[];
interface ElementChildrenAttribute {
// eslint-disable-next-line @typescript-eslint/ban-types
children: {};
}

View file

@ -52,6 +52,7 @@ async function errorNodeUnsupported() {
Node.js v${process.versions.node} is not supported by Astro!
Please upgrade Node.js to a supported version: "${engines}"\n`);
// eslint-disable-next-line @typescript-eslint/no-require-imports
const ci = typeof require !== 'undefined' ? require('ci-info') : await import('ci-info');
// Special instructions for CI environments, which may have special steps needed.

View file

@ -123,7 +123,7 @@ export type TransitionAnimationValue =
| TransitionDirectionalAnimations;
// Allow users to extend this for astro-jsx.d.ts
// eslint-disable-next-line @typescript-eslint/no-empty-interface
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface AstroClientDirectives {}
export interface AstroBuiltinAttributes {
@ -459,7 +459,6 @@ export interface ViteUserConfig extends vite.UserConfig {
}
export interface ImageServiceConfig<T extends Record<string, any> = Record<string, any>> {
// eslint-disable-next-line @typescript-eslint/ban-types
entrypoint: 'astro/assets/services/sharp' | 'astro/assets/services/squoosh' | (string & {});
config?: T;
}

View file

@ -123,7 +123,7 @@ export async function generateImagesForPath(
);
await fs.promises.unlink(getFullImagePath(originalFilePath, env));
}
} catch (e) {
} catch {
/* No-op, it's okay if we fail to delete one of the file, we're not too picky. */
}
}

View file

@ -19,7 +19,7 @@ async function loadRemoteImage(src: URL, headers: Headers) {
}
return await res.arrayBuffer();
} catch (err: unknown) {
} catch {
return undefined;
}
}

View file

@ -30,7 +30,7 @@ async function loadLocalImage(src: string, url: URL) {
if (!isAbsolute(filePath) || !filePath.startsWith(assetsDirPath)) {
return undefined;
}
} catch (err: unknown) {
} catch{
return undefined;
}
}
@ -39,7 +39,7 @@ async function loadLocalImage(src: string, url: URL) {
try {
buffer = await readFile(fileUrl);
} catch (e) {
} catch {
// Fallback to try to load the file using `fetch`
try {
const sourceUrl = new URL(src, url.origin);
@ -62,7 +62,7 @@ async function loadRemoteImage(src: URL) {
}
return Buffer.from(await res.arrayBuffer());
} catch (err: unknown) {
} catch {
return undefined;
}
}

View file

@ -28,7 +28,7 @@ async function loadSharp() {
let sharpImport: typeof import('sharp');
try {
sharpImport = (await import('sharp')).default;
} catch (e) {
} catch {
throw new AstroError(AstroErrorData.MissingSharp);
}

View file

@ -1500,7 +1500,7 @@ var Module = (function () {
wasmMemory.grow((size - buffer.byteLength + 65535) >>> 16)
updateGlobalBufferAndViews(wasmMemory.buffer)
return 1
} catch (e) {}
} catch {}
}
function _emscripten_resize_heap(requestedSize) {
var oldSize = HEAPU8.length

View file

@ -1660,7 +1660,7 @@ var Module = (function () {
wasmMemory.grow((size - buffer.byteLength + 65535) >>> 16)
updateGlobalBufferAndViews(wasmMemory.buffer)
return 1
} catch (e) {}
} catch {}
}
function _emscripten_resize_heap(requestedSize) {
var oldSize = HEAPU8.length

View file

@ -1504,7 +1504,7 @@ var Module = (function () {
wasmMemory.grow((size - buffer.byteLength + 65535) >>> 16)
updateGlobalBufferAndViews(wasmMemory.buffer)
return 1
} catch (e) {}
} catch {}
}
function _emscripten_resize_heap(requestedSize) {
var oldSize = HEAPU8.length

View file

@ -1627,7 +1627,7 @@ var Module = (function () {
wasmMemory.grow((size - buffer.byteLength + 65535) >>> 16)
updateGlobalBufferAndViews(wasmMemory.buffer)
return 1
} catch (e) {}
} catch {}
}
function _emscripten_resize_heap(requestedSize) {
var oldSize = HEAPU8.length

View file

@ -1,4 +1,3 @@
/* tslint-disable ban-types */
import { parentPort, Worker } from 'worker_threads';
function uuid() {

View file

@ -1476,7 +1476,7 @@ var Module = (function () {
wasmMemory.grow((size - buffer.byteLength + 65535) >>> 16)
updateGlobalBufferAndViews(wasmMemory.buffer)
return 1
} catch (e) {}
} catch {}
}
function _emscripten_resize_heap(requestedSize) {
var oldSize = HEAPU8.length

View file

@ -1656,7 +1656,7 @@ var Module = (function () {
wasmMemory.grow((size - buffer.byteLength + 65535) >>> 16)
updateGlobalBufferAndViews(wasmMemory.buffer)
return 1
} catch (e) {}
} catch {}
}
function _emscripten_resize_heap(requestedSize) {
var oldSize = HEAPU8.length

View file

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-types */
import type { WithRequired } from '../type-utils.js';
import type { VALID_INPUT_FORMATS, VALID_OUTPUT_FORMATS } from './consts.js';
import type { ImageService } from './services/service.js';

View file

@ -24,7 +24,7 @@ export async function imageMetadata(
format: type as ImageInputFormat,
orientation,
};
} catch (e) {
} catch {
throw new AstroError({
...AstroErrorData.NoImageMetadata,
message: AstroErrorData.NoImageMetadata.message(src),

View file

@ -24,7 +24,7 @@ export async function emitESMImage(
let fileData: Buffer;
try {
fileData = await fs.readFile(url);
} catch (err) {
} catch {
return undefined;
}

View file

@ -42,7 +42,7 @@ export async function inferRemoteSize(url: string): Promise<Omit<ImageMetadata,
return dimensions;
}
} catch (error) {
} catch {
// This catch block is specifically for `imageMetadata` errors
// which might occur if the accumulated data isn't yet sufficient.
}

View file

@ -22,7 +22,7 @@ export function lookup(input: Uint8Array): ISizeCalculationResult {
const type = detector(input)
if (typeof type !== 'undefined') {
if (globalOptions.disabledTypes.indexOf(type) > -1) {
if (globalOptions.disabledTypes.includes(type)) {
throw new TypeError('disabled file type: ' + type)
}

View file

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/non-nullable-type-assertion-style */
/* eslint-disable regexp/prefer-regexp-exec */
import type { IImage, ISize } from './interface.ts'
import { toUTF8String } from './utils.js'
@ -52,9 +52,9 @@ function parseViewbox(viewbox: string): IAttributes {
}
function parseAttributes(root: string): IAttributes {
const width = root.match(extractorRegExps.width)
const height = root.match(extractorRegExps.height)
const viewbox = root.match(extractorRegExps.viewbox)
const width = extractorRegExps.width.exec(root)
const height = extractorRegExps.height.exec(root)
const viewbox = extractorRegExps.viewbox.exec(root)
return {
height: height && (parseLength(height[2]) as number),
viewbox: viewbox && (parseViewbox(viewbox[2]) as IAttributes),
@ -94,7 +94,7 @@ export const SVG: IImage = {
validate: (input) => svgReg.test(toUTF8String(input, 0, 1000)),
calculate(input) {
const root = toUTF8String(input).match(extractorRegExps.root)
const root = extractorRegExps.root.exec(toUTF8String(input))
if (root) {
const attrs = parseAttributes(root[0])
if (attrs.width && attrs.height) {

View file

@ -71,7 +71,7 @@ async function copyToClipboard(text: string) {
return;
}
command = 'xclip -sel clipboard -l 1';
} catch (e) {
} catch {
// Did not find xclip, bail out!
return;
}
@ -91,7 +91,7 @@ async function copyToClipboard(text: string) {
input: text.trim(),
encoding: 'utf8',
});
} catch (e) {
} catch {
console.error(
colors.red(`\nSorry, something went wrong!`) + ` Please copy the text above manually.`
);

View file

@ -29,7 +29,7 @@ export async function getPackage<T>(
require.resolve(packageName, { paths: [options.cwd ?? process.cwd()] });
const packageImport = await import(packageName);
return packageImport as T;
} catch (e) {
} catch {
if (options.optional) return undefined;
let message = `To continue, Astro requires the following dependency to be installed: ${bold(
packageName
@ -207,7 +207,7 @@ async function getRegistry(): Promise<string> {
_registry = stdout?.trim()?.replace(/\/$/, '') || fallback;
// Detect cases where the shell command returned a non-URL (e.g. a warning)
if (!new URL(_registry).host) _registry = fallback;
} catch (e) {
} catch {
_registry = fallback;
}
return _registry;

View file

@ -104,5 +104,5 @@ export abstract class Pipeline {
abstract getComponentByRoute(routeData: RouteData): Promise<ComponentInstance>;
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface HeadElements extends Pick<SSRResult, 'scripts' | 'styles' | 'links'> {}

View file

@ -3,7 +3,7 @@ import type { BuildOptions, Rollup, Plugin as VitePlugin } from 'vite';
import type { BuildInternals } from '../internal.js';
import type { PageBuildData } from '../types.js';
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
type OutputOptionsHook = Extract<VitePlugin['outputOptions'], Function>;
type OutputOptions = Parameters<OutputOptionsHook>[0];

View file

@ -34,7 +34,7 @@ import { appendForwardSlash, prependForwardSlash, removeTrailingForwardSlash } f
// Also, make sure to not index the complexified type, as it would return a simplified value type, which goes
// back to the issue again. The complexified type should be the base representation that we want to expose.
// eslint-disable-next-line @typescript-eslint/no-empty-interface
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface ComplexifyUnionObj {}
type ComplexifyWithUnion<T> = T & ComplexifyUnionObj;

View file

@ -53,8 +53,7 @@ export const presets = new Map<frameworkWithTSSettings, TSConfig>([
],
]);
// eslint-disable-next-line @typescript-eslint/ban-types
type TSConfigResult<T = {}> = Promise<
type TSConfigResult<T = object> = Promise<
(TSConfckParseResult & T) | 'invalid-config' | 'missing-config' | 'unknown-error'
>;

View file

@ -76,7 +76,7 @@ export default async function dev(inlineConfig: AstroInlineConfig): Promise<DevS
}
})
.catch(() => {});
} catch (e) {
} catch {
// Just ignore the error, we don't want to block the dev server from starting and this is just a nice-to-have feature
}
}

View file

@ -66,7 +66,7 @@ export function enhanceViteSSRError({
if (
fileId &&
!renderers?.find((r) => r.name === '@astrojs/mdx') &&
/Syntax error/.test(safeError.message) &&
safeError.message.includes('Syntax error') &&
/.mdx$/.test(fileId)
) {
safeError = new AstroError({
@ -78,7 +78,7 @@ export function enhanceViteSSRError({
}
// Since Astro.glob is a wrapper around Vite's import.meta.glob, errors don't show accurate information, let's fix that
if (/Invalid glob/.test(safeError.message)) {
if (safeError.message.includes('Invalid glob')) {
const globPattern = /glob: "(.+)" \(/.exec(safeError.message)?.[1];
if (globPattern) {

View file

@ -74,7 +74,7 @@ export function getParts(part: string, file: string) {
export function validateSegment(segment: string, file = '') {
if (!file) file = segment;
if (/\]\[/.test(segment)) {
if (segment.includes('][')) {
throw new Error(`Invalid route ${file} \u2014 parameters must be separated`);
}
if (countOccurrences('[', segment) !== countOccurrences(']', segment)) {
@ -293,7 +293,7 @@ function createInjectedRoutes({ settings, cwd }: CreateRouteManifestParams): Pri
let resolved: string;
try {
resolved = require.resolve(entrypoint, { paths: [cwd || fileURLToPath(config.root)] });
} catch (e) {
} catch {
resolved = fileURLToPath(new URL(entrypoint, config.root));
}
const component = slash(path.relative(cwd || fileURLToPath(config.root), resolved));

View file

@ -96,7 +96,6 @@ export const EnvSchema = z.record(EnvSchemaKey, z.intersection(EnvFieldMetadata,
// https://www.totaltypescript.com/concepts/the-prettify-helper
type Prettify<T> = {
[K in keyof T]: T[K];
// eslint-disable-next-line @typescript-eslint/ban-types
} & {};
export type EnvSchema = z.infer<typeof EnvSchema>;

View file

@ -82,7 +82,7 @@ export function eventError({
/**
* Safely get the error message from an error, even if it's a function.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
function getSafeErrorMessage(message: string | Function): string {
if (typeof message === 'string') {
return message;

View file

@ -5,7 +5,6 @@ interface AppToggledEventPayload {
}
export function eventAppToggled(options: {
// eslint-disable-next-line @typescript-eslint/ban-types
appName: 'other' | (string & {});
}): { eventName: string; payload: AppToggledEventPayload }[] {
const payload: AppToggledEventPayload = {

View file

@ -21,7 +21,7 @@ export type Audit = {
try {
customElements.define('astro-dev-toolbar-audit-window', DevToolbarAuditListWindow);
customElements.define('astro-dev-toolbar-audit-list-item', DevToolbarAuditListItem);
} catch (e) {}
} catch {}
let showState = false;

View file

@ -179,9 +179,9 @@ async function renderFrameworkComponent(
// Attempt: can we guess the renderer from the export extension?
if (!renderer) {
const extname = metadata.componentUrl?.split('.').pop();
renderer = renderers.filter(
renderer = renderers.find(
({ name }) => name === `@astrojs/${extname}` || name === extname
)[0];
);
}
}

View file

@ -118,7 +118,7 @@ async function fetchHTML(
redirected: res.redirected ? res.url : undefined,
mediaType,
};
} catch (err) {
} catch {
// can't fetch, let someone else deal with it.
return null;
}
@ -290,7 +290,7 @@ async function updateDOM(
) {
try {
await animate('old');
} catch (err) {
} catch {
// animate might reject as a consequence of a call to skipTransition()
// ignored on purpose
}

View file

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-types */
// Q: Why is this not in @types?
// A: `@types` is for types that are part of the public API. This is just a bunch of utilities we use throughout the codebase. (Mostly by Erika)
@ -12,7 +11,7 @@ export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
// Name is pretty self descriptive, but it removes the index signature of an object
export type OmitIndexSignature<ObjectType> = {
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
[KeyType in keyof ObjectType as object extends Record<KeyType, unknown>
? never
: KeyType]: ObjectType[KeyType];
};

View file

@ -12,7 +12,6 @@ import { isCSSRequest } from './util.js';
const fileExtensionsToSSR = new Set(['.astro', '.mdoc', ...SUPPORTED_MARKDOWN_FILE_EXTENSIONS]);
const STRIP_QUERY_PARAMS_REGEX = /\?.*$/;
const ASTRO_PROPAGATED_ASSET_REGEX = /\?astroPropagatedAssets/;
/** recursively crawl the module graph to get all style files imported by parent id */
export async function* crawlGraph(
@ -78,7 +77,7 @@ export async function* crawlGraph(
const isFileTypeNeedingSSR = fileExtensionsToSSR.has(npath.extname(importedModulePathname));
// A propagation stopping point is a module with the ?astroPropagatedAssets flag.
// When we encounter one of these modules we don't want to continue traversing.
const isPropagationStoppingPoint = ASTRO_PROPAGATED_ASSET_REGEX.test(importedModule.id);
const isPropagationStoppingPoint = importedModule.id.includes('?astroPropagatedAssets');
if (
isFileTypeNeedingSSR &&
// Should not SSR a module with ?astroPropagatedAssets

View file

@ -27,14 +27,14 @@ export default function loadFallbackPlugin({
try {
// await is necessary for the catch
return await fs.promises.readFile(cleanUrl(id), 'utf-8');
} catch (e) {
} catch{
try {
return await fs.promises.readFile(id, 'utf-8');
} catch (e2) {
} catch {
try {
const fullpath = new URL('.' + id, root);
return await fs.promises.readFile(fullpath, 'utf-8');
} catch (e3) {
} catch {
// Let fall through to the next
}
}

View file

@ -31,7 +31,7 @@ export default function astroScannerPlugin({
let fileURL: URL;
try {
fileURL = new URL(`file://${filename}`);
} catch (e) {
} catch {
// If we can't construct a valid URL, exit early
return;
}

View file

@ -22,7 +22,7 @@ export default function astroScriptsPostPlugin({
let fileURL: URL;
try {
fileURL = new URL(`file://${filename}`);
} catch (e) {
} catch {
// If we can't construct a valid URL, exit early
return;
}

View file

@ -88,7 +88,7 @@ describe('astro cli', () => {
const projectRootURL = new URL('./fixtures/astro-check-no-errors/', import.meta.url);
try {
proc = await cli('check', '--root', fileURLToPath(projectRootURL));
} catch (err) {}
} catch {}
assert.equal(proc?.stdout.includes('0 errors'), true);
}

View file

@ -75,7 +75,7 @@ describe('AstroConfig - config.output', () => {
let html;
try {
html = await fixture.readFile('/index.html');
} catch (err) {
} catch {
assert.equal(false, true, 'Couldnt find the file, which mean it did not build.');
}
assert.equal(html.length > 0, true);

View file

@ -1156,7 +1156,6 @@ describe('astro:image', () => {
const app = await fixture.loadTestAdapterApp();
let request = new Request('http://example.com/');
let response = await app.render(request);
console.log;
assert.equal(response.status, 200);
const html = await response.text();
const $ = cheerio.load(html);

View file

@ -51,9 +51,9 @@ describe('CSS ordering - import order with layouts', () => {
let specialButtonCSS = -1;
let globalCSS = -1;
for (let i = 0; i < content.length; i++) {
if (content[i].css.indexOf('.SpecialButton') !== -1) {
if (content[i].css.includes('.SpecialButton')) {
specialButtonCSS = i;
} else if (content[i].css.indexOf('green') !== -1) {
} else if (content[i].css.includes('green')) {
globalCSS = i;
}
}

View file

@ -61,7 +61,7 @@ describe('SSG manual routing', () => {
try {
await fixture.readFile('/blog.html');
assert.fail();
} catch (e) {}
} catch {}
});
it('should return a 200 because the custom middleware allows it', async () => {

View file

@ -313,7 +313,7 @@ describe('Middleware API in PROD mode, SSR', () => {
assert.equal(existsSync(path), true);
const content = readFileSync(fileURLToPath(middlewarePath), 'utf-8');
assert.equal(content.length > 0, true);
} catch (e) {
} catch {
assert.fail();
}
});

View file

@ -9,6 +9,7 @@ import { z } from '../../zod.mjs';
describe('ActionReturnType', () => {
it('Infers action return type', async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const action = defineAction({
input: z.object({
name: z.string(),

View file

@ -15,6 +15,7 @@ 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>>();
});
@ -30,6 +31,7 @@ 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>>();
});
@ -45,6 +47,7 @@ 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']>>();
});

View file

@ -62,14 +62,14 @@ describe('astro/src/core/cookies', () => {
let headers = Array.from(cookies.headers());
assert.equal(headers.length, 1);
assert.equal(/foo=deleted/.test(headers[0]), true);
assert.equal(/Expires=Thu, 01 Jan 1970 00:00:00 GMT/.test(headers[0]), true);
assert.equal(headers[0].includes('foo=deleted'), true);
assert.equal(headers[0].includes('Expires=Thu, 01 Jan 1970 00:00:00 GMT'), true);
assert.equal(/Domain=example.com/.test(headers[0]), true);
assert.equal(/Path=\/subpath\//.test(headers[0]), true);
assert.equal(/Priority=High/.test(headers[0]), true);
assert.equal(/Secure/.test(headers[0]), true);
assert.equal(/HttpOnly/.test(headers[0]), true);
assert.equal(/SameSite=Strict/.test(headers[0]), true);
assert.equal(headers[0].includes('Path=/subpath/'), true);
assert.equal(headers[0].includes('Priority=High'), true);
assert.equal(headers[0].includes('Secure'), true);
assert.equal(headers[0].includes('HttpOnly'), true);
assert.equal(headers[0].includes('SameSite=Strict'), true);
});
it('ignores expires option', () => {
@ -82,8 +82,8 @@ describe('astro/src/core/cookies', () => {
let headers = Array.from(cookies.headers());
assert.equal(headers.length, 1);
assert.equal(/foo=deleted/.test(headers[0]), true);
assert.equal(/Expires=Thu, 01 Jan 1970 00:00:00 GMT/.test(headers[0]), true);
assert.equal(headers[0].includes('foo=deleted'), true);
assert.equal(headers[0].includes('Expires=Thu, 01 Jan 1970 00:00:00 GMT'), true);
});
it('ignores maxAge option', () => {
@ -96,8 +96,8 @@ describe('astro/src/core/cookies', () => {
let headers = Array.from(cookies.headers());
assert.equal(headers.length, 1);
assert.equal(/foo=deleted/.test(headers[0]), true);
assert.equal(/Expires=Thu, 01 Jan 1970 00:00:00 GMT/.test(headers[0]), true);
assert.equal(headers[0].includes('foo=deleted'), true);
assert.equal(headers[0].includes('Expires=Thu, 01 Jan 1970 00:00:00 GMT'), true);
});
});
});

View file

@ -200,7 +200,7 @@ describe('dev container', () => {
container.handle(r.req, r.res);
await r.done;
const doc = await r.text();
assert.equal(/Regular page/.test(doc), true);
assert.equal(doc.includes('Regular page'), true);
assert.equal(r.res.statusCode, 200);
}
{
@ -209,7 +209,7 @@ describe('dev container', () => {
container.handle(r.req, r.res);
await r.done;
const doc = await r.text();
assert.equal(/Custom 404/.test(doc), true);
assert.equal(doc.includes('Custom 404'), true);
assert.equal(r.res.statusCode, 404);
}
{
@ -218,7 +218,7 @@ describe('dev container', () => {
container.handle(r.req, r.res);
await r.done;
const doc = await r.text();
assert.equal(/Custom 404/.test(doc), true);
assert.equal(doc.includes('Custom 404'), true);
assert.equal(r.res.statusCode, 404);
}
}

View file

@ -44,7 +44,7 @@ describe('core/render chunk', () => {
assert.ok(target);
assert.equal(target.text(), '[object Object]');
} catch (e) {
} catch {
assert.fail();
}
}

View file

@ -82,7 +82,7 @@ class VirtualVolumeWithFallback extends VirtualVolume {
readFileSync(p, ...args) {
try {
return super.readFileSync(p, ...args);
} catch (e) {
} catch {
return realFS.readFileSync(p, ...args);
}
}

View file

@ -60,5 +60,5 @@ async function init({ cwd }: { cwd: string }) {
],
{ cwd, stdio: 'ignore' }
);
} catch (e) {}
} catch {}
}

View file

@ -18,7 +18,7 @@ async function getRegistry(packageManager: string): Promise<string> {
_registry = stdout?.trim()?.replace(/\/$/, '') || fallback;
// Detect cases where the shell command returned a non-URL (e.g. a warning)
if (!new URL(_registry).host) _registry = fallback;
} catch (e) {
} catch {
_registry = fallback;
}
return _registry;

View file

@ -37,7 +37,7 @@ export async function shell(
const done = new Promise((resolve) => child.on('close', resolve));
[stdout, stderr] = await Promise.all([text(child.stdout), text(child.stderr)]);
await done;
} catch (e) {
} catch {
throw { stdout, stderr, exitCode: 1 };
}
const { exitCode } = child;

View file

@ -190,7 +190,7 @@ function getDefaultValueSql(columnName: string, column: DBColumnWithDefault): st
let stringified = '';
try {
stringified = JSON.stringify(column.schema.default);
} catch (e) {
} catch {
// eslint-disable-next-line no-console
console.log(
`Invalid default value for column ${bold(

View file

@ -64,7 +64,7 @@ export function createRemoteDatabaseClient(appToken: string, remoteDbURL: string
try {
const json = await res.json();
remoteResult = remoteResultSchema.parse(json);
} catch (e) {
} catch {
throw new DetailedLibsqlError({
message: await getUnexpectedResponseMessage(res),
code: KNOWN_ERROR_CODES.SQL_QUERY_FAILED,
@ -125,7 +125,7 @@ export function createRemoteDatabaseClient(appToken: string, remoteDbURL: string
try {
const json = await res.json();
remoteResults = z.array(remoteResultSchema).parse(json);
} catch (e) {
} catch {
throw new DetailedLibsqlError({
message: await getUnexpectedResponseMessage(res),
code: KNOWN_ERROR_CODES.SQL_QUERY_FAILED,
@ -181,7 +181,7 @@ async function parseRemoteError(response: Response): Promise<DetailedLibsqlError
let error;
try {
error = errorSchema.parse(await response.clone().json()).error;
} catch (e) {
} catch {
return new DetailedLibsqlError({
message: await getUnexpectedResponseMessage(response),
code: KNOWN_ERROR_CODES.SQL_QUERY_FAILED,

View file

@ -90,7 +90,7 @@ function createRemoteDbServer() {
let json;
try {
json = JSON.parse(Buffer.concat(rawBody).toString());
} catch (e) {
} catch {
applyParseError(res);
return;
}

View file

@ -5,7 +5,7 @@ import { LitElementRenderer } from '@lit-labs/ssr/lib/lit-element-renderer.js';
import * as parse5 from 'parse5';
function isCustomElementTag(name) {
return typeof name === 'string' && /-/.test(name);
return typeof name === 'string' && name.includes('-');
}
function getCustomElementConstructor(name) {

View file

@ -217,10 +217,10 @@ export default function (dir, opts = {}) {
if (brots && /br/i.test(val)) extns.unshift(...brots);
extns.push(...extensions); // [...br, ...gz, orig, ...exts]
if (pathname.indexOf('%') !== -1) {
if (pathname.includes('%')) {
try {
pathname = decodeURIComponent(pathname);
} catch (err) {
} catch {
/* malform uri */
}
}

View file

@ -36,8 +36,8 @@ async function check(
// There are edge cases (SolidJS) where Preact *might* render a string,
// but components would be <undefined></undefined>
// It also might render an empty sting.
return html == '' ? false : !/<undefined>/.test(html);
} catch (err) {
return html == '' ? false : !html.includes('<undefined>');
} catch {
return false;
}
} finally {
@ -108,7 +108,7 @@ function useConsoleFilter() {
try {
console.error = filteredConsoleError;
} catch (error) {
} catch {
// If we're unable to hook `console.error`, just accept it
}
}

View file

@ -77,7 +77,7 @@ function useConsoleFilter() {
originalConsoleWarning = console.warn;
try {
console.warn = filteredConsoleWarning;
} catch (error) {
} catch {
// If we're unable to hook `console.warn`, just accept it
}
}

View file

@ -13,7 +13,7 @@ export function toTSX(code: string, className: string): string {
'export default class extends __sveltets_2_createSvelte2TsxComponent(',
`export default function ${className}__AstroComponent_(_props: typeof Component.props): any {}\nlet Component = `
);
} catch (e: any) {
} catch {
return result;
}

View file

@ -15,7 +15,7 @@ async function getPostCssConfig(
const searchPath = typeof postcssInlineOptions === 'string' ? postcssInlineOptions : root!;
try {
postcssConfigResult = await postcssrc({}, searchPath);
} catch (e) {
} catch {
postcssConfigResult = null;
}
}

View file

@ -13,7 +13,6 @@ export function isESMImportedImage(src: ImageMetadata | string): src is ImageMet
return typeof src === 'object';
}
// eslint-disable-next-line @typescript-eslint/ban-types
export type DevImageService = 'sharp' | 'squoosh' | (string & {});
// https://vercel.com/docs/build-output-api/v3/configuration#images

View file

@ -57,7 +57,7 @@ export function toTSX(code: string, className: string): string {
}
}
}
} catch (e: any) {
} catch {
return result;
}

View file

@ -158,7 +158,7 @@ function prefixError(err: any, prefix: string) {
try {
err.message = `${prefix}:\n${err.message}`;
return err;
} catch (error) {
} catch {
// Any errors here are ok, there's fallback code below
}
}

View file

@ -160,7 +160,7 @@ class ManagedRemoteAppToken implements ManagedAppToken {
export async function getProjectIdFromFile() {
try {
return await readFile(PROJECT_ID_FILE, 'utf-8');
} catch (error) {
} catch {
return undefined;
}
}
@ -168,7 +168,7 @@ export async function getProjectIdFromFile() {
export async function getSessionIdFromFile() {
try {
return await readFile(SESSION_LOGIN_FILE, 'utf-8');
} catch (error) {
} catch {
return undefined;
}
}

View file

@ -20,7 +20,7 @@ export async function getRegistry(): Promise<string> {
_registry = stdout?.trim()?.replace(/\/$/, '') || fallback;
// Detect cases where the shell command returned a non-URL (e.g. a warning)
if (!new URL(_registry).host) _registry = fallback;
} catch (e) {
} catch {
_registry = fallback;
}
return _registry;

View file

@ -46,7 +46,7 @@ export async function shell(
const done = new Promise((resolve) => child.on('close', resolve));
[stdout, stderr] = await Promise.all([text(child.stdout), text(child.stderr)]);
await done;
} catch (e) {
} catch {
throw { stdout, stderr, exitCode: 1 };
}
const { exitCode } = child;

View file

@ -60,8 +60,8 @@ importers:
specifier: ~5.5.4
version: 5.5.4
typescript-eslint:
specifier: ^7.18.0
version: 7.18.0(eslint@9.8.0)(typescript@5.5.4)
specifier: ^8.0.1
version: 8.0.1(eslint@9.8.0)(typescript@5.5.4)
benchmark:
dependencies:
@ -7481,63 +7481,62 @@ packages:
'@types/yargs-parser@21.0.3':
resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==}
'@typescript-eslint/eslint-plugin@7.18.0':
resolution: {integrity: sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/eslint-plugin@8.0.1':
resolution: {integrity: sha512-5g3Y7GDFsJAnY4Yhvk8sZtFfV6YNF2caLzjrRPUBzewjPCaj0yokePB4LJSobyCzGMzjZZYFbwuzbfDHlimXbQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
'@typescript-eslint/parser': ^7.0.0
eslint: ^8.56.0
'@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0
eslint: ^8.57.0 || ^9.0.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
'@typescript-eslint/parser@7.18.0':
resolution: {integrity: sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/parser@8.0.1':
resolution: {integrity: sha512-5IgYJ9EO/12pOUwiBKFkpU7rS3IU21mtXzB81TNwq2xEybcmAZrE9qwDtsb5uQd9aVO9o0fdabFyAmKveXyujg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.56.0
eslint: ^8.57.0 || ^9.0.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
'@typescript-eslint/scope-manager@7.18.0':
resolution: {integrity: sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/scope-manager@8.0.1':
resolution: {integrity: sha512-NpixInP5dm7uukMiRyiHjRKkom5RIFA4dfiHvalanD2cF0CLUuQqxfg8PtEUo9yqJI2bBhF+pcSafqnG3UBnRQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript-eslint/type-utils@7.18.0':
resolution: {integrity: sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
eslint: ^8.56.0
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
'@typescript-eslint/types@7.18.0':
resolution: {integrity: sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/typescript-estree@7.18.0':
resolution: {integrity: sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/type-utils@8.0.1':
resolution: {integrity: sha512-+/UT25MWvXeDX9YaHv1IS6KI1fiuTto43WprE7pgSMswHbn1Jm9GEM4Txp+X74ifOWV8emu2AWcbLhpJAvD5Ng==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
'@typescript-eslint/utils@7.18.0':
resolution: {integrity: sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
eslint: ^8.56.0
'@typescript-eslint/types@8.0.1':
resolution: {integrity: sha512-PpqTVT3yCA/bIgJ12czBuE3iBlM3g4inRSC5J0QOdQFAn07TYrYEQBBKgXH1lQpglup+Zy6c1fxuwTk4MTNKIw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript-eslint/visitor-keys@7.18.0':
resolution: {integrity: sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/typescript-estree@8.0.1':
resolution: {integrity: sha512-8V9hriRvZQXPWU3bbiUV4Epo7EvgM6RTs+sUmxp5G//dBGy402S7Fx0W0QkB2fb4obCF8SInoUzvTYtc3bkb5w==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
typescript: '*'
peerDependenciesMeta:
typescript:
optional: true
'@typescript-eslint/utils@8.0.1':
resolution: {integrity: sha512-CBFR0G0sCt0+fzfnKaciu9IBsKvEKYwN9UZ+eeogK1fYHg4Qxk1yf/wLQkLXlq8wbU2dFlgAesxt8Gi76E8RTA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.57.0 || ^9.0.0
'@typescript-eslint/visitor-keys@8.0.1':
resolution: {integrity: sha512-W5E+o0UfUcK5EgchLZsyVWqARmsM7v54/qEq6PY3YI5arkgmCzHiuk0zKSJJbm71V0xdRna4BGomkCTXz2/LkQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@typescript/twoslash@3.1.0':
resolution: {integrity: sha512-kTwMUQ8xtAZaC4wb2XuLkPqFVBj2dNBueMQ89NWEuw87k2nLBbuafeG5cob/QEr6YduxIdTVUjix0MtC7mPlmg==}
@ -9324,7 +9323,6 @@ packages:
libsql@0.3.12:
resolution: {integrity: sha512-to30hj8O3DjS97wpbKN6ERZ8k66MN1IaOfFLR6oHqd25GMiPJ/ZX0VaZ7w+TsPmxcFS3p71qArj/hiedCyvXCg==}
cpu: [x64, arm64, wasm32]
os: [darwin, linux, win32]
lilconfig@2.1.0:
@ -11110,11 +11108,10 @@ packages:
typescript-auto-import-cache@0.3.3:
resolution: {integrity: sha512-ojEC7+Ci1ij9eE6hp8Jl9VUNnsEKzztktP5gtYNRMrTmfXVwA1PITYYAkpxCvvupdSYa/Re51B6KMcv1CTZEUA==}
typescript-eslint@7.18.0:
resolution: {integrity: sha512-PonBkP603E3tt05lDkbOMyaxJjvKqQrXsnow72sVeOFINDE/qNmnnd+f9b4N+U7W6MXnnYyrhtmF2t08QWwUbA==}
engines: {node: ^18.18.0 || >=20.0.0}
typescript-eslint@8.0.1:
resolution: {integrity: sha512-V3Y+MdfhawxEjE16dWpb7/IOgeXnLwAEEkS7v8oDqNcR1oYlqWhGH/iHqHdKVdpWme1VPZ0SoywXAkCqawj2eQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.56.0
typescript: '*'
peerDependenciesMeta:
typescript:
@ -13325,14 +13322,14 @@ snapshots:
'@types/yargs-parser@21.0.3': {}
'@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@9.8.0)(typescript@5.5.4))(eslint@9.8.0)(typescript@5.5.4)':
'@typescript-eslint/eslint-plugin@8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.8.0)(typescript@5.5.4))(eslint@9.8.0)(typescript@5.5.4)':
dependencies:
'@eslint-community/regexpp': 4.11.0
'@typescript-eslint/parser': 7.18.0(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/scope-manager': 7.18.0
'@typescript-eslint/type-utils': 7.18.0(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/utils': 7.18.0(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 7.18.0
'@typescript-eslint/parser': 8.0.1(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/scope-manager': 8.0.1
'@typescript-eslint/type-utils': 8.0.1(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.1(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 8.0.1
eslint: 9.8.0
graphemer: 1.4.0
ignore: 5.3.1
@ -13343,12 +13340,12 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/parser@7.18.0(eslint@9.8.0)(typescript@5.5.4)':
'@typescript-eslint/parser@8.0.1(eslint@9.8.0)(typescript@5.5.4)':
dependencies:
'@typescript-eslint/scope-manager': 7.18.0
'@typescript-eslint/types': 7.18.0
'@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 7.18.0
'@typescript-eslint/scope-manager': 8.0.1
'@typescript-eslint/types': 8.0.1
'@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4)
'@typescript-eslint/visitor-keys': 8.0.1
debug: 4.3.6
eslint: 9.8.0
optionalDependencies:
@ -13356,29 +13353,29 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/scope-manager@7.18.0':
'@typescript-eslint/scope-manager@8.0.1':
dependencies:
'@typescript-eslint/types': 7.18.0
'@typescript-eslint/visitor-keys': 7.18.0
'@typescript-eslint/types': 8.0.1
'@typescript-eslint/visitor-keys': 8.0.1
'@typescript-eslint/type-utils@7.18.0(eslint@9.8.0)(typescript@5.5.4)':
'@typescript-eslint/type-utils@8.0.1(eslint@9.8.0)(typescript@5.5.4)':
dependencies:
'@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.4)
'@typescript-eslint/utils': 7.18.0(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.1(eslint@9.8.0)(typescript@5.5.4)
debug: 4.3.6
eslint: 9.8.0
ts-api-utils: 1.3.0(typescript@5.5.4)
optionalDependencies:
typescript: 5.5.4
transitivePeerDependencies:
- eslint
- supports-color
'@typescript-eslint/types@7.18.0': {}
'@typescript-eslint/types@8.0.1': {}
'@typescript-eslint/typescript-estree@7.18.0(typescript@5.5.4)':
'@typescript-eslint/typescript-estree@8.0.1(typescript@5.5.4)':
dependencies:
'@typescript-eslint/types': 7.18.0
'@typescript-eslint/visitor-keys': 7.18.0
'@typescript-eslint/types': 8.0.1
'@typescript-eslint/visitor-keys': 8.0.1
debug: 4.3.6
globby: 11.1.0
is-glob: 4.0.3
@ -13390,20 +13387,20 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@typescript-eslint/utils@7.18.0(eslint@9.8.0)(typescript@5.5.4)':
'@typescript-eslint/utils@8.0.1(eslint@9.8.0)(typescript@5.5.4)':
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@9.8.0)
'@typescript-eslint/scope-manager': 7.18.0
'@typescript-eslint/types': 7.18.0
'@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.4)
'@typescript-eslint/scope-manager': 8.0.1
'@typescript-eslint/types': 8.0.1
'@typescript-eslint/typescript-estree': 8.0.1(typescript@5.5.4)
eslint: 9.8.0
transitivePeerDependencies:
- supports-color
- typescript
'@typescript-eslint/visitor-keys@7.18.0':
'@typescript-eslint/visitor-keys@8.0.1':
dependencies:
'@typescript-eslint/types': 7.18.0
'@typescript-eslint/types': 8.0.1
eslint-visitor-keys: 3.4.3
'@typescript/twoslash@3.1.0':
@ -17627,15 +17624,15 @@ snapshots:
dependencies:
semver: 7.6.3
typescript-eslint@7.18.0(eslint@9.8.0)(typescript@5.5.4):
typescript-eslint@8.0.1(eslint@9.8.0)(typescript@5.5.4):
dependencies:
'@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@9.8.0)(typescript@5.5.4))(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/parser': 7.18.0(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/utils': 7.18.0(eslint@9.8.0)(typescript@5.5.4)
eslint: 9.8.0
'@typescript-eslint/eslint-plugin': 8.0.1(@typescript-eslint/parser@8.0.1(eslint@9.8.0)(typescript@5.5.4))(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/parser': 8.0.1(eslint@9.8.0)(typescript@5.5.4)
'@typescript-eslint/utils': 8.0.1(eslint@9.8.0)(typescript@5.5.4)
optionalDependencies:
typescript: 5.5.4
transitivePeerDependencies:
- eslint
- supports-color
typescript@5.5.4: {}