diff --git a/src/runtime/validator.ts b/src/runtime/validator.ts
index ee0ac25d..6f4c9a18 100644
--- a/src/runtime/validator.ts
+++ b/src/runtime/validator.ts
@@ -26,7 +26,7 @@ export const useChecker = (
}
// Clean up Vue scoped style attributes
- html = typeof html === 'string' ? html.replace(/ ?data-v-[-a-z0-9]+\b/g, '') : html
+ html = typeof html === 'string' ? html.replace(/ ?data-v-[-a-z0-9]+(=["']([-a-z0-9]|\/|:|\.)*["'])?/g, '') : html
const { valid, results } = validator.validateString(html)
if (valid && !results.length) {
diff --git a/test/checker.test.ts b/test/checker.test.ts
index 8eabd3c4..feb69338 100644
--- a/test/checker.test.ts
+++ b/test/checker.test.ts
@@ -122,6 +122,24 @@ describe('useChecker', () => {
expect(console.error).not.toHaveBeenCalled()
})
+ it('ignores vite-plugin-inspect generated data attributes', async () => {
+ const mockValidator = vi.fn().mockImplementation(() => ({ valid: true, results: [] }))
+ const { checkHTML: checker } = useChecker({ validateString: mockValidator } as any, false)
+
+ await checker(
+ 'https://test.com/',
+ 'Link'
+ )
+ expect(mockValidator).toHaveBeenCalledWith(
+ 'Link'
+ )
+ expect(console.log).toHaveBeenCalledWith(
+ `No HTML validation errors found for ${chalk.bold('https://test.com/')}`
+ )
+ expect(console.warn).not.toHaveBeenCalled()
+ expect(console.error).not.toHaveBeenCalled()
+ })
+
it('formats HTML with prettier when asked to do so', async () => {
const mockValidator = vi.fn().mockImplementation(() => ({ valid: false, results: [] }))
const { checkHTML: checker } = useChecker({ validateString: mockValidator } as any, true)