Skip to content

Commit 2c6d2d3

Browse files
committedOct 28, 2024··
feat: apply lint, use explict import
1 parent da4e176 commit 2c6d2d3

29 files changed

+511
-188
lines changed
 
+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { defineAppConfig } from '#imports'
2+
13
export default defineAppConfig({
24
fixture1: 'from app.config.ts',
35
})

‎packages/devtools/client/composables/client-services/markdown.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type MarkdownIt from 'markdown-it'
2+
import { shallowRef } from 'vue'
23

34
const md = shallowRef<MarkdownIt>()
45

‎packages/devtools/client/composables/client-services/shiki.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { BuiltinLanguage, HighlighterCore } from 'shiki'
22
import { createHighlighterCore, createJavaScriptRegexEngine } from 'shiki/core'
3+
import { shallowRef } from 'vue'
34

45
export const shiki = shallowRef<HighlighterCore>()
56

‎packages/devtools/client/composables/client.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
import type { useRoute, useRouter } from '#imports'
12
import type { NuxtDevtoolsClient, NuxtDevtoolsHostClient, NuxtDevtoolsIframeClient, VueInspectorData } from '@nuxt/devtools-kit/types'
23
import type { Unhead } from '@unhead/schema'
4+
import type { ComputedRef } from 'vue'
5+
import { useState } from '#imports'
6+
import { useColorMode } from '@vueuse/core'
7+
import { computed, ref } from 'vue'
38
import { renderMarkdown } from './client-services/markdown'
49
import { renderCodeHighlight } from './client-services/shiki'
510
import { extendedRpcMap, rpc } from './rpc'

‎packages/devtools/client/composables/dev-auth.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import { devtoolsUiShowNotification } from '#imports'
12
import { until } from '@vueuse/core'
23
import { UAParser } from 'ua-parser-js'
4+
import { ref } from 'vue'
5+
import { AuthConfirm } from './dialog'
6+
import { rpc } from './rpc'
37

48
export const devAuthToken = ref<string | null>(localStorage.getItem('__nuxt_dev_token__'))
59

‎packages/devtools/client/composables/dialog.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type { InstallModuleReturn, ModuleActionType, ModuleStaticInfo } from '../../src/types'
2+
import { useState } from '#imports'
3+
import { createTemplatePromise } from '@vueuse/core'
24

35
export const ModuleDialog = createTemplatePromise<boolean, [info: ModuleStaticInfo, result: InstallModuleReturn, type: ModuleActionType]>()
46

‎packages/devtools/client/composables/editor.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
import { useRouter } from '#app/composables/router'
2+
import { devtoolsUiShowNotification } from '#imports'
13
import { useClipboard } from '@vueuse/core'
4+
import { rpc } from './rpc'
5+
import { useServerConfig, useVirtualFiles } from './state'
6+
import { useCurrentVirtualFile } from './state-routes'
7+
import { telemetry } from './telemetry'
28

39
export function useOpenInEditor() {
410
const config = useServerConfig()

‎packages/devtools/client/composables/npm.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import type { NpmCommandOptions } from '../../src/types'
2+
import { useNuxtApp } from '#app/nuxt'
23
import semver from 'semver'
4+
import { computed, ref } from 'vue'
5+
import { ensureDevAuthToken } from './dev-auth'
6+
import { rpc } from './rpc'
7+
import { useAsyncState } from './utils'
38

49
export type PackageUpdateState = 'idle' | 'running' | 'updated'
510

‎packages/devtools/client/composables/rpc.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { ClientFunctions, ServerFunctions } from '../../src/types'
2+
import { useDebounce } from '@vueuse/core'
23
import { createBirpc } from 'birpc'
34
import { parse, stringify } from 'flatted'
45
import { tryCreateHotContext } from 'vite-hot-client'
6+
import { ref } from 'vue'
57
import { WS_EVENT_NAME } from '../../src/constant'
68

79
export const wsConnecting = ref(false)

‎packages/devtools/client/composables/state-commands.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import type { MaybeRefOrGetter } from 'vue'
2+
import { useRouter } from '#app/composables/router'
23
import { randomStr } from '@antfu/utils'
4+
import { computed, onUnmounted, reactive, toValue } from 'vue'
5+
import { useEnabledTabs } from './state-tabs'
36

47
export interface CommandItem {
58
id: string

‎packages/devtools/client/composables/state-components.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import type { Component } from 'nuxt/schema'
2+
import { computed } from 'vue'
3+
import { useClient } from './client'
4+
import { rpc } from './rpc'
5+
import { useAsyncState } from './utils'
26

37
export function useComponents() {
48
const client = useClient()

‎packages/devtools/client/composables/state-modules.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import type { InstalledModuleInfo, ModuleStaticInfo } from '../../src/types'
2+
import { useState } from '#imports'
3+
import { computed } from 'vue'
4+
import { useServerConfig } from './state'
5+
import { getModuleNameFromPath, isNodeModulePath, parseReadablePath, useAsyncState } from './utils'
26

37
const ignoredModules = [
48
'pages',

‎packages/devtools/client/composables/state-routes.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// virtual-files Tab
2+
import { useSessionState } from './utils'
3+
24
export function useCurrentVirtualFile() {
35
return useSessionState<string>('virtual-files:current', '')
46
}

‎packages/devtools/client/composables/state-schema.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useSessionState } from './utils'
2+
13
export function useSchemaInput() {
24
return useSessionState<{
35
name?: string

‎packages/devtools/client/composables/state-subprocess.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { AnalyzeBuildingState, InstallingModulestate } from '~/../src/types'
2+
import { ref } from 'vue'
23

34
export const processInstallingModules = ref<InstallingModulestate[]>([])
45

‎packages/devtools/client/composables/state-tabs.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
import type { MaybeRef } from 'vue'
1+
import type { computed, ComputedRef, MaybeRef } from 'vue'
22
import type { CategorizedTabs, ModuleBuiltinTab, ModuleCustomTab, RouteInfo, TabCategory } from '../../src/types'
3+
import { useRouter } from '#app/composables/router'
34
import { objectPick } from '@antfu/utils'
5+
import { toValue, unref } from 'vue'
6+
import { useClientRouter } from './client'
7+
import { useCustomTabs, useServerPages } from './state'
8+
import { useDevToolsOptions } from './storage-options'
49

510
export function useAllTabs() {
611
const customTabs = useCustomTabs()

‎packages/devtools/client/composables/state.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import type { Ref } from 'vue'
22
import type { HookInfo, RouteInfo } from '../../src/types'
3+
import { useFetch } from '#app/composables/fetch'
34
import { objectPick } from '@antfu/utils'
5+
import { computed } from 'vue'
6+
import { useClientRouter } from './client'
7+
import { rpc } from './rpc'
8+
import { useAsyncState } from './utils'
49

510
export function useServerPages() {
611
return useAsyncState('getServerPages', () => rpc.getServerPages())

‎packages/devtools/client/composables/storage-options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ToRefs } from 'vue'
22
import type { NuxtDevToolsOptions } from '../../types'
33
import { watchDebounced } from '@vueuse/core'
4-
import { toRefs } from 'vue'
4+
import { reactive, toRefs } from 'vue'
55
import { defaultTabOptions } from '../../src/constant'
66
import { rpc } from './rpc'
77

‎packages/devtools/client/composables/storage.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type { DevToolsFrameState } from '~~/../src/types'
2+
import { useLocalStorage, useWindowSize } from '@vueuse/core'
3+
import { computed } from 'vue'
24

35
export const isFirstVisit = useLocalStorage('nuxt-devtools-first-visit', true)
46

‎packages/devtools/client/composables/telemetry.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import { userAgentInfo } from './dev-auth'
2+
import { rpc } from './rpc'
3+
import { useDevToolsOptions } from './storage-options'
4+
15
export const telemetryEnabled = useDevToolsOptions('behavior').telemetry
26

37
export function telemetry(event: string, payload?: object, immediate = false) {

‎packages/devtools/client/composables/utils.ts

+6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import type { AsyncDataOptions } from '#app'
22
import type { ComponentRelationship, ComponentWithRelationships, NormalizedHeadTag, SocialPreviewCard, SocialPreviewResolved } from '~/../src/types'
33
import type { Component } from 'nuxt/schema'
44
import type { Ref } from 'vue'
5+
import { useAsyncData } from '#app/composables/asyncData'
6+
import { useNuxtApp } from '#app/nuxt'
7+
import { useState } from '#imports'
8+
import { useSessionStorage } from '@vueuse/core'
59
import { relative } from 'pathe'
10+
import { triggerRef } from 'vue'
11+
import { useClient } from './client'
612

713
export function isNodeModulePath(path: string) {
814
return !!path.match(/[/\\]node_modules[/\\]/) || isPackageName(path)

‎packages/devtools/client/middleware/route.global.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { defineNuxtRouteMiddleware, navigateTo } from '#imports'
12
import { isFirstVisit } from '~/composables/storage'
23

34
export default defineNuxtRouteMiddleware((to) => {

‎packages/devtools/client/nuxt.config.ts

+55-45
Original file line numberDiff line numberDiff line change
@@ -24,63 +24,74 @@ export default defineNuxtConfig({
2424
'nuxt-eslint-auto-explicit-import',
2525
],
2626

27-
ssr: false,
28-
29-
nitro: {
30-
output: {
31-
publicDir: resolver.resolve('../dist/client'),
27+
// For dogfooding purposes
28+
$development: {
29+
appConfig: {
30+
fixture2: 'from nuxt.config.ts',
3231
},
33-
devStorage: {
34-
test: {
35-
driver: 'fs',
36-
base: resolver.resolve('./.data/test'),
32+
33+
runtimeConfig: {
34+
'fixture3': 'private runtime config from nuxt.config.ts',
35+
'api-key': 'null',
36+
'public': {
37+
fixture4: 'public runtime config from nuxt.config.ts',
3738
},
3839
},
39-
hooks: {
40-
'prerender:routes': function (routes) {
41-
// Disable prerendering as it's an SPA
42-
routes.clear()
40+
41+
nitro: {
42+
devStorage: {
43+
test: {
44+
driver: 'fs',
45+
base: resolver.resolve('./.data/test'),
46+
},
47+
},
48+
experimental: {
49+
tasks: true,
50+
},
51+
scheduledTasks: {
52+
'*/5 * * * *': ['collection:1', 'collection:2'],
53+
'*/30 * * * *': ['ping'],
4354
},
4455
},
45-
experimental: {
46-
tasks: true,
47-
},
48-
scheduledTasks: {
49-
'*/5 * * * *': ['collection:1', 'collection:2'],
50-
'*/30 * * * *': ['ping'],
56+
},
57+
58+
// Production Overrides
59+
$production: {
60+
app: {
61+
// We set a placeholder for the middleware to be replaced with the correct base URL
62+
baseURL: '/__NUXT_DEVTOOLS_BASE__/',
5163
},
5264
},
5365

66+
ssr: false,
67+
68+
app: {
69+
baseURL: '/__nuxt_devtools__/client/',
70+
},
71+
5472
alias: {
5573
'@nuxt/devtools-kit/iframe-client': resolver.resolve('../../devtools-kit/src/runtime/iframe-client'),
5674
'@nuxt/devtools-kit/types': resolver.resolve('../../devtools-kit/src/types'),
5775
'@nuxt/devtools-kit': resolver.resolve('../../devtools-kit/src/index'),
5876
},
5977

60-
eslint: {
61-
config: {
62-
standalone: false,
63-
},
78+
experimental: {
79+
watcher: 'parcel',
6480
},
6581

66-
appConfig: {
67-
fixture2: 'from nuxt.config.ts',
68-
},
82+
compatibilityDate: '2024-07-22',
6983

70-
runtimeConfig: {
71-
'fixture3': 'private runtime config from nuxt.config.ts',
72-
'api-key': 'null',
73-
'public': {
74-
fixture4: 'public runtime config from nuxt.config.ts',
84+
nitro: {
85+
output: {
86+
publicDir: resolver.resolve('../dist/client'),
7587
},
76-
},
7788

78-
app: {
79-
baseURL: '/__nuxt_devtools__/client/',
80-
},
81-
82-
experimental: {
83-
watcher: 'parcel',
89+
hooks: {
90+
'prerender:routes': function (routes) {
91+
// Disable prerendering as it's an SPA
92+
routes.clear()
93+
},
94+
},
8495
},
8596

8697
vite: {
@@ -138,13 +149,12 @@ export default defineNuxtConfig({
138149
includeWorkspace: true,
139150
},
140151

141-
// Production Overrides
142-
$production: {
143-
app: {
144-
// We set a placeholder for the middleware to be replaced with the correct base URL
145-
baseURL: '/__NUXT_DEVTOOLS_BASE__/',
152+
eslint: {
153+
config: {
154+
standalone: false,
155+
nuxt: {
156+
sortConfigKeys: true,
157+
},
146158
},
147159
},
148-
149-
compatibilityDate: '2024-07-22',
150160
})

‎packages/devtools/client/plugins/global.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import { defineNuxtPlugin, useRouter } from '#imports'
2+
import { triggerRef } from 'vue'
3+
import { useClient, useComponentInspectorData } from '../composables/client'
4+
import { rpc } from '../composables/rpc'
5+
16
export default defineNuxtPlugin(() => {
27
const client = useClient()
38
const inspectorData = useComponentInspectorData()

‎packages/devtools/client/plugins/vue-devtools.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { defineNuxtPlugin } from '#imports'
12
import { VueDevToolsVuePlugin } from '@vue/devtools-core'
23

34
export default defineNuxtPlugin((nuxtApp) => {

‎packages/devtools/client/setup/client-rpc.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
import type { ClientFunctions } from '../../src/types'
2+
import { useNuxtApp, useRouter } from '#imports'
3+
import { useClient } from '../composables/client'
4+
import { devAuthToken, isDevAuthed } from '../composables/dev-auth'
5+
import { clientFunctions, rpc } from '../composables/rpc'
6+
import { processAnalyzeBuildInfo, processInstallingModules } from '../composables/state-subprocess'
7+
import { useDevToolsOptions } from '../composables/storage-options'
8+
import { telemetry } from '../composables/telemetry'
29

310
export function setupClientRPC() {
411
const nuxt = useNuxtApp()

‎packages/devtools/client/setup/vue-devtools.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { functions, onRpcConnected, rpc } from '@vue/devtools-core'
22
import { createRpcClient, toggleHighPerfMode } from '@vue/devtools-kit'
3+
import { watchEffect } from 'vue'
4+
import { useDevToolsFrameState } from '../composables/storage'
35

46
export function setupVueDevTools() {
57
const state = useDevToolsFrameState()

‎pnpm-lock.yaml

+370-139
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ catalog:
1313
'@iconify-json/simple-icons': ^1.2.3
1414
'@iconify-json/tabler': ^1.2.3
1515
'@nuxt/content': ^2.13.2
16-
'@nuxt/eslint': ^0.5.7
16+
'@nuxt/eslint': ^0.6.1
1717
'@nuxt/kit': ^3.13.2
1818
'@nuxt/module-builder': ^0.8.3
1919
'@nuxt/schema': ^3.13.2
@@ -83,7 +83,7 @@ catalog:
8383
nanoid: ^5.0.7
8484
nitropack: ^2.9.7
8585
nuxt: ^3.13.2
86-
nuxt-eslint-auto-explicit-import: ^0.1.0
86+
nuxt-eslint-auto-explicit-import: ^0.1.1
8787
nypm: ^0.3.11
8888
ofetch: ^1.3.4
8989
ohash: ^1.1.4

0 commit comments

Comments
 (0)
Please sign in to comment.