Skip to content

Commit

Permalink
throw an error if added not set
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed May 15, 2023
1 parent a23d11b commit 2de8352
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions scripts/build-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Expand Down Expand Up @@ -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}`);

Expand Down
9 changes: 7 additions & 2 deletions scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};
Expand Down

0 comments on commit 2de8352

Please sign in to comment.