chore(deps): update dependency @antfu/eslint-config to v6 (#8832)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Vladimir Sheremet <sleuths.slews0s@icloud.com>
This commit is contained in:
renovate[bot] 2025-11-06 15:16:39 +01:00 committed by GitHub
parent 77aa3168c0
commit 9a9323b737
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 395 additions and 319 deletions

View File

@ -37,7 +37,7 @@
"test:browser:playwright": "pnpm -C test/browser run test:playwright"
},
"devDependencies": {
"@antfu/eslint-config": "^5.4.1",
"@antfu/eslint-config": "^6.2.0",
"@antfu/ni": "^27.0.1",
"@playwright/test": "^1.56.1",
"@rollup/plugin-commonjs": "^28.0.9",

View File

@ -10,7 +10,7 @@ export interface KeyboardState {
export const keyboard: UserEventCommand<(
text: string,
state: KeyboardState
state: KeyboardState,
) => Promise<{ unreleased: string[] }>> = async (
context,
text,

View File

@ -18,14 +18,14 @@ export interface Codec<
> {
decode: (
buffer: TypedArray,
options: DecoderOptions
options: DecoderOptions,
) => Promisable<{
data: TypedArray
metadata: DecoderMetadata & BaseMetadata
}>
encode: (
image: { data: TypedArray; metadata: BaseMetadata },
options: EncoderOptions
options: EncoderOptions,
) => Promisable<TypedArray>
}
@ -45,7 +45,7 @@ export type Comparator<Options extends Record<string, unknown>> = (
* Note that the comparator might choose to ignore the flag, so a diff image is not guaranteed.
*/
createDiff: boolean
} & Options
} & Options,
) => Promisable<{ pass: boolean; diff: TypedArray | null; message: string | null }>
type CustomComparatorsToRegister = {

View File

@ -31,13 +31,13 @@ export interface WebSocketBrowserHandlers {
debug: (...args: string[]) => void
resolveId: (
id: string,
importer?: string
importer?: string,
) => Promise<ServerIdResolution | null>
triggerCommand: <T>(
sessionId: string,
command: string,
testPath: string | undefined,
payload: unknown[]
payload: unknown[],
) => Promise<T>
resolveMock: (
id: string,
@ -46,7 +46,7 @@ export interface WebSocketBrowserHandlers {
) => Promise<ServerMockResolution>
invalidate: (ids: string[]) => void
getBrowserFileSourceMap: (
id: string
id: string,
) => SourceMap | null | { mappings: '' } | undefined
wdioSwitchContext: (direction: 'iframe' | 'parent') => void

View File

@ -18,7 +18,7 @@ export type Tester = (
this: TesterContext,
a: any,
b: any,
customTesters: Array<Tester>
customTesters: Array<Tester>,
) => boolean | undefined
export interface TesterContext {
@ -26,7 +26,7 @@ export interface TesterContext {
a: unknown,
b: unknown,
customTesters?: Array<Tester>,
strictCheck?: boolean
strictCheck?: boolean,
) => boolean
}
export type { DiffOptions } from '@vitest/utils/diff'
@ -52,7 +52,7 @@ export interface MatcherState {
a: unknown,
b: unknown,
customTesters?: Array<Tester>,
strictCheck?: boolean
strictCheck?: boolean,
) => boolean
expand?: boolean
expectedAssertionsNumber?: number | null
@ -399,7 +399,7 @@ export interface JestAssertion<T = any> extends jest.Matchers<void, T>, CustomMa
*/
toHaveProperty: <E>(
property: string | (string | number)[],
value?: E
value?: E,
) => void
/**
@ -684,7 +684,7 @@ export interface Assertion<T = any>
| 'object'
| 'string'
| 'symbol'
| 'undefined'
| 'undefined',
) => void
/**

View File

@ -37,16 +37,16 @@ export function createCompilerHints(options?: CompilerHintsOptions): ModuleMocke
// @ts-expect-error injected by the plugin
? globalThis[globalThisAccessor]
: new Proxy(
{} as any,
{
get(_, name) {
throw new Error(
'Vitest mocker was not initialized in this environment. '
+ `vi.${String(name)}() is forbidden.`,
)
{} as any,
{
get(_, name) {
throw new Error(
'Vitest mocker was not initialized in this environment. '
+ `vi.${String(name)}() is forbidden.`,
)
},
},
},
)
)
}
return {

View File

@ -253,7 +253,7 @@ export interface ModuleMockerRPC {
resolveMock: (
id: string,
importer: string,
options: { mock: 'spy' | 'factory' | 'auto' }
options: { mock: 'spy' | 'factory' | 'auto' },
) => Promise<ResolveMockResult>
}

View File

@ -41,7 +41,7 @@ interface Visitors {
onIdentifier?: (
node: Positioned<Identifier>,
info: IdentifierInfo,
parentStack: Node[]
parentStack: Node[],
) => void
onImportMeta?: (node: Node) => void
onDynamicImport?: (node: Positioned<ImportExpression>) => void

View File

@ -1,7 +1,7 @@
type Awaitable<T> = T | PromiseLike<T>
export type ModuleMockFactoryWithHelper<M = unknown> = (
importOriginal: <T extends M = M>() => Promise<T>
importOriginal: <T extends M = M>() => Promise<T>,
) => Awaitable<Partial<M>>
export type ModuleMockFactory = () => any
export interface ModuleMockOptions {

View File

@ -270,7 +270,7 @@ function resolveFixtureValue(
async function resolveFixtureFunction(
fixtureFn: (
context: unknown,
useFn: (arg: unknown) => Promise<void>
useFn: (arg: unknown) => Promise<void>,
) => Promise<void>,
context: unknown,
cleanupFnArray: (() => void | Promise<void>)[],

View File

@ -820,7 +820,7 @@ function createTest(
> & { fixtures?: FixtureItem[] },
title: string,
optionsOrFn?: TestOptions | TestFunction,
optionsOrTest?: number | TestFunction
optionsOrTest?: number | TestFunction,
) => void,
context?: Record<string, any>,
) {

View File

@ -89,7 +89,7 @@ export interface VitestRunner {
*/
onBeforeTryTask?: (
test: Test,
options: { retry: number; repeats: number }
options: { retry: number; repeats: number },
) => unknown
/**
* When the task has finished running, but before cleanup hooks are called
@ -104,7 +104,7 @@ export interface VitestRunner {
*/
onAfterTryTask?: (
test: Test,
options: { retry: number; repeats: number }
options: { retry: number; repeats: number },
) => unknown
/**
* Called after the retry resolution happend. Unlike `onAfterTryTask`, the test now has a new state.
@ -112,7 +112,7 @@ export interface VitestRunner {
*/
onAfterRetryTask?: (
test: Test,
options: { retry: number; repeats: number }
options: { retry: number; repeats: number },
) => unknown
/**

View File

@ -307,7 +307,7 @@ export interface TestAnnotation {
export type Task = Test | Suite | File
export type TestFunction<ExtraContext = object> = (
context: TestContext & ExtraContext
context: TestContext & ExtraContext,
) => Awaitable<any> | void
// jest's ExtractEachCallbackArgs
@ -493,7 +493,7 @@ interface Hooks<ExtraContext> {
export type TestAPI<ExtraContext = object> = ChainableTestAPI<ExtraContext>
& ExtendedAPI<ExtraContext> & Hooks<ExtraContext> & {
extend: <T extends Record<string, any> = object>(
fixtures: Fixtures<T, ExtraContext>
fixtures: Fixtures<T, ExtraContext>,
) => TestAPI<{
[K in keyof T | keyof ExtraContext]: K extends keyof T
? T[K]
@ -502,7 +502,7 @@ export type TestAPI<ExtraContext = object> = ChainableTestAPI<ExtraContext>
: never;
}>
scoped: (
fixtures: Fixtures<Partial<ExtraContext>>
fixtures: Fixtures<Partial<ExtraContext>>,
) => void
}
@ -531,7 +531,7 @@ export interface FixtureOptions {
export type Use<T> = (value: T) => Promise<void>
export type FixtureFn<T, K extends keyof T, ExtraContext> = (
context: Omit<T, K> & ExtraContext,
use: Use<T[K]>
use: Use<T[K]>,
) => Promise<void>
export type Fixture<T, K extends keyof T, ExtraContext = object> = ((
...args: any
@ -652,7 +652,7 @@ export interface SuiteCollector<ExtraContext = object> {
}
export type SuiteFactory<ExtraContext = object> = (
test: TestAPI<ExtraContext>
test: TestAPI<ExtraContext>,
) => Awaitable<void>
export interface RuntimeContext {

View File

@ -212,16 +212,16 @@ export function fn<T extends Procedure | Constructable = Procedure>(
export function spyOn<T extends object, S extends Properties<Required<T>>>(
object: T,
key: S,
accessor: 'get'
accessor: 'get',
): Mock<() => T[S]>
export function spyOn<T extends object, G extends Properties<Required<T>>>(
object: T,
key: G,
accessor: 'set'
accessor: 'set',
): Mock<(arg: T[G]) => void>
export function spyOn<T extends object, M extends Classes<Required<T>> | Methods<Required<T>>>(
object: T,
key: M
key: M,
): Required<T>[M] extends Constructable | Procedure
? Mock<Required<T>[M]>
: never

View File

@ -57,9 +57,9 @@ class ChangeBuffer {
this.lines.push(
this.line.length !== 1
? new Diff(
this.op,
concatenateRelevantDiffs(this.op, this.line, this.changeColor),
)
this.op,
concatenateRelevantDiffs(this.op, this.line, this.changeColor),
)
: this.line[0][0] === this.op
? this.line[0] // can use instance
: new Diff(this.op, this.line[0][1]), // was common diff

View File

@ -37,12 +37,12 @@ export interface WebSocketHandlers {
getModuleGraph: (
projectName: string,
id: string,
browser?: boolean
browser?: boolean,
) => Promise<ModuleGraphData>
getTransformResult: (
projectName: string,
id: string,
browser?: boolean
browser?: boolean,
) => Promise<TransformResultWithSource | undefined>
readTestFile: (id: string) => Promise<string | null>
saveTestFile: (id: string, content: string) => Promise<void>
@ -57,7 +57,7 @@ export interface WebSocketEvents {
onFinished?: (
files: File[],
errors: unknown[],
coverage?: unknown
coverage?: unknown,
) => Awaitable<void>
onTestAnnotate?: (testId: string, annotation: TestAnnotation) => Awaitable<void>
onTaskUpdate?: (packs: TaskResultPack[], events: TaskEventPack[]) => Awaitable<void>

View File

@ -265,7 +265,7 @@ export interface VitestUtils {
* @returns Fully mocked module
*/
importMock: <T = ESModuleExports>(
path: string
path: string,
) => Promise<MaybeMockedDeep<T>>
/**
@ -327,19 +327,19 @@ export interface VitestUtils {
& (<T>(item: T, deep: true) => MaybeMockedDeep<T>)
& (<T>(
item: T,
options: { partial?: false; deep?: false }
options: { partial?: false; deep?: false },
) => MaybeMocked<T>)
& (<T>(
item: T,
options: { partial?: false; deep: true }
options: { partial?: false; deep: true },
) => MaybeMockedDeep<T>)
& (<T>(
item: T,
options: { partial: true; deep?: false }
options: { partial: true; deep?: false },
) => MaybePartiallyMocked<T>)
& (<T>(
item: T,
options: { partial: true; deep: true }
options: { partial: true; deep: true },
) => MaybePartiallyMockedDeep<T>)
& (<T>(item: T) => MaybeMocked<T>)
@ -388,7 +388,7 @@ export interface VitestUtils {
*/
stubEnv: <T extends string>(
name: T,
value: T extends 'PROD' | 'DEV' | 'SSR' ? boolean : string | undefined
value: T extends 'PROD' | 'DEV' | 'SSR' ? boolean : string | undefined,
) => VitestUtils
/**
@ -766,16 +766,16 @@ function _mocker(): VitestMocker {
// @ts-expect-error injected by vite-nide
? __vitest_mocker__
: new Proxy(
{} as any,
{
get(_, name) {
throw new Error(
'Vitest mocker was not initialized in this environment. '
+ `vi.${String(name)}() is forbidden.`,
)
{} as any,
{
get(_, name) {
throw new Error(
'Vitest mocker was not initialized in this environment. '
+ `vi.${String(name)}() is forbidden.`,
)
},
},
},
)
)
}
function getImporter(name: string) {

View File

@ -20,7 +20,7 @@ const suppressWarningsPath = resolve(rootDir, './suppress-warnings.cjs')
type RunWithFiles = (
files: TestSpecification[],
invalidates?: string[]
invalidates?: string[],
) => Promise<void>
export interface ProcessPool {

View File

@ -334,7 +334,7 @@ export interface ProjectBrowser {
cb: BrowserCommand<
Parameters<BrowserCommands[K]>,
ReturnType<BrowserCommands[K]>
>
>,
) => void
triggerCommand: <K extends keyof BrowserCommands>(
name: K,

View File

@ -201,7 +201,7 @@ export interface ResolveSnapshotPathHandlerContext { config: SerializedConfig }
export type ResolveSnapshotPathHandler = (
testPath: string,
snapExtension: string,
context: ResolveSnapshotPathHandlerContext
context: ResolveSnapshotPathHandlerContext,
) => string
export type BuiltinPool
@ -1133,7 +1133,7 @@ export interface UserWorkspaceConfig extends ViteUserConfig {
// TODO: remove types when "workspace" support is removed
export type UserProjectConfigFn = (
env: ConfigEnv
env: ConfigEnv,
) => UserWorkspaceConfig | Promise<UserWorkspaceConfig>
export type UserProjectConfigExport
= | UserWorkspaceConfig

View File

@ -33,13 +33,13 @@ export interface CoverageProvider {
/** Callback to generate final coverage results */
generateCoverage: (
reportContext: ReportContext
reportContext: ReportContext,
) => CoverageResults | Promise<CoverageResults>
/** Callback to convert coverage results to coverage reports. Called with results returned from `generateCoverage` */
reportCoverage: (
coverage: CoverageResults,
reportContext: ReportContext
reportContext: ReportContext,
) => void | Promise<void>
/** Callback for `--merge-reports` options. Called with multiple coverage results generated by `generateCoverage`. */
@ -50,7 +50,7 @@ export interface CoverageProvider {
sourceCode: string,
id: string,
// TODO: when upgrading vite, import Rollup from vite
pluginCtx: any
pluginCtx: any,
) => TransformResult | Promise<TransformResult>
/** Callback that's called when the coverage is enabled via a programmatic `enableCoverage` API. */

View File

@ -35,7 +35,7 @@ export interface Reporter {
onTestRunEnd?: (
testModules: ReadonlyArray<TestModule>,
unhandledErrors: ReadonlyArray<SerializedError>,
reason: TestRunEndReason
reason: TestRunEndReason,
) => Awaitable<void>
/**

View File

@ -237,6 +237,6 @@ export interface WatcherTriggerPattern {
pattern: RegExp
testsToRun: (
file: string,
match: RegExpMatchArray
match: RegExpMatchArray,
) => string[] | string | null | undefined | void
}

View File

@ -32,12 +32,12 @@ export interface FsOptions {
export interface BrowserCommands {
readFile: (
path: string,
options?: BufferEncoding | FsOptions
options?: BufferEncoding | FsOptions,
) => Promise<string>
writeFile: (
path: string,
content: string,
options?: BufferEncoding | (FsOptions & { mode?: number | string })
options?: BufferEncoding | (FsOptions & { mode?: number | string }),
) => Promise<void>
removeFile: (path: string) => Promise<void>
}

View File

@ -33,7 +33,7 @@ export type {
export type ViteUserConfigFnObject = (env: ConfigEnv) => ViteUserConfig
export type ViteUserConfigFnPromise = (env: ConfigEnv) => Promise<ViteUserConfig>
export type ViteUserConfigFn = (
env: ConfigEnv
env: ConfigEnv,
) => ViteUserConfig | Promise<ViteUserConfig>
export type ViteUserConfigExport
= | ViteUserConfig
@ -44,7 +44,7 @@ export type ViteUserConfigExport
export function defineConfig(config: ViteUserConfig): ViteUserConfig
export function defineConfig(
config: Promise<ViteUserConfig>
config: Promise<ViteUserConfig>,
): Promise<ViteUserConfig>
export function defineConfig(config: ViteUserConfigFnObject): ViteUserConfigFnObject
export function defineConfig(config: ViteUserConfigFnPromise): ViteUserConfigFnPromise

View File

@ -45,7 +45,7 @@ function createBenchmark(
this: Record<'skip' | 'only' | 'todo', boolean | undefined>,
name: string | Function,
fn?: BenchFunction,
options?: BenchOptions
options?: BenchOptions,
) => void,
) {
const benchmark = createChainable(

View File

@ -11,7 +11,7 @@ interface ModuleEvaluateOptions {
type ModuleLinker = (
specifier: string,
referencingModule: VMModule,
extra: { assert: object }
extra: { assert: object },
) => VMModule | Promise<VMModule>
type ModuleStatus
= | 'unlinked'

View File

@ -25,7 +25,7 @@ export interface Environment {
setupVM?: (options: Record<string, any>) => Awaitable<VmEnvironmentReturn>
setup: (
global: any,
options: Record<string, any>
options: Record<string, any>,
) => Awaitable<EnvironmentReturn>
}

View File

@ -39,7 +39,7 @@ declare module '@vitest/expect' {
soft: <T>(actual: T, message?: string) => Assertion<T>
poll: <T>(
actual: () => T,
options?: ExpectPollOptions
options?: ExpectPollOptions,
) => PromisifyAssertion<Awaited<T>>
addEqualityTesters: (testers: Array<Tester>) => void
assertions: (expected: number) => void
@ -76,7 +76,7 @@ declare module '@vitest/expect' {
*/
toThrowErrorMatchingInlineSnapshot: (
snapshot?: string,
hint?: string
hint?: string,
) => void
/**

View File

@ -3,7 +3,7 @@ import type { MockedModuleType } from '@vitest/mocker'
type Promisable<T> = T | Promise<T>
export type MockFactoryWithHelper<M = unknown> = (
importOriginal: <T extends M = M>() => Promise<T>
importOriginal: <T extends M = M>() => Promise<T>,
) => Promisable<Partial<M>>
export type MockFactory = () => any
export interface MockOptions {

558
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff