@github/markdownlint-github
Version:
An opinionated collection of markdownlint rules used by GitHub.
32 lines (26 loc) • 658 B
JavaScript
import { lint } from "markdownlint/async";
export async function runTest(strings, rule, ruleConfig) {
const thisRuleName = rule.names[1];
const config = {
config: {
default: false,
[thisRuleName]: ruleConfig || true,
},
customRules: [rule],
};
const results = await Promise.all(
strings.map((variation) => {
const thisTestConfig = {
...config,
strings: [variation],
};
return new Promise((resolve, reject) => {
lint(thisTestConfig, (err, result) => {
if (err) reject(err);
resolve(result[0]);
});
});
}),
);
return results.flat();
}