mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 06:50:12 +01:00
Add test for outdated ignore expressions to markdownlint-test-repos.
This commit is contained in:
parent
6dea67825a
commit
3e8d3320f7
1 changed files with 5 additions and 4 deletions
|
|
@ -60,7 +60,11 @@ function lintTestRepo(t, globPatterns, configPath, ignoreRes) {
|
||||||
return markdownlintPromise(options).then((results) => {
|
return markdownlintPromise(options).then((results) => {
|
||||||
let resultsString = results.toString();
|
let resultsString = results.toString();
|
||||||
for (const ignoreRe of (ignoreRes || [])) {
|
for (const ignoreRe of (ignoreRes || [])) {
|
||||||
|
const lengthBefore = resultsString.length;
|
||||||
resultsString = resultsString.replace(ignoreRe, "");
|
resultsString = resultsString.replace(ignoreRe, "");
|
||||||
|
if (resultsString.length === lengthBefore) {
|
||||||
|
t.fail(`Unnecessary ignore: ${ignoreRe}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (resultsString.length > 0) {
|
if (resultsString.length > 0) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
|
@ -158,10 +162,7 @@ if (existsSync(dotnetDocsDir)) {
|
||||||
const rootDir = dotnetDocsDir;
|
const rootDir = dotnetDocsDir;
|
||||||
const globPatterns = [ join(rootDir, "**/*.md") ];
|
const globPatterns = [ join(rootDir, "**/*.md") ];
|
||||||
const configPath = join(rootDir, ".markdownlint.json");
|
const configPath = join(rootDir, ".markdownlint.json");
|
||||||
const ignoreRes = [
|
const ignoreRes = [ /^[^:]+: \d+: (MD049|MD050)\/.*$\r?\n?/gm ];
|
||||||
/^[^:]+: \d+: (MD049|MD050)\/.*$\r?\n?/gm,
|
|
||||||
/^[^:]+\/dotnet-dump\.md: \d+: MD033\/.*$\r?\n?/gm
|
|
||||||
];
|
|
||||||
return lintTestRepo(t, globPatterns, configPath, ignoreRes);
|
return lintTestRepo(t, globPatterns, configPath, ignoreRes);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue