diff --git a/.changeset/slimy-waves-double.md b/.changeset/slimy-waves-double.md new file mode 100644 index 00000000..30bf7874 --- /dev/null +++ b/.changeset/slimy-waves-double.md @@ -0,0 +1,5 @@ +--- +'vite-plugin-checker': patch +--- + +feat: make filepath in terminal clickable diff --git a/packages/vite-plugin-checker/__tests__/__snapshots__/logger.spec.ts.snap b/packages/vite-plugin-checker/__tests__/__snapshots__/logger.spec.ts.snap index 6dcbea1c..0120d612 100644 --- a/packages/vite-plugin-checker/__tests__/__snapshots__/logger.spec.ts.snap +++ b/packages/vite-plugin-checker/__tests__/__snapshots__/logger.spec.ts.snap @@ -2,7 +2,7 @@ exports[`logger > diagnosticToTerminalLog > get error 1`] = ` " ERROR(ESLint) Unexpected var, use let or const instead. - FILE /Users/vite-plugin-checker/playground/eslint/src/main.ts:3:1 + FILE file:///Users/vite-plugin-checker/playground/eslint/src/main.ts:3:1 1 | import { text } from './text' 2 | @@ -16,7 +16,7 @@ exports[`logger > diagnosticToTerminalLog > get error 1`] = ` exports[`logger > diagnosticToTerminalLog > get warning 1`] = ` " WARNING(ESLint) Unexpected var, use let or const instead. - FILE /Users/vite-plugin-checker/playground/eslint/src/main.ts:3:1 + FILE file:///Users/vite-plugin-checker/playground/eslint/src/main.ts:3:1 1 | import { text } from './text' 2 | diff --git a/packages/vite-plugin-checker/src/logger.ts b/packages/vite-plugin-checker/src/logger.ts index 60b9315c..f5fba070 100644 --- a/packages/vite-plugin-checker/src/logger.ts +++ b/packages/vite-plugin-checker/src/logger.ts @@ -104,13 +104,14 @@ export function diagnosticToTerminalLog( const levelLabel = labelMap[d.level ?? DiagnosticLevel.Error] const fileLabel = boldBlack.bgCyanBright(' FILE ') + ' ' + const filePath = 'file://' + d.id const position = d.loc ? chalk.yellow(d.loc.start.line) + ':' + chalk.yellow(d.loc.start.column) : '' return [ levelLabel + ' ' + d.message, - fileLabel + d.id + ':' + position + os.EOL, + fileLabel + filePath + ':' + position + os.EOL, d.codeFrame + os.EOL, d.conclusion, ] diff --git a/playground/backend-integration/__test__/__snapshots__/test.spec.ts.snap b/playground/backend-integration/__test__/__snapshots__/test.spec.ts.snap index 4fc25bb1..f5cff5ab 100644 --- a/playground/backend-integration/__test__/__snapshots__/test.spec.ts.snap +++ b/playground/backend-integration/__test__/__snapshots__/test.spec.ts.snap @@ -5,7 +5,7 @@ exports[`backend-integration > serve > get initial error 1`] = `"[{\\"checkerId\ exports[`backend-integration > serve > get initial error 2`] = ` " ERROR(TypeScript) Argument of type 'number' is not assignable to parameter of type 'string | (() => string)'. - FILE /playground-temp/backend-integration/src/App.tsx:6:46 + FILE file:///playground-temp/backend-integration/src/App.tsx:6:46 4 | 5 | function App() { diff --git a/playground/config-default/__tests__/__snapshots__/test.spec.ts.snap b/playground/config-default/__tests__/__snapshots__/test.spec.ts.snap index 1d1aa37b..74d323e4 100644 --- a/playground/config-default/__tests__/__snapshots__/test.spec.ts.snap +++ b/playground/config-default/__tests__/__snapshots__/test.spec.ts.snap @@ -4,7 +4,7 @@ exports[`config-default > serve > get initial error 1`] = `"[{\\"checkerId\\":\\ exports[`config-default > serve > get initial error 2`] = ` " ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/config-default/src/main.ts:3:1 + FILE file:///playground-temp/config-default/src/main.ts:3:1 1 | import { text } from './text' 2 | @@ -14,7 +14,7 @@ exports[`config-default > serve > get initial error 2`] = ` 5 | const rootDom = document.querySelector('#root')! as HTMLElement 6 | rootDom.innerHTML = hello + text WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion) - FILE /playground-temp/config-default/src/main.ts:5:17 + FILE file:///playground-temp/config-default/src/main.ts:5:17 3 | var hello = 'Hello' 4 | diff --git a/playground/eslint-config-log-level/__tests__/__snapshots__/test.spec.ts.snap b/playground/eslint-config-log-level/__tests__/__snapshots__/test.spec.ts.snap index 6834d4a4..103b6607 100644 --- a/playground/eslint-config-log-level/__tests__/__snapshots__/test.spec.ts.snap +++ b/playground/eslint-config-log-level/__tests__/__snapshots__/test.spec.ts.snap @@ -4,7 +4,7 @@ exports[`eslint-config-log-level > serve > should only emit warning logs 1`] = ` exports[`eslint-config-log-level > serve > should only emit warning logs 2`] = ` " WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion) - FILE /playground-temp/eslint-config-log-level/src/main.ts:5:17 + FILE file:///playground-temp/eslint-config-log-level/src/main.ts:5:17 3 | var hello = 'Hello' 4 | @@ -20,7 +20,7 @@ exports[`eslint-config-log-level > serve > should only emit warning logs 3`] = ` exports[`eslint-config-log-level > serve > should only emit warning logs 4`] = ` " WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion) - FILE /playground-temp/eslint-config-log-level/src/main.ts:5:17 + FILE file:///playground-temp/eslint-config-log-level/src/main.ts:5:17 3 | var hello = 'Hello~' 4 | diff --git a/playground/eslint-default/__tests__/__snapshots__/test.spec.ts.snap b/playground/eslint-default/__tests__/__snapshots__/test.spec.ts.snap index 0f02010e..bbe4c679 100644 --- a/playground/eslint-default/__tests__/__snapshots__/test.spec.ts.snap +++ b/playground/eslint-default/__tests__/__snapshots__/test.spec.ts.snap @@ -4,7 +4,7 @@ exports[`eslint > serve > get initial error and subsequent error 1`] = `"[{\\"ch exports[`eslint > serve > get initial error and subsequent error 2`] = ` " ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/eslint-default/src/main.ts:3:1 + FILE file:///playground-temp/eslint-default/src/main.ts:3:1 1 | import { text } from './text' 2 | @@ -14,7 +14,7 @@ exports[`eslint > serve > get initial error and subsequent error 2`] = ` 5 | const rootDom = document.querySelector('#root')! 6 | rootDom.innerHTML = hello + text WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion) - FILE /playground-temp/eslint-default/src/main.ts:5:17 + FILE file:///playground-temp/eslint-default/src/main.ts:5:17 3 | var hello = 'Hello' 4 | @@ -30,7 +30,7 @@ exports[`eslint > serve > get initial error and subsequent error 3`] = `"[{\\"ch exports[`eslint > serve > get initial error and subsequent error 4`] = ` " ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/eslint-default/src/main.ts:3:1 + FILE file:///playground-temp/eslint-default/src/main.ts:3:1 1 | import { text } from './text' 2 | @@ -40,7 +40,7 @@ exports[`eslint > serve > get initial error and subsequent error 4`] = ` 5 | const rootDom = document.querySelector('#root')! 6 | rootDom.innerHTML = hello + text WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion) - FILE /playground-temp/eslint-default/src/main.ts:5:17 + FILE file:///playground-temp/eslint-default/src/main.ts:5:17 3 | var hello = 'Hello~' 4 | @@ -56,7 +56,7 @@ exports[`eslint > serve > get initial error and subsequent error 5`] = `"[{\\"ch exports[`eslint > serve > get initial error and subsequent error 6`] = ` " ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/eslint-default/src/main.ts:3:1 + FILE file:///playground-temp/eslint-default/src/main.ts:3:1 1 | import { text } from './text' 2 | @@ -66,7 +66,7 @@ exports[`eslint > serve > get initial error and subsequent error 6`] = ` 5 | const rootDom = document.querySelector('#root')! 6 | rootDom.innerHTML = hello + text WARNING(ESLint) Forbidden non-null assertion. (@typescript-eslint/no-non-null-assertion) - FILE /playground-temp/eslint-default/src/main.ts:5:17 + FILE file:///playground-temp/eslint-default/src/main.ts:5:17 3 | var hello = 'Hello~' 4 | diff --git a/playground/multiple-hmr/__tests__/__snapshots__/test.spec.ts.snap b/playground/multiple-hmr/__tests__/__snapshots__/test.spec.ts.snap index 49793ffe..052ec198 100644 --- a/playground/multiple-hmr/__tests__/__snapshots__/test.spec.ts.snap +++ b/playground/multiple-hmr/__tests__/__snapshots__/test.spec.ts.snap @@ -4,7 +4,7 @@ exports[`multiple-hmr > serve > get initial error and subsequent error 1`] = `"[ exports[`multiple-hmr > serve > get initial error and subsequent error 2`] = ` " ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/multiple-hmr/src/App.tsx:6:3 + FILE file:///playground-temp/multiple-hmr/src/App.tsx:6:3 4 | 5 | function App() { @@ -15,7 +15,7 @@ exports[`multiple-hmr > serve > get initial error and subsequent error 2`] = ` 9 |
[ESLint] Found 1 error and 0 warning ERROR(TypeScript) Argument of type 'number' is not assignable to parameter of type 'string | (() => string)'. - FILE /playground-temp/multiple-hmr/src/App.tsx:6:44 + FILE file:///playground-temp/multiple-hmr/src/App.tsx:6:44 4 | 5 | function App() { diff --git a/playground/multiple-reload/__tests__/__snapshots__/test.spec.ts.snap b/playground/multiple-reload/__tests__/__snapshots__/test.spec.ts.snap index 1927f1c8..c11492c6 100644 --- a/playground/multiple-reload/__tests__/__snapshots__/test.spec.ts.snap +++ b/playground/multiple-reload/__tests__/__snapshots__/test.spec.ts.snap @@ -4,7 +4,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 1`] = exports[`multiple-reload > serve > get initial error and subsequent error 2`] = ` " ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/multiple-reload/src/main.ts:3:1 + FILE file:///playground-temp/multiple-reload/src/main.ts:3:1 1 | import { text } from './text' 2 | @@ -14,7 +14,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 2`] = 5 | 6 | const rootDom = document.querySelector('#root')! ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/multiple-reload/src/main.ts:4:1 + FILE file:///playground-temp/multiple-reload/src/main.ts:4:1 2 | 3 | var hello1: number = 'Hello1' @@ -25,7 +25,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 2`] = 7 | rootDom.innerHTML = hello1 + text [ESLint] Found 2 errors and 0 warning ERROR(TypeScript) Type 'string' is not assignable to type 'number'. - FILE /playground-temp/multiple-reload/src/main.ts:3:5 + FILE file:///playground-temp/multiple-reload/src/main.ts:3:5 1 | import { text } from './text' 2 | @@ -36,7 +36,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 2`] = 6 | const rootDom = document.querySelector('#root')! ERROR(TypeScript) Type 'string' is not assignable to type 'boolean'. - FILE /playground-temp/multiple-reload/src/main.ts:4:5 + FILE file:///playground-temp/multiple-reload/src/main.ts:4:5 2 | 3 | var hello1: number = 'Hello1' @@ -53,7 +53,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 3`] = exports[`multiple-reload > serve > get initial error and subsequent error 4`] = ` " ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/multiple-reload/src/main.ts:3:1 + FILE file:///playground-temp/multiple-reload/src/main.ts:3:1 1 | import { text } from './text' 2 | @@ -63,7 +63,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 4`] = 5 | 6 | const rootDom = document.querySelector('#root')! ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/multiple-reload/src/main.ts:4:1 + FILE file:///playground-temp/multiple-reload/src/main.ts:4:1 2 | 3 | var hello1: number = 'Hello1~' @@ -74,7 +74,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 4`] = 7 | rootDom.innerHTML = hello1 + text [ESLint] Found 2 errors and 0 warning ERROR(TypeScript) Type 'string' is not assignable to type 'number'. - FILE /playground-temp/multiple-reload/src/main.ts:3:5 + FILE file:///playground-temp/multiple-reload/src/main.ts:3:5 1 | import { text } from './text' 2 | @@ -85,7 +85,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 4`] = 6 | const rootDom = document.querySelector('#root')! ERROR(TypeScript) Type 'string' is not assignable to type 'boolean'. - FILE /playground-temp/multiple-reload/src/main.ts:4:5 + FILE file:///playground-temp/multiple-reload/src/main.ts:4:5 2 | 3 | var hello1: number = 'Hello1~' @@ -102,7 +102,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 5`] = exports[`multiple-reload > serve > get initial error and subsequent error 6`] = ` " ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/multiple-reload/src/main.ts:3:1 + FILE file:///playground-temp/multiple-reload/src/main.ts:3:1 1 | import { text } from './text' 2 | @@ -112,7 +112,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 6`] = 5 | 6 | const rootDom = document.querySelector('#root')! ERROR(ESLint) Unexpected var, use let or const instead. (no-var) - FILE /playground-temp/multiple-reload/src/main.ts:4:1 + FILE file:///playground-temp/multiple-reload/src/main.ts:4:1 2 | 3 | var hello1: number = 'Hello1~' @@ -123,7 +123,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 6`] = 7 | rootDom.innerHTML = hello1 + text [ESLint] Found 2 errors and 0 warning ERROR(TypeScript) Type 'string' is not assignable to type 'number'. - FILE /playground-temp/multiple-reload/src/main.ts:3:5 + FILE file:///playground-temp/multiple-reload/src/main.ts:3:5 1 | import { text } from './text' 2 | @@ -134,7 +134,7 @@ exports[`multiple-reload > serve > get initial error and subsequent error 6`] = 6 | const rootDom = document.querySelector('#root')! ERROR(TypeScript) Type 'string' is not assignable to type 'boolean'. - FILE /playground-temp/multiple-reload/src/main.ts:4:5 + FILE file:///playground-temp/multiple-reload/src/main.ts:4:5 2 | 3 | var hello1: number = 'Hello1~' diff --git a/playground/stylelint-default/__tests__/__snapshots__/test.spec.ts.snap b/playground/stylelint-default/__tests__/__snapshots__/test.spec.ts.snap index 440f6bbc..0a609cb0 100644 --- a/playground/stylelint-default/__tests__/__snapshots__/test.spec.ts.snap +++ b/playground/stylelint-default/__tests__/__snapshots__/test.spec.ts.snap @@ -4,7 +4,7 @@ exports[`stylelint > serve > get initial error and subsequent error 1`] = `"[{\\ exports[`stylelint > serve > get initial error and subsequent error 2`] = ` " ERROR(Stylelint) Unexpected empty block (block-no-empty) (block-no-empty) - FILE /playground-temp/stylelint-default/src/style.css:1:7 + FILE file:///playground-temp/stylelint-default/src/style.css:1:7 > 1 | #root { | ^ @@ -14,7 +14,7 @@ exports[`stylelint > serve > get initial error and subsequent error 2`] = ` 4 | body { 5 | color: rgb(0, 0, 0); ERROR(Stylelint) Expected modern color-function notation (color-function-notation) (color-function-notation) - FILE /playground-temp/stylelint-default/src/style.css:5:10 + FILE file:///playground-temp/stylelint-default/src/style.css:5:10 3 | 4 | body { @@ -29,7 +29,7 @@ exports[`stylelint > serve > get initial error and subsequent error 3`] = `"[{\\ exports[`stylelint > serve > get initial error and subsequent error 4`] = ` " ERROR(Stylelint) Unexpected empty block (block-no-empty) (block-no-empty) - FILE /playground-temp/stylelint-default/src/style.css:1:7 + FILE file:///playground-temp/stylelint-default/src/style.css:1:7 > 1 | #root { | ^ diff --git a/playground/typescript-react/__tests__/__snapshots__/test.spec.ts.snap b/playground/typescript-react/__tests__/__snapshots__/test.spec.ts.snap index 3f41f98b..b41589ac 100644 --- a/playground/typescript-react/__tests__/__snapshots__/test.spec.ts.snap +++ b/playground/typescript-react/__tests__/__snapshots__/test.spec.ts.snap @@ -5,7 +5,7 @@ exports[`typescript-react > serve > get initial error and subsequent error 1`] = exports[`typescript-react > serve > get initial error and subsequent error 2`] = ` " ERROR(TypeScript) Argument of type 'number' is not assignable to parameter of type 'string | (() => string)'. - FILE /playground-temp/typescript-react/src/App.tsx:6:46 + FILE file:///playground-temp/typescript-react/src/App.tsx:6:46 4 | 5 | function App() { @@ -23,7 +23,7 @@ exports[`typescript-react > serve > get initial error and subsequent error 3`] = exports[`typescript-react > serve > get initial error and subsequent error 4`] = ` " ERROR(TypeScript) Argument of type 'number' is not assignable to parameter of type 'string | (() => string)'. - FILE /playground-temp/typescript-react/src/App.tsx:6:46 + FILE file:///playground-temp/typescript-react/src/App.tsx:6:46 4 | 5 | function App() { diff --git a/playground/vls-vue2/__tests__/__snapshots__/test.spec.ts.snap b/playground/vls-vue2/__tests__/__snapshots__/test.spec.ts.snap index e7123dea..ab7f0976 100644 --- a/playground/vls-vue2/__tests__/__snapshots__/test.spec.ts.snap +++ b/playground/vls-vue2/__tests__/__snapshots__/test.spec.ts.snap @@ -4,7 +4,7 @@ exports[`vue2-vls > serve > get initial error and subsequent error 1`] = `"[{\\" exports[`vue2-vls > serve > get initial error and subsequent error 2`] = ` " ERROR(VLS) Property 'msg1' does not exist on type 'CombinedVueInstance<{ msg: string; } & Vue, Record, never, never, (event: string, ...args: any[]) => Vue, Record, never, never, ...>> & Vue<...>, ... 4 more ..., {}>'. Did you mean 'msg'? - FILE /playground-temp/vls-vue2/src/components/HelloWorld.vue:3:12 + FILE file:///playground-temp/vls-vue2/src/components/HelloWorld.vue:3:12 1 |