diff --git a/docs/errors/OXDT0001.md b/docs/errors/OXDT0001.md new file mode 100644 index 00000000..b0d27660 --- /dev/null +++ b/docs/errors/OXDT0001.md @@ -0,0 +1,19 @@ +--- +outline: deep +--- +# OXDT0001: Failed to Create Lint Result + +## Message +> Failed to create a lint result: `{reason}` + +## Cause +Oxlint could not start, its output could not be parsed, or the lint result could not be written to the project directory. + +## Example +Clicking `Run Lint` when oxlint is not installed in the project. + +## Fix +Ensure oxlint is installed, its configuration is valid, and the project directory is writable. + +## Source +- [`packages/oxc/src/node/rpc/functions/oxlint-run.ts`](https://github.com/vitejs/devtools/blob/main/packages/oxc/src/node/rpc/functions/oxlint-run.ts) — Runs oxlint and saves the lint result. diff --git a/docs/errors/OXDT0002.md b/docs/errors/OXDT0002.md new file mode 100644 index 00000000..6ccd09e9 --- /dev/null +++ b/docs/errors/OXDT0002.md @@ -0,0 +1,19 @@ +--- +outline: deep +--- +# OXDT0002: Invalid Lint Result ID + +## Message +> Invalid lint result ID "`{resultId}`". + +## Cause +A non-numeric ID was provided when reading or deleting a lint result. + +## Example +Passing `../other-directory` as the result ID in an RPC call. + +## Fix +Use a numeric ID shown in the lint result list. + +## Source +- [`packages/oxc/src/node/utils/lint-results-manager.ts`](https://github.com/vitejs/devtools/blob/main/packages/oxc/src/node/utils/lint-results-manager.ts) — Validates the result ID before file operations. diff --git a/docs/errors/OXDT0003.md b/docs/errors/OXDT0003.md new file mode 100644 index 00000000..48fcf934 --- /dev/null +++ b/docs/errors/OXDT0003.md @@ -0,0 +1,19 @@ +--- +outline: deep +--- +# OXDT0003: Failed to Delete Lint Result + +## Message +> Failed to delete lint result "`{resultId}`": `{reason}` + +## Cause +The lint result does not exist, or the project directory does not allow the file to be deleted. + +## Example +Deleting a lint result that another process has already removed. + +## Fix +Refresh the lint result list and ensure the project directory is writable. + +## Source +- [`packages/oxc/src/node/rpc/functions/oxlint-delete-result.ts`](https://github.com/vitejs/devtools/blob/main/packages/oxc/src/node/rpc/functions/oxlint-delete-result.ts) — Deletes the local lint result. diff --git a/docs/errors/index.md b/docs/errors/index.md index 47eecb41..ca78c491 100644 --- a/docs/errors/index.md +++ b/docs/errors/index.md @@ -63,3 +63,13 @@ Emitted by `@vitejs/devtools-vitest`. |------|-------|-------| | [VTDT0001](./VTDT0001) | error | Vitest UI Install Failed | | [VTDT0002](./VTDT0002) | error | Vitest UI Server Unreachable | + +## Oxc DevTools (OXDT) + +Emitted by `@vitejs/devtools-oxc`. + +| Code | Level | Title | +|------|-------|-------| +| [OXDT0001](./OXDT0001) | error | Failed to Create Lint Result | +| [OXDT0002](./OXDT0002) | error | Invalid Lint Result ID | +| [OXDT0003](./OXDT0003) | error | Failed to Delete Lint Result | diff --git a/docs/oxc/index.md b/docs/oxc/index.md index af491d20..fe44b72c 100644 --- a/docs/oxc/index.md +++ b/docs/oxc/index.md @@ -25,4 +25,4 @@ export default defineConfig({ }) ``` -It also runs standalone from the CLI — generate lint logs with `npx @vitejs/devtools-oxc lint`, then launch the UI with `npx @vitejs/devtools-oxc`. +It also runs standalone from the CLI with `npx @vitejs/devtools-oxc`. diff --git a/package.json b/package.json index e70c8cca..a3605210 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "watch": "pnpm -r run watch", "dev:rolldown": "pnpm -C packages/rolldown run dev", "dev:vite": "pnpm -C packages/vite run dev", + "dev:oxc": "pnpm -C packages/oxc run dev", "docs": "pnpm -C docs run docs", "docs:build": "pnpm build && pnpm -C docs run docs:build", "docs:serve": "pnpm -C docs run docs:serve", diff --git a/packages/oxc/README.md b/packages/oxc/README.md index 6a00a0c1..ec241b3f 100644 --- a/packages/oxc/README.md +++ b/packages/oxc/README.md @@ -40,12 +40,6 @@ yarn add -D @vitejs/devtools-oxc bun add -D @vitejs/devtools-oxc ``` -### Generate lint logs - -```sh -npx @vitejs/devtools-oxc lint -``` - ### Launch UI ```sh diff --git a/packages/oxc/package.json b/packages/oxc/package.json index 3f470bf0..8f4307d2 100644 --- a/packages/oxc/package.json +++ b/packages/oxc/package.json @@ -43,11 +43,9 @@ "typecheck": "vue-tsc --noEmit" }, "dependencies": { - "@clack/prompts": "catalog:inlined", "@vitejs/devtools-kit": "workspace:*", - "ansis": "catalog:deps", + "cac": "catalog:deps", "devframe": "catalog:deps", - "gunshi": "catalog:deps", "nostics": "catalog:deps", "pathe": "catalog:deps", "tinyexec": "catalog:deps" diff --git a/packages/oxc/src/app/app.vue b/packages/oxc/src/app/app.vue index 7a793338..659cffd6 100644 --- a/packages/oxc/src/app/app.vue +++ b/packages/oxc/src/app/app.vue @@ -12,7 +12,5 @@ connect() {{ connectionState.error }} -
- -
+ diff --git a/packages/oxc/src/app/components/SessionCard.vue b/packages/oxc/src/app/components/LintResultCard.vue similarity index 56% rename from packages/oxc/src/app/components/SessionCard.vue rename to packages/oxc/src/app/components/LintResultCard.vue index 1b2d3701..377ebd51 100644 --- a/packages/oxc/src/app/components/SessionCard.vue +++ b/packages/oxc/src/app/components/LintResultCard.vue @@ -1,26 +1,46 @@ diff --git a/packages/oxc/src/app/components/LintResultDetailsLoader.vue b/packages/oxc/src/app/components/LintResultDetailsLoader.vue new file mode 100644 index 00000000..455b285b --- /dev/null +++ b/packages/oxc/src/app/components/LintResultDetailsLoader.vue @@ -0,0 +1,105 @@ + + + diff --git a/packages/oxc/src/app/components/SummaryCard.vue b/packages/oxc/src/app/components/SummaryCard.vue index 3fbf020a..ef01f522 100644 --- a/packages/oxc/src/app/components/SummaryCard.vue +++ b/packages/oxc/src/app/components/SummaryCard.vue @@ -31,19 +31,8 @@ const durationMs = computed(() => Math.round(props.summary.start_time * 1000)) target="_blank" w-fit > - - v{{ version }} + + v{{ version }}
@@ -55,21 +44,16 @@ const durationMs = computed(() => Math.round(props.summary.start_time * 1000)) @@ -91,7 +75,7 @@ const durationMs = computed(() => Math.round(props.summary.start_time * 1000))
Created At
- + {{ new Date(timestamp).toLocaleString() }} @@ -99,7 +83,7 @@ const durationMs = computed(() => Math.round(props.summary.start_time * 1000))
Lint Duration
- + @@ -107,18 +91,7 @@ const durationMs = computed(() => Math.round(props.summary.start_time * 1000))
Checked Files
- + {{ summary.number_of_files }} files. {{ summary.files_with_issues }} with issues Math.round(props.summary.start_time * 1000))
Issues
- + {{ totalIssues }} issues. {{ summary.error_count }} errors -import ContainerCard from '@vitejs/devtools-ui/components/Container/ContainerCard.vue' import BannerOxcDevTools from '@vitejs/devtools-ui/components/Banner/BannerOxcDevTools.vue' +import DisplayBadge from '@vitejs/devtools-ui/components/Display/DisplayBadge.vue' +import DisplayNumberBadge from '@vitejs/devtools-ui/components/Display/DisplayNumberBadge.vue' import { useAsyncState } from '@vueuse/core' +import { computed } from 'vue' import { useRpc } from '#imports' const rpc = useRpc() -const { state: overview } = useAsyncState(() => rpc.value.call('devtools-oxc:overview'), { - oxlint: { - installed: false, - version: undefined, - latest: true, - npmxLink: undefined, +const { state: overview, isLoading } = useAsyncState( + () => rpc.value.call('devtools-oxc:overview'), + { + oxlint: { + installed: false, + version: undefined, + latest: true, + npmxLink: undefined, + }, + oxfmt: { + installed: false, + version: undefined, + latest: true, + npmxLink: undefined, + }, }, - oxfmt: { - installed: false, - version: undefined, - latest: true, - npmxLink: undefined, - }, -}) - +) -