mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Update MD051/link-fragments to not provide error context for multi-line scenarios.
This commit is contained in:
parent
ef1bd286a9
commit
1eb40d3c4c
4 changed files with 12 additions and 8 deletions
|
|
@ -6202,11 +6202,14 @@ module.exports = {
|
||||||
var _loop = function _loop() {
|
var _loop = function _loop() {
|
||||||
var definition = _step4.value;
|
var definition = _step4.value;
|
||||||
if (definition.text.length > 1 && definition.text.startsWith("#") && !fragments.has(definition.text)) {
|
if (definition.text.length > 1 && definition.text.startsWith("#") && !fragments.has(definition.text)) {
|
||||||
|
// eslint-disable-next-line no-undef-init
|
||||||
|
var context = undefined;
|
||||||
// eslint-disable-next-line no-undef-init
|
// eslint-disable-next-line no-undef-init
|
||||||
var range = undefined;
|
var range = undefined;
|
||||||
// eslint-disable-next-line no-undef-init
|
// eslint-disable-next-line no-undef-init
|
||||||
var fixInfo = undefined;
|
var fixInfo = undefined;
|
||||||
if (link.startLine === link.endLine) {
|
if (link.startLine === link.endLine) {
|
||||||
|
context = link.text;
|
||||||
range = [link.startColumn, link.endColumn - link.startColumn];
|
range = [link.startColumn, link.endColumn - link.startColumn];
|
||||||
fixInfo = {
|
fixInfo = {
|
||||||
"editColumn": definition.startColumn,
|
"editColumn": definition.startColumn,
|
||||||
|
|
@ -6220,9 +6223,9 @@ module.exports = {
|
||||||
if (mixedCaseKey) {
|
if (mixedCaseKey) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
(fixInfo || {}).insertText = mixedCaseKey;
|
(fixInfo || {}).insertText = mixedCaseKey;
|
||||||
addErrorDetailIf(onError, link.startLine, mixedCaseKey, definition.text, undefined, link.text, range, fixInfo);
|
addErrorDetailIf(onError, link.startLine, mixedCaseKey, definition.text, undefined, context, range, fixInfo);
|
||||||
} else {
|
} else {
|
||||||
addError(onError, link.startLine, undefined, link.text, range);
|
addError(onError, link.startLine, undefined, context, range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -94,11 +94,14 @@ module.exports = {
|
||||||
definition.text.startsWith("#") &&
|
definition.text.startsWith("#") &&
|
||||||
!fragments.has(definition.text)
|
!fragments.has(definition.text)
|
||||||
) {
|
) {
|
||||||
|
// eslint-disable-next-line no-undef-init
|
||||||
|
let context = undefined;
|
||||||
// eslint-disable-next-line no-undef-init
|
// eslint-disable-next-line no-undef-init
|
||||||
let range = undefined;
|
let range = undefined;
|
||||||
// eslint-disable-next-line no-undef-init
|
// eslint-disable-next-line no-undef-init
|
||||||
let fixInfo = undefined;
|
let fixInfo = undefined;
|
||||||
if (link.startLine === link.endLine) {
|
if (link.startLine === link.endLine) {
|
||||||
|
context = link.text;
|
||||||
range = [ link.startColumn, link.endColumn - link.startColumn ];
|
range = [ link.startColumn, link.endColumn - link.startColumn ];
|
||||||
fixInfo = {
|
fixInfo = {
|
||||||
"editColumn": definition.startColumn,
|
"editColumn": definition.startColumn,
|
||||||
|
|
@ -117,7 +120,7 @@ module.exports = {
|
||||||
mixedCaseKey,
|
mixedCaseKey,
|
||||||
definition.text,
|
definition.text,
|
||||||
undefined,
|
undefined,
|
||||||
link.text,
|
context,
|
||||||
range,
|
range,
|
||||||
fixInfo
|
fixInfo
|
||||||
);
|
);
|
||||||
|
|
@ -126,7 +129,7 @@ module.exports = {
|
||||||
onError,
|
onError,
|
||||||
link.startLine,
|
link.startLine,
|
||||||
undefined,
|
undefined,
|
||||||
link.text,
|
context,
|
||||||
range
|
range
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23597,8 +23597,7 @@ Generated by [AVA](https://avajs.dev).
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
errorContext: `[Invalid {MD051}](#multi-line␊
|
errorContext: null,
|
||||||
"Title")`,
|
|
||||||
errorDetail: null,
|
errorDetail: null,
|
||||||
errorRange: null,
|
errorRange: null,
|
||||||
fixInfo: null,
|
fixInfo: null,
|
||||||
|
|
@ -23667,8 +23666,7 @@ Generated by [AVA](https://avajs.dev).
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
errorContext: `[Multi-line {MD051}](#NAMEDLINK␊
|
errorContext: null,
|
||||||
"Title")`,
|
|
||||||
errorDetail: 'Expected: #namedlink; Actual: #NAMEDLINK',
|
errorDetail: 'Expected: #namedlink; Actual: #NAMEDLINK',
|
||||||
errorRange: null,
|
errorRange: null,
|
||||||
fixInfo: null,
|
fixInfo: null,
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue