From 2f8a5ecb82150069fc99f535d275eaa2fa9ef4d4 Mon Sep 17 00:00:00 2001 From: Arthur Fiorette Date: Thu, 17 Oct 2024 11:11:48 -0300 Subject: [PATCH] fix: url docs for error codes --- .changeset/tender-planes-thank.md | 5 +++++ packages/ts-html-plugin/src/errors.ts | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 .changeset/tender-planes-thank.md diff --git a/.changeset/tender-planes-thank.md b/.changeset/tender-planes-thank.md new file mode 100644 index 000000000..4ae40ab5a --- /dev/null +++ b/.changeset/tender-planes-thank.md @@ -0,0 +1,5 @@ +--- +'@kitajs/ts-html-plugin': patch +--- + +Fixed url docs for error codes diff --git a/packages/ts-html-plugin/src/errors.ts b/packages/ts-html-plugin/src/errors.ts index a2e2db927..e4a1689c9 100644 --- a/packages/ts-html-plugin/src/errors.ts +++ b/packages/ts-html-plugin/src/errors.ts @@ -1,22 +1,23 @@ +function urlDocs(error: `k${number}`) { + return `https://html.kitajs.org/packages/ts-html-plugin#${error}`; +} + export const Xss = { code: '0 K601' as any, - message: - 'Usage of xss-prone content without `safe` attribute. https://kitajs.github.io/ts-html-plugin#k601' + message: `Usage of xss-prone content without \`safe\` attribute. ${urlDocs('k601')}` }; export const DoubleEscape = { code: '0 K602' as any, - message: - 'Double escaping detected. Please remove the `safe` attribute. https://kitajs.github.io/ts-html-plugin#k602' + message: `Double escaping detected. Please remove the \`safe\` attribute. ${urlDocs('k602')}` }; export const ComponentXss = { code: '0 K603' as any, - message: - 'Xss-prone content inside a Component, wrap it into a Html.escapeHtml() call. https://kitajs.github.io/ts-html-plugin#k603' + message: `Xss-prone content inside a Component, wrap it into a Html.escapeHtml() call. ${urlDocs('k603')}` }; export const UnusedSafe = { code: '0 K604' as any, - message: 'Unused safe attribute. https://kitajs.github.io/ts-html-plugin#k604' + message: `Unused safe attribute. ${urlDocs('k604')}` };