Skip to content

Commit

Permalink
Add test for outdated ignore expressions to markdownlint-test-repos.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Dec 21, 2021
1 parent 6dea678 commit 3e8d332
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/markdownlint-test-repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ function lintTestRepo(t, globPatterns, configPath, ignoreRes) {
return markdownlintPromise(options).then((results) => {
let resultsString = results.toString();
for (const ignoreRe of (ignoreRes || [])) {
const lengthBefore = resultsString.length;
resultsString = resultsString.replace(ignoreRe, "");
if (resultsString.length === lengthBefore) {
t.fail(`Unnecessary ignore: ${ignoreRe}`);
}
}
if (resultsString.length > 0) {
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -158,10 +162,7 @@ if (existsSync(dotnetDocsDir)) {
const rootDir = dotnetDocsDir;
const globPatterns = [ join(rootDir, "**/*.md") ];
const configPath = join(rootDir, ".markdownlint.json");
const ignoreRes = [
/^[^:]+: \d+: (MD049|MD050)\/.*$\r?\n?/gm,
/^[^:]+\/dotnet-dump\.md: \d+: MD033\/.*$\r?\n?/gm
];
const ignoreRes = [ /^[^:]+: \d+: (MD049|MD050)\/.*$\r?\n?/gm ];
return lintTestRepo(t, globPatterns, configPath, ignoreRes);
});
}
Expand Down

0 comments on commit 3e8d332

Please sign in to comment.