Skip to content

Commit 8becac5

Browse files
committed
fix: handle EmptyResult in stylelint to prevent _postcssResult from being empty
1 parent ed9c093 commit 8becac5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.changeset/dry-pots-cry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'vite-plugin-checker': patch
3+
---
4+
5+
handle EmptyResult in stylelint to prevent _postcssResult from being empty

packages/vite-plugin-checker/src/logger.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,12 @@ export function normalizeStylelintDiagnostic(
421421
column: d.endColumn,
422422
},
423423
}
424-
424+
let cssSource = ''
425+
if (diagnostic._postcssResult && 'css' in diagnostic._postcssResult) {
426+
cssSource = diagnostic._postcssResult.css
427+
}
425428
const codeFrame = createFrame({
426-
// @ts-ignore
427-
source: diagnostic._postcssResult.css ?? '',
429+
source: cssSource,
428430
location: loc,
429431
})
430432

0 commit comments

Comments
 (0)