mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
Add missing lineNumber property to FixInfo type (fixes #405).
This commit is contained in:
parent
cebde8f9f6
commit
02240fac98
3 changed files with 13 additions and 7 deletions
|
@ -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
|
||||
|
|
4
lib/markdownlint.d.ts
vendored
4
lib/markdownlint.d.ts
vendored
|
@ -316,6 +316,10 @@ type LintError = {
|
|||
* Fix information.
|
||||
*/
|
||||
type FixInfo = {
|
||||
/**
|
||||
* Line number (1-based).
|
||||
*/
|
||||
lineNumber?: number;
|
||||
/**
|
||||
* Column of the fix (1-based).
|
||||
*/
|
||||
|
|
|
@ -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).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue