Add missing lineNumber property to FixInfo type (fixes #405).

This commit is contained in:
David Anson 2021-06-14 22:30:35 -07:00
parent cebde8f9f6
commit 02240fac98
3 changed files with 13 additions and 7 deletions

View file

@ -34,13 +34,14 @@ function assertLintResults(results: markdownlint.LintResults) {
assert.equal(results["string"][0].errorDetail, null);
assert.equal(results["string"][0].errorContext, null);
assert.deepEqual(results["string"][0].errorRange, [ 9, 1 ]);
assert(!!results["string"][0].fixInfo);
// @ts-ignore
assert.equal(results["string"][0].fixInfo.editColumn, 10);
// @ts-ignore
assert(!results["string"][0].fixInfo.deleteCount);
// @ts-ignore
assert.equal(results["string"][0].fixInfo.insertText, "\n");
const fixInfo = results["string"][0].fixInfo;
assert(!!fixInfo);
if (fixInfo) {
assert.equal(fixInfo.lineNumber, null);
assert.equal(fixInfo.editColumn, 10);
assert(!fixInfo.deleteCount);
assert.equal(fixInfo.insertText, "\n");
}
assert.equal(results["../bad.md"].length, 2);
// Deliberate assignment to unused variable validates types
// False-positive for js/useless-assignment-to-local

View file

@ -316,6 +316,10 @@ type LintError = {
* Fix information.
*/
type FixInfo = {
/**
* Line number (1-based).
*/
lineNumber?: number;
/**
* Column of the fix (1-based).
*/

View file

@ -1196,6 +1196,7 @@ module.exports = markdownlint;
* Fix information.
*
* @typedef {Object} FixInfo
* @property {number} [lineNumber] Line number (1-based).
* @property {number} [editColumn] Column of the fix (1-based).
* @property {number} [deleteCount] Count of characters to delete.
* @property {string} [insertText] Text to insert (after deleting).