mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Add tests for MD013/line-length edge case behavior.
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled
This commit is contained in:
parent
b4df555e7c
commit
eb83b49845
5 changed files with 187 additions and 1 deletions
12
test/long-lines-negative-line-length.md
Normal file
12
test/long-lines-negative-line-length.md
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# Long Lines Negative Line Length
|
||||||
|
|
||||||
|
Text text text text text text text text text text text text text text text text text text text text.
|
||||||
|
|
||||||
|
This is an invalid configuration, but present in the wild and (for backward compatibility) disables the rule:
|
||||||
|
<https://github.com/electron/lint-roller/blob/1e062bda146160afb8eb232966287d5edb20e0a4/configs/markdownlint.json#L9>
|
||||||
|
|
||||||
|
<!-- markdownlint-configure-file {
|
||||||
|
"line-length": {
|
||||||
|
"line_length": -1
|
||||||
|
}
|
||||||
|
} -->
|
||||||
37
test/long-lines-thresholds.md
Normal file
37
test/long-lines-thresholds.md
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Long Lines Thresholds
|
||||||
|
|
||||||
|
00000000011111111112222222222333333333344444444445
|
||||||
|
12345678901234567890123456789012345678901234567890
|
||||||
|
|
||||||
|
Texxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx t
|
||||||
|
|
||||||
|
Texxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx t
|
||||||
|
|
||||||
|
{MD013:-2}
|
||||||
|
|
||||||
|
## Texxxxxxxxxxxxxxxxxxxxxxxx t
|
||||||
|
|
||||||
|
## Texxxxxxxxxxxxxxxxxxxxxxxxx t
|
||||||
|
|
||||||
|
{MD013:-2}
|
||||||
|
|
||||||
|
```text
|
||||||
|
Texxxxxxxxxxxxxxxxx t
|
||||||
|
Texxxxxxxxxxxxxxxxxx t
|
||||||
|
```
|
||||||
|
|
||||||
|
{MD013:-3}
|
||||||
|
|
||||||
|
Texxxxxxxxxxxxx t
|
||||||
|
Texxxxxxxxxxxxxx t
|
||||||
|
|
||||||
|
{MD013:-2}
|
||||||
|
|
||||||
|
<!-- markdownlint-configure-file {
|
||||||
|
"code-block-style": false,
|
||||||
|
"line-length": {
|
||||||
|
"line_length": 40,
|
||||||
|
"heading_line_length": 30,
|
||||||
|
"code_block_line_length": 20
|
||||||
|
}
|
||||||
|
} -->
|
||||||
|
|
@ -1101,7 +1101,7 @@ test("readme", async(t) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("validateJsonUsingConfigSchemaStrict", async(t) => {
|
test("validateJsonUsingConfigSchemaStrict", async(t) => {
|
||||||
t.plan(220);
|
t.plan(221);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const ajv = new Ajv(ajvOptions);
|
const ajv = new Ajv(ajvOptions);
|
||||||
const validateSchemaStrict = ajv.compile(configSchemaStrict);
|
const validateSchemaStrict = ajv.compile(configSchemaStrict);
|
||||||
|
|
@ -1112,6 +1112,7 @@ test("validateJsonUsingConfigSchemaStrict", async(t) => {
|
||||||
"test/inline-configure-file-invalid.md",
|
"test/inline-configure-file-invalid.md",
|
||||||
"test/inline-configure-file-violations.md",
|
"test/inline-configure-file-violations.md",
|
||||||
"test/invalid-ul-style-style.md",
|
"test/invalid-ul-style-style.md",
|
||||||
|
"test/long-lines-negative-line-length.md",
|
||||||
"test/wrong-types-in-config-file.md"
|
"test/wrong-types-in-config-file.md"
|
||||||
]);
|
]);
|
||||||
const files = await globby([
|
const files = await globby([
|
||||||
|
|
|
||||||
|
|
@ -42078,6 +42078,27 @@ Generated by [AVA](https://avajs.dev).
|
||||||
<!-- markdownlint-disable-file descriptive-link-text -->`,
|
<!-- markdownlint-disable-file descriptive-link-text -->`,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## long-lines-negative-line-length.md
|
||||||
|
|
||||||
|
> Snapshot 1
|
||||||
|
|
||||||
|
{
|
||||||
|
errors: [],
|
||||||
|
fixed: `# Long Lines Negative Line Length␊
|
||||||
|
␊
|
||||||
|
Text text text text text text text text text text text text text text text text text text text text.␊
|
||||||
|
␊
|
||||||
|
This is an invalid configuration, but present in the wild and (for backward compatibility) disables the rule:␊
|
||||||
|
<https://github.com/electron/lint-roller/blob/1e062bda146160afb8eb232966287d5edb20e0a4/configs/markdownlint.json#L9>␊
|
||||||
|
␊
|
||||||
|
<!-- markdownlint-configure-file {␊
|
||||||
|
"line-length": {␊
|
||||||
|
"line_length": -1␊
|
||||||
|
}␊
|
||||||
|
} -->␊
|
||||||
|
`,
|
||||||
|
}
|
||||||
|
|
||||||
## long-lines-short-code.md
|
## long-lines-short-code.md
|
||||||
|
|
||||||
> Snapshot 1
|
> Snapshot 1
|
||||||
|
|
@ -42637,6 +42658,121 @@ Generated by [AVA](https://avajs.dev).
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## long-lines-thresholds.md
|
||||||
|
|
||||||
|
> Snapshot 1
|
||||||
|
|
||||||
|
{
|
||||||
|
errors: [
|
||||||
|
{
|
||||||
|
errorContext: null,
|
||||||
|
errorDetail: 'Expected: 40; Actual: 42',
|
||||||
|
errorRange: [
|
||||||
|
41,
|
||||||
|
2,
|
||||||
|
],
|
||||||
|
fixInfo: null,
|
||||||
|
lineNumber: 8,
|
||||||
|
ruleDescription: 'Line length',
|
||||||
|
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md013.md',
|
||||||
|
ruleNames: [
|
||||||
|
'MD013',
|
||||||
|
'line-length',
|
||||||
|
],
|
||||||
|
severity: 'error',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorContext: null,
|
||||||
|
errorDetail: 'Expected: 30; Actual: 32',
|
||||||
|
errorRange: [
|
||||||
|
31,
|
||||||
|
2,
|
||||||
|
],
|
||||||
|
fixInfo: null,
|
||||||
|
lineNumber: 14,
|
||||||
|
ruleDescription: 'Line length',
|
||||||
|
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md013.md',
|
||||||
|
ruleNames: [
|
||||||
|
'MD013',
|
||||||
|
'line-length',
|
||||||
|
],
|
||||||
|
severity: 'error',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorContext: null,
|
||||||
|
errorDetail: 'Expected: 20; Actual: 22',
|
||||||
|
errorRange: [
|
||||||
|
21,
|
||||||
|
2,
|
||||||
|
],
|
||||||
|
fixInfo: null,
|
||||||
|
lineNumber: 20,
|
||||||
|
ruleDescription: 'Line length',
|
||||||
|
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md013.md',
|
||||||
|
ruleNames: [
|
||||||
|
'MD013',
|
||||||
|
'line-length',
|
||||||
|
],
|
||||||
|
severity: 'error',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorContext: null,
|
||||||
|
errorDetail: 'Expected: 20; Actual: 22',
|
||||||
|
errorRange: [
|
||||||
|
21,
|
||||||
|
2,
|
||||||
|
],
|
||||||
|
fixInfo: null,
|
||||||
|
lineNumber: 26,
|
||||||
|
ruleDescription: 'Line length',
|
||||||
|
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md013.md',
|
||||||
|
ruleNames: [
|
||||||
|
'MD013',
|
||||||
|
'line-length',
|
||||||
|
],
|
||||||
|
severity: 'error',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
fixed: `# Long Lines Thresholds␊
|
||||||
|
␊
|
||||||
|
00000000011111111112222222222333333333344444444445␊
|
||||||
|
12345678901234567890123456789012345678901234567890␊
|
||||||
|
␊
|
||||||
|
Texxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx t␊
|
||||||
|
␊
|
||||||
|
Texxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx t␊
|
||||||
|
␊
|
||||||
|
{MD013:-2}␊
|
||||||
|
␊
|
||||||
|
## Texxxxxxxxxxxxxxxxxxxxxxxx t␊
|
||||||
|
␊
|
||||||
|
## Texxxxxxxxxxxxxxxxxxxxxxxxx t␊
|
||||||
|
␊
|
||||||
|
{MD013:-2}␊
|
||||||
|
␊
|
||||||
|
\`\`\`text␊
|
||||||
|
Texxxxxxxxxxxxxxxxx t␊
|
||||||
|
Texxxxxxxxxxxxxxxxxx t␊
|
||||||
|
\`\`\`␊
|
||||||
|
␊
|
||||||
|
{MD013:-3}␊
|
||||||
|
␊
|
||||||
|
Texxxxxxxxxxxxx t␊
|
||||||
|
Texxxxxxxxxxxxxx t␊
|
||||||
|
␊
|
||||||
|
{MD013:-2}␊
|
||||||
|
␊
|
||||||
|
<!-- markdownlint-configure-file {␊
|
||||||
|
"code-block-style": false,␊
|
||||||
|
"line-length": {␊
|
||||||
|
"line_length": 40,␊
|
||||||
|
"heading_line_length": 30,␊
|
||||||
|
"code_block_line_length": 20␊
|
||||||
|
}␊
|
||||||
|
} -->␊
|
||||||
|
`,
|
||||||
|
}
|
||||||
|
|
||||||
## long_lines.md
|
## long_lines.md
|
||||||
|
|
||||||
> Snapshot 1
|
> Snapshot 1
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue