mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 06:50:12 +01:00
wip
This commit is contained in:
parent
284bf0335f
commit
cfe46ea322
2 changed files with 11 additions and 7 deletions
|
|
@ -108,9 +108,15 @@ function validateRuleList(ruleList, synchronous) {
|
||||||
* @returns {LintResults} New LintResults instance.
|
* @returns {LintResults} New LintResults instance.
|
||||||
*/
|
*/
|
||||||
function newResults(ruleList) {
|
function newResults(ruleList) {
|
||||||
const lintResults = {};
|
/**
|
||||||
// eslint-disable-next-line jsdoc/require-jsdoc
|
* Returns the string representation of a LintResults instance.
|
||||||
|
*
|
||||||
|
* @param {boolean} useAlias True if rule alias should be used instead of name.
|
||||||
|
* @returns {string} String representation of the instance.
|
||||||
|
*/
|
||||||
function toString(useAlias) {
|
function toString(useAlias) {
|
||||||
|
// eslint-disable-next-line consistent-this, no-invalid-this, unicorn/no-this-assignment
|
||||||
|
const lintResults = this;
|
||||||
let ruleNameToRule = null;
|
let ruleNameToRule = null;
|
||||||
const results = [];
|
const results = [];
|
||||||
const keys = Object.keys(lintResults);
|
const keys = Object.keys(lintResults);
|
||||||
|
|
@ -161,6 +167,7 @@ function newResults(ruleList) {
|
||||||
}
|
}
|
||||||
return results.join("\n");
|
return results.join("\n");
|
||||||
}
|
}
|
||||||
|
const lintResults = {};
|
||||||
Object.defineProperty(lintResults, "toString", { "value": toString });
|
Object.defineProperty(lintResults, "toString", { "value": toString });
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return lintResults;
|
return lintResults;
|
||||||
|
|
@ -515,7 +522,7 @@ function lintContent(
|
||||||
"config": null
|
"config": null
|
||||||
});
|
});
|
||||||
// Function to run for each rule
|
// Function to run for each rule
|
||||||
let results = [];
|
const results = [];
|
||||||
/**
|
/**
|
||||||
* @param {Rule} rule Rule.
|
* @param {Rule} rule Rule.
|
||||||
* @returns {Promise<void> | null} Promise.
|
* @returns {Promise<void> | null} Promise.
|
||||||
|
|
|
||||||
|
|
@ -626,7 +626,7 @@ test("frontMatterResultVersion3", (t) => new Promise((resolve) => {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("convertToResultVersionN", async (t) => {
|
test("convertToResultVersionN", async(t) => {
|
||||||
t.plan(6);
|
t.plan(6);
|
||||||
const options = {
|
const options = {
|
||||||
"files": [
|
"files": [
|
||||||
|
|
@ -644,15 +644,12 @@ test("convertToResultVersionN", async (t) => {
|
||||||
lintPromise({ ...options, "resultVersion": 1 }),
|
lintPromise({ ...options, "resultVersion": 1 }),
|
||||||
lintPromise({ ...options, "resultVersion": 0 })
|
lintPromise({ ...options, "resultVersion": 0 })
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const v2 = convertToResultVersion2(version3);
|
const v2 = convertToResultVersion2(version3);
|
||||||
t.deepEqual(v2, version2);
|
t.deepEqual(v2, version2);
|
||||||
t.is(v2.toString(), version2.toString());
|
t.is(v2.toString(), version2.toString());
|
||||||
|
|
||||||
const v1 = convertToResultVersion1(version3);
|
const v1 = convertToResultVersion1(version3);
|
||||||
t.deepEqual(v1, version1);
|
t.deepEqual(v1, version1);
|
||||||
t.is(v1.toString(), version1.toString());
|
t.is(v1.toString(), version1.toString());
|
||||||
|
|
||||||
const v0 = convertToResultVersion0(version3);
|
const v0 = convertToResultVersion0(version3);
|
||||||
t.deepEqual(v0, version0);
|
t.deepEqual(v0, version0);
|
||||||
t.is(v0.toString(), version0.toString());
|
t.is(v0.toString(), version0.toString());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue