Skip to content

Commit 6f671b2

Browse files
nathanchaseNathan Chase
andauthored
feat: add additional information to error reporting (#12)
Co-authored-by: Nathan Chase <[email protected]>
1 parent cfc4aa6 commit 6f671b2

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/validator.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,23 @@ export const useChecker = (validator: HtmlValidate, usePrettier = false, reporte
4747
: await import('html-validate/dist/formatters/stylish').then(r => r.default || /* istanbul ignore next */ r)
4848

4949
const formattedResult = formatter(results)
50+
51+
let additionalInfo = ''
52+
53+
const messages = results[0].messages
54+
55+
messages.forEach(({ ruleId }: any) => {
56+
const url = `https://html-validate.org/rules/${ruleId}.html`
57+
additionalInfo = additionalInfo + url + '\n '
58+
})
59+
5060
reporter.error(
5161
`HTML validation errors found for ${chalk.bold(url)}`,
52-
formattedResult
62+
'\n',
63+
formattedResult,
64+
'\n',
65+
`${chalk.bold('More information:')}`,
66+
'\n',
67+
additionalInfo
5368
)
5469
}

0 commit comments

Comments
 (0)