Skip to content

Commit

Permalink
chore(deps): update @antfu/eslint-config v3.8.0 (#6751)
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa authored Oct 23, 2024
1 parent 9d9bad5 commit de74785
Show file tree
Hide file tree
Showing 421 changed files with 1,807 additions and 1,765 deletions.
2 changes: 1 addition & 1 deletion docs/.vitepress/components/ListItem.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { computed, effectScope, onMounted, ref } from 'vue'
import { until, useElementVisibility } from '@vueuse/core'
import { computed, effectScope, onMounted, ref } from 'vue'
const el = ref<HTMLDivElement>()
const state = ref(0)
Expand Down
6 changes: 3 additions & 3 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { defineConfig } from 'vitepress'
import { withPwa } from '@vite-pwa/vitepress'
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
import { withPwa } from '@vite-pwa/vitepress'
import { defineConfig } from 'vitepress'
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
import { version } from '../../package.json'
import { teamMembers } from './contributors'
import {
contributing,
discord,
Expand All @@ -18,7 +19,6 @@ import {
} from './meta'
import { pwa } from './scripts/pwa'
import { transformHead } from './scripts/transformHead'
import { teamMembers } from './contributors'

export default ({ mode }: { mode: string }) => {
return withPwa(defineConfig({
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/contributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,4 @@ const plainTeamEmeritiMembers: CoreTeam[] = [
const teamMembers = plainTeamMembers.map(tm => createLinks(tm))
const teamEmeritiMembers = plainTeamEmeritiMembers.map(tm => createLinks(tm))

export { teamMembers, teamEmeritiMembers }
export { teamEmeritiMembers, teamMembers }
2 changes: 1 addition & 1 deletion docs/.vitepress/scripts/cli-generator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CLIOption, CLIOptions } from '../../../packages/vitest/src/node/cli/cli-config'
import { writeFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import type { CLIOption, CLIOptions } from '../../../packages/vitest/src/node/cli/cli-config'
import { cliOptionsConfig } from '../../../packages/vitest/src/node/cli/cli-config'

const docsDir = resolve(dirname(fileURLToPath(import.meta.url)), '../..')
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/scripts/fetch-avatars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async function download(url: string, fileName: string) {
if (existsSync(fileName)) {
return
}
// eslint-disable-next-line no-console

console.log('downloading', fileName)
try {
const image = await (await fetch(url)).arrayBuffer()
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/scripts/pwa.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { PwaOptions } from '@vite-pwa/vitepress'
import {
githubusercontentRegex,
pwaFontStylesRegex,
pwaFontsRegex,
pwaFontStylesRegex,
vitestDescription,
vitestName,
vitestShortName,
Expand Down
12 changes: 6 additions & 6 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { h } from 'vue'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { inBrowser } from 'vitepress'
import '../style/main.css'
import '../style/vars.css'
import 'uno.css'
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
import { inBrowser } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
import { h } from 'vue'
import HomePage from '../components/HomePage.vue'
import Version from '../components/Version.vue'
import '../style/main.css'
import '../style/vars.css'
import 'uno.css'
import '@shikijs/vitepress-twoslash/style.css'

if (inBrowser) {
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ To communicate between different processes, you can create methods object using
```ts
import { createBirpc } from 'birpc'
import { parse, stringify } from 'flatted'
import { WorkspaceProject, createMethodsRPC } from 'vitest/node'
import { createMethodsRPC, WorkspaceProject } from 'vitest/node'

function createRpc(project: WorkspaceProject, wss: WebSocketServer) {
return createBirpc(
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ A task is an object that is part of a suite. It is automatically added to the cu
// ./utils/custom.js
import { createTaskCollector, getCurrentSuite, setFn } from 'vitest/suite'

export { describe, beforeAll, afterAll } from 'vitest'
export { afterAll, beforeAll, describe } from 'vitest'

// this function will be called during collection phase:
// don't call function handler here, add it to suite tasks
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ You can use it like below in your [setup file](/config/#setupfiles)
```js
import { afterAll, afterEach, beforeAll } from 'vitest'
import { setupServer } from 'msw/node'
import { HttpResponse, graphql, http } from 'msw'
import { graphql, http, HttpResponse } from 'msw'

const posts = [
{
Expand Down
6 changes: 3 additions & 3 deletions docs/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Plugin } from 'vite'
import { defineConfig } from 'vite'
import Components from 'unplugin-vue-components/vite'
import Unocss from 'unocss/vite'
import { presetAttributify, presetIcons, presetUno } from 'unocss'
import Unocss from 'unocss/vite'
import Components from 'unplugin-vue-components/vite'
import { defineConfig } from 'vite'

export default defineConfig({
optimizeDeps: {
Expand Down
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ export default antfu(
files: [
`docs/${GLOB_SRC}`,
`**/*.md`,
`**/*.md/${GLOB_SRC}`,
],
rules: {
'perfectionist/sort-imports': 'off',
'style/max-statements-per-line': 'off',
'import/newline-after-import': 'off',
'import/first': 'off',
Expand All @@ -122,6 +124,7 @@ export default antfu(
`test/${GLOB_SRC}`,
],
rules: {
'antfu/no-top-level-await': 'off',
'unicorn/consistent-function-scoping': 'off',
},
},
Expand Down
4 changes: 2 additions & 2 deletions examples/fastify/test/app.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { afterAll, expect, test } from 'vitest'
import supertest from 'supertest'
import { afterAll, expect, test } from 'vitest'

import app from '../src/app'
import { usersData } from '../mockData'
import app from '../src/app'

test('with HTTP injection', async () => {
const response = await app.inject({
Expand Down
2 changes: 1 addition & 1 deletion examples/lit/src/my-button.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LitElement, css, html } from 'lit'
import { css, html, LitElement } from 'lit'
import { customElement, property } from 'lit/decorators.js'

/**
Expand Down
2 changes: 1 addition & 1 deletion examples/lit/test/basic.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from 'vitest'
import { page } from '@vitest/browser/context'
import { beforeEach, describe, expect, it } from 'vitest'

import '../src/my-button.js'

Expand Down
4 changes: 2 additions & 2 deletions examples/workspace/packages/client/test/basic.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { expect, test } from 'vitest'
import { render, screen } from '@testing-library/react'
import { userEvent } from '@testing-library/user-event'
import React from 'react'
import { expect, test } from 'vitest'
import Link from '../components/Link.jsx'

test('Link changes the state when hovered', async () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/workspace/packages/server/test/app.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { afterAll, expect, test } from 'vitest'
import supertest from 'supertest'
import { afterAll, expect, test } from 'vitest'

import app from '../src/app'
import { usersData } from '../mockData'
import app from '../src/app'

test('with HTTP injection', async () => {
const response = await app.inject({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"test:browser:playwright": "pnpm -C test/browser run test:playwright"
},
"devDependencies": {
"@antfu/eslint-config": "3.0.0",
"@antfu/eslint-config": "^3.8.0",
"@antfu/ni": "^0.23.0",
"@playwright/test": "^1.48.0",
"@rollup/plugin-commonjs": "^28.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/browser/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createRequire } from 'node:module'
import esbuild from 'rollup-plugin-esbuild'
import dts from 'rollup-plugin-dts'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import resolve from '@rollup/plugin-node-resolve'
import { defineConfig } from 'rollup'
import dts from 'rollup-plugin-dts'
import esbuild from 'rollup-plugin-esbuild'

const require = createRequire(import.meta.url)
const pkg = require('./package.json')
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/channel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CancelReason } from '@vitest/runner'
import type { MockedModuleSerialized } from '@vitest/mocker'
import type { CancelReason } from '@vitest/runner'
import { getBrowserState } from './utils'

export interface IframeDoneEvent {
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CancelReason } from '@vitest/runner'
import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from '../node/types'
import { type BirpcReturn, createBirpc } from 'birpc'
import { parse, stringify } from 'flatted'
import type { WebSocketBrowserEvents, WebSocketBrowserHandlers } from '../node/types'
import { getBrowserState } from './utils'

const PAGE_TYPE = getBrowserState().type
Expand Down
8 changes: 4 additions & 4 deletions packages/browser/src/client/orchestrator.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { SerializedConfig } from 'vitest'
import { channel, client } from '@vitest/browser/client'
import { globalChannel, type GlobalChannelIncomingEvent, type IframeChannelEvent, type IframeChannelIncomingEvent } from '@vitest/browser/client'
import { generateHash } from '@vitest/runner/utils'
import { type GlobalChannelIncomingEvent, type IframeChannelEvent, type IframeChannelIncomingEvent, globalChannel } from '@vitest/browser/client'
import { relative } from 'pathe'
import type { SerializedConfig } from 'vitest'
import { getBrowserState, getConfig } from './utils'
import { getUiAPI } from './ui'
import { createModuleMockerInterceptor } from './tester/msw'
import { getUiAPI } from './ui'
import { getBrowserState, getConfig } from './utils'

const url = new URL(location.href)
const ID_ALL = '__vitest_all__'
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/client/tester/context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RunnerTask } from 'vitest'
import type { BrowserRPC } from '@vitest/browser/client'
import type { Options as TestingLibraryOptions, UserEvent as TestingLibraryUserEvent } from '@testing-library/user-event'
import type { BrowserRPC } from '@vitest/browser/client'
import type { RunnerTask } from 'vitest'
import type {
BrowserPage,
Locator,
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/expect-element.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as matchers from '@testing-library/jest-dom/matchers'
import type { Locator } from '@vitest/browser/context'
import type { ExpectPollOptions } from 'vitest'
import * as matchers from '@testing-library/jest-dom/matchers'
import { chai, expect } from 'vitest'

export async function setupExpectDom() {
Expand Down
10 changes: 5 additions & 5 deletions packages/browser/src/client/tester/locators/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { BrowserRPC } from '@vitest/browser/client'
import type {
LocatorByRoleOptions,
LocatorOptions,
Expand All @@ -7,21 +8,20 @@ import type {
UserEventFillOptions,
UserEventHoverOptions,
} from '@vitest/browser/context'
import type { WorkerGlobalState } from 'vitest'
import type { BrowserRunnerState } from '../../utils'
import { page, server } from '@vitest/browser/context'
import type { BrowserRPC } from '@vitest/browser/client'
import {
Ivya,
type ParsedSelector,
getByAltTextSelector,
getByLabelSelector,
getByPlaceholderSelector,
getByRoleSelector,
getByTestIdSelector,
getByTextSelector,
getByTitleSelector,
Ivya,
type ParsedSelector,
} from 'ivya'
import type { WorkerGlobalState } from 'vitest'
import type { BrowserRunnerState } from '../../utils'
import { getBrowserState, getWorkerState } from '../../utils'
import { getElementError } from '../public-utils'

Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/locators/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { page, server } from '@vitest/browser/context'
import { userEvent } from '@testing-library/user-event'
import { page, server } from '@vitest/browser/context'
import {
getByAltTextSelector,
getByLabelSelector,
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/msw.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { channel } from '@vitest/browser/client'
import type {
IframeChannelEvent,
IframeMockFactoryRequestEvent,
IframeMockingDoneEvent,
} from '@vitest/browser/client'
import type { MockedModuleSerialized } from '@vitest/mocker'
import { channel } from '@vitest/browser/client'
import { ManualMockedModule } from '@vitest/mocker'
import { ModuleMockerMSWInterceptor } from '@vitest/mocker/browser'
import { nanoid } from '@vitest/utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/public-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Locator, type LocatorSelectors, page } from '@vitest/browser/context'
import { type StringifyOptions, stringify } from 'vitest/utils'
import { asLocator } from 'ivya'
import { stringify, type StringifyOptions } from 'vitest/utils'

export function getElementLocatorSelectors(element: Element): LocatorSelectors {
const locator = page.elementLocator(element)
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getSafeTimers } from 'vitest/utils'
import type { VitestBrowserClient } from '@vitest/browser/client'
import { getSafeTimers } from 'vitest/utils'

const { get } = Reflect

Expand Down
12 changes: 6 additions & 6 deletions packages/browser/src/client/tester/runner.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { CancelReason, File, Suite, Task, TaskResultPack, VitestRunner } from '@vitest/runner'
import type { SerializedConfig, WorkerGlobalState } from 'vitest'
import type { VitestExecutor } from 'vitest/execute'
import { NodeBenchmarkRunner, VitestTestRunner } from 'vitest/runners'
import { loadDiffConfig, loadSnapshotSerializers, takeCoverageInsideWorker } from 'vitest/browser'
import { TraceMap, originalPositionFor } from 'vitest/utils'
import { page, userEvent } from '@vitest/browser/context'
import type { VitestBrowserClientMocker } from './mocker'
import { globalChannel } from '@vitest/browser/client'
import { page, userEvent } from '@vitest/browser/context'
import { loadDiffConfig, loadSnapshotSerializers, takeCoverageInsideWorker } from 'vitest/browser'
import { NodeBenchmarkRunner, VitestTestRunner } from 'vitest/runners'
import { originalPositionFor, TraceMap } from 'vitest/utils'
import { executor } from '../utils'
import { VitestBrowserSnapshotEnvironment } from './snapshot'
import { rpc } from './rpc'
import type { VitestBrowserClientMocker } from './mocker'
import { VitestBrowserSnapshotEnvironment } from './snapshot'

interface BrowserRunnerOptions {
config: SerializedConfig
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/client/tester/snapshot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SnapshotEnvironment } from 'vitest/snapshot'
import { type ParsedStack, TraceMap, originalPositionFor } from 'vitest/utils'
import type { VitestBrowserClient } from '@vitest/browser/client'
import type { SnapshotEnvironment } from 'vitest/snapshot'
import { originalPositionFor, type ParsedStack, TraceMap } from 'vitest/utils'

export class VitestBrowserSnapshotEnvironment implements SnapshotEnvironment {
private sourceMaps = new Map<string, any>()
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/client/tester/state.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { BrowserRPC } from '@vitest/browser/client'
import type { WorkerGlobalState } from 'vitest'
import { parse } from 'flatted'
import type { BrowserRPC } from '@vitest/browser/client'
import { getBrowserState } from '../utils'

const config = getBrowserState().config
Expand Down
8 changes: 4 additions & 4 deletions packages/browser/src/client/tester/tester.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { SpyModule, collectTests, setupCommonEnv, startCoverageInsideWorker, startTests, stopCoverageInsideWorker } from 'vitest/browser'
import { page, userEvent } from '@vitest/browser/context'
import type { IframeMockEvent, IframeMockInvalidateEvent, IframeUnmockEvent } from '@vitest/browser/client'
import { channel, client, onCancel, waitForChannel } from '@vitest/browser/client'
import { page, userEvent } from '@vitest/browser/context'
import { collectTests, setupCommonEnv, SpyModule, startCoverageInsideWorker, startTests, stopCoverageInsideWorker } from 'vitest/browser'
import { executor, getBrowserState, getConfig, getWorkerState } from '../utils'
import { setupDialogsSpy } from './dialog'
import { setupExpectDom } from './expect-element'
import { setupConsoleLogSpy } from './logger'
import { VitestBrowserClientMocker } from './mocker'
import { createSafeRpc } from './rpc'
import { browserHashMap, initiateRunner } from './runner'
import { VitestBrowserClientMocker } from './mocker'
import { setupExpectDom } from './expect-element'

const cleanupSymbol = Symbol.for('vitest:component-cleanup')

Expand Down
Loading

0 comments on commit de74785

Please sign in to comment.