Skip to content

Commit

Permalink
tools: update remark-preset-lint-node to 2.1.1
Browse files Browse the repository at this point in the history
PR-URL: #37604
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott committed Mar 4, 2021
1 parent ffb34b6 commit 49342fe
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 32 deletions.
49 changes: 27 additions & 22 deletions tools/lint-md.js
Original file line number Diff line number Diff line change
Expand Up @@ -49469,6 +49469,17 @@ 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 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...");
releasedVersions = process.env.NODE_RELEASED_VERSIONS.split(",").map(
(v) => `v${v}`
);
invalidVersionMessage = `version not listed in the changelogs, `;
}
invalidVersionMessage += `use the placeholder \`${VERSION_PLACEHOLDER}\``;

const kContainsIllegalKey = Symbol("illegal key");
const kWrongKeyOrder = Symbol("Wrong key order");
function unorderedKeys(meta) {
Expand All @@ -49488,11 +49499,16 @@ function containsInvalidVersionNumber(version) {
return version.some(containsInvalidVersionNumber);
}

return (
version !== undefined &&
version !== VERSION_PLACEHOLDER &&
!validVersionNumberRegex.test(version)
);
if (version === undefined || version === VERSION_PLACEHOLDER) return false;

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

return !validVersionNumberRegex.test(version);
}
const getValidSemver = (version) =>
version === VERSION_PLACEHOLDER ? MAX_SAFE_SEMVER_VERSION : version;
Expand Down Expand Up @@ -49569,11 +49585,7 @@ function validateChanges(file, node, changes) {
}

if (containsInvalidVersionNumber(change.version)) {
file.message(
`changes[${index}]: version(s) must respect the pattern \`vx.x.x\` ` +
`or use the placeholder \`${VERSION_PLACEHOLDER}\``,
node
);
file.message(`changes[${index}]: ${invalidVersionMessage}`, node);
} else if (areVersionsUnordered(change.version)) {
file.message(`changes[${index}]: list of versions is not in order`, node);
}
Expand Down Expand Up @@ -49627,31 +49639,22 @@ function validateMeta(node, file, meta) {
}

if (containsInvalidVersionNumber(meta.added)) {
file.message(
"Invalid `added` value: version(s) must respect the pattern `vx.x.x` " +
`or use the placeholder \`${VERSION_PLACEHOLDER}\``,
node
);
file.message(`Invalid \`added\` value: ${invalidVersionMessage}`, node);
} else if (areVersionsUnordered(meta.added)) {
file.message("Versions in `added` list are not in order", node);
}

if (containsInvalidVersionNumber(meta.deprecated)) {
file.message(
"Invalid `deprecated` value: version(s) must respect the pattern `vx.x.x` " +
`or use the placeholder \`${VERSION_PLACEHOLDER}\``,
`Invalid \`deprecated\` value: ${invalidVersionMessage}`,
node
);
} else if (areVersionsUnordered(meta.deprecated)) {
file.message("Versions in `deprecated` list are not in order", node);
}

if (containsInvalidVersionNumber(meta.removed)) {
file.message(
"Invalid `removed` value: version(s) must respect the pattern `vx.x.x` " +
`or use the placeholder \`${VERSION_PLACEHOLDER}\``,
node
);
file.message(`Invalid \`removed\` value: ${invalidVersionMessage}`, node);
} else if (areVersionsUnordered(meta.removed)) {
file.message("Versions in `removed` list are not in order", node);
}
Expand Down Expand Up @@ -50490,6 +50493,7 @@ var plugins$2 = [
flags: [
"bash",
"c",
"cjs",
"coffee",
"console",
"cpp",
Expand All @@ -50498,6 +50502,7 @@ var plugins$2 = [
"js",
"json",
"markdown",
"mjs",
"powershell",
"r",
"text",
Expand Down
16 changes: 6 additions & 10 deletions tools/node-lint-md-cli-rollup/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 49342fe

Please sign in to comment.