From b4df555e7ccc9870f172376dbc342cf132ff3e8e Mon Sep 17 00:00:00 2001 From: David Anson Date: Tue, 25 Nov 2025 14:48:55 -0800 Subject: [PATCH] Add test to ensure all project version numbers match. --- README.md | 8 ++++---- test/markdownlint-test.mjs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c1366a7a..82f74547 100644 --- a/README.md +++ b/README.md @@ -979,7 +979,7 @@ All of which return an object like: { "lineNumber": 3, "ruleNames": [ "MD010", "no-hard-tabs" ], "ruleDescription": "Hard tabs", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md010.md", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/md010.md", "errorDetail": "Column: 17", "errorContext": null, "errorRange": [ 17, 1 ], @@ -988,7 +988,7 @@ All of which return an object like: { "lineNumber": 1, "ruleNames": [ "MD018", "no-missing-space-atx" ], "ruleDescription": "No space after hash on atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md018.md", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/md018.md", "errorDetail": null, "errorContext": "#bad.md", "errorRange": [ 1, 2 ], @@ -997,7 +997,7 @@ All of which return an object like: { "lineNumber": 3, "ruleNames": [ "MD018", "no-missing-space-atx" ], "ruleDescription": "No space after hash on atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md018.md", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/md018.md", "errorDetail": null, "errorContext": "#This file fails\tsome rules.", "errorRange": [ 1, 2 ], @@ -1006,7 +1006,7 @@ All of which return an object like: { "lineNumber": 1, "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ], "ruleDescription": "First line in a file should be a top-level heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md041.md", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/md041.md", "errorDetail": null, "errorContext": "#bad.md", "errorRange": null, diff --git a/test/markdownlint-test.mjs b/test/markdownlint-test.mjs index bc2825dc..d8b73509 100644 --- a/test/markdownlint-test.mjs +++ b/test/markdownlint-test.mjs @@ -1587,3 +1587,35 @@ test("constants", (t) => { // @ts-ignore t.is(constants.version, packageJson.version); }); + +test("version numbers match", async(t) => { + t.plan(441); + const files = [ + // See previous test + // "./package.json", + "./CHANGELOG.md", + "./README.md", + "./helpers/README.md", + "./lib/configuration-strict.d.ts", + // See previous test + // "./lib/constants.mjs", + "./schema/.markdownlint.jsonc", + "./schema/.markdownlint.yaml", + "./schema/markdownlint-config-schema.json", + "./schema/markdownlint-config-schema-strict.json" + ]; + const contents = await Promise.all(files.map((file) => fs.promises.readFile(file, "utf8"))); + for (const content of contents) { + // eslint-disable-next-line init-declarations + let match; + const githubProjectOrFileRe = /(?:DavidAnson\/markdownlint|markdownlint\/blob)\/v(\d+\.\d+\.\d+)/gu; + while ((match = githubProjectOrFileRe.exec(content)) !== null) { + t.is(match[1], packageJson.version); + } + const firstChangelogRe = /## (\d+\.\d+\.\d+)/u; + match = firstChangelogRe.exec(content); + if (match) { + t.is(match[1], packageJson.version); + } + } +});