Delete markdownlint-test-default-config.json, allow MD041 to default to true, add missing headings.

This commit is contained in:
David Anson 2020-11-15 17:03:20 -08:00
parent bb157b2ce7
commit 3827842930
81 changed files with 161 additions and 123 deletions

View file

@ -1,4 +1,5 @@
{ {
"default": true, "default": true,
"MD002": false "MD002": false,
"MD041": false
} }

View file

@ -1,4 +1,5 @@
{ {
"default": true, "default": true,
"MD002": false "MD002": false,
"MD041": false
} }

View file

@ -1,3 +1,5 @@
# blockquote_blank_lines
Some text Some text
> a quote > a quote
@ -26,6 +28,6 @@ Some text
Expected errors: Expected errors:
{MD028:5} {MD028:7} {MD028:8} {MD028:10} {MD028:17} {MD028:7} {MD028:9} {MD028:10} {MD028:12} {MD028:19}
{MD009:10} (trailing space is intentional) {MD009:12} (trailing space is intentional)
{MD012:8} (multiple blank lines are intentional) {MD012:10} (multiple blank lines are intentional)

View file

@ -1,3 +1,5 @@
# blockquote_spaces
Some text Some text
> Hello world > Hello world

View file

@ -2,7 +2,6 @@
"default": true, "default": true,
"MD002": true, "MD002": true,
"MD006": true, "MD006": true,
"MD041": true,
"MD043": { "MD043": {
"headings": [ "headings": [
"## Heading 1 {MD002} {MD041}", "## Heading 1 {MD002} {MD041}",

View file

@ -1,3 +1,5 @@
# bulleted_list_2_space_indent
This is a document where the lists are indented by 2 spaces, but the style is This is a document where the lists are indented by 2 spaces, but the style is
set to 4 space indents for lists: set to 4 space indents for lists:

View file

@ -1,3 +1,5 @@
# bulleted_list_4_space_indent
* Test X * Test X
* Test Y {MD007} * Test Y {MD007}
* Test Z {MD007} * Test Z {MD007}

View file

@ -1,3 +1,5 @@
# code_block_consistency
This is text. This is text.
This is a This is a
@ -6,6 +8,6 @@ This is text.
And here is more text And here is more text
```text ```text
and here is a different {MD046:8} and here is a different {MD046:10}
code block code block
``` ```

View file

@ -1,3 +1,5 @@
# code_block_fenced
This is text. This is text.
This is a {MD046} This is a {MD046}
@ -12,7 +14,7 @@ This is a code block that won't trigger.
```text ```text
This is code This is code
with a line with trailing spaces. {MD009:14} with a line with trailing spaces. {MD009:16}
``` ```
But we'll do another: But we'll do another:

View file

@ -1,3 +1,5 @@
# code_block_indented
This is text. This is text.
This is a This is a
@ -6,7 +8,7 @@ This is text.
And here is more text And here is more text
```text ```text
This is {MD046:8} also a code block. This is {MD046:10} also a code block.
``` ```
But we'll do another: But we'll do another:

View file

@ -1,9 +1,11 @@
# code_fence_style_backtick
```text ```text
This is a code block This is a code block
``` ```
~~~text ~~~text
This is {MD048:5} a code block This is {MD048:7} a code block
~~~ ~~~
```text ```text
@ -14,6 +16,6 @@ This is fine
~~~text ~~~text
``` ```
This is not {MD048:15} This is not {MD048:17}
``` ```
~~~ ~~~

View file

@ -1,5 +1,7 @@
# code_fence_style_tilde
```text ```text
This is {MD048:1} a code block This is {MD048:3} a code block
``` ```
~~~text ~~~text
@ -8,7 +10,7 @@ This is a code block
```text ```text
~~~ ~~~
This is not fine {MD048:9} This is not fine {MD048:11}
~~~ ~~~
``` ```

View file

@ -1,7 +1,9 @@
# consecutive_blank_lines
Some text Some text
Some text {MD012:3} Some text {MD012:5}
This is a code block This is a code block

View file

@ -1,3 +1,5 @@
# consistent_bullet_styles_asterisk
* Item * Item
* Item * Item
* Item * Item

View file

@ -1,3 +1,5 @@
# consistent_bullet_styles_dash
- Item - Item
- Item - Item
- Item - Item

View file

@ -1,3 +1,5 @@
# consistent_bullet_styles_plus
+ Item + Item
+ Item + Item
+ Item + Item

View file

@ -1,5 +1,6 @@
{ {
"default": true, "default": true,
"MD002": true, "MD002": true,
"MD006": true "MD006": true,
"MD041": false
} }

View file

@ -1,4 +1,4 @@
{ {
"default": true, "default": true,
"MD041": true "MD041": false
} }

View file

@ -1,6 +1,5 @@
{ {
"default": true, "default": true,
"MD041": true,
"MD043": { "MD043": {
"headings": [ "headings": [
"# Heading" "# Heading"

View file

@ -2,6 +2,5 @@
"default": true, "default": true,
"MD009": { "MD009": {
"br_spaces": 0 "br_spaces": 0
}, }
"MD041": true
} }

View file

@ -1,3 +1,5 @@
# emphasis_instead_of_headings
**Section 1: the first section {MD036}** **Section 1: the first section {MD036}**
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor

View file

@ -1,3 +1,5 @@
# fenced_code_blocks
This is a GFM-style fenced code block: This is a GFM-style fenced code block:
``` bash ``` bash
@ -24,4 +26,4 @@ None of the above should trigger any heading related rules.
Code block without a language specifier Code block without a language specifier
``` ```
{MD040:23} {MD048:13} {MD040:25} {MD048:15}

View file

@ -1,4 +1,5 @@
{ {
"default": true, "default": true,
"MD040": false "MD040": false,
"MD041": false
} }

View file

@ -1,4 +1,4 @@
{ {
"default": true, "default": true,
"MD041": true "MD041": false
} }

View file

@ -1,4 +1,4 @@
{ {
"default": true, "default": true,
"MD041": true "MD041": false
} }

View file

@ -1,4 +0,0 @@
{
"default": false,
"MD041": true
}

View file

@ -1,4 +0,0 @@
{
"default": false,
"MD041": true
}

View file

@ -1,3 +1,5 @@
# fix_102_extra_nodes_in_link_text
[test _test_ test](www.test.com) [test _test_ test](www.test.com)
[test `test` test](www.test.com) [test `test` test](www.test.com)
[test *test* test](www.test.com) [test *test* test](www.test.com)

View file

@ -1,4 +1,4 @@
{ {
"default": true, "default": true,
"MD041": true "MD041": false
} }

View file

@ -1,5 +1,4 @@
{ {
"default": true, "default": true,
"MD013": false, "MD013": false
"MD041": true
} }

View file

@ -1,5 +1,4 @@
{ {
"default": true, "default": true,
"MD013": false, "MD013": false
"MD041": true
} }

View file

@ -1,5 +1,4 @@
{ {
"default": true, "default": true,
"MD013": false, "MD013": false
"MD041": true
} }

View file

@ -3,6 +3,5 @@
"MD002": { "MD002": {
"level": 2 "level": 2
}, },
"MD013": false, "MD013": false
"MD041": true
} }

View file

@ -1,4 +0,0 @@
{
"default": true,
"MD041": true
}

View file

@ -1,5 +1,4 @@
{ {
"default": true, "default": true,
"MD013": false, "MD013": false
"MD041": true
} }

View file

@ -1,4 +0,0 @@
{
"default": true,
"MD041": true
}

View file

@ -1,4 +0,0 @@
{
"default": true,
"MD041": true
}

View file

@ -1,5 +1,4 @@
{ {
"default": true, "default": true,
"MD013": false, "MD013": false
"MD041": true
} }

View file

@ -1,4 +0,0 @@
{
"default": true,
"MD041": true
}

View file

@ -1,4 +0,0 @@
{
"default": true,
"MD041": true
}

View file

@ -1,4 +0,0 @@
{
"default": true,
"MD041": true
}

View file

@ -3,4 +3,4 @@
"MD009": { "MD009": {
"strict": true "strict": true
} }
} }

View file

@ -0,0 +1,4 @@
{
"default": true,
"MD041": false
}

View file

@ -1,4 +1,5 @@
{ {
"default": true, "default": true,
"MD003": false "MD003": false,
"MD041": false
} }

View file

@ -1,3 +1,5 @@
# hr_style_dashes
*** ***
* * * * * *
@ -18,5 +20,5 @@ _____
*** ***
{MD035:1} {MD035:3} {MD035:5} {MD035:9} {MD035:11} {MD035:13} {MD035:15} {MD035:3} {MD035:5} {MD035:7} {MD035:11} {MD035:13} {MD035:15} {MD035:17}
{MD035:17} {MD035:19} {MD035:19} {MD035:21}

View file

@ -1,3 +1,5 @@
# hr_style_inconsistent
*** ***
* * * * * *
@ -18,5 +20,5 @@ _____
*** ***
{MD035:3} {MD035:5} {MD035:7} {MD035:9} {MD035:11} {MD035:13} {MD035:15} {MD035:5} {MD035:7} {MD035:9} {MD035:11} {MD035:13} {MD035:15} {MD035:17}
{MD035:17} {MD035:19}

View file

@ -1,3 +1,5 @@
# hr_style_long
*** ***
* * * * * *
@ -18,5 +20,5 @@ _____
*** ***
{MD035:1} {MD035:3} {MD035:5} {MD035:7} {MD035:9} {MD035:11} {MD035:13} {MD035:3} {MD035:5} {MD035:7} {MD035:9} {MD035:11} {MD035:13} {MD035:15}
{MD035:15} {MD035:19} {MD035:17} {MD035:21}

View file

@ -1,3 +1,5 @@
# hr_style_stars
*** ***
* * * * * *
@ -18,5 +20,5 @@ _____
*** ***
{MD035:3} {MD035:5} {MD035:7} {MD035:9} {MD035:11} {MD035:13} {MD035:15} {MD035:5} {MD035:7} {MD035:9} {MD035:11} {MD035:13} {MD035:15} {MD035:17}
{MD035:17} {MD035:19}

View file

@ -2,6 +2,5 @@
"default": true, "default": true,
"MD025": { "MD025": {
"front_matter_title": "" "front_matter_title": ""
}, }
"MD041": true
} }

View file

@ -2,6 +2,5 @@
"default": true, "default": true,
"MD025": { "MD025": {
"front_matter_title": "" "front_matter_title": ""
}, }
"MD041": true
} }

View file

@ -1,4 +0,0 @@
{
"default": true,
"MD041": true
}

View file

@ -1,3 +1,5 @@
# inconsistent_bullet_styles_asterisk
* Item * Item
+ Item {MD004} + Item {MD004}
- Item {MD004} - Item {MD004}

View file

@ -1,3 +1,5 @@
# inconsistent_bullet_styles_dash
- Item - Item
* Item {MD004} * Item {MD004}
+ Item {MD004} + Item {MD004}

View file

@ -1,3 +1,5 @@
# inconsistent_bullet_styles_plus
+ Item + Item
* Item {MD004} * Item {MD004}
- Item {MD004} - Item {MD004}

View file

@ -1,3 +1,5 @@
# incorrect_bullet_style_asterisk
* Item * Item
- Item {MD004} - Item {MD004}
+ Item {MD004} + Item {MD004}

View file

@ -1,3 +1,5 @@
# incorrect_bullet_style_dash
* Item {MD004} * Item {MD004}
- Item - Item
+ Item {MD004} + Item {MD004}

View file

@ -1,3 +1,5 @@
# incorrect_bullet_style_plus
* Item {MD004} * Item {MD004}
- Item {MD004} - Item {MD004}
+ Item + Item

View file

@ -1,3 +1,5 @@
# inline_html-allowed_elements
<h1>This is allowed.</h1> <h1>This is allowed.</h1>
<h2>This is not allowed. {MD033}</h2> <h2>This is not allowed. {MD033}</h2>

View file

@ -1,3 +1,5 @@
# links-with-markup
[This link is plain](link) [This link is plain](link)
[This link has `code`](link) [This link has `code`](link)

View file

@ -0,0 +1,4 @@
{
"default": true,
"MD041": false
}

View file

@ -1,3 +1,5 @@
# lists_without_blank_lines
* list (on first line) * list (on first line)
text text
@ -58,7 +60,7 @@ text
text text
* list {MD032} {MD031:62} * list {MD032} {MD031:64}
``` ```
code code
``` ```
@ -68,7 +70,7 @@ text
``` ```
code code
``` ```
* list {MD032} {MD031:70} * list {MD032} {MD031:72}
text text

View file

@ -1,3 +1,5 @@
# long_lines_100
This is a very very very very very very very very long line over 80 chars but less than 100 This is a very very very very very very very very long line over 80 chars but less than 100
This is a very very very very very very very very very very long line over 80 chars, and also over 100. {MD013} This is a very very very very very very very very very very long line over 80 chars, and also over 100. {MD013}

View file

@ -1,3 +1,5 @@
# long_lines_code-default
This is a short line. This is a short line.
This is a very very very very very very very very very very very very very very very very very very very very long line. {MD013} This is a very very very very very very very very very very very very very very very very very very very very long line. {MD013}

View file

@ -1,3 +1,5 @@
# long_lines_code
This is a short line. This is a short line.
This is a very very very very very very very very very very very very very very very very very very very very long line. {MD013} This is a very very very very very very very very very very very very very very very very very very very very long line. {MD013}

View file

@ -1,3 +0,0 @@
{
"MD041": false
}

View file

@ -7,11 +7,9 @@ const path = require("path");
const { promisify } = require("util"); const { promisify } = require("util");
const tape = require("tape"); const tape = require("tape");
require("tape-player"); require("tape-player");
const packageJson = require("../package.json"); const { version } = require("../package.json");
const markdownlint = require("../lib/markdownlint"); const markdownlint = require("../lib/markdownlint");
const helpers = require("../helpers"); const helpers = require("../helpers");
const defaultConfig = require("./markdownlint-test-default-config.json");
const version = packageJson.version;
/** /**
* Create a test function for the specified test file. * Create a test function for the specified test file.
@ -27,7 +25,7 @@ function createTestForFile(file) {
const resultsFile = file.replace(/\.md$/, ".results.json"); const resultsFile = file.replace(/\.md$/, ".results.json");
const fixedFile = file.replace(/\.md$/, ".md.fixed"); const fixedFile = file.replace(/\.md$/, ".md.fixed");
const configFile = file.replace(/\.md$/, ".json"); const configFile = file.replace(/\.md$/, ".json");
let mergedConfig = null; let config = null;
const actualPromise = fs.promises.stat(configFile) const actualPromise = fs.promises.stat(configFile)
.then( .then(
function configFileExists() { function configFileExists() {
@ -38,14 +36,15 @@ function createTestForFile(file) {
return {}; return {};
}) })
.then( .then(
function lintWithConfig(config) { function captureConfig(configResult) {
mergedConfig = { config = configResult;
...defaultConfig, }
...config )
}; .then(
function lintWithConfig() {
return markdownlintPromise({ return markdownlintPromise({
"files": [ file ], "files": [ file ],
"config": mergedConfig, config,
"resultVersion": detailedResults ? 2 : 3 "resultVersion": detailedResults ? 2 : 3
}); });
}) })
@ -55,7 +54,7 @@ function createTestForFile(file) {
Promise.all([ Promise.all([
markdownlintPromise({ markdownlintPromise({
"files": [ file ], "files": [ file ],
"config": mergedConfig, config,
"resultVersion": 3 "resultVersion": 3
}), }),
fs.promises.readFile(file, "utf8"), fs.promises.readFile(file, "utf8"),
@ -150,7 +149,7 @@ function createTestForFile(file) {
"strings": { "strings": {
"input": corrections "input": corrections
}, },
"config": mergedConfig, config,
"resultVersion": 3 "resultVersion": 3
}); });
}) })

View file

@ -12,14 +12,11 @@ const pluginTexMath = require("markdown-it-texmath");
const tape = require("tape"); const tape = require("tape");
require("tape-player"); require("tape-player");
const tv4 = require("tv4"); const tv4 = require("tv4");
const packageJson = require("../package.json"); const { homepage, version } = require("../package.json");
const markdownlint = require("../lib/markdownlint"); const markdownlint = require("../lib/markdownlint");
const rules = require("../lib/rules"); const rules = require("../lib/rules");
const customRules = require("./rules/rules.js"); const customRules = require("./rules/rules.js");
const defaultConfig = require("./markdownlint-test-default-config.json");
const configSchema = require("../schema/markdownlint-config-schema.json"); const configSchema = require("../schema/markdownlint-config-schema.json");
const homepage = packageJson.homepage;
const version = packageJson.version;
const pluginTexMathOptions = { const pluginTexMathOptions = {
"engine": { "engine": {
@ -133,7 +130,9 @@ tape("stringInputLineEndings", (test) => {
"crlf": "One\r\nTwo\r\n#Three\n", "crlf": "One\r\nTwo\r\n#Three\n",
"mixed": "One\rTwo\n#Three\n" "mixed": "One\rTwo\n#Three\n"
}, },
"config": defaultConfig, "config": {
"MD041": false
},
"resultVersion": 0 "resultVersion": 0
}; };
markdownlint(options, function callback(err, actualResult) { markdownlint(options, function callback(err, actualResult) {
@ -774,8 +773,7 @@ tape("missingStringValue", (test) => {
"undefined": undefined, "undefined": undefined,
"null": null, "null": null,
"empty": "" "empty": ""
}, }
"config": defaultConfig
}, function callback(err, result) { }, function callback(err, result) {
test.ifError(err); test.ifError(err);
const expectedResult = { const expectedResult = {
@ -1491,7 +1489,7 @@ tape("texmath-content-in-lists with texmath plugin", (test) => {
tape("getVersion", (test) => { tape("getVersion", (test) => {
test.plan(1); test.plan(1);
const actual = markdownlint.getVersion(); const actual = markdownlint.getVersion();
const expected = packageJson.version; const expected = version;
test.equal(actual, expected, "Version string not correct."); test.equal(actual, expected, "Version string not correct.");
test.end(); test.end();
}); });

View file

@ -1,4 +1,5 @@
{ {
"default": true, "default": true,
"MD041": false,
"MD047": false "MD047": false
} }

View file

@ -1,4 +0,0 @@
{
"default": true,
"MD041": true
}

View file

@ -1,4 +0,0 @@
{
"default": true,
"MD041": true
}

View file

@ -1,3 +1,5 @@
# ordered_list_item_prefix-paren
Good list: Good list:
1) Do this. 1) Do this.

View file

@ -1,3 +1,5 @@
# ordered_list_item_prefix
Good list: Good list:
1. Do this. 1. Do this.

View file

@ -1,3 +1,5 @@
# ordered_list_item_prefix_ordered-paren
Good list: Good list:
1) Do this. 1) Do this.

View file

@ -1,3 +1,5 @@
# ordered_list_item_prefix_ordered
Good list: Good list:
1. Do this. 1. Do this.

View file

@ -1,5 +1,6 @@
{ {
"default": true, "default": true,
"MD041": false,
"MD043": { "MD043": {
"headings": [ "headings": [
"# One", "# One",

View file

@ -1,3 +1,5 @@
# reversed_link
Go to (this website)[https://www.example.com] {MD011} Go to (this website)[https://www.example.com] {MD011}
However, this shouldn't trigger inside code blocks: However, this shouldn't trigger inside code blocks:

View file

@ -1,3 +1,5 @@
# spaces_after_list_marker
Normal list Normal list
* Foo * Foo

View file

@ -1,3 +1,5 @@
# spaces_inside_codespan_elements
`normal codespan element` `normal codespan element`
` codespan element with space inside left` {MD038} ` codespan element with space inside left` {MD038}

View file

@ -1,3 +1,5 @@
# sublist-bullet-style
1. item 1. item
1. item 1. item
+ item + item

View file

@ -1,6 +1,8 @@
# trailing_spaces_br
This line has a single trailing space {MD009} This line has a single trailing space {MD009}
This line has two trailing spaces and should be allowed This line has two trailing spaces and should be allowed
This line has three trailing spaces {MD009} This line has three trailing spaces {MD009}
This line has four trailing spaces {MD009} This line has four trailing spaces {MD009}
{MD009:5} {MD009:7}

View file

@ -1,3 +1,5 @@
# whitespace_issues
Some text {MD009} Some text {MD009}
Some more text {MD010} Some more text {MD010}
Some more text Some more text