Skip to content

Commit be3fa3f

Browse files
committed
chore: update deps, apply lint
1 parent 82eef12 commit be3fa3f

94 files changed

Lines changed: 1892 additions & 2756 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/app/app.vue‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,21 @@ useHead({
88
lang: 'en',
99
},
1010
})
11-
const links = [{
12-
label: 'Documentation',
13-
to: '/guide/getting-started',
14-
}, {
15-
label: 'Playground',
16-
to: '/playground',
17-
}, {
18-
label: 'Releases',
19-
to: 'https://github.com/nuxt/devtools/releases',
20-
target: '_blank',
21-
}]
11+
const links = [
12+
{
13+
label: 'Documentation',
14+
to: '/guide/getting-started',
15+
},
16+
{
17+
label: 'Playground',
18+
to: '/playground',
19+
},
20+
{
21+
label: 'Releases',
22+
to: 'https://github.com/nuxt/devtools/releases',
23+
target: '_blank',
24+
},
25+
]
2226
const { version } = useRuntimeConfig().public
2327
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('docs'))
2428

‎docs/content/2.module/0.guide.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ export default defineNuxtModule({
117117
// call client RPC functions when something changes; `broadcast` reaches
118118
// every connected client (none are connected yet when this hook runs)
119119
nuxt.hook('builder:watch', (_event, path) => {
120-
rpc.broadcast({ method: 'show-notification', args: [`${path} changed`], event: true })
120+
rpc.broadcast({
121+
method: 'show-notification',
122+
args: [`${path} changed`],
123+
event: true
124+
})
121125
})
122126
})
123127
},

‎docs/content/2.module/1.utils-kit.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ import { onDevtoolsReady } from '@nuxt/devtools-kit'
108108
onDevtoolsReady((ctx) => {
109109
// Output-only child process
110110
ctx.terminals.startChildProcess(
111-
{ command: 'npm', args: ['run', 'dev'] },
111+
{
112+
command: 'npm',
113+
args: ['run', 'dev']
114+
},
112115
{ id: 'my-module:dev', title: 'Dev Server', icon: 'logos-npm-icon' },
113116
)
114117

@@ -145,7 +148,10 @@ in the built-in **Terminals** dock):
145148
import { startSubprocess } from '@nuxt/devtools-kit'
146149

147150
const subprocess = startSubprocess(
148-
{ command: 'vite', args: ['build', '--watch'] },
151+
{
152+
command: 'vite',
153+
args: ['build', '--watch']
154+
},
149155
{ id: 'my-module:build', name: 'Build', icon: 'ph:terminal-duotone' },
150156
)
151157

‎docs/nuxt.config.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export default defineNuxtConfig({
1515
'@vueuse/nuxt',
1616
'@nuxtjs/plausible',
1717
'nuxt-og-image',
18-
...(process.env.CI ? [] : ['../local']),
18+
...(process.env.CI
19+
? []
20+
: ['../local']),
1921
],
2022

2123
css: ['~/assets/css/main.css'],

‎packages/devtools-kit/src/diagnostics.ts‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ export type NuxtDiagnosticCode = keyof typeof diagnosticCodes
9090
*/
9191
export const consoleDiagnostics = defineDiagnostics({
9292
docsBase: diagnosticsDocsBase,
93-
reporters: [createConsoleReporter()],
93+
reporters: [
94+
createConsoleReporter(),
95+
],
9496
codes: diagnosticCodes,
9597
})
9698

@@ -108,14 +110,18 @@ interface DiagnosticsState {
108110

109111
const stateByCtx = new WeakMap<object, DiagnosticsState>()
110112
/** Fallback state used when no server context is resolvable yet. */
111-
const fallbackState: DiagnosticsState = { emitted: new Set() }
113+
const fallbackState: DiagnosticsState = {
114+
emitted: new Set(),
115+
}
112116

113117
function getState(ctx: object | undefined): DiagnosticsState {
114118
if (!ctx)
115119
return fallbackState
116120
let state = stateByCtx.get(ctx)
117121
if (!state) {
118-
state = { emitted: new Set() }
122+
state = {
123+
emitted: new Set(),
124+
}
119125
stateByCtx.set(ctx, state)
120126
}
121127
return state
@@ -212,7 +218,9 @@ export function defineStandaloneDiagnostics(
212218
): ReturnType<typeof defineDiagnostics> {
213219
return defineDiagnostics({
214220
...options,
215-
reporters: options.reporters ?? [createConsoleReporter()],
221+
reporters: options.reporters ?? [
222+
createConsoleReporter(),
223+
],
216224
})
217225
}
218226

‎packages/devtools-kit/src/index.ts‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ export function addCustomTab(tab: ModuleCustomTab | (() => ModuleCustomTab | Pro
4646
deprecate(nuxt, 'NDT_DEP_0005', {
4747
api: 'addCustomTab',
4848
replacement: 'onDevtoolsReady((ctx) => ctx.docks.register(...))',
49-
}, { key: typeof tab === 'function' ? undefined : tab.name })
49+
}, {
50+
key: typeof tab === 'function'
51+
? undefined
52+
: tab.name,
53+
})
5054

5155
nuxt.hook('devtools:customTabs', async (tabs) => {
5256
if (typeof tab === 'function')
@@ -120,13 +124,22 @@ export function startSubprocess(
120124
},
121125
)
122126

123-
nuxt.callHook('devtools:terminal:write', { id, data: `> ${[execaOptions.command, ...execaOptions.args || []].join(' ')}\n\n` })
127+
nuxt.callHook('devtools:terminal:write', { id, data: `> ${[
128+
execaOptions.command,
129+
...execaOptions.args || [],
130+
].join(' ')}\n\n` })
124131

125132
proc.process?.stdout?.on('data', (data) => {
126-
nuxt.callHook('devtools:terminal:write', { id, data: data.toString() })
133+
nuxt.callHook('devtools:terminal:write', {
134+
id,
135+
data: data.toString(),
136+
})
127137
})
128138
proc.process?.stderr?.on('data', (data) => {
129-
nuxt.callHook('devtools:terminal:write', { id, data: data.toString() })
139+
nuxt.callHook('devtools:terminal:write', {
140+
id,
141+
data: data.toString(),
142+
})
130143
})
131144
proc.process?.on('exit', (code) => {
132145
if (!restarting) {
@@ -170,8 +183,12 @@ export function startSubprocess(
170183

171184
function register() {
172185
nuxt.callHook('devtools:terminal:register', {
173-
onActionRestart: tabOptions.restartable === false ? undefined : restart,
174-
onActionTerminate: tabOptions.terminatable === false ? undefined : terminate,
186+
onActionRestart: tabOptions.restartable === false
187+
? undefined
188+
: restart,
189+
onActionTerminate: tabOptions.terminatable === false
190+
? undefined
191+
: terminate,
175192
isTerminated: false,
176193
...tabOptions,
177194
})

‎packages/devtools-kit/test/diagnostics.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,16 @@ describe('deprecate', () => {
8989
it('routes through the host catalog once the kit has connected', () => {
9090
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
9191
const handle = vi.fn()
92-
const hostCatalog = { NDT_DEP_0001: handle, NDT_DEP_0003: vi.fn() }
92+
const hostCatalog = {
93+
NDT_DEP_0001: handle,
94+
NDT_DEP_0003: vi.fn(),
95+
}
9396
const register = vi.fn()
9497
const defineDiagnostics = vi.fn(() => hostCatalog)
9598
const ctx = {
96-
devtoolsKit: { diagnostics: { logger: {}, register, defineDiagnostics } },
99+
devtoolsKit: {
100+
diagnostics: { logger: {}, register, defineDiagnostics },
101+
},
97102
}
98103

99104
registerHostDiagnostics(ctx as any)

‎packages/devtools-onboard/src/module.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ const BASE = '/__devtools/'
2626

2727
function listsDevtools(modules: NuxtOptions['modules']): boolean {
2828
return modules.some((entry) => {
29-
const id = Array.isArray(entry) ? entry[0] : entry
29+
const id = Array.isArray(entry)
30+
? entry[0]
31+
: entry
3032
return typeof id === 'string' && DEVTOOLS_MODULES.has(id)
3133
})
3234
}
@@ -41,7 +43,9 @@ function listsDevtools(modules: NuxtOptions['modules']): boolean {
4143
async function devtoolsSpec(): Promise<string> {
4244
const { version, peerDependencies } = await readPackageJSON(fileURLToPath(import.meta.url))
4345
const range = peerDependencies?.[DEVTOOLS] ?? ''
44-
return `${DEVTOOLS}@${range.startsWith('npm:') ? range : `^${version}`}`
46+
return `${DEVTOOLS}@${range.startsWith('npm:')
47+
? range
48+
: `^${version}`}`
4549
}
4650

4751
export default defineNuxtModule({

‎packages/devtools-onboard/test/module.test.ts‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ async function bootNuxt(overrides: NuxtConfig, { withoutDevtools = false, instal
4747
await nuxt.close()
4848
await rm(rootDir, { recursive: true, force: true })
4949
})
50-
if (withoutDevtools)
51-
nuxt.options.modulesDir = [join(rootDir, 'node_modules')]
50+
if (withoutDevtools) {
51+
nuxt.options.modulesDir = [
52+
join(rootDir, 'node_modules'),
53+
]
54+
}
5255
await nuxt.ready()
5356
return nuxt
5457
}
@@ -59,7 +62,11 @@ function onboardScripts(nuxt: Nuxt) {
5962

6063
/** Serves what the module mounts on a real client Vite server; resolves to its origin. */
6164
async function serveViteMiddleware(nuxt: Nuxt): Promise<{ origin: string, viteServer: ViteDevServer }> {
62-
const viteServer = await createViteServer({ configFile: false, logLevel: 'silent', server: { middlewareMode: true, ws: false } })
65+
const viteServer = await createViteServer({
66+
configFile: false,
67+
logLevel: 'silent',
68+
server: { middlewareMode: true, ws: false },
69+
})
6370
cleanups.push(() => viteServer.close())
6471
// Mount only what the module adds, not Vite's own transform middlewares.
6572
viteServer.middlewares.stack.length = 0
@@ -81,7 +88,10 @@ const onboardStatus = (origin: string) => fetch(`${origin}/__devtools/__onboard/
8188

8289
describe('@nuxt/devtools-onboard', () => {
8390
it('does nothing when devtools are disabled', async () => {
84-
const nuxt = await bootNuxt({ devtools: false, modules: [onboardModule] })
91+
const nuxt = await bootNuxt({
92+
devtools: false,
93+
modules: [onboardModule],
94+
})
8595
expect(nuxt.options._requiredModules['@nuxt/devtools']).toBeUndefined()
8696
expect(onboardScripts(nuxt)).toHaveLength(0)
8797
}, 60_000)
@@ -93,7 +103,10 @@ describe('@nuxt/devtools-onboard', () => {
93103
}, 60_000)
94104

95105
it('loads @nuxt/devtools-nightly installed under its own name, over @nuxt/devtools', async () => {
96-
const nuxt = await bootNuxt({ dev: true }, { withoutDevtools: true, installed: ['@nuxt/devtools', '@nuxt/devtools-nightly'] })
106+
const nuxt = await bootNuxt({ dev: true }, {
107+
withoutDevtools: true,
108+
installed: ['@nuxt/devtools', '@nuxt/devtools-nightly'],
109+
})
97110
expect(nuxt.options.appConfig.loadedDevtools).toBe('@nuxt/devtools-nightly')
98111
expect(onboardScripts(nuxt)).toHaveLength(0)
99112
}, 60_000)

‎packages/devtools-onboard/test/terminal-confirm.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { PassThrough } from 'node:stream'
22
import { afterEach, expect, it, vi } from 'vitest'
33
import { confirmInTerminal } from '../src/terminal-confirm'
44

5-
const COMMAND = ['npm', 'i', '-D', '@nuxt/devtools@^4.0.0']
5+
const COMMAND = [
6+
'npm',
7+
'i',
8+
'-D',
9+
'@nuxt/devtools@^4.0.0',
10+
]
611

712
function terminal({ isTTY = true, isRaw = false } = {}) {
813
const asked: string[] = []

0 commit comments

Comments
 (0)