mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02: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.
|
||||
*/
|
||||
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) {
|
||||
// eslint-disable-next-line consistent-this, no-invalid-this, unicorn/no-this-assignment
|
||||
const lintResults = this;
|
||||
let ruleNameToRule = null;
|
||||
const results = [];
|
||||
const keys = Object.keys(lintResults);
|
||||
|
@ -161,6 +167,7 @@ function newResults(ruleList) {
|
|||
}
|
||||
return results.join("\n");
|
||||
}
|
||||
const lintResults = {};
|
||||
Object.defineProperty(lintResults, "toString", { "value": toString });
|
||||
// @ts-ignore
|
||||
return lintResults;
|
||||
|
@ -515,7 +522,7 @@ function lintContent(
|
|||
"config": null
|
||||
});
|
||||
// Function to run for each rule
|
||||
let results = [];
|
||||
const results = [];
|
||||
/**
|
||||
* @param {Rule} rule Rule.
|
||||
* @returns {Promise<void> | null} Promise.
|
||||
|
|
|
@ -644,15 +644,12 @@ test("convertToResultVersionN", async (t) => {
|
|||
lintPromise({ ...options, "resultVersion": 1 }),
|
||||
lintPromise({ ...options, "resultVersion": 0 })
|
||||
]);
|
||||
|
||||
const v2 = convertToResultVersion2(version3);
|
||||
t.deepEqual(v2, version2);
|
||||
t.is(v2.toString(), version2.toString());
|
||||
|
||||
const v1 = convertToResultVersion1(version3);
|
||||
t.deepEqual(v1, version1);
|
||||
t.is(v1.toString(), version1.toString());
|
||||
|
||||
const v0 = convertToResultVersion0(version3);
|
||||
t.deepEqual(v0, version0);
|
||||
t.is(v0.toString(), version0.toString());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue