mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Add more test cases for trailing spaces.
This commit is contained in:
parent
ac38a614e9
commit
28b273e798
5 changed files with 106 additions and 4 deletions
|
|
@ -2678,7 +2678,7 @@ module.exports = {
|
||||||
const tokenLines = params.lines.slice(token.map[0], token.map[1]);
|
const tokenLines = params.lines.slice(token.map[0], token.map[1]);
|
||||||
forEachInlineCodeSpan(tokenLines.join("\n"), (code, lineIndex) => {
|
forEachInlineCodeSpan(tokenLines.join("\n"), (code, lineIndex) => {
|
||||||
const codeLineCount = code.split(newLineRe).length;
|
const codeLineCount = code.split(newLineRe).length;
|
||||||
for (let i = 0; i < codeLineCount; i++) {
|
for (let i = 0; i < codeLineCount - 1; i++) {
|
||||||
codeInlineLineNumbers.push(token.lineNumber + lineIndex + i);
|
codeInlineLineNumbers.push(token.lineNumber + lineIndex + i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -2699,7 +2699,7 @@ module.exports = {
|
||||||
includesSorted(codeInlineLineNumbers, lineNumber))))) {
|
includesSorted(codeInlineLineNumbers, lineNumber))))) {
|
||||||
const column = line.length - trailingSpaces + 1;
|
const column = line.length - trailingSpaces + 1;
|
||||||
addError(onError, lineNumber, "Expected: " + (expected === 0 ? "" : "0 or ") +
|
addError(onError, lineNumber, "Expected: " + (expected === 0 ? "" : "0 or ") +
|
||||||
expected + "; Actual: " + trailingSpaces, null, [column, trailingSpaces], {
|
expected + "; Actual: " + trailingSpaces, undefined, [column, trailingSpaces], {
|
||||||
"editColumn": column,
|
"editColumn": column,
|
||||||
"deleteCount": trailingSpaces
|
"deleteCount": trailingSpaces
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ module.exports = {
|
||||||
const tokenLines = params.lines.slice(token.map[0], token.map[1]);
|
const tokenLines = params.lines.slice(token.map[0], token.map[1]);
|
||||||
forEachInlineCodeSpan(tokenLines.join("\n"), (code, lineIndex) => {
|
forEachInlineCodeSpan(tokenLines.join("\n"), (code, lineIndex) => {
|
||||||
const codeLineCount = code.split(newLineRe).length;
|
const codeLineCount = code.split(newLineRe).length;
|
||||||
for (let i = 0; i < codeLineCount; i++) {
|
for (let i = 0; i < codeLineCount - 1; i++) {
|
||||||
codeInlineLineNumbers.push(token.lineNumber + lineIndex + i);
|
codeInlineLineNumbers.push(token.lineNumber + lineIndex + i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -67,7 +67,7 @@ module.exports = {
|
||||||
lineNumber,
|
lineNumber,
|
||||||
"Expected: " + (expected === 0 ? "" : "0 or ") +
|
"Expected: " + (expected === 0 ? "" : "0 or ") +
|
||||||
expected + "; Actual: " + trailingSpaces,
|
expected + "; Actual: " + trailingSpaces,
|
||||||
null,
|
undefined,
|
||||||
[ column, trailingSpaces ],
|
[ column, trailingSpaces ],
|
||||||
{
|
{
|
||||||
"editColumn": column,
|
"editColumn": column,
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,15 @@ Text text
|
||||||
text text
|
text text
|
||||||
text
|
text
|
||||||
|
|
||||||
|
Text text
|
||||||
|
text `code
|
||||||
|
span` text
|
||||||
|
|
||||||
|
Text text
|
||||||
|
text `code
|
||||||
|
span code
|
||||||
|
span` text
|
||||||
|
|
||||||
{MD009:9}
|
{MD009:9}
|
||||||
{MD009:24}
|
{MD009:24}
|
||||||
{MD009:32}
|
{MD009:32}
|
||||||
|
|
@ -62,3 +71,7 @@ text
|
||||||
{MD009:43}
|
{MD009:43}
|
||||||
{MD009:48}
|
{MD009:48}
|
||||||
{MD009:54}
|
{MD009:54}
|
||||||
|
{MD009:58}
|
||||||
|
{MD009:61}
|
||||||
|
{MD009:62}
|
||||||
|
{MD009:63}
|
||||||
|
|
|
||||||
|
|
@ -11940,6 +11940,82 @@ Generated by [AVA](https://avajs.dev).
|
||||||
'no-trailing-spaces',
|
'no-trailing-spaces',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
errorContext: null,
|
||||||
|
errorDetail: 'Expected: 0 or 2; Actual: 2',
|
||||||
|
errorRange: [
|
||||||
|
11,
|
||||||
|
2,
|
||||||
|
],
|
||||||
|
fixInfo: {
|
||||||
|
deleteCount: 2,
|
||||||
|
editColumn: 11,
|
||||||
|
},
|
||||||
|
lineNumber: 58,
|
||||||
|
ruleDescription: 'Trailing spaces',
|
||||||
|
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009',
|
||||||
|
ruleNames: [
|
||||||
|
'MD009',
|
||||||
|
'no-trailing-spaces',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorContext: null,
|
||||||
|
errorDetail: 'Expected: 0 or 2; Actual: 2',
|
||||||
|
errorRange: [
|
||||||
|
11,
|
||||||
|
2,
|
||||||
|
],
|
||||||
|
fixInfo: {
|
||||||
|
deleteCount: 2,
|
||||||
|
editColumn: 11,
|
||||||
|
},
|
||||||
|
lineNumber: 61,
|
||||||
|
ruleDescription: 'Trailing spaces',
|
||||||
|
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009',
|
||||||
|
ruleNames: [
|
||||||
|
'MD009',
|
||||||
|
'no-trailing-spaces',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorContext: null,
|
||||||
|
errorDetail: 'Expected: 0 or 2; Actual: 2',
|
||||||
|
errorRange: [
|
||||||
|
10,
|
||||||
|
2,
|
||||||
|
],
|
||||||
|
fixInfo: {
|
||||||
|
deleteCount: 2,
|
||||||
|
editColumn: 10,
|
||||||
|
},
|
||||||
|
lineNumber: 62,
|
||||||
|
ruleDescription: 'Trailing spaces',
|
||||||
|
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009',
|
||||||
|
ruleNames: [
|
||||||
|
'MD009',
|
||||||
|
'no-trailing-spaces',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorContext: null,
|
||||||
|
errorDetail: 'Expected: 0 or 2; Actual: 2',
|
||||||
|
errorRange: [
|
||||||
|
11,
|
||||||
|
2,
|
||||||
|
],
|
||||||
|
fixInfo: {
|
||||||
|
deleteCount: 2,
|
||||||
|
editColumn: 11,
|
||||||
|
},
|
||||||
|
lineNumber: 63,
|
||||||
|
ruleDescription: 'Trailing spaces',
|
||||||
|
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009',
|
||||||
|
ruleNames: [
|
||||||
|
'MD009',
|
||||||
|
'no-trailing-spaces',
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
fixed: `# Hard Line Breaks␊
|
fixed: `# Hard Line Breaks␊
|
||||||
␊
|
␊
|
||||||
|
|
@ -11996,6 +12072,15 @@ Generated by [AVA](https://avajs.dev).
|
||||||
text text␊
|
text text␊
|
||||||
text␊
|
text␊
|
||||||
␊
|
␊
|
||||||
|
Text text␊
|
||||||
|
text \`code␊
|
||||||
|
span\` text␊
|
||||||
|
␊
|
||||||
|
Text text␊
|
||||||
|
text \`code␊
|
||||||
|
span code␊
|
||||||
|
span\` text␊
|
||||||
|
␊
|
||||||
{MD009:9}␊
|
{MD009:9}␊
|
||||||
{MD009:24}␊
|
{MD009:24}␊
|
||||||
{MD009:32}␊
|
{MD009:32}␊
|
||||||
|
|
@ -12005,6 +12090,10 @@ Generated by [AVA](https://avajs.dev).
|
||||||
{MD009:43}␊
|
{MD009:43}␊
|
||||||
{MD009:48}␊
|
{MD009:48}␊
|
||||||
{MD009:54}␊
|
{MD009:54}␊
|
||||||
|
{MD009:58}␊
|
||||||
|
{MD009:61}␊
|
||||||
|
{MD009:62}␊
|
||||||
|
{MD009:63}␊
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue