From 2de83524205d8be3fa2199e503f9eabba2ecab6d Mon Sep 17 00:00:00 2001 From: Slava Leleka Date: Mon, 15 May 2023 20:05:31 +0300 Subject: [PATCH] throw an error if added not set --- scripts/build-docs.js | 6 ++++++ scripts/helpers.js | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/build-docs.js b/scripts/build-docs.js index f283f8f75..699f68cc4 100644 --- a/scripts/build-docs.js +++ b/scripts/build-docs.js @@ -145,6 +145,9 @@ const getMarkdownDataForStaticRedirects = () => { if (!description) { throw new Error(`No description for static redirect '${title}'`); } + if (!added) { + throw new Error(`No added version for static redirect '${title}'`); + } acc.list.push(`* [${title}](#${title})${EOL}`); @@ -184,6 +187,9 @@ const getMarkdownDataForBlockingRedirects = () => { if (!description) { throw new Error(`No description for blocking redirect '${title}'`); } + if (!added) { + throw new Error(`No added version for blocking redirect '${title}'`); + } acc.list.push(`* [${title}](#${title})${EOL}`); diff --git a/scripts/helpers.js b/scripts/helpers.js index 2a1fd3134..e81fb1055 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -96,11 +96,16 @@ Please add one OR edit the list of NON_SCRIPTLETS_FILES / NON_REDIRECTS_FILES.`) */ const prepareCommentsData = (commentTags, source) => { const [typeTag, descriptionTag, addedTag] = commentTags; + const name = typeTag.string; + const versionAdded = addedTag?.string; + if (!versionAdded) { + throw new Error(`No @added tag for ${name}`); + } return { type: typeTag.type, - name: typeTag.string, + name, description: descriptionTag.string, - versionAdded: addedTag?.string, + versionAdded, source, }; };