mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Update MD044/proper-names to avoid providing bogus range when proper name could not be found.
This commit is contained in:
parent
f635d7b72c
commit
87aac66d68
2 changed files with 21 additions and 6 deletions
15
lib/md044.js
15
lib/md044.js
|
@ -40,7 +40,14 @@ module.exports = {
|
|||
// Attempt to fix bad offset due to inline content
|
||||
matchIndex = fullLine.indexOf(wordMatch);
|
||||
}
|
||||
const range = [ matchIndex + 1, matchLength ];
|
||||
const range = (matchIndex === -1) ?
|
||||
null :
|
||||
[ matchIndex + 1, matchLength ];
|
||||
const fixInfo = (matchIndex === -1) ? null : {
|
||||
"editColumn": matchIndex + 1,
|
||||
"deleteCount": matchLength,
|
||||
"insertText": name
|
||||
};
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
lineNumber,
|
||||
|
@ -49,11 +56,7 @@ module.exports = {
|
|||
null,
|
||||
null,
|
||||
range,
|
||||
{
|
||||
"editColumn": matchIndex + 1,
|
||||
"deleteCount": matchLength,
|
||||
"insertText": name
|
||||
}
|
||||
fixInfo
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue