Skip to content

Commit

Permalink
fixup! feat: allowlist for version numbers in YAML comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Feb 5, 2021
1 parent 3001dad commit 0c7400d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions remark-lint-nodejs-yaml-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const validVersionNumberRegex = /^v\d+\.\d+\.\d+$/;
const prUrlRegex = new RegExp("^https://github.com/nodejs/node/pull/\\d+$");
const privatePRUrl = "https://github.com/nodejs-private/node-private/pull/";

let releasedVersion;
let releasedVersions;
let invalidVersionMessage = "version(s) must respect the pattern `vx.x.x` or";
if (process.env.NODE_RELEASED_VERSIONS) {
console.log("Using release list from env...");
releasedVersion = process.env.NODE_RELEASED_VERSIONS.split(",").map(
releasedVersions = process.env.NODE_RELEASED_VERSIONS.split(",").map(
(v) => `v${v}`
);
invalidVersionMessage = `version not listed in the changelogs, `;
Expand Down Expand Up @@ -55,11 +55,11 @@ function containsInvalidVersionNumber(version) {
if (version === undefined || version === VERSION_PLACEHOLDER) return false;

if (
releasedVersion &&
releasedVersions &&
// Always ignore 0.0.x and 0.1.x release numbers:
(version[1] !== "0" || (version[3] !== "0" && version[3] !== "1"))
)
return !releasedVersion.includes(version);
return !releasedVersions.includes(version);

return !validVersionNumberRegex.test(version);
}
Expand Down

0 comments on commit 0c7400d

Please sign in to comment.