From ac8545e0d152efbd0d3baca7f1f02b950281623b Mon Sep 17 00:00:00 2001 From: Jens Heinrich <59469646+JensHeinrich@users.noreply.github.com> Date: Sat, 6 Mar 2021 20:46:07 +0100 Subject: [PATCH 01/36] Add reference to the Related section (fixes #374). Co-authored-by: Jens Heinrich --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 85d6a722..919e979f 100644 --- a/README.md +++ b/README.md @@ -835,7 +835,8 @@ const results = window.markdownlint.sync(options).toString(); ## Examples -For ideas how to integrate `markdownlint` into your workflow, refer to the following projects: +For ideas how to integrate `markdownlint` into your workflow, refer to the +following projects or one of the tools in the [Related section](#Related): * [.NET Documentation](https://docs.microsoft.com/en-us/dotnet/) ([Search repository](https://github.com/dotnet/docs/search?q=markdownlint)) * [ally.js](https://allyjs.io/) ([Search repository](https://github.com/medialize/ally.js/search?q=markdownlint)) From 4f9b6985864aec3ce1daad14e414388a9fd8ab3b Mon Sep 17 00:00:00 2001 From: Yash Singh Date: Tue, 9 Mar 2021 13:00:04 -0800 Subject: [PATCH 02/36] Add note for plain text (#376). --- doc/Rules.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/Rules.md b/doc/Rules.md index 73e458c6..0c3e9c2f 100644 --- a/doc/Rules.md +++ b/doc/Rules.md @@ -1569,6 +1569,14 @@ echo Hello world ``` ```` +To display a code block without syntax highlighting, use: + +````markdown +```text +Plain text in a code block +``` +```` + Rationale: Specifying a language improves content rendering by using the correct syntax highlighting for code. More information: . From dbb3f3accfc462e5f7fcdeb8237df1eeb5215b20 Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 4 Apr 2021 14:40:10 -0700 Subject: [PATCH 03/36] Remove CI status badge from README.md. --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 919e979f..7a0108e4 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ > A Node.js style checker and lint tool for Markdown/CommonMark files. [![npm version][npm-image]][npm-url] -[![CI Status][ci-image]][ci-url] [![License][license-image]][license-url] ## Install @@ -945,7 +944,5 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more information. [npm-image]: https://img.shields.io/npm/v/markdownlint.svg [npm-url]: https://www.npmjs.com/package/markdownlint -[ci-image]: https://github.com/DavidAnson/markdownlint/workflows/CI/badge.svg?branch=main -[ci-url]: https://github.com/DavidAnson/markdownlint/actions?query=branch%3Amain [license-image]: https://img.shields.io/npm/l/markdownlint.svg [license-url]: https://opensource.org/licenses/MIT From 6302b26c99c46eee2a8eea504b8f4beae0ccfd10 Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 4 Apr 2021 14:43:21 -0700 Subject: [PATCH 04/36] Update CodeQL action according to latest guidance. --- .github/workflows/codeql-analysis.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1fdeba37..77ae5e58 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,11 +20,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - name: Initialize CodeQL uses: github/codeql-action/init@v1 From 47ff95e8d2edc86e42badbb1f1fc1ccba3029bd5 Mon Sep 17 00:00:00 2001 From: Yash Singh Date: Fri, 9 Apr 2021 16:33:01 -0700 Subject: [PATCH 05/36] Add spaces_per_tab parameter to MD010/no-hard-tabs (fixes #384). (#385) --- demo/markdownlint-browser.js | 6 +++- doc/Rules.md | 5 +++- lib/md010.js | 6 +++- schema/.markdownlint.jsonc | 4 ++- schema/.markdownlint.yaml | 2 ++ schema/build-config-schema.js | 5 ++++ schema/markdownlint-config-schema.json | 10 +++++++ test/detailed-results-4-tabs-MD010.json | 7 +++++ test/detailed-results-4-tabs-MD010.md | 3 ++ test/detailed-results-4-tabs-MD010.md.fixed | 3 ++ ...detailed-results-4-tabs-MD010.results.json | 29 +++++++++++++++++++ ...detailed-results-default-spaces-MD010.json | 4 +++ test/detailed-results-default-spaces-MD010.md | 3 ++ ...iled-results-default-spaces-MD010.md.fixed | 3 ++ ...-results-default-spaces-MD010.results.json | 29 +++++++++++++++++++ ...ailed-results-no-tabs-edge-case-MD010.json | 7 +++++ ...etailed-results-no-tabs-edge-case-MD010.md | 3 ++ ...d-results-no-tabs-edge-case-MD010.md.fixed | 3 ++ ...sults-no-tabs-edge-case-MD010.results.json | 29 +++++++++++++++++++ 19 files changed, 157 insertions(+), 4 deletions(-) create mode 100644 test/detailed-results-4-tabs-MD010.json create mode 100644 test/detailed-results-4-tabs-MD010.md create mode 100644 test/detailed-results-4-tabs-MD010.md.fixed create mode 100644 test/detailed-results-4-tabs-MD010.results.json create mode 100644 test/detailed-results-default-spaces-MD010.json create mode 100644 test/detailed-results-default-spaces-MD010.md create mode 100644 test/detailed-results-default-spaces-MD010.md.fixed create mode 100644 test/detailed-results-default-spaces-MD010.results.json create mode 100644 test/detailed-results-no-tabs-edge-case-MD010.json create mode 100644 test/detailed-results-no-tabs-edge-case-MD010.md create mode 100644 test/detailed-results-no-tabs-edge-case-MD010.md.fixed create mode 100644 test/detailed-results-no-tabs-edge-case-MD010.results.json diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 5e0f6a8d..60ed8232 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -2143,6 +2143,10 @@ module.exports = { "function": function MD010(params, onError) { var codeBlocks = params.config.code_blocks; var includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks; + var spacesPerTab = params.config.spaces_per_tab; + var spaceMultiplier = (spacesPerTab === undefined) ? + 1 : + Math.max(0, Number(spacesPerTab)); forEachLine(lineMetadata(), function (line, lineIndex, inCode) { if (!inCode || includeCodeBlocks) { var match = null; @@ -2152,7 +2156,7 @@ module.exports = { addError(onError, lineIndex + 1, "Column: " + column, null, [column, length_1], { "editColumn": column, "deleteCount": length_1, - "insertText": "".padEnd(length_1) + "insertText": "".padEnd(length_1 * spaceMultiplier) }); } } diff --git a/doc/Rules.md b/doc/Rules.md index 0c3e9c2f..1cc8d5fb 100644 --- a/doc/Rules.md +++ b/doc/Rules.md @@ -388,7 +388,7 @@ Tags: whitespace, hard_tab Aliases: no-hard-tabs -Parameters: code_blocks (boolean; default true) +Parameters: code_blocks, spaces_per_tab (boolean; default true, number; default 1) Fixable: Most violations can be fixed by tooling @@ -420,6 +420,9 @@ You have the option to exclude this rule for code blocks. To do so, set the `code_blocks` parameter to `false`. Code blocks are included by default since handling of tabs by tools is often inconsistent (ex: using 4 vs. 8 spaces). +If you would like the fixer to change tabs to x spaces, then configure the `spaces_per_tab` +parameter to the number x. The default value would be 1. + Rationale: Hard tabs are often rendered inconsistently by different editors and can be harder to work with than spaces. diff --git a/lib/md010.js b/lib/md010.js index 5ebe08f8..de20f6cc 100644 --- a/lib/md010.js +++ b/lib/md010.js @@ -14,6 +14,10 @@ module.exports = { "function": function MD010(params, onError) { const codeBlocks = params.config.code_blocks; const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks; + const spacesPerTab = params.config.spaces_per_tab; + const spaceMultiplier = (spacesPerTab === undefined) ? + 1 : + Math.max(0, Number(spacesPerTab)); forEachLine(lineMetadata(), (line, lineIndex, inCode) => { if (!inCode || includeCodeBlocks) { let match = null; @@ -29,7 +33,7 @@ module.exports = { { "editColumn": column, "deleteCount": length, - "insertText": "".padEnd(length) + "insertText": "".padEnd(length * spaceMultiplier) }); } } diff --git a/schema/.markdownlint.jsonc b/schema/.markdownlint.jsonc index 412af350..8dffad8e 100644 --- a/schema/.markdownlint.jsonc +++ b/schema/.markdownlint.jsonc @@ -55,7 +55,9 @@ // MD010/no-hard-tabs - Hard tabs "MD010": { // Include code blocks - "code_blocks": true + "code_blocks": true, + // Number of spaces for each hard tab + "spaces_per_tab": 1 }, // MD011/no-reversed-links - Reversed link syntax diff --git a/schema/.markdownlint.yaml b/schema/.markdownlint.yaml index 5aaa9e46..f337ec18 100644 --- a/schema/.markdownlint.yaml +++ b/schema/.markdownlint.yaml @@ -50,6 +50,8 @@ MD009: MD010: # Include code blocks code_blocks: true + # Number of spaces for each hard tab + spaces_per_tab: 1 # MD011/no-reversed-links - Reversed link syntax MD011: true diff --git a/schema/build-config-schema.js b/schema/build-config-schema.js index 6e8ff95b..3d66887d 100644 --- a/schema/build-config-schema.js +++ b/schema/build-config-schema.js @@ -135,6 +135,11 @@ rules.forEach(function forRule(rule) { "description": "Include code blocks", "type": "boolean", "default": true + }, + "spaces_per_tab": { + "description": "Number of spaces for each hard tab", + "type": "number", + "default": 1 } }; break; diff --git a/schema/markdownlint-config-schema.json b/schema/markdownlint-config-schema.json index 20a4d094..80722918 100644 --- a/schema/markdownlint-config-schema.json +++ b/schema/markdownlint-config-schema.json @@ -327,6 +327,11 @@ "description": "Include code blocks", "type": "boolean", "default": true + }, + "spaces_per_tab": { + "description": "Number of spaces for each hard tab", + "type": "number", + "default": 1 } }, "additionalProperties": false @@ -343,6 +348,11 @@ "description": "Include code blocks", "type": "boolean", "default": true + }, + "spaces_per_tab": { + "description": "Number of spaces for each hard tab", + "type": "number", + "default": 1 } }, "additionalProperties": false diff --git a/test/detailed-results-4-tabs-MD010.json b/test/detailed-results-4-tabs-MD010.json new file mode 100644 index 00000000..2be47c1d --- /dev/null +++ b/test/detailed-results-4-tabs-MD010.json @@ -0,0 +1,7 @@ +{ + "MD009": false, + "MD010": { + "spaces_per_tab": 4 + }, + "MD041": false +} diff --git a/test/detailed-results-4-tabs-MD010.md b/test/detailed-results-4-tabs-MD010.md new file mode 100644 index 00000000..db0aba00 --- /dev/null +++ b/test/detailed-results-4-tabs-MD010.md @@ -0,0 +1,3 @@ + text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-4-tabs-MD010.md.fixed b/test/detailed-results-4-tabs-MD010.md.fixed new file mode 100644 index 00000000..bd248107 --- /dev/null +++ b/test/detailed-results-4-tabs-MD010.md.fixed @@ -0,0 +1,3 @@ + text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-4-tabs-MD010.results.json b/test/detailed-results-4-tabs-MD010.results.json new file mode 100644 index 00000000..b0a97c51 --- /dev/null +++ b/test/detailed-results-4-tabs-MD010.results.json @@ -0,0 +1,29 @@ +[ + { + "errorContext": null, + "errorDetail": "Column: 1", + "errorRange": [1, 13], + "lineNumber": 1, + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "ruleNames": ["MD010", "no-hard-tabs"] + }, + { + "errorContext": null, + "errorDetail": "Column: 5", + "errorRange": [5, 2], + "lineNumber": 2, + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "ruleNames": ["MD010", "no-hard-tabs"] + }, + { + "errorContext": null, + "errorDetail": "Column: 27", + "errorRange": [27, 3], + "lineNumber": 3, + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "ruleNames": ["MD010", "no-hard-tabs"] + } +] diff --git a/test/detailed-results-default-spaces-MD010.json b/test/detailed-results-default-spaces-MD010.json new file mode 100644 index 00000000..72db1d34 --- /dev/null +++ b/test/detailed-results-default-spaces-MD010.json @@ -0,0 +1,4 @@ +{ + "MD009": false, + "MD041": false +} diff --git a/test/detailed-results-default-spaces-MD010.md b/test/detailed-results-default-spaces-MD010.md new file mode 100644 index 00000000..db0aba00 --- /dev/null +++ b/test/detailed-results-default-spaces-MD010.md @@ -0,0 +1,3 @@ + text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-default-spaces-MD010.md.fixed b/test/detailed-results-default-spaces-MD010.md.fixed new file mode 100644 index 00000000..b7f7ff9c --- /dev/null +++ b/test/detailed-results-default-spaces-MD010.md.fixed @@ -0,0 +1,3 @@ + text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-default-spaces-MD010.results.json b/test/detailed-results-default-spaces-MD010.results.json new file mode 100644 index 00000000..b0a97c51 --- /dev/null +++ b/test/detailed-results-default-spaces-MD010.results.json @@ -0,0 +1,29 @@ +[ + { + "errorContext": null, + "errorDetail": "Column: 1", + "errorRange": [1, 13], + "lineNumber": 1, + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "ruleNames": ["MD010", "no-hard-tabs"] + }, + { + "errorContext": null, + "errorDetail": "Column: 5", + "errorRange": [5, 2], + "lineNumber": 2, + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "ruleNames": ["MD010", "no-hard-tabs"] + }, + { + "errorContext": null, + "errorDetail": "Column: 27", + "errorRange": [27, 3], + "lineNumber": 3, + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "ruleNames": ["MD010", "no-hard-tabs"] + } +] diff --git a/test/detailed-results-no-tabs-edge-case-MD010.json b/test/detailed-results-no-tabs-edge-case-MD010.json new file mode 100644 index 00000000..3c4b4177 --- /dev/null +++ b/test/detailed-results-no-tabs-edge-case-MD010.json @@ -0,0 +1,7 @@ +{ + "MD009": false, + "MD010": { + "spaces_per_tab": 0 + }, + "MD041": false +} diff --git a/test/detailed-results-no-tabs-edge-case-MD010.md b/test/detailed-results-no-tabs-edge-case-MD010.md new file mode 100644 index 00000000..db0aba00 --- /dev/null +++ b/test/detailed-results-no-tabs-edge-case-MD010.md @@ -0,0 +1,3 @@ + text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-no-tabs-edge-case-MD010.md.fixed b/test/detailed-results-no-tabs-edge-case-MD010.md.fixed new file mode 100644 index 00000000..f58b2f71 --- /dev/null +++ b/test/detailed-results-no-tabs-edge-case-MD010.md.fixed @@ -0,0 +1,3 @@ +text +text and text 2 +texts with trailing spaces diff --git a/test/detailed-results-no-tabs-edge-case-MD010.results.json b/test/detailed-results-no-tabs-edge-case-MD010.results.json new file mode 100644 index 00000000..b0a97c51 --- /dev/null +++ b/test/detailed-results-no-tabs-edge-case-MD010.results.json @@ -0,0 +1,29 @@ +[ + { + "errorContext": null, + "errorDetail": "Column: 1", + "errorRange": [1, 13], + "lineNumber": 1, + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "ruleNames": ["MD010", "no-hard-tabs"] + }, + { + "errorContext": null, + "errorDetail": "Column: 5", + "errorRange": [5, 2], + "lineNumber": 2, + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "ruleNames": ["MD010", "no-hard-tabs"] + }, + { + "errorContext": null, + "errorDetail": "Column: 27", + "errorRange": [27, 3], + "lineNumber": 3, + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "ruleNames": ["MD010", "no-hard-tabs"] + } +] From 34b9518cfe5148eced1df47654b2a25b7d475d71 Mon Sep 17 00:00:00 2001 From: David Anson Date: Tue, 20 Apr 2021 14:07:18 -0700 Subject: [PATCH 06/36] Replace Node 15 with 16 in CI tests. ( --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a91ca27..d70a9861 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-latest] - node-version: [10.x, 12.x, 14.x, 15.x] + node-version: [10.x, 12.x, 14.x, 16.x] steps: - uses: actions/checkout@v2 From a157e20ed05b394fdcb910a5f5c7460de0692f71 Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 2 May 2021 22:42:48 -0700 Subject: [PATCH 07/36] Remove deprecated Node 10 from CI. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d70a9861..8f607531 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-latest] - node-version: [10.x, 12.x, 14.x, 16.x] + node-version: [12.x, 14.x, 16.x] steps: - uses: actions/checkout@v2 From 9122b8d93505a06acba5a748ad361de0051ad0f4 Mon Sep 17 00:00:00 2001 From: Bryan Jenks Date: Fri, 14 May 2021 08:45:14 -0700 Subject: [PATCH 08/36] Typo Correction. (#395) --- schema/.markdownlint.jsonc | 2 +- schema/.markdownlint.yaml | 2 +- schema/build-config-schema.js | 2 +- schema/markdownlint-config-schema.json | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/schema/.markdownlint.jsonc b/schema/.markdownlint.jsonc index 8dffad8e..1f2493b1 100644 --- a/schema/.markdownlint.jsonc +++ b/schema/.markdownlint.jsonc @@ -246,7 +246,7 @@ // MD048/code-fence-style - Code fence style "MD048": { - // Code fence syle + // Code fence style "style": "consistent" } } \ No newline at end of file diff --git a/schema/.markdownlint.yaml b/schema/.markdownlint.yaml index f337ec18..ba61bef1 100644 --- a/schema/.markdownlint.yaml +++ b/schema/.markdownlint.yaml @@ -223,5 +223,5 @@ MD047: true # MD048/code-fence-style - Code fence style MD048: - # Code fence syle + # Code fence style style: "consistent" \ No newline at end of file diff --git a/schema/build-config-schema.js b/schema/build-config-schema.js index 3d66887d..0b6b5567 100644 --- a/schema/build-config-schema.js +++ b/schema/build-config-schema.js @@ -385,7 +385,7 @@ rules.forEach(function forRule(rule) { case "MD048": scheme.properties = { "style": { - "description": "Code fence syle", + "description": "Code fence style", "type": "string", "enum": [ "consistent", diff --git a/schema/markdownlint-config-schema.json b/schema/markdownlint-config-schema.json index 80722918..77e85157 100644 --- a/schema/markdownlint-config-schema.json +++ b/schema/markdownlint-config-schema.json @@ -1406,7 +1406,7 @@ "default": true, "properties": { "style": { - "description": "Code fence syle", + "description": "Code fence style", "type": "string", "enum": [ "consistent", @@ -1427,7 +1427,7 @@ "default": true, "properties": { "style": { - "description": "Code fence syle", + "description": "Code fence style", "type": "string", "enum": [ "consistent", From c6d95cb9042ecc03d577e94eacfb8b8b56548ad8 Mon Sep 17 00:00:00 2001 From: Jeremy Suriel Date: Thu, 20 May 2021 15:45:27 -0400 Subject: [PATCH 09/36] Update MD043 to fix required header checks in middle and last when using special char "*" (#396) --- demo/markdownlint-browser.js | 11 ++++++++--- lib/md043.js | 11 ++++++++--- ...quired-headings-missing-last-zero-or-more.json | 14 ++++++++++++++ ...required-headings-missing-last-zero-or-more.md | 15 +++++++++++++++ ...ired-headings-missing-middle-zero-or-more.json | 14 ++++++++++++++ ...quired-headings-missing-middle-zero-or-more.md | 15 +++++++++++++++ test/required-headings-zero-or-more-last.json | 11 +++++++++++ test/required-headings-zero-or-more-last.md | 5 +++++ 8 files changed, 90 insertions(+), 6 deletions(-) create mode 100644 test/required-headings-missing-last-zero-or-more.json create mode 100644 test/required-headings-missing-last-zero-or-more.md create mode 100644 test/required-headings-missing-middle-zero-or-more.json create mode 100644 test/required-headings-missing-middle-zero-or-more.md create mode 100644 test/required-headings-zero-or-more-last.json create mode 100644 test/required-headings-zero-or-more-last.md diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 60ed8232..885ed1a2 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -3703,8 +3703,11 @@ module.exports = { var actual = levels_1[heading.tag] + " " + content; var expected = getExpected_1(); if (expected === "*") { - matchAny_1 = true; - getExpected_1(); + var nextExpected = getExpected_1(); + if (nextExpected.toLowerCase() !== actual.toLowerCase()) { + matchAny_1 = true; + i_1--; + } } else if (expected === "+") { matchAny_1 = true; @@ -3721,8 +3724,10 @@ module.exports = { } } }); + var extraHeadings = requiredHeadings.length - i_1; if (!hasError_1 && - (i_1 < requiredHeadings.length) && + ((extraHeadings > 1) || + ((extraHeadings === 1) && (requiredHeadings[i_1] !== "*"))) && (anyHeadings_1 || !requiredHeadings.every(function (heading) { return heading === "*"; }))) { addErrorContext(onError, params.lines.length, requiredHeadings[i_1]); } diff --git a/lib/md043.js b/lib/md043.js index e1945121..5805305b 100644 --- a/lib/md043.js +++ b/lib/md043.js @@ -28,8 +28,11 @@ module.exports = { const actual = levels[heading.tag] + " " + content; const expected = getExpected(); if (expected === "*") { - matchAny = true; - getExpected(); + const nextExpected = getExpected(); + if (nextExpected.toLowerCase() !== actual.toLowerCase()) { + matchAny = true; + i--; + } } else if (expected === "+") { matchAny = true; } else if (expected.toLowerCase() === actual.toLowerCase()) { @@ -43,9 +46,11 @@ module.exports = { } } }); + const extraHeadings = requiredHeadings.length - i; if ( !hasError && - (i < requiredHeadings.length) && + ((extraHeadings > 1) || + ((extraHeadings === 1) && (requiredHeadings[i] !== "*"))) && (anyHeadings || !requiredHeadings.every((heading) => heading === "*")) ) { addErrorContext(onError, params.lines.length, diff --git a/test/required-headings-missing-last-zero-or-more.json b/test/required-headings-missing-last-zero-or-more.json new file mode 100644 index 00000000..2bb3e509 --- /dev/null +++ b/test/required-headings-missing-last-zero-or-more.json @@ -0,0 +1,14 @@ +{ + "default": true, + "MD043": { + "headings": [ + "# One", + "*", + "### Three", + "*", + "### Five", + "*", + "#### FOO" + ] + } +} diff --git a/test/required-headings-missing-last-zero-or-more.md b/test/required-headings-missing-last-zero-or-more.md new file mode 100644 index 00000000..6a95d2e4 --- /dev/null +++ b/test/required-headings-missing-last-zero-or-more.md @@ -0,0 +1,15 @@ +# One + +## Two + +### THREE + +## four + +## Five + +### SiX + +#### FOO + +{MD043:16} diff --git a/test/required-headings-missing-middle-zero-or-more.json b/test/required-headings-missing-middle-zero-or-more.json new file mode 100644 index 00000000..267593db --- /dev/null +++ b/test/required-headings-missing-middle-zero-or-more.json @@ -0,0 +1,14 @@ +{ + "default": true, + "MD043": { + "headings": [ + "# One", + "*", + "### Three", + "*", + "### FOO", + "*", + "#### 7" + ] + } +} diff --git a/test/required-headings-missing-middle-zero-or-more.md b/test/required-headings-missing-middle-zero-or-more.md new file mode 100644 index 00000000..764d8b99 --- /dev/null +++ b/test/required-headings-missing-middle-zero-or-more.md @@ -0,0 +1,15 @@ +# One + +## Two + +### THREE + +## four + +## Five + +### SiX + +#### 7 + +{MD043:16} diff --git a/test/required-headings-zero-or-more-last.json b/test/required-headings-zero-or-more-last.json new file mode 100644 index 00000000..6f8e3bfb --- /dev/null +++ b/test/required-headings-zero-or-more-last.json @@ -0,0 +1,11 @@ +{ + "default": true, + "MD043": { + "headings": [ + "# One", + "## Two", + "### Three", + "*" + ] + } +} diff --git a/test/required-headings-zero-or-more-last.md b/test/required-headings-zero-or-more-last.md new file mode 100644 index 00000000..f4cccf5d --- /dev/null +++ b/test/required-headings-zero-or-more-last.md @@ -0,0 +1,5 @@ +# One + +## Two + +### THREE From 6d534b46c87f600b1f39daa2a0d896d968d38ed1 Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 23 May 2021 14:14:13 -0700 Subject: [PATCH 10/36] Switch to actions/setup-node@v2. --- .github/workflows/ci.yml | 2 +- .github/workflows/test-repos.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f607531..a12dd3bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: Install Dependencies diff --git a/.github/workflows/test-repos.yml b/.github/workflows/test-repos.yml index 751e1b79..7ff15af6 100644 --- a/.github/workflows/test-repos.yml +++ b/.github/workflows/test-repos.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - name: Install Dependencies From e441d247eefb10d533fcd4fef0553726a990382e Mon Sep 17 00:00:00 2001 From: David Anson Date: Tue, 8 Jun 2021 22:02:02 -0700 Subject: [PATCH 11/36] Update dependencies: markdown-it to 12.0.6. --- demo/markdownlint-browser.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 885ed1a2..33ea45ed 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -4028,7 +4028,7 @@ module.exports = rules; /***/ ((module) => { "use strict"; -module.exports = JSON.parse("{\"name\":\"markdownlint\",\"version\":\"0.23.1\",\"description\":\"A Node.js style checker and lint tool for Markdown/CommonMark files.\",\"main\":\"lib/markdownlint.js\",\"types\":\"lib/markdownlint.d.ts\",\"author\":\"David Anson (https://dlaa.me/)\",\"license\":\"MIT\",\"homepage\":\"https://github.com/DavidAnson/markdownlint\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/DavidAnson/markdownlint.git\"},\"bugs\":\"https://github.com/DavidAnson/markdownlint/issues\",\"scripts\":{\"build-config\":\"npm run build-config-schema && npm run build-config-example\",\"build-config-example\":\"node schema/build-config-example.js\",\"build-config-schema\":\"node schema/build-config-schema.js\",\"build-declaration\":\"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf 'lib/{c,md,r}*.d.ts' 'helpers/*.d.ts'\",\"build-demo\":\"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats\",\"build-example\":\"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2\",\"ci\":\"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code\",\"clean-test-repos\":\"rimraf test-repos\",\"clone-test-repos\":\"mkdir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet\",\"clone-test-repos-large\":\"npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet\",\"declaration\":\"npm run build-declaration && npm run test-declaration\",\"example\":\"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint\",\"lint\":\"eslint --max-warnings 0 .\",\"lint-test-repos\":\"ava --timeout=5m test/markdownlint-test-repos.js\",\"test\":\"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js\",\"test-cover\":\"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test\",\"test-declaration\":\"cd example/typescript && tsc && node type-check.js\",\"test-extra\":\"ava --timeout=5m test/markdownlint-test-extra.js\"},\"engines\":{\"node\":\">=10\"},\"dependencies\":{\"markdown-it\":\"12.0.4\"},\"devDependencies\":{\"ava\":\"~3.15.0\",\"c8\":\"~7.5.0\",\"cpy-cli\":\"~3.1.1\",\"eslint\":\"~7.19.0\",\"eslint-plugin-jsdoc\":\"~31.6.0\",\"eslint-plugin-node\":\"~11.1.0\",\"eslint-plugin-unicorn\":\"~27.0.0\",\"globby\":\"~11.0.2\",\"js-yaml\":\"~4.0.0\",\"markdown-it-for-inline\":\"~0.1.1\",\"markdown-it-sub\":\"~1.0.0\",\"markdown-it-sup\":\"~1.0.0\",\"markdown-it-texmath\":\"~0.8.0\",\"markdownlint-rule-helpers\":\"~0.13.0\",\"npm-run-all\":\"~4.1.5\",\"rimraf\":\"~3.0.2\",\"strip-json-comments\":\"~3.1.1\",\"toml\":\"~3.0.0\",\"ts-loader\":\"~8.0.15\",\"tv4\":\"~1.3.0\",\"typescript\":\"~4.1.3\",\"webpack\":\"~5.21.1\",\"webpack-cli\":\"~4.5.0\"},\"keywords\":[\"markdown\",\"lint\",\"md\",\"CommonMark\",\"markdownlint\"]}"); +module.exports = JSON.parse("{\"name\":\"markdownlint\",\"version\":\"0.23.1\",\"description\":\"A Node.js style checker and lint tool for Markdown/CommonMark files.\",\"main\":\"lib/markdownlint.js\",\"types\":\"lib/markdownlint.d.ts\",\"author\":\"David Anson (https://dlaa.me/)\",\"license\":\"MIT\",\"homepage\":\"https://github.com/DavidAnson/markdownlint\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/DavidAnson/markdownlint.git\"},\"bugs\":\"https://github.com/DavidAnson/markdownlint/issues\",\"scripts\":{\"build-config\":\"npm run build-config-schema && npm run build-config-example\",\"build-config-example\":\"node schema/build-config-example.js\",\"build-config-schema\":\"node schema/build-config-schema.js\",\"build-declaration\":\"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf 'lib/{c,md,r}*.d.ts' 'helpers/*.d.ts'\",\"build-demo\":\"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats\",\"build-example\":\"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2\",\"ci\":\"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code\",\"clean-test-repos\":\"rimraf test-repos\",\"clone-test-repos\":\"mkdir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet\",\"clone-test-repos-large\":\"npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet\",\"declaration\":\"npm run build-declaration && npm run test-declaration\",\"example\":\"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint\",\"lint\":\"eslint --max-warnings 0 .\",\"lint-test-repos\":\"ava --timeout=5m test/markdownlint-test-repos.js\",\"test\":\"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js\",\"test-cover\":\"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test\",\"test-declaration\":\"cd example/typescript && tsc && node type-check.js\",\"test-extra\":\"ava --timeout=5m test/markdownlint-test-extra.js\"},\"engines\":{\"node\":\">=10\"},\"dependencies\":{\"markdown-it\":\"12.0.6\"},\"devDependencies\":{\"ava\":\"~3.15.0\",\"c8\":\"~7.5.0\",\"cpy-cli\":\"~3.1.1\",\"eslint\":\"~7.19.0\",\"eslint-plugin-jsdoc\":\"~31.6.0\",\"eslint-plugin-node\":\"~11.1.0\",\"eslint-plugin-unicorn\":\"~27.0.0\",\"globby\":\"~11.0.2\",\"js-yaml\":\"~4.0.0\",\"markdown-it-for-inline\":\"~0.1.1\",\"markdown-it-sub\":\"~1.0.0\",\"markdown-it-sup\":\"~1.0.0\",\"markdown-it-texmath\":\"~0.8.0\",\"markdownlint-rule-helpers\":\"~0.13.0\",\"npm-run-all\":\"~4.1.5\",\"rimraf\":\"~3.0.2\",\"strip-json-comments\":\"~3.1.1\",\"toml\":\"~3.0.0\",\"ts-loader\":\"~8.0.15\",\"tv4\":\"~1.3.0\",\"typescript\":\"~4.1.3\",\"webpack\":\"~5.21.1\",\"webpack-cli\":\"~4.5.0\"},\"keywords\":[\"markdown\",\"lint\",\"md\",\"CommonMark\",\"markdownlint\"]}"); /***/ }), diff --git a/package.json b/package.json index ce4c4a6c..7b1c33c9 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "node": ">=10" }, "dependencies": { - "markdown-it": "12.0.4" + "markdown-it": "12.0.6" }, "devDependencies": { "ava": "~3.15.0", From fb5f647368e9841d7c7615929249871e0a66e866 Mon Sep 17 00:00:00 2001 From: David Anson Date: Tue, 8 Jun 2021 22:20:13 -0700 Subject: [PATCH 12/36] Update dependencies: c8 to 7.7.2, eslint to 7.28.0, eslint-plugin-jsdoc to 35.1.3, eslint-plugin-unicorn to 33.0.1, globby to 11.0.3, js-yaml to 4.1.0, markdown-it-texmath to 0.9.0, markdownlint-rule-helpers to 0.14.0, ts-loader to 9.2.3, typescript to 4.3.2, webpack to 5.38.1, webpack-cli to 4.7.2. --- .eslintrc.json | 10 ++++++ demo/markdownlint-browser.js | 68 +++++++++++++++++++----------------- lib/markdownlint.d.ts | 4 +-- lib/markdownlint.js | 6 ++-- package.json | 24 ++++++------- test/markdownlint-test.js | 8 +++-- 6 files changed, 67 insertions(+), 53 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 6fb0c078..86878e12 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -142,6 +142,7 @@ "unicorn/no-array-push-push": "error", "unicorn/no-array-reduce": "error", "unicorn/no-console-spaces": "error", + "unicorn/no-document-cookie": "error", "unicorn/no-for-loop": "error", "unicorn/no-hex-escape": "error", "unicorn/no-instanceof-array": "error", @@ -153,6 +154,7 @@ "unicorn/no-null": "off", "unicorn/no-object-as-default-parameter": "error", "unicorn/no-process-exit": "error", + "unicorn/no-static-only-class": "error", "unicorn/no-this-assignment": "error", "unicorn/no-unreadable-array-destructuring": "error", "unicorn/no-unsafe-regex": "off", @@ -163,6 +165,7 @@ "unicorn/numeric-separators-style": "error", "unicorn/prefer-add-event-listener": "error", "unicorn/prefer-array-find": "error", + "unicorn/prefer-array-flat": "error", "unicorn/prefer-array-flat-map": "error", "unicorn/prefer-array-index-of": "error", "unicorn/prefer-array-some": "error", @@ -176,9 +179,13 @@ "unicorn/prefer-keyboard-event-key": "error", "unicorn/prefer-math-trunc": "error", "unicorn/prefer-modern-dom-apis": "error", + "unicorn/prefer-module": "off", "unicorn/prefer-negative-index": "error", + "unicorn/prefer-node-protocol": "error", "unicorn/prefer-number-properties": "error", + "unicorn/prefer-object-has-own": "error", "unicorn/prefer-optional-catch-binding": "error", + "unicorn/prefer-prototype-methods": "error", "unicorn/prefer-query-selector": "error", "unicorn/prefer-reflect-apply": "error", "unicorn/prefer-regexp-test": "error", @@ -188,9 +195,12 @@ "unicorn/prefer-string-slice": "off", "unicorn/prefer-string-starts-ends-with": "error", "unicorn/prefer-string-trim-start-end": "error", + "unicorn/prefer-switch": "off", "unicorn/prefer-ternary": "error", "unicorn/prefer-type-error": "error", "unicorn/prevent-abbreviations": "off", + "unicorn/require-array-join-separator": "error", + "unicorn/require-number-to-fixed-digits-argument": "error", "unicorn/string-content": "error", "unicorn/throw-new-error": "error" }, diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 33ea45ed..e4d4b89b 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -1,5 +1,5 @@ /*! markdownlint 0.23.1 https://github.com/DavidAnson/markdownlint @license MIT */ -var markdownlint;markdownlint = +var markdownlint; /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ @@ -30,7 +30,7 @@ module.exports = webpackEmptyContext; "use strict"; // @ts-check -var os = __webpack_require__(/*! os */ "?5533"); +var os = __webpack_require__(/*! os */ "?591e"); // Regular expression for matching common newline characters // See NEWLINES_RE in markdown-it/lib/rules_core/normalize.js var newLineRe = /\r\n?|\n/g; @@ -769,16 +769,14 @@ var __assign = (this && this.__assign) || function () { }; return __assign.apply(this, arguments); }; -var __spreadArrays = (this && this.__spreadArrays) || function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; +var __spreadArray = (this && this.__spreadArray) || function (to, from) { + for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) + to[j] = from[i]; + return to; }; -var fs = __webpack_require__(/*! fs */ "?65c5"); -var path = __webpack_require__(/*! path */ "?0f27"); -var promisify = __webpack_require__(/*! util */ "?0bed").promisify; +var fs = __webpack_require__(/*! fs */ "?ec0a"); +var path = __webpack_require__(/*! path */ "?b85c"); +var promisify = __webpack_require__(/*! util */ "?96a2").promisify; var markdownIt = __webpack_require__(/*! markdown-it */ "markdown-it"); var rules = __webpack_require__(/*! ./rules */ "../lib/rules.js"); var helpers = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"); @@ -952,7 +950,7 @@ function annotateTokens(tokens, lines) { // Handle missing maps for table head/body if ((token.type === "thead_open") || (token.type === "tbody_open")) { - tableMap = token.map.slice(); + tableMap = __spreadArray([], token.map); } else if ((token.type === "tr_close") && tableMap) { @@ -963,7 +961,7 @@ function annotateTokens(tokens, lines) { tableMap = null; } if (tableMap && !token.map) { - token.map = tableMap.slice(); + token.map = __spreadArray([], tableMap); } // Update token metadata if (token.map) { @@ -1323,7 +1321,7 @@ function lintContent(ruleList, name, content, md, config, frontMatter, handleRul "lineNumber": errorInfo.lineNumber + frontMatterLines.length, "detail": errorInfo.detail || null, "context": errorInfo.context || null, - "range": errorInfo.range ? __spreadArrays(errorInfo.range) : null, + "range": errorInfo.range ? __spreadArray([], errorInfo.range) : null, "fixInfo": fixInfo ? cleanFixInfo : null }); } @@ -1449,7 +1447,7 @@ function lintInput(options, synchronous, callback) { } var files = []; if (Array.isArray(options.files)) { - files = options.files.slice(); + files = __spreadArray([], options.files); } else if (options.files) { files = [String(options.files)]; @@ -4028,7 +4026,7 @@ module.exports = rules; /***/ ((module) => { "use strict"; -module.exports = JSON.parse("{\"name\":\"markdownlint\",\"version\":\"0.23.1\",\"description\":\"A Node.js style checker and lint tool for Markdown/CommonMark files.\",\"main\":\"lib/markdownlint.js\",\"types\":\"lib/markdownlint.d.ts\",\"author\":\"David Anson (https://dlaa.me/)\",\"license\":\"MIT\",\"homepage\":\"https://github.com/DavidAnson/markdownlint\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/DavidAnson/markdownlint.git\"},\"bugs\":\"https://github.com/DavidAnson/markdownlint/issues\",\"scripts\":{\"build-config\":\"npm run build-config-schema && npm run build-config-example\",\"build-config-example\":\"node schema/build-config-example.js\",\"build-config-schema\":\"node schema/build-config-schema.js\",\"build-declaration\":\"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf 'lib/{c,md,r}*.d.ts' 'helpers/*.d.ts'\",\"build-demo\":\"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats\",\"build-example\":\"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2\",\"ci\":\"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code\",\"clean-test-repos\":\"rimraf test-repos\",\"clone-test-repos\":\"mkdir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet\",\"clone-test-repos-large\":\"npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet\",\"declaration\":\"npm run build-declaration && npm run test-declaration\",\"example\":\"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint\",\"lint\":\"eslint --max-warnings 0 .\",\"lint-test-repos\":\"ava --timeout=5m test/markdownlint-test-repos.js\",\"test\":\"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js\",\"test-cover\":\"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test\",\"test-declaration\":\"cd example/typescript && tsc && node type-check.js\",\"test-extra\":\"ava --timeout=5m test/markdownlint-test-extra.js\"},\"engines\":{\"node\":\">=10\"},\"dependencies\":{\"markdown-it\":\"12.0.6\"},\"devDependencies\":{\"ava\":\"~3.15.0\",\"c8\":\"~7.5.0\",\"cpy-cli\":\"~3.1.1\",\"eslint\":\"~7.19.0\",\"eslint-plugin-jsdoc\":\"~31.6.0\",\"eslint-plugin-node\":\"~11.1.0\",\"eslint-plugin-unicorn\":\"~27.0.0\",\"globby\":\"~11.0.2\",\"js-yaml\":\"~4.0.0\",\"markdown-it-for-inline\":\"~0.1.1\",\"markdown-it-sub\":\"~1.0.0\",\"markdown-it-sup\":\"~1.0.0\",\"markdown-it-texmath\":\"~0.8.0\",\"markdownlint-rule-helpers\":\"~0.13.0\",\"npm-run-all\":\"~4.1.5\",\"rimraf\":\"~3.0.2\",\"strip-json-comments\":\"~3.1.1\",\"toml\":\"~3.0.0\",\"ts-loader\":\"~8.0.15\",\"tv4\":\"~1.3.0\",\"typescript\":\"~4.1.3\",\"webpack\":\"~5.21.1\",\"webpack-cli\":\"~4.5.0\"},\"keywords\":[\"markdown\",\"lint\",\"md\",\"CommonMark\",\"markdownlint\"]}"); +module.exports = JSON.parse('{"name":"markdownlint","version":"0.23.1","description":"A Node.js style checker and lint tool for Markdown/CommonMark files.","main":"lib/markdownlint.js","types":"lib/markdownlint.d.ts","author":"David Anson (https://dlaa.me/)","license":"MIT","homepage":"https://github.com/DavidAnson/markdownlint","repository":{"type":"git","url":"https://github.com/DavidAnson/markdownlint.git"},"bugs":"https://github.com/DavidAnson/markdownlint/issues","scripts":{"build-config":"npm run build-config-schema && npm run build-config-example","build-config-example":"node schema/build-config-example.js","build-config-schema":"node schema/build-config-schema.js","build-declaration":"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf \'lib/{c,md,r}*.d.ts\' \'helpers/*.d.ts\'","build-demo":"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats","build-example":"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2","ci":"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code","clean-test-repos":"rimraf test-repos","clone-test-repos":"mkdir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet","clone-test-repos-large":"npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet","declaration":"npm run build-declaration && npm run test-declaration","example":"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint","lint":"eslint --max-warnings 0 .","lint-test-repos":"ava --timeout=5m test/markdownlint-test-repos.js","test":"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js","test-cover":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test","test-declaration":"cd example/typescript && tsc && node type-check.js","test-extra":"ava --timeout=5m test/markdownlint-test-extra.js"},"engines":{"node":">=10"},"dependencies":{"markdown-it":"12.0.6"},"devDependencies":{"ava":"~3.15.0","c8":"~7.7.2","cpy-cli":"~3.1.1","eslint":"~7.28.0","eslint-plugin-jsdoc":"~35.1.3","eslint-plugin-node":"~11.1.0","eslint-plugin-unicorn":"~33.0.1","globby":"~11.0.3","js-yaml":"~4.1.0","markdown-it-for-inline":"~0.1.1","markdown-it-sub":"~1.0.0","markdown-it-sup":"~1.0.0","markdown-it-texmath":"~0.9.0","markdownlint-rule-helpers":"~0.14.0","npm-run-all":"~4.1.5","rimraf":"~3.0.2","strip-json-comments":"~3.1.1","toml":"~3.0.0","ts-loader":"~9.2.3","tv4":"~1.3.0","typescript":"~4.3.2","webpack":"~5.38.1","webpack-cli":"~4.7.2"},"keywords":["markdown","lint","md","CommonMark","markdownlint"]}'); /***/ }), @@ -4043,17 +4041,7 @@ module.exports = markdownit; /***/ }), -/***/ "?65c5": -/*!********************!*\ - !*** fs (ignored) ***! - \********************/ -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ "?5533": +/***/ "?591e": /*!********************!*\ !*** os (ignored) ***! \********************/ @@ -4063,7 +4051,17 @@ module.exports = markdownit; /***/ }), -/***/ "?0f27": +/***/ "?ec0a": +/*!********************!*\ + !*** fs (ignored) ***! + \********************/ +/***/ (() => { + +/* (ignored) */ + +/***/ }), + +/***/ "?b85c": /*!**********************!*\ !*** path (ignored) ***! \**********************/ @@ -4073,7 +4071,7 @@ module.exports = markdownit; /***/ }), -/***/ "?0bed": +/***/ "?96a2": /*!**********************!*\ !*** util (ignored) ***! \**********************/ @@ -4091,8 +4089,9 @@ module.exports = markdownit; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -4115,9 +4114,12 @@ module.exports = markdownit; /******/ })(); /******/ /************************************************************************/ -/******/ // module exports must be returned from runtime so entry inlining is disabled +/******/ /******/ // startup /******/ // Load entry module and return exports -/******/ return __webpack_require__("../lib/markdownlint.js"); +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = __webpack_require__("../lib/markdownlint.js"); +/******/ markdownlint = __webpack_exports__; +/******/ /******/ })() ; \ No newline at end of file diff --git a/lib/markdownlint.d.ts b/lib/markdownlint.d.ts index 7a6199e3..b38c7836 100644 --- a/lib/markdownlint.d.ts +++ b/lib/markdownlint.d.ts @@ -334,12 +334,12 @@ type FixInfo = { * {@link ../schema/markdownlint-config-schema.json}. */ type Configuration = { - [x: string]: any; + [x: string]: RuleConfiguration; }; /** * Rule configuration. */ -type RuleConfiguration = any; +type RuleConfiguration = boolean | any; /** * Parses a configuration string and returns a configuration object. */ diff --git a/lib/markdownlint.js b/lib/markdownlint.js index 165a144b..ee7e8bcc 100644 --- a/lib/markdownlint.js +++ b/lib/markdownlint.js @@ -190,7 +190,7 @@ function annotateTokens(tokens, lines) { (token.type === "thead_open") || (token.type === "tbody_open") ) { - tableMap = token.map.slice(); + tableMap = [ ...token.map ]; } else if ( (token.type === "tr_close") && tableMap @@ -203,7 +203,7 @@ function annotateTokens(tokens, lines) { tableMap = null; } if (tableMap && !token.map) { - token.map = tableMap.slice(); + token.map = [ ...tableMap ]; } // Update token metadata if (token.map) { @@ -736,7 +736,7 @@ function lintInput(options, synchronous, callback) { } let files = []; if (Array.isArray(options.files)) { - files = options.files.slice(); + files = [ ...options.files ]; } else if (options.files) { files = [ String(options.files) ]; } diff --git a/package.json b/package.json index 7b1c33c9..d23ce7b1 100644 --- a/package.json +++ b/package.json @@ -40,28 +40,28 @@ }, "devDependencies": { "ava": "~3.15.0", - "c8": "~7.5.0", + "c8": "~7.7.2", "cpy-cli": "~3.1.1", - "eslint": "~7.19.0", - "eslint-plugin-jsdoc": "~31.6.0", + "eslint": "~7.28.0", + "eslint-plugin-jsdoc": "~35.1.3", "eslint-plugin-node": "~11.1.0", - "eslint-plugin-unicorn": "~27.0.0", - "globby": "~11.0.2", - "js-yaml": "~4.0.0", + "eslint-plugin-unicorn": "~33.0.1", + "globby": "~11.0.3", + "js-yaml": "~4.1.0", "markdown-it-for-inline": "~0.1.1", "markdown-it-sub": "~1.0.0", "markdown-it-sup": "~1.0.0", - "markdown-it-texmath": "~0.8.0", - "markdownlint-rule-helpers": "~0.13.0", + "markdown-it-texmath": "~0.9.0", + "markdownlint-rule-helpers": "~0.14.0", "npm-run-all": "~4.1.5", "rimraf": "~3.0.2", "strip-json-comments": "~3.1.1", "toml": "~3.0.0", - "ts-loader": "~8.0.15", + "ts-loader": "~9.2.3", "tv4": "~1.3.0", - "typescript": "~4.1.3", - "webpack": "~5.21.1", - "webpack-cli": "~4.5.0" + "typescript": "~4.3.2", + "webpack": "~5.38.1", + "webpack-cli": "~4.7.2" }, "keywords": [ "markdown", diff --git a/test/markdownlint-test.js b/test/markdownlint-test.js index 5193a7a3..32b73edc 100644 --- a/test/markdownlint-test.js +++ b/test/markdownlint-test.js @@ -681,7 +681,7 @@ test.cb("filesArrayNotModified", (t) => { "./test/atx_heading_spacing.md", "./test/first_heading_bad_atx.md" ]; - const expectedFiles = files.slice(); + const expectedFiles = [ ...files ]; markdownlint({ "files": files }, function callback(err) { t.falsy(err); t.deepEqual(files, expectedFiles, "Files modified."); @@ -811,12 +811,13 @@ test.cb("readme", (t) => { fs.readFile("README.md", "utf8", function readFile(err, contents) { t.falsy(err); - const rulesLeft = rules.slice(); + const rulesLeft = [ ...rules ]; let seenRelated = false; let seenRules = false; let inRules = false; let seenTags = false; let inTags = false; + // @ts-ignore md.parse(contents, {}).forEach(function forToken(token) { if ( (token.type === "bullet_list_open") && @@ -878,7 +879,7 @@ test.cb("rules", (t) => { fs.readFile("doc/Rules.md", "utf8", (err, contents) => { t.falsy(err); - const rulesLeft = rules.slice(); + const rulesLeft = [ ...rules ]; let inHeading = false; let rule = null; let ruleHasTags = true; @@ -896,6 +897,7 @@ test.cb("rules", (t) => { t.true(!ruleUsesParams, "Missing parameters for rule " + r.names + "."); }; + // @ts-ignore md.parse(contents, {}).forEach(function forToken(token) { if ((token.type === "heading_open") && (token.tag === "h2")) { inHeading = true; From 4db40256d901651b746983abb686f46d32e5d112 Mon Sep 17 00:00:00 2001 From: David Anson Date: Sat, 12 Jun 2021 17:10:59 -0700 Subject: [PATCH 13/36] Re-implement MD044/proper-names for better accuracy (range and fixInfo are now always valid) (fixes #402, fixes #403). --- demo/markdownlint-browser.js | 109 +++++++++------------- lib/md044.js | 136 ++++++++++++---------------- test/markdownlint-test-scenarios.js | 1 + test/proper-names-no-code.md | 20 +++- test/proper-names-projects.json | 1 - test/proper-names-projects.md | 8 +- test/proper-names.md | 10 +- 7 files changed, 135 insertions(+), 150 deletions(-) diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index e4d4b89b..71c25871 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -3745,9 +3745,8 @@ module.exports = { "use strict"; // @ts-check -var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addErrorDetailIf = _a.addErrorDetailIf, bareUrlRe = _a.bareUrlRe, escapeForRegExp = _a.escapeForRegExp, filterTokens = _a.filterTokens, forEachInlineChild = _a.forEachInlineChild, newLineRe = _a.newLineRe; -var startNonWordRe = /^\W/; -var endNonWordRe = /\W$/; +var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addErrorDetailIf = _a.addErrorDetailIf, bareUrlRe = _a.bareUrlRe, escapeForRegExp = _a.escapeForRegExp, forEachLine = _a.forEachLine, newLineRe = _a.newLineRe, forEachInlineCodeSpan = _a.forEachInlineCodeSpan; +var lineMetadata = __webpack_require__(/*! ./cache */ "../lib/cache.js").lineMetadata; module.exports = { "names": ["MD044", "proper-names"], "description": "Proper names should have the correct capitalization", @@ -3755,73 +3754,55 @@ module.exports = { "function": function MD044(params, onError) { var names = params.config.names; names = Array.isArray(names) ? names : []; + names.sort(function (a, b) { return (b.length - a.length) || a.localeCompare(b); }); var codeBlocks = params.config.code_blocks; var includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks; - // Text of automatic hyperlinks is implicitly a URL - var autolinkText = new Set(); - filterTokens(params, "inline", function (token) { - var inAutoLink = false; - token.children.forEach(function (child) { - var info = child.info, type = child.type; - if ((type === "link_open") && (info === "auto")) { - inAutoLink = true; - } - else if (type === "link_close") { - inAutoLink = false; - } - else if ((type === "text") && inAutoLink) { - autolinkText.add(child); + var exclusions = []; + if (!includeCodeBlocks) { + forEachInlineCodeSpan(params.lines.join("\n"), function (code, lineIndex, columnIndex) { + var codeLines = code.split(newLineRe); + // eslint-disable-next-line unicorn/no-for-loop + for (var i = 0; i < codeLines.length; i++) { + exclusions.push([lineIndex + i, columnIndex, codeLines[i].length]); + columnIndex = 0; } }); - }); - // For each proper name... - names.forEach(function (name) { - var escapedName = escapeForRegExp(name); - var startNamePattern = startNonWordRe.test(name) ? "" : "\\S*\\b"; - var endNamePattern = endNonWordRe.test(name) ? "" : "\\b\\S*"; - var namePattern = "(" + startNamePattern + ")(" + escapedName + ")(" + endNamePattern + ")"; - var anyNameRe = new RegExp(namePattern, "gi"); - // eslint-disable-next-line jsdoc/require-jsdoc - function forToken(token) { - if (!autolinkText.has(token)) { - var fenceOffset_1 = (token.type === "fence") ? 1 : 0; - token.content.split(newLineRe).forEach(function (line, index) { - var match = null; - while ((match = anyNameRe.exec(line)) !== null) { - var fullMatch = match[0], leftMatch = match[1], nameMatch = match[2], rightMatch = match[3]; - if (fullMatch.search(bareUrlRe) === -1) { - var wordMatch = fullMatch - .replace(new RegExp("^\\W{0," + leftMatch.length + "}"), "") - .replace(new RegExp("\\W{0," + rightMatch.length + "}$"), ""); - if (!names.includes(wordMatch)) { - var lineNumber = token.lineNumber + index + fenceOffset_1; - var fullLine = params.lines[lineNumber - 1]; - var matchLength = wordMatch.length; - var matchIndex = fullLine.indexOf(wordMatch); - var range = (matchIndex === -1) ? - null : - [matchIndex + 1, matchLength]; - var fixInfo = (matchIndex === -1) ? - null : - { - "editColumn": matchIndex + 1, - "deleteCount": matchLength, - "insertText": name - }; - addErrorDetailIf(onError, lineNumber, name, nameMatch, null, null, range, fixInfo); - } - } + } + var _loop_1 = function (name_1) { + var escapedName = escapeForRegExp(name_1); + var startNamePattern = /^\W/.test(name_1) ? "" : "[^\\s([\"]*\\b_*"; + var endNamePattern = /\W$/.test(name_1) ? "" : "_*\\b[^\\s)\\]\"]*"; + var namePattern = "(" + startNamePattern + ")(" + escapedName + ")" + endNamePattern; + var nameRe = new RegExp(namePattern, "gi"); + forEachLine(lineMetadata(), function (line, lineIndex, inCode, onFence) { + if (includeCodeBlocks || (!inCode && !onFence)) { + var match = null; + var _loop_2 = function () { + var fullMatch = match[0], leftMatch = match[1], nameMatch = match[2]; + var index = match.index + leftMatch.length; + var length_1 = nameMatch.length; + if ((fullMatch.search(bareUrlRe) === -1) && + exclusions.every(function (span) { return ((lineIndex !== span[0]) || + (index + length_1 < span[1]) || + (index > span[1] + span[2])); })) { + addErrorDetailIf(onError, lineIndex + 1, name_1, nameMatch, null, null, [index + 1, length_1], { + "editColumn": index + 1, + "deleteCount": length_1, + "insertText": name_1 + }); } - }); + exclusions.push([lineIndex, index, length_1]); + }; + while ((match = nameRe.exec(line)) !== null) { + _loop_2(); + } } - } - forEachInlineChild(params, "text", forToken); - if (includeCodeBlocks) { - forEachInlineChild(params, "code_inline", forToken); - filterTokens(params, "code_block", forToken); - filterTokens(params, "fence", forToken); - } - }); + }); + }; + for (var _i = 0, names_1 = names; _i < names_1.length; _i++) { + var name_1 = names_1[_i]; + _loop_1(name_1); + } } }; diff --git a/lib/md044.js b/lib/md044.js index 41778e8c..d6f1187a 100644 --- a/lib/md044.js +++ b/lib/md044.js @@ -2,11 +2,9 @@ "use strict"; -const { addErrorDetailIf, bareUrlRe, escapeForRegExp, filterTokens, - forEachInlineChild, newLineRe } = require("../helpers"); - -const startNonWordRe = /^\W/; -const endNonWordRe = /\W$/; +const { addErrorDetailIf, bareUrlRe, escapeForRegExp, forEachLine, newLineRe, + forEachInlineCodeSpan } = require("../helpers"); +const { lineMetadata } = require("./cache"); module.exports = { "names": [ "MD044", "proper-names" ], @@ -15,80 +13,66 @@ module.exports = { "function": function MD044(params, onError) { let names = params.config.names; names = Array.isArray(names) ? names : []; + names.sort((a, b) => (b.length - a.length) || a.localeCompare(b)); const codeBlocks = params.config.code_blocks; const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks; - // Text of automatic hyperlinks is implicitly a URL - const autolinkText = new Set(); - filterTokens(params, "inline", (token) => { - let inAutoLink = false; - token.children.forEach((child) => { - const { info, type } = child; - if ((type === "link_open") && (info === "auto")) { - inAutoLink = true; - } else if (type === "link_close") { - inAutoLink = false; - } else if ((type === "text") && inAutoLink) { - autolinkText.add(child); + const exclusions = []; + if (!includeCodeBlocks) { + forEachInlineCodeSpan( + params.lines.join("\n"), + (code, lineIndex, columnIndex) => { + const codeLines = code.split(newLineRe); + // eslint-disable-next-line unicorn/no-for-loop + for (let i = 0; i < codeLines.length; i++) { + exclusions.push( + [ lineIndex + i, columnIndex, codeLines[i].length ] + ); + columnIndex = 0; + } + } + ); + } + for (const name of names) { + const escapedName = escapeForRegExp(name); + const startNamePattern = /^\W/.test(name) ? "" : "[^\\s([\"]*\\b_*"; + const endNamePattern = /\W$/.test(name) ? "" : "_*\\b[^\\s)\\]\"]*"; + const namePattern = + `(${startNamePattern})(${escapedName})${endNamePattern}`; + const nameRe = new RegExp(namePattern, "gi"); + forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => { + if (includeCodeBlocks || (!inCode && !onFence)) { + let match = null; + while ((match = nameRe.exec(line)) !== null) { + const [ fullMatch, leftMatch, nameMatch ] = match; + const index = match.index + leftMatch.length; + const length = nameMatch.length; + if ( + (fullMatch.search(bareUrlRe) === -1) && + exclusions.every((span) => ( + (lineIndex !== span[0]) || + (index + length < span[1]) || + (index > span[1] + span[2]) + )) + ) { + addErrorDetailIf( + onError, + lineIndex + 1, + name, + nameMatch, + null, + null, + [ index + 1, length ], + { + "editColumn": index + 1, + "deleteCount": length, + "insertText": name + } + ); + } + exclusions.push([ lineIndex, index, length ]); + } } }); - }); - // For each proper name... - names.forEach((name) => { - const escapedName = escapeForRegExp(name); - const startNamePattern = startNonWordRe.test(name) ? "" : "\\S*\\b"; - const endNamePattern = endNonWordRe.test(name) ? "" : "\\b\\S*"; - const namePattern = - `(${startNamePattern})(${escapedName})(${endNamePattern})`; - const anyNameRe = new RegExp(namePattern, "gi"); - // eslint-disable-next-line jsdoc/require-jsdoc - function forToken(token) { - if (!autolinkText.has(token)) { - const fenceOffset = (token.type === "fence") ? 1 : 0; - token.content.split(newLineRe).forEach((line, index) => { - let match = null; - while ((match = anyNameRe.exec(line)) !== null) { - const [ fullMatch, leftMatch, nameMatch, rightMatch ] = match; - if (fullMatch.search(bareUrlRe) === -1) { - const wordMatch = fullMatch - .replace(new RegExp(`^\\W{0,${leftMatch.length}}`), "") - .replace(new RegExp(`\\W{0,${rightMatch.length}}$`), ""); - if (!names.includes(wordMatch)) { - const lineNumber = token.lineNumber + index + fenceOffset; - const fullLine = params.lines[lineNumber - 1]; - const matchLength = wordMatch.length; - const matchIndex = fullLine.indexOf(wordMatch); - const range = (matchIndex === -1) ? - null : - [ matchIndex + 1, matchLength ]; - const fixInfo = (matchIndex === -1) ? - null : - { - "editColumn": matchIndex + 1, - "deleteCount": matchLength, - "insertText": name - }; - addErrorDetailIf( - onError, - lineNumber, - name, - nameMatch, - null, - null, - range, - fixInfo - ); - } - } - } - }); - } - } - forEachInlineChild(params, "text", forToken); - if (includeCodeBlocks) { - forEachInlineChild(params, "code_inline", forToken); - filterTokens(params, "code_block", forToken); - filterTokens(params, "fence", forToken); - } - }); + } } }; diff --git a/test/markdownlint-test-scenarios.js b/test/markdownlint-test-scenarios.js index 98beeaba..1254813e 100644 --- a/test/markdownlint-test-scenarios.js +++ b/test/markdownlint-test-scenarios.js @@ -29,6 +29,7 @@ function createTestForFile(file) { .then( function configFileExists() { return fs.promises.readFile(configFile, "utf8") + // @ts-ignore .then(JSON.parse); }, function noConfigFile() { diff --git a/test/proper-names-no-code.md b/test/proper-names-no-code.md index 66a0dc3a..488738d0 100644 --- a/test/proper-names-no-code.md +++ b/test/proper-names-no-code.md @@ -22,4 +22,22 @@ node.js is runtime A short paragraph about node.js and {MD044} -javascript. {MD044} +also javascript. {MD044} + +`javascript` + +`code +javascript` + +`code +javascript +code` + +`javascript +code` + +text JavaScript text `javascript` text JavaScript text +text `javascript` text JavaScript text `javascript` text + +text javascript text `javascript` text {MD044} +text `javascript` text javascript text {MD044} diff --git a/test/proper-names-projects.json b/test/proper-names-projects.json index 5b6fbc7f..71daf346 100644 --- a/test/proper-names-projects.json +++ b/test/proper-names-projects.json @@ -6,7 +6,6 @@ "github.com", "github.com/about", "npm", - "NPM", "Vue", "Vuex", "vue-router" diff --git a/test/proper-names-projects.md b/test/proper-names-projects.md index 6e304bf2..0360e14c 100644 --- a/test/proper-names-projects.md +++ b/test/proper-names-projects.md @@ -32,14 +32,16 @@ The library vue-router Not Vue-router {MD044} -Or vue-router-extra {MD044} +But vue-router-extra is different -Or extra-vue-router {MD044} +As is extra-vue-router Quoted "Vue" and "vue-router" Emphasized *Vue* and *vue-router* +Underscored _Vue_ and _vue-router_ + Call it npm -Or NPM But not Npm {MD044} +Or NPM {MD044} diff --git a/test/proper-names.md b/test/proper-names.md index b4ca9f03..57f5a7c2 100644 --- a/test/proper-names.md +++ b/test/proper-names.md @@ -72,12 +72,12 @@ javascript. {MD044} {MD044} `javascript` -{MD044} `code -javascript` +`code +javascript` {MD044} -{MD044} `code -javascript +`code +javascript {MD044} code` -{MD044} `javascript +`javascript {MD044} code` From 72543a82e76b46c54c3ac00f6e0a0fa447832ba6 Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 13 Jun 2021 13:07:03 -0700 Subject: [PATCH 14/36] Update re-implementation of MD044/proper-names to exclude link destinations and references. --- demo/markdownlint-browser.js | 37 +++++++++++++++++++++++-------- helpers/helpers.js | 6 ++++- lib/md044.js | 29 +++++++++++++++++++----- test/proper-names-links.md | 43 ++++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 16 deletions(-) create mode 100644 test/proper-names-links.md diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 71c25871..604e0481 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -51,7 +51,10 @@ module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/; // Regular expression for all instances of emphasis markers var emphasisMarkersRe = /[_*]/g; // Regular expression for inline links and shortcut reference links -var linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g; +var linkRe = /(\[(?:[^[\]]|\[[^\]]*\])*\])(\(\S*\)|\[\S*\])?/g; +module.exports.linkRe = linkRe; +// Regular expression for link reference definition lines +module.exports.linkReferenceRe = /^ {0,3}\[[^\]]+]:\s.*$/; // readFile options for reading with the UTF-8 encoding module.exports.utf8Encoding = "utf8"; // All punctuation characters (normal and full-width) @@ -3745,7 +3748,7 @@ module.exports = { "use strict"; // @ts-check -var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addErrorDetailIf = _a.addErrorDetailIf, bareUrlRe = _a.bareUrlRe, escapeForRegExp = _a.escapeForRegExp, forEachLine = _a.forEachLine, newLineRe = _a.newLineRe, forEachInlineCodeSpan = _a.forEachInlineCodeSpan; +var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addErrorDetailIf = _a.addErrorDetailIf, bareUrlRe = _a.bareUrlRe, escapeForRegExp = _a.escapeForRegExp, forEachLine = _a.forEachLine, linkRe = _a.linkRe, linkReferenceRe = _a.linkReferenceRe, newLineRe = _a.newLineRe, forEachInlineCodeSpan = _a.forEachInlineCodeSpan; var lineMetadata = __webpack_require__(/*! ./cache */ "../lib/cache.js").lineMetadata; module.exports = { "names": ["MD044", "proper-names"], @@ -3758,6 +3761,23 @@ module.exports = { var codeBlocks = params.config.code_blocks; var includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks; var exclusions = []; + forEachLine(lineMetadata(), function (line, lineIndex) { + if (linkReferenceRe.test(line)) { + exclusions.push([lineIndex, 0, line.length]); + } + else { + var match = null; + while ((match = bareUrlRe.exec(line)) !== null) { + exclusions.push([lineIndex, match.index, match[0].length]); + } + while ((match = linkRe.exec(line)) !== null) { + var text = match[1], destination = match[2]; + if (destination) { + exclusions.push([lineIndex, match.index + text.length, destination.length]); + } + } + } + }); if (!includeCodeBlocks) { forEachInlineCodeSpan(params.lines.join("\n"), function (code, lineIndex, columnIndex) { var codeLines = code.split(newLineRe); @@ -3770,21 +3790,20 @@ module.exports = { } var _loop_1 = function (name_1) { var escapedName = escapeForRegExp(name_1); - var startNamePattern = /^\W/.test(name_1) ? "" : "[^\\s([\"]*\\b_*"; - var endNamePattern = /\W$/.test(name_1) ? "" : "_*\\b[^\\s)\\]\"]*"; + var startNamePattern = /^\W/.test(name_1) ? "" : "\\b_*"; + var endNamePattern = /\W$/.test(name_1) ? "" : "_*\\b"; var namePattern = "(" + startNamePattern + ")(" + escapedName + ")" + endNamePattern; var nameRe = new RegExp(namePattern, "gi"); forEachLine(lineMetadata(), function (line, lineIndex, inCode, onFence) { if (includeCodeBlocks || (!inCode && !onFence)) { var match = null; var _loop_2 = function () { - var fullMatch = match[0], leftMatch = match[1], nameMatch = match[2]; + var leftMatch = match[1], nameMatch = match[2]; var index = match.index + leftMatch.length; var length_1 = nameMatch.length; - if ((fullMatch.search(bareUrlRe) === -1) && - exclusions.every(function (span) { return ((lineIndex !== span[0]) || - (index + length_1 < span[1]) || - (index > span[1] + span[2])); })) { + if (exclusions.every(function (span) { return ((lineIndex !== span[0]) || + (index + length_1 < span[1]) || + (index > span[1] + span[2])); })) { addErrorDetailIf(onError, lineIndex + 1, name_1, nameMatch, null, null, [index + 1, length_1], { "editColumn": index + 1, "deleteCount": length_1, diff --git a/helpers/helpers.js b/helpers/helpers.js index 52ca1470..5c6f58e6 100644 --- a/helpers/helpers.js +++ b/helpers/helpers.js @@ -29,7 +29,11 @@ module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/; const emphasisMarkersRe = /[_*]/g; // Regular expression for inline links and shortcut reference links -const linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g; +const linkRe = /(\[(?:[^[\]]|\[[^\]]*\])*\])(\(\S*\)|\[\S*\])?/g; +module.exports.linkRe = linkRe; + +// Regular expression for link reference definition lines +module.exports.linkReferenceRe = /^ {0,3}\[[^\]]+]:\s.*$/; // readFile options for reading with the UTF-8 encoding module.exports.utf8Encoding = "utf8"; diff --git a/lib/md044.js b/lib/md044.js index d6f1187a..af3b1ce7 100644 --- a/lib/md044.js +++ b/lib/md044.js @@ -2,8 +2,8 @@ "use strict"; -const { addErrorDetailIf, bareUrlRe, escapeForRegExp, forEachLine, newLineRe, - forEachInlineCodeSpan } = require("../helpers"); +const { addErrorDetailIf, bareUrlRe, escapeForRegExp, forEachLine, linkRe, + linkReferenceRe, newLineRe, forEachInlineCodeSpan } = require("../helpers"); const { lineMetadata } = require("./cache"); module.exports = { @@ -17,6 +17,24 @@ module.exports = { const codeBlocks = params.config.code_blocks; const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks; const exclusions = []; + forEachLine(lineMetadata(), (line, lineIndex) => { + if (linkReferenceRe.test(line)) { + exclusions.push([ lineIndex, 0, line.length ]); + } else { + let match = null; + while ((match = bareUrlRe.exec(line)) !== null) { + exclusions.push([ lineIndex, match.index, match[0].length ]); + } + while ((match = linkRe.exec(line)) !== null) { + const [ , text, destination ] = match; + if (destination) { + exclusions.push( + [ lineIndex, match.index + text.length, destination.length ] + ); + } + } + } + }); if (!includeCodeBlocks) { forEachInlineCodeSpan( params.lines.join("\n"), @@ -34,8 +52,8 @@ module.exports = { } for (const name of names) { const escapedName = escapeForRegExp(name); - const startNamePattern = /^\W/.test(name) ? "" : "[^\\s([\"]*\\b_*"; - const endNamePattern = /\W$/.test(name) ? "" : "_*\\b[^\\s)\\]\"]*"; + const startNamePattern = /^\W/.test(name) ? "" : "\\b_*"; + const endNamePattern = /\W$/.test(name) ? "" : "_*\\b"; const namePattern = `(${startNamePattern})(${escapedName})${endNamePattern}`; const nameRe = new RegExp(namePattern, "gi"); @@ -43,11 +61,10 @@ module.exports = { if (includeCodeBlocks || (!inCode && !onFence)) { let match = null; while ((match = nameRe.exec(line)) !== null) { - const [ fullMatch, leftMatch, nameMatch ] = match; + const [ , leftMatch, nameMatch ] = match; const index = match.index + leftMatch.length; const length = nameMatch.length; if ( - (fullMatch.search(bareUrlRe) === -1) && exclusions.every((span) => ( (lineIndex !== span[0]) || (index + length < span[1]) || diff --git a/test/proper-names-links.md b/test/proper-names-links.md new file mode 100644 index 00000000..46d42a62 --- /dev/null +++ b/test/proper-names-links.md @@ -0,0 +1,43 @@ +# Proper names in links + +javascript {MD044} + +Learn about JavaScript here: https://example.com/javascript/about + +Learn about JavaScript here: + +Learn about [JavaScript](https://example.com/javascript/about). + +Learn about [JavaScript](wiki/javascript/about). + +Learn about [JavaScript](wiki/javascript). + +Learn about [JavaScript](javascript/about). + +Learn about [JavaScript](javascript). + +Learn about [JavaScript][js]. + +Learn about [JavaScript][example-js]. + +Learn about [JavaScript][javascript]. + +Learn about [javascript][js]. {MD044} + +Learn about [javascript][example-js]. {MD044} + +Learn about [javascript]. {MD044} + +[js]: https://example.com/javascript/about + [example-js]: javascript + [javascript]: https://example.com/js + [javascript]: https://example.com/js {MD044} + + From 7b810c48a9578b16d2e7e38b9bde525a4f4a8987 Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 13 Jun 2021 15:05:03 -0700 Subject: [PATCH 15/36] Add exclusion for test repo file with newly-reported violation (remove outdated exclusion). --- test/markdownlint-test-repos.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/markdownlint-test-repos.js b/test/markdownlint-test-repos.js index 14bc3618..ea48a6e9 100644 --- a/test/markdownlint-test-repos.js +++ b/test/markdownlint-test-repos.js @@ -102,11 +102,10 @@ if (existsSync(dotnetDocsDir)) { const globPatterns = [ join(rootDir, "**/*.md"), "!" + join(rootDir, "samples/**/*.md"), - // A table parsing change in markdown-it v12 causes a new issue here + // MD044 newly detects an issue in this file "!" + join( rootDir, - "docs/standard/base-types/" + - "regular-expression-example-scanning-for-hrefs.md" + "docs/framework/wcf/feature-details/configuring-iis-for-wcf.md" ) ]; const configPath = join(rootDir, ".markdownlint.json"); From 427057dd1e08f10b5938eb4aeba9f46967cb5330 Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 13 Jun 2021 16:37:29 -0700 Subject: [PATCH 16/36] Add to test-repos script: mochajs/mocha, webhintio/hint, webpack.js.org, v8-v8-dev. --- README.md | 1 - package.json | 12 +++++++-- test/markdownlint-test-repos.js | 44 ++++++++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7a0108e4..189381ec 100644 --- a/README.md +++ b/README.md @@ -848,7 +848,6 @@ following projects or one of the tools in the [Related section](#Related): * [Reactable](https://glittershark.github.io/reactable/) ([Search repository](https://github.com/glittershark/reactable/search?q=markdownlint)) * [Sinon.JS](https://sinonjs.org/) ([Search repository](https://github.com/sinonjs/sinon/search?q=markdownlint)) * [TestCafe](https://devexpress.github.io/testcafe/) ([Search repository](https://github.com/DevExpress/testcafe/search?q=markdownlint)) -* [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/basic-types.html) ([Search repository](https://github.com/Microsoft/TypeScript-Handbook/search?q=markdownlint)) * [V8](https://v8.dev/) ([Search repository](https://github.com/v8/v8.dev/search?q=markdownlint)) * [webhint](https://webhint.io/) ([Search repository](https://github.com/webhintio/hint/search?q=markdownlint)) * [webpack](https://webpack.js.org/) ([Search repository](https://github.com/webpack/webpack.js.org/search?q=markdownlint)) diff --git a/package.json b/package.json index d23ce7b1..639b10c9 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,16 @@ "build-example": "npm install --no-save --ignore-scripts grunt grunt-cli gulp through2", "ci": "npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code", "clean-test-repos": "rimraf test-repos", - "clone-test-repos": "mkdir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet", - "clone-test-repos-large": "npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet", + "clone-test-repos-dotnet-docs": "cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet", + "clone-test-repos-eslint-eslint": "cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet", + "clone-test-repos-mkdocs-mkdocs": "cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet", + "clone-test-repos-mochajs-mocha": "cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet", + "clone-test-repos-pi-hole-docs": "cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet", + "clone-test-repos-v8-v8-dev": "cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet", + "clone-test-repos-webhintio-hint": "cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet", + "clone-test-repos-webpack-webpack-js-org": "cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet", + "clone-test-repos": "mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org", + "clone-test-repos-large": "npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev", "declaration": "npm run build-declaration && npm run test-declaration", "example": "cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint", "lint": "eslint --max-warnings 0 .", diff --git a/test/markdownlint-test-repos.js b/test/markdownlint-test-repos.js index ea48a6e9..16781be6 100644 --- a/test/markdownlint-test-repos.js +++ b/test/markdownlint-test-repos.js @@ -54,6 +54,7 @@ function lintTestRepo(t, globPatterns, configPath) { files, config }; + console.log(`${t.title}: Linting ${files.length} files...`); return markdownlintPromise(options).then((results) => { const resultsString = results.toString(); if (resultsString.length > 0) { @@ -79,13 +80,27 @@ test("https://github.com/mkdocs/mkdocs", (t) => { const globPatterns = [ join(rootDir, "README.md"), join(rootDir, "CONTRIBUTING.md"), - join(rootDir, "docs/*"), + join(rootDir, "docs/**/*.md"), "!" + join(rootDir, "docs/CNAME") ]; const configPath = join(rootDir, ".markdownlintrc"); return lintTestRepo(t, globPatterns, configPath); }); +test("https://github.com/mochajs/mocha", (t) => { + const rootDir = "./test-repos/mochajs-mocha"; + const globPatterns = [ + join(rootDir, "*.md"), + join(rootDir, "docs/**/*.md"), + join(rootDir, ".github/*.md"), + join(rootDir, "lib/**/*.md"), + join(rootDir, "test/**/*.md"), + join(rootDir, "example/**/*.md") + ]; + const configPath = join(rootDir, ".markdownlint.json"); + return lintTestRepo(t, globPatterns, configPath); +}); + test("https://github.com/pi-hole/docs", (t) => { const rootDir = "./test-repos/pi-hole-docs"; const globPatterns = [ join(rootDir, "**/*.md") ]; @@ -93,6 +108,23 @@ test("https://github.com/pi-hole/docs", (t) => { return lintTestRepo(t, globPatterns, configPath); }); +test("https://github.com/webhintio/hint", (t) => { + const rootDir = "./test-repos/webhintio-hint"; + const globPatterns = [ + join(rootDir, "**/*.md"), + "!" + join(rootDir, "**/CHANGELOG.md") + ]; + const configPath = join(rootDir, ".markdownlintrc"); + return lintTestRepo(t, globPatterns, configPath); +}); + +test("https://github.com/webpack/webpack.js.org", (t) => { + const rootDir = "./test-repos/webpack-webpack-js-org"; + const globPatterns = [ join(rootDir, "**/*.md") ]; + const configPath = join(rootDir, ".markdownlint.json"); + return lintTestRepo(t, globPatterns, configPath); +}); + // Optional repositories (very large) const dotnetDocsDir = "./test-repos/dotnet-docs"; @@ -112,3 +144,13 @@ if (existsSync(dotnetDocsDir)) { return lintTestRepo(t, globPatterns, configPath); }); } + +const v8v8DevDir = "./test-repos/v8-v8-dev"; +if (existsSync(v8v8DevDir)) { + test("https://github.com/v8/v8.dev", (t) => { + const rootDir = v8v8DevDir; + const globPatterns = [ join(rootDir, "src/**/*.md") ]; + const configPath = join(rootDir, ".markdownlint.json"); + return lintTestRepo(t, globPatterns, configPath); + }); +} From cebde8f9f622be7d59902c09f489c99732b04afd Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 13 Jun 2021 16:45:38 -0700 Subject: [PATCH 17/36] Suppress unwanted no-console linting violation in test script, update browser script. --- demo/markdownlint-browser.js | 2 +- test/markdownlint-test-repos.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 604e0481..641c098e 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -4026,7 +4026,7 @@ module.exports = rules; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"markdownlint","version":"0.23.1","description":"A Node.js style checker and lint tool for Markdown/CommonMark files.","main":"lib/markdownlint.js","types":"lib/markdownlint.d.ts","author":"David Anson (https://dlaa.me/)","license":"MIT","homepage":"https://github.com/DavidAnson/markdownlint","repository":{"type":"git","url":"https://github.com/DavidAnson/markdownlint.git"},"bugs":"https://github.com/DavidAnson/markdownlint/issues","scripts":{"build-config":"npm run build-config-schema && npm run build-config-example","build-config-example":"node schema/build-config-example.js","build-config-schema":"node schema/build-config-schema.js","build-declaration":"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf \'lib/{c,md,r}*.d.ts\' \'helpers/*.d.ts\'","build-demo":"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats","build-example":"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2","ci":"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code","clean-test-repos":"rimraf test-repos","clone-test-repos":"mkdir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet","clone-test-repos-large":"npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet","declaration":"npm run build-declaration && npm run test-declaration","example":"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint","lint":"eslint --max-warnings 0 .","lint-test-repos":"ava --timeout=5m test/markdownlint-test-repos.js","test":"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js","test-cover":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test","test-declaration":"cd example/typescript && tsc && node type-check.js","test-extra":"ava --timeout=5m test/markdownlint-test-extra.js"},"engines":{"node":">=10"},"dependencies":{"markdown-it":"12.0.6"},"devDependencies":{"ava":"~3.15.0","c8":"~7.7.2","cpy-cli":"~3.1.1","eslint":"~7.28.0","eslint-plugin-jsdoc":"~35.1.3","eslint-plugin-node":"~11.1.0","eslint-plugin-unicorn":"~33.0.1","globby":"~11.0.3","js-yaml":"~4.1.0","markdown-it-for-inline":"~0.1.1","markdown-it-sub":"~1.0.0","markdown-it-sup":"~1.0.0","markdown-it-texmath":"~0.9.0","markdownlint-rule-helpers":"~0.14.0","npm-run-all":"~4.1.5","rimraf":"~3.0.2","strip-json-comments":"~3.1.1","toml":"~3.0.0","ts-loader":"~9.2.3","tv4":"~1.3.0","typescript":"~4.3.2","webpack":"~5.38.1","webpack-cli":"~4.7.2"},"keywords":["markdown","lint","md","CommonMark","markdownlint"]}'); +module.exports = JSON.parse('{"name":"markdownlint","version":"0.23.1","description":"A Node.js style checker and lint tool for Markdown/CommonMark files.","main":"lib/markdownlint.js","types":"lib/markdownlint.d.ts","author":"David Anson (https://dlaa.me/)","license":"MIT","homepage":"https://github.com/DavidAnson/markdownlint","repository":{"type":"git","url":"https://github.com/DavidAnson/markdownlint.git"},"bugs":"https://github.com/DavidAnson/markdownlint/issues","scripts":{"build-config":"npm run build-config-schema && npm run build-config-example","build-config-example":"node schema/build-config-example.js","build-config-schema":"node schema/build-config-schema.js","build-declaration":"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf \'lib/{c,md,r}*.d.ts\' \'helpers/*.d.ts\'","build-demo":"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats","build-example":"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2","ci":"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code","clean-test-repos":"rimraf test-repos","clone-test-repos-dotnet-docs":"cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet","clone-test-repos-eslint-eslint":"cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet","clone-test-repos-mkdocs-mkdocs":"cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet","clone-test-repos-mochajs-mocha":"cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet","clone-test-repos-pi-hole-docs":"cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet","clone-test-repos-v8-v8-dev":"cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet","clone-test-repos-webhintio-hint":"cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet","clone-test-repos-webpack-webpack-js-org":"cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet","clone-test-repos":"mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org","clone-test-repos-large":"npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev","declaration":"npm run build-declaration && npm run test-declaration","example":"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint","lint":"eslint --max-warnings 0 .","lint-test-repos":"ava --timeout=5m test/markdownlint-test-repos.js","test":"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js","test-cover":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test","test-declaration":"cd example/typescript && tsc && node type-check.js","test-extra":"ava --timeout=5m test/markdownlint-test-extra.js"},"engines":{"node":">=10"},"dependencies":{"markdown-it":"12.0.6"},"devDependencies":{"ava":"~3.15.0","c8":"~7.7.2","cpy-cli":"~3.1.1","eslint":"~7.28.0","eslint-plugin-jsdoc":"~35.1.3","eslint-plugin-node":"~11.1.0","eslint-plugin-unicorn":"~33.0.1","globby":"~11.0.3","js-yaml":"~4.1.0","markdown-it-for-inline":"~0.1.1","markdown-it-sub":"~1.0.0","markdown-it-sup":"~1.0.0","markdown-it-texmath":"~0.9.0","markdownlint-rule-helpers":"~0.14.0","npm-run-all":"~4.1.5","rimraf":"~3.0.2","strip-json-comments":"~3.1.1","toml":"~3.0.0","ts-loader":"~9.2.3","tv4":"~1.3.0","typescript":"~4.3.2","webpack":"~5.38.1","webpack-cli":"~4.7.2"},"keywords":["markdown","lint","md","CommonMark","markdownlint"]}'); /***/ }), diff --git a/test/markdownlint-test-repos.js b/test/markdownlint-test-repos.js index 16781be6..fbfb0e05 100644 --- a/test/markdownlint-test-repos.js +++ b/test/markdownlint-test-repos.js @@ -54,6 +54,7 @@ function lintTestRepo(t, globPatterns, configPath) { files, config }; + // eslint-disable-next-line no-console console.log(`${t.title}: Linting ${files.length} files...`); return markdownlintPromise(options).then((results) => { const resultsString = results.toString(); From 02240fac987239a1e9adb23e452d358da6a6776a Mon Sep 17 00:00:00 2001 From: David Anson Date: Mon, 14 Jun 2021 22:30:35 -0700 Subject: [PATCH 18/36] Add missing lineNumber property to FixInfo type (fixes #405). --- example/typescript/type-check.ts | 15 ++++++++------- lib/markdownlint.d.ts | 4 ++++ lib/markdownlint.js | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/example/typescript/type-check.ts b/example/typescript/type-check.ts index def7d776..3d0ee90b 100644 --- a/example/typescript/type-check.ts +++ b/example/typescript/type-check.ts @@ -34,13 +34,14 @@ function assertLintResults(results: markdownlint.LintResults) { assert.equal(results["string"][0].errorDetail, null); assert.equal(results["string"][0].errorContext, null); assert.deepEqual(results["string"][0].errorRange, [ 9, 1 ]); - assert(!!results["string"][0].fixInfo); - // @ts-ignore - assert.equal(results["string"][0].fixInfo.editColumn, 10); - // @ts-ignore - assert(!results["string"][0].fixInfo.deleteCount); - // @ts-ignore - assert.equal(results["string"][0].fixInfo.insertText, "\n"); + const fixInfo = results["string"][0].fixInfo; + assert(!!fixInfo); + if (fixInfo) { + assert.equal(fixInfo.lineNumber, null); + assert.equal(fixInfo.editColumn, 10); + assert(!fixInfo.deleteCount); + assert.equal(fixInfo.insertText, "\n"); + } assert.equal(results["../bad.md"].length, 2); // Deliberate assignment to unused variable validates types // False-positive for js/useless-assignment-to-local diff --git a/lib/markdownlint.d.ts b/lib/markdownlint.d.ts index b38c7836..e344bd0d 100644 --- a/lib/markdownlint.d.ts +++ b/lib/markdownlint.d.ts @@ -316,6 +316,10 @@ type LintError = { * Fix information. */ type FixInfo = { + /** + * Line number (1-based). + */ + lineNumber?: number; /** * Column of the fix (1-based). */ diff --git a/lib/markdownlint.js b/lib/markdownlint.js index ee7e8bcc..ebc86282 100644 --- a/lib/markdownlint.js +++ b/lib/markdownlint.js @@ -1196,6 +1196,7 @@ module.exports = markdownlint; * Fix information. * * @typedef {Object} FixInfo + * @property {number} [lineNumber] Line number (1-based). * @property {number} [editColumn] Column of the fix (1-based). * @property {number} [deleteCount] Count of characters to delete. * @property {string} [insertText] Text to insert (after deleting). From 5f0f7653e03a3c26f08d5dbaf31e5e2a91d64636 Mon Sep 17 00:00:00 2001 From: David Anson Date: Mon, 14 Jun 2021 22:47:24 -0700 Subject: [PATCH 19/36] Update all "detailed-results" tests to use resultVersion 3 (based on current output). --- ...detailed-results-4-tabs-MD010.results.json | 59 +- .../detailed-results-MD001-MD010.results.json | 377 +++++--- .../detailed-results-MD011-MD021.results.json | 330 ++++--- .../detailed-results-MD022-MD030.results.json | 315 ++++--- ...results-MD030-warning-message.results.json | 56 +- .../detailed-results-MD031-MD040.results.json | 842 ++++++++++++------ .../detailed-results-MD041-MD050.results.json | 325 ++++--- test/detailed-results-bare-urls.results.json | 210 +++-- ...ts-blanks-around-headings-0-2.results.json | 52 +- ...ts-blanks-around-headings-3-0.results.json | 50 +- ...esults-blanks-around-headings.results.json | 93 +- ...ts-code-fences-in-blockquotes.results.json | 168 ++-- ...-results-default-spaces-MD010.results.json | 59 +- ...ults-fixing-with-front-matter.results.json | 136 ++- ...detailed-results-front-matter.results.json | 51 +- test/detailed-results-html-tags.results.json | 493 ++++++---- test/detailed-results-links.results.json | 381 +++++--- ...sults-no-tabs-edge-case-MD010.results.json | 59 +- ...dered-list-item-prefix-single.results.json | 27 +- ...ordered-list-item-prefix-zero.results.json | 152 ++-- ...detailed-results-proper-names.results.json | 560 +++++++----- test/markdownlint-test-scenarios.js | 2 +- 22 files changed, 3152 insertions(+), 1645 deletions(-) diff --git a/test/detailed-results-4-tabs-MD010.results.json b/test/detailed-results-4-tabs-MD010.results.json index b0a97c51..9da12090 100644 --- a/test/detailed-results-4-tabs-MD010.results.json +++ b/test/detailed-results-4-tabs-MD010.results.json @@ -1,29 +1,62 @@ [ { - "errorContext": null, - "errorDetail": "Column: 1", - "errorRange": [1, 13], "lineNumber": 1, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], "ruleDescription": "Hard tabs", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "ruleNames": ["MD010", "no-hard-tabs"] + "errorDetail": "Column: 1", + "errorContext": null, + "errorRange": [ + 1, + 13 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 13, + "insertText": " " + } }, { - "errorContext": null, - "errorDetail": "Column: 5", - "errorRange": [5, 2], "lineNumber": 2, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], "ruleDescription": "Hard tabs", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "ruleNames": ["MD010", "no-hard-tabs"] + "errorDetail": "Column: 5", + "errorContext": null, + "errorRange": [ + 5, + 2 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 2, + "insertText": " " + } }, { - "errorContext": null, - "errorDetail": "Column: 27", - "errorRange": [27, 3], "lineNumber": 3, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], "ruleDescription": "Hard tabs", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "ruleNames": ["MD010", "no-hard-tabs"] + "errorDetail": "Column: 27", + "errorContext": null, + "errorRange": [ + 27, + 3 + ], + "fixInfo": { + "editColumn": 27, + "deleteCount": 3, + "insertText": " " + } } -] +] \ No newline at end of file diff --git a/test/detailed-results-MD001-MD010.results.json b/test/detailed-results-MD001-MD010.results.json index a821b7ce..7e4baf47 100644 --- a/test/detailed-results-MD001-MD010.results.json +++ b/test/detailed-results-MD001-MD010.results.json @@ -1,128 +1,255 @@ [ - { - "lineNumber": 3, - "ruleNames": [ "MD001", "heading-increment", "header-increment" ], - "ruleDescription": "Heading levels should only increment by one level at a time", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md001", - "errorDetail": "Expected: h3; Actual: h4", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 1, - "ruleNames": [ "MD002", "first-heading-h1", "first-header-h1" ], - "ruleDescription": "First heading should be a top-level heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md002", - "errorDetail": "Expected: h1; Actual: h2", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 5, - "ruleNames": [ "MD003", "heading-style", "header-style" ], - "ruleDescription": "Heading style", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md003", - "errorDetail": "Expected: atx; Actual: atx_closed", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 10, - "ruleNames": [ "MD004", "ul-style" ], - "ruleDescription": "Unordered list style", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md004", - "errorDetail": "Expected: asterisk; Actual: dash", - "errorContext": null, - "errorRange": [1, 2] - }, - { - "lineNumber": 8, - "ruleNames": [ "MD005", "list-indent" ], - "ruleDescription": "Inconsistent indentation for list items at the same level", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 23, - "ruleNames": [ "MD005", "list-indent" ], - "ruleDescription": "Inconsistent indentation for list items at the same level", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", - "errorDetail": "Expected: 1; Actual: 0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 29, - "ruleNames": [ "MD005", "list-indent" ], - "ruleDescription": "Inconsistent indentation for list items at the same level", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", - "errorDetail": "Expected: (3); Actual: (4)", - "errorContext": null, - "errorRange": [1, 5] - }, - { - "lineNumber": 12, - "ruleNames": [ "MD006", "ul-start-left" ], - "ruleDescription": "Consider starting bulleted lists at the beginning of the line", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md006", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 13, - "ruleNames": [ "MD006", "ul-start-left" ], - "ruleDescription": "Consider starting bulleted lists at the beginning of the line", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md006", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 8, - "ruleNames": [ "MD007", "ul-indent" ], - "ruleDescription": "Unordered list indentation", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 12, - "ruleNames": [ "MD007", "ul-indent" ], - "ruleDescription": "Unordered list indentation", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 13, - "ruleNames": [ "MD007", "ul-indent" ], - "ruleDescription": "Unordered list indentation", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 15, - "ruleNames": [ "MD009", "no-trailing-spaces" ], - "ruleDescription": "Trailing spaces", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", - "errorDetail": "Expected: 0 or 2; Actual: 1", - "errorContext": null, - "errorRange": [5, 1] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD010", "no-hard-tabs" ], - "ruleDescription": "Hard tabs", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "errorDetail": "Column: 5", - "errorContext": null, - "errorRange": [5, 1] + { + "lineNumber": 3, + "ruleNames": [ + "MD001", + "heading-increment", + "header-increment" + ], + "ruleDescription": "Heading levels should only increment by one level at a time", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md001", + "errorDetail": "Expected: h3; Actual: h4", + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 1, + "ruleNames": [ + "MD002", + "first-heading-h1", + "first-header-h1" + ], + "ruleDescription": "First heading should be a top-level heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md002", + "errorDetail": "Expected: h1; Actual: h2", + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD003", + "heading-style", + "header-style" + ], + "ruleDescription": "Heading style", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md003", + "errorDetail": "Expected: atx; Actual: atx_closed", + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 10, + "ruleNames": [ + "MD004", + "ul-style" + ], + "ruleDescription": "Unordered list style", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md004", + "errorDetail": "Expected: asterisk; Actual: dash", + "errorContext": null, + "errorRange": [ + 1, + 2 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1, + "insertText": "*" } + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD005", + "list-indent" + ], + "ruleDescription": "Inconsistent indentation for list items at the same level", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 23, + "ruleNames": [ + "MD005", + "list-indent" + ], + "ruleDescription": "Inconsistent indentation for list items at the same level", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", + "errorDetail": "Expected: 1; Actual: 0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 0, + "insertText": " " + } + }, + { + "lineNumber": 29, + "ruleNames": [ + "MD005", + "list-indent" + ], + "ruleDescription": "Inconsistent indentation for list items at the same level", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md005", + "errorDetail": "Expected: (3); Actual: (4)", + "errorContext": null, + "errorRange": [ + 1, + 5 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1, + "insertText": "" + } + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD006", + "ul-start-left" + ], + "ruleDescription": "Consider starting bulleted lists at the beginning of the line", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md006", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "deleteCount": 1 + } + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD006", + "ul-start-left" + ], + "ruleDescription": "Consider starting bulleted lists at the beginning of the line", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md006", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "deleteCount": 1 + } + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD007", + "ul-indent" + ], + "ruleDescription": "Unordered list indentation", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1, + "insertText": "" + } + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD007", + "ul-indent" + ], + "ruleDescription": "Unordered list indentation", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1, + "insertText": "" + } + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD007", + "ul-indent" + ], + "ruleDescription": "Unordered list indentation", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md007", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1, + "insertText": "" + } + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD009", + "no-trailing-spaces" + ], + "ruleDescription": "Trailing spaces", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", + "errorDetail": "Expected: 0 or 2; Actual: 1", + "errorContext": null, + "errorRange": [ + 5, + 1 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 1 + } + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], + "ruleDescription": "Hard tabs", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", + "errorDetail": "Column: 5", + "errorContext": null, + "errorRange": [ + 5, + 1 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 1, + "insertText": " " + } + } ] \ No newline at end of file diff --git a/test/detailed-results-MD011-MD021.results.json b/test/detailed-results-MD011-MD021.results.json index 954d9ea7..f55d4358 100644 --- a/test/detailed-results-MD011-MD021.results.json +++ b/test/detailed-results-MD011-MD021.results.json @@ -1,110 +1,226 @@ [ - { - "lineNumber": 5, - "ruleNames": [ "MD011", "no-reversed-links" ], - "ruleDescription": "Reversed link syntax", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", - "errorDetail": "(reversed)[link]", - "errorContext": null, - "errorRange": [3, 16] - }, - { - "lineNumber": 26, - "ruleNames": [ "MD011", "no-reversed-links" ], - "ruleDescription": "Reversed link syntax", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", - "errorDetail": "(reversed)[link]", - "errorContext": null, - "errorRange": [11, 16] - }, - { - "lineNumber": 7, - "ruleNames": [ "MD012", "no-multiple-blanks" ], - "ruleDescription": "Multiple consecutive blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md012", - "errorDetail": "Expected: 1; Actual: 2", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 8, - "ruleNames": [ "MD013", "line-length" ], - "ruleDescription": "Line length", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md013", - "errorDetail": "Expected: 80; Actual: 99", - "errorContext": null, - "errorRange": [81, 19] - }, - { - "lineNumber": 10, - "ruleNames": [ "MD013", "line-length" ], - "ruleDescription": "Line length", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md013", - "errorDetail": "Expected: 40; Actual: 62", - "errorContext": null, - "errorRange": [41, 22] - }, - { - "lineNumber": 12, - "ruleNames": [ "MD014", "commands-show-output" ], - "ruleDescription": "Dollar signs used before commands without showing output", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md014", - "errorDetail": null, - "errorContext": "$ command with no output", - "errorRange": [5, 2] - }, - { - "lineNumber": 14, - "ruleNames": [ "MD018", "no-missing-space-atx" ], - "ruleDescription": "No space after hash on atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md018", - "errorDetail": null, - "errorContext": "##No space A", - "errorRange": [1, 3] - }, - { - "lineNumber": 16, - "ruleNames": [ "MD019", "no-multiple-space-atx" ], - "ruleDescription": "Multiple spaces after hash on atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md019", - "errorDetail": null, - "errorContext": "## Multiple spaces B", - "errorRange": [1, 5] - }, - { - "lineNumber": 18, - "ruleNames": [ "MD020", "no-missing-space-closed-atx" ], - "ruleDescription": "No space inside hashes on closed atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md020", - "errorDetail": null, - "errorContext": "##No space C ##", - "errorRange": [1, 3] - }, - { - "lineNumber": 20, - "ruleNames": [ "MD020", "no-missing-space-closed-atx" ], - "ruleDescription": "No space inside hashes on closed atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md020", - "errorDetail": null, - "errorContext": "## No space D##", - "errorRange": [13, 3] - }, - { - "lineNumber": 22, - "ruleNames": [ "MD021", "no-multiple-space-closed-atx" ], - "ruleDescription": "Multiple spaces inside hashes on closed atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md021", - "errorDetail": null, - "errorContext": "## Multiple spaces E ##", - "errorRange": [1, 5] - }, - { - "lineNumber": 24, - "ruleNames": [ "MD021", "no-multiple-space-closed-atx" ], - "ruleDescription": "Multiple spaces inside hashes on closed atx style heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md021", - "errorDetail": null, - "errorContext": "## Multiple spaces F ##", - "errorRange": [20, 5] + { + "lineNumber": 5, + "ruleNames": [ + "MD011", + "no-reversed-links" + ], + "ruleDescription": "Reversed link syntax", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", + "errorDetail": "(reversed)[link]", + "errorContext": null, + "errorRange": [ + 3, + 16 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 16, + "insertText": "[reversed](link)" } + }, + { + "lineNumber": 26, + "ruleNames": [ + "MD011", + "no-reversed-links" + ], + "ruleDescription": "Reversed link syntax", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", + "errorDetail": "(reversed)[link]", + "errorContext": null, + "errorRange": [ + 11, + 16 + ], + "fixInfo": { + "editColumn": 11, + "deleteCount": 16, + "insertText": "[reversed](link)" + } + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD012", + "no-multiple-blanks" + ], + "ruleDescription": "Multiple consecutive blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md012", + "errorDetail": "Expected: 1; Actual: 2", + "errorContext": null, + "errorRange": null, + "fixInfo": { + "deleteCount": -1 + } + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD013", + "line-length" + ], + "ruleDescription": "Line length", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md013", + "errorDetail": "Expected: 80; Actual: 99", + "errorContext": null, + "errorRange": [ + 81, + 19 + ], + "fixInfo": null + }, + { + "lineNumber": 10, + "ruleNames": [ + "MD013", + "line-length" + ], + "ruleDescription": "Line length", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md013", + "errorDetail": "Expected: 40; Actual: 62", + "errorContext": null, + "errorRange": [ + 41, + 22 + ], + "fixInfo": null + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD014", + "commands-show-output" + ], + "ruleDescription": "Dollar signs used before commands without showing output", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md014", + "errorDetail": null, + "errorContext": "$ command with no output", + "errorRange": [ + 5, + 2 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 2 + } + }, + { + "lineNumber": 14, + "ruleNames": [ + "MD018", + "no-missing-space-atx" + ], + "ruleDescription": "No space after hash on atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md018", + "errorDetail": null, + "errorContext": "##No space A", + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 3, + "insertText": " " + } + }, + { + "lineNumber": 16, + "ruleNames": [ + "MD019", + "no-multiple-space-atx" + ], + "ruleDescription": "Multiple spaces after hash on atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md019", + "errorDetail": null, + "errorContext": "## Multiple spaces B", + "errorRange": [ + 1, + 5 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 1 + } + }, + { + "lineNumber": 18, + "ruleNames": [ + "MD020", + "no-missing-space-closed-atx" + ], + "ruleDescription": "No space inside hashes on closed atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md020", + "errorDetail": null, + "errorContext": "##No space C ##", + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 15, + "insertText": "## No space C ##" + } + }, + { + "lineNumber": 20, + "ruleNames": [ + "MD020", + "no-missing-space-closed-atx" + ], + "ruleDescription": "No space inside hashes on closed atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md020", + "errorDetail": null, + "errorContext": "## No space D##", + "errorRange": [ + 13, + 3 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 15, + "insertText": "## No space D ##" + } + }, + { + "lineNumber": 22, + "ruleNames": [ + "MD021", + "no-multiple-space-closed-atx" + ], + "ruleDescription": "Multiple spaces inside hashes on closed atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md021", + "errorDetail": null, + "errorContext": "## Multiple spaces E ##", + "errorRange": [ + 1, + 5 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 24, + "insertText": "## Multiple spaces E ##" + } + }, + { + "lineNumber": 24, + "ruleNames": [ + "MD021", + "no-multiple-space-closed-atx" + ], + "ruleDescription": "Multiple spaces inside hashes on closed atx style heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md021", + "errorDetail": null, + "errorContext": "## Multiple spaces F ##", + "errorRange": [ + 20, + 5 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 24, + "insertText": "## Multiple spaces F ##" + } + } ] \ No newline at end of file diff --git a/test/detailed-results-MD022-MD030.results.json b/test/detailed-results-MD022-MD030.results.json index ae3c3643..75bd0485 100644 --- a/test/detailed-results-MD022-MD030.results.json +++ b/test/detailed-results-MD022-MD030.results.json @@ -1,110 +1,211 @@ [ - { - "lineNumber": 1, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Below", - "errorContext": "# Heading", - "errorRange": null - }, - { - "lineNumber": 1, - "ruleNames": [ "MD023", "heading-start-left", "header-start-left" ], - "ruleDescription": "Headings must start at the beginning of the line", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md023", - "errorDetail": null, - "errorContext": " # Heading", - "errorRange": [1, 2] - }, - { - "lineNumber": 4, - "ruleNames": [ "MD024", "no-duplicate-heading", "no-duplicate-header" ], - "ruleDescription": "Multiple headings with the same content", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md024", - "errorDetail": null, - "errorContext": "# Heading", - "errorRange": null - }, - { - "lineNumber": 4, - "ruleNames": [ "MD025", "single-title", "single-h1" ], - "ruleDescription": "Multiple top-level headings in the same document", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md025", - "errorDetail": null, - "errorContext": "# Heading", - "errorRange": null - }, - { - "lineNumber": 6, - "ruleNames": [ "MD026", "no-trailing-punctuation" ], - "ruleDescription": "Trailing punctuation in heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md026", - "errorDetail": "Punctuation: '.'", - "errorContext": null, - "errorRange": [19, 1] - }, - { - "lineNumber": 8, - "ruleNames": [ "MD027", "no-multiple-space-blockquote" ], - "ruleDescription": "Multiple spaces after blockquote symbol", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", - "errorDetail": null, - "errorContext": "> Multiple spaces", - "errorRange": [1, 4] - }, - { - "lineNumber": 15, - "ruleNames": [ "MD027", "no-multiple-space-blockquote" ], - "ruleDescription": "Multiple spaces after blockquote symbol", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", - "errorDetail": null, - "errorContext": "> > Multiple spaces, multiple...", - "errorRange": [ 1, 6 ] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD027", "no-multiple-space-blockquote" ], - "ruleDescription": "Multiple spaces after blockquote symbol", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", - "errorDetail": null, - "errorContext": "> > > Multiple spaces, multip...", - "errorRange": [ 1, 8 ] - }, - { - "lineNumber": 19, - "ruleNames": [ "MD027", "no-multiple-space-blockquote" ], - "ruleDescription": "Multiple spaces after blockquote symbol", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", - "errorDetail": null, - "errorContext": "> > > Multiple spaces, multip...", - "errorRange": [ 1, 4 ] - }, - { - "lineNumber": 9, - "ruleNames": [ "MD028", "no-blanks-blockquote" ], - "ruleDescription": "Blank line inside blockquote", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md028", - "errorDetail": null, - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 13, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 2; Actual: 3; Style: 1/2/3", - "errorContext": null, - "errorRange": [1, 4] - }, - { - "lineNumber": 13, - "ruleNames": [ "MD030", "list-marker-space" ], - "ruleDescription": "Spaces after list markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", - "errorDetail": "Expected: 1; Actual: 2", - "errorContext": null, - "errorRange": [1, 4] + { + "lineNumber": 1, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Below", + "errorContext": "# Heading", + "errorRange": null, + "fixInfo": { + "lineNumber": 2, + "insertText": "\n" } + }, + { + "lineNumber": 1, + "ruleNames": [ + "MD023", + "heading-start-left", + "header-start-left" + ], + "ruleDescription": "Headings must start at the beginning of the line", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md023", + "errorDetail": null, + "errorContext": " # Heading", + "errorRange": [ + 1, + 2 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 1 + } + }, + { + "lineNumber": 4, + "ruleNames": [ + "MD024", + "no-duplicate-heading", + "no-duplicate-header" + ], + "ruleDescription": "Multiple headings with the same content", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md024", + "errorDetail": null, + "errorContext": "# Heading", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 4, + "ruleNames": [ + "MD025", + "single-title", + "single-h1" + ], + "ruleDescription": "Multiple top-level headings in the same document", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md025", + "errorDetail": null, + "errorContext": "# Heading", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 6, + "ruleNames": [ + "MD026", + "no-trailing-punctuation" + ], + "ruleDescription": "Trailing punctuation in heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md026", + "errorDetail": "Punctuation: '.'", + "errorContext": null, + "errorRange": [ + 19, + 1 + ], + "fixInfo": { + "editColumn": 19, + "deleteCount": 1 + } + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD027", + "no-multiple-space-blockquote" + ], + "ruleDescription": "Multiple spaces after blockquote symbol", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", + "errorDetail": null, + "errorContext": "> Multiple spaces", + "errorRange": [ + 1, + 4 + ], + "fixInfo": { + "editColumn": 2, + "deleteCount": 1 + } + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD027", + "no-multiple-space-blockquote" + ], + "ruleDescription": "Multiple spaces after blockquote symbol", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", + "errorDetail": null, + "errorContext": "> > Multiple spaces, multiple...", + "errorRange": [ + 1, + 6 + ], + "fixInfo": { + "editColumn": 4, + "deleteCount": 1 + } + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD027", + "no-multiple-space-blockquote" + ], + "ruleDescription": "Multiple spaces after blockquote symbol", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", + "errorDetail": null, + "errorContext": "> > > Multiple spaces, multip...", + "errorRange": [ + 1, + 8 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 1 + } + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD027", + "no-multiple-space-blockquote" + ], + "ruleDescription": "Multiple spaces after blockquote symbol", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md027", + "errorDetail": null, + "errorContext": "> > > Multiple spaces, multip...", + "errorRange": [ + 1, + 4 + ], + "fixInfo": { + "editColumn": 2, + "deleteCount": 1 + } + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD028", + "no-blanks-blockquote" + ], + "ruleDescription": "Blank line inside blockquote", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md028", + "errorDetail": null, + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 2; Actual: 3; Style: 1/2/3", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD030", + "list-marker-space" + ], + "ruleDescription": "Spaces after list markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", + "errorDetail": "Expected: 1; Actual: 2", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 2, + "insertText": " " + } + } ] \ No newline at end of file diff --git a/test/detailed-results-MD030-warning-message.results.json b/test/detailed-results-MD030-warning-message.results.json index 178ff597..c775e2d8 100644 --- a/test/detailed-results-MD030-warning-message.results.json +++ b/test/detailed-results-MD030-warning-message.results.json @@ -1,20 +1,42 @@ [ - { - "lineNumber": 19, - "ruleNames": [ "MD030", "list-marker-space" ], - "ruleDescription": "Spaces after list markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", - "errorDetail": "Expected: 1; Actual: 2", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 21, - "ruleNames": [ "MD030", "list-marker-space" ], - "ruleDescription": "Spaces after list markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", - "errorDetail": "Expected: 1; Actual: 2", - "errorContext": null, - "errorRange": [1, 4] + { + "lineNumber": 19, + "ruleNames": [ + "MD030", + "list-marker-space" + ], + "ruleDescription": "Spaces after list markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", + "errorDetail": "Expected: 1; Actual: 2", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": { + "editColumn": 2, + "deleteCount": 2, + "insertText": " " } + }, + { + "lineNumber": 21, + "ruleNames": [ + "MD030", + "list-marker-space" + ], + "ruleDescription": "Spaces after list markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md030", + "errorDetail": "Expected: 1; Actual: 2", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 2, + "insertText": " " + } + } ] \ No newline at end of file diff --git a/test/detailed-results-MD031-MD040.results.json b/test/detailed-results-MD031-MD040.results.json index 307040f3..24854df5 100644 --- a/test/detailed-results-MD031-MD040.results.json +++ b/test/detailed-results-MD031-MD040.results.json @@ -1,263 +1,585 @@ [ - { - "lineNumber": 3, - "ruleNames": [ "MD031", "blanks-around-fences" ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "```", - "errorRange": null - }, - { - "lineNumber": 4, - "ruleNames": [ "MD032", "blanks-around-lists" ], - "ruleDescription": "Lists should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md032", - "errorDetail": null, - "errorContext": "* List", - "errorRange": null - }, - { - "lineNumber": 47, - "ruleNames": [ "MD032", "blanks-around-lists" ], - "ruleDescription": "Lists should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md032", - "errorDetail": null, - "errorContext": "* List", - "errorRange": null - }, - { - "lineNumber": 6, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: hr", - "errorContext": null, - "errorRange": [ 7, 5 ] - }, - { - "lineNumber": 8, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com", - "errorRange": [ 6, 19 ] - }, - { - "lineNumber": 11, - "ruleNames": [ "MD035", "hr-style" ], - "ruleDescription": "Horizontal rule style", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md035", - "errorDetail": "Expected: ---; Actual: ***", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 13, - "ruleNames": [ "MD036", "no-emphasis-as-heading", "no-emphasis-as-header" ], - "ruleDescription": "Emphasis used instead of a heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md036", - "errorDetail": null, - "errorContext": "Emphasis", - "errorRange": null - }, - { - "lineNumber": 15, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "* inside *", - "errorRange": [ 7, 10 ] - }, - { - "lineNumber": 31, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "* some*", - "errorRange": [ 17, 7 ] - }, - { - "lineNumber": 32, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "*some *", - "errorRange": [ 17, 7 ] - }, - { - "lineNumber": 33, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "**some **", - "errorRange": [ 17, 9 ] - }, - { - "lineNumber": 34, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "_ some_", - "errorRange": [ 17, 7 ] - }, - { - "lineNumber": 35, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "__ some __", - "errorRange": [ 19, 10 ] - }, - { - "lineNumber": 62, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "* inside", - "errorRange": [ 7, 8 ] - }, - { - "lineNumber": 63, - "ruleNames": [ "MD037", "no-space-in-emphasis" ], - "ruleDescription": "Spaces inside emphasis markers", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", - "errorDetail": null, - "errorContext": "multi-line *", - "errorRange": [ 1, 12 ] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "` inside`", - "errorRange": [ 7, 9 ] - }, - { - "lineNumber": 24, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "`` inside``", - "errorRange": [ 7, 11 ] - }, - { - "lineNumber": 25, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "` code`", - "errorRange": [ 19, 7 ] - }, - { - "lineNumber": 26, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "` elements`", - "errorRange": [ 26, 11 ] - }, - { - "lineNumber": 27, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "`` code``", - "errorRange": [ 21, 9 ] - }, - { - "lineNumber": 28, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "`` ` embedded backtick``", - "errorRange": [ 1, 25 ] - }, - { - "lineNumber": 29, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "``embedded backtick` ``", - "errorRange": [ 1, 24 ] - }, - { - "lineNumber": 38, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "` code", - "errorRange": [ 6, 6 ] - }, - { - "lineNumber": 44, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "span `", - "errorRange": [ 1, 7 ] - }, - { - "lineNumber": 53, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "span code ```", - "errorRange": [ 1, 13 ] - }, - { - "lineNumber": 55, - "ruleNames": [ "MD038", "no-space-in-code" ], - "ruleDescription": "Spaces inside code span elements", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", - "errorDetail": null, - "errorContext": "```` code", - "errorRange": [ 11, 9 ] - }, - { - "lineNumber": 19, - "ruleNames": [ "MD039", "no-space-in-links" ], - "ruleDescription": "Spaces inside link text", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", - "errorDetail": null, - "errorContext": "[ inside ]", - "errorRange": [ 7, 10 ] - }, - { - "lineNumber": 60, - "ruleNames": [ "MD039", "no-space-in-links" ], - "ruleDescription": "Spaces inside link text", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", - "errorDetail": null, - "errorContext": "[ space]", - "errorRange": [ 6, 8 ] - }, - { - "lineNumber": 21, - "ruleNames": [ "MD040", "fenced-code-language" ], - "ruleDescription": "Fenced code blocks should have a language specified", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md040", - "errorDetail": null, - "errorContext": "```", - "errorRange": null + { + "lineNumber": 3, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "```", + "errorRange": null, + "fixInfo": { + "lineNumber": 4, + "insertText": "\n" } + }, + { + "lineNumber": 4, + "ruleNames": [ + "MD032", + "blanks-around-lists" + ], + "ruleDescription": "Lists should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md032", + "errorDetail": null, + "errorContext": "* List", + "errorRange": null, + "fixInfo": { + "insertText": "\n" + } + }, + { + "lineNumber": 47, + "ruleNames": [ + "MD032", + "blanks-around-lists" + ], + "ruleDescription": "Lists should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md032", + "errorDetail": null, + "errorContext": "* List", + "errorRange": null, + "fixInfo": { + "lineNumber": 48, + "insertText": "\n" + } + }, + { + "lineNumber": 6, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: hr", + "errorContext": null, + "errorRange": [ + 7, + 5 + ], + "fixInfo": null + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com", + "errorRange": [ + 6, + 19 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 19, + "insertText": "" + } + }, + { + "lineNumber": 11, + "ruleNames": [ + "MD035", + "hr-style" + ], + "ruleDescription": "Horizontal rule style", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md035", + "errorDetail": "Expected: ---; Actual: ***", + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD036", + "no-emphasis-as-heading", + "no-emphasis-as-header" + ], + "ruleDescription": "Emphasis used instead of a heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md036", + "errorDetail": null, + "errorContext": "Emphasis", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "* inside *", + "errorRange": [ + 7, + 10 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 10, + "insertText": "*inside*" + } + }, + { + "lineNumber": 31, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "* some*", + "errorRange": [ + 17, + 7 + ], + "fixInfo": { + "editColumn": 17, + "deleteCount": 7, + "insertText": "*some*" + } + }, + { + "lineNumber": 32, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "*some *", + "errorRange": [ + 17, + 7 + ], + "fixInfo": { + "editColumn": 17, + "deleteCount": 7, + "insertText": "*some*" + } + }, + { + "lineNumber": 33, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "**some **", + "errorRange": [ + 17, + 9 + ], + "fixInfo": { + "editColumn": 17, + "deleteCount": 9, + "insertText": "**some**" + } + }, + { + "lineNumber": 34, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "_ some_", + "errorRange": [ + 17, + 7 + ], + "fixInfo": { + "editColumn": 17, + "deleteCount": 7, + "insertText": "_some_" + } + }, + { + "lineNumber": 35, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "__ some __", + "errorRange": [ + 19, + 10 + ], + "fixInfo": { + "editColumn": 19, + "deleteCount": 10, + "insertText": "__some__" + } + }, + { + "lineNumber": 62, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "* inside", + "errorRange": [ + 7, + 8 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 8, + "insertText": "*inside" + } + }, + { + "lineNumber": 63, + "ruleNames": [ + "MD037", + "no-space-in-emphasis" + ], + "ruleDescription": "Spaces inside emphasis markers", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md037", + "errorDetail": null, + "errorContext": "multi-line *", + "errorRange": [ + 1, + 12 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 12, + "insertText": "multi-line*" + } + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "` inside`", + "errorRange": [ + 7, + 9 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 7, + "insertText": "inside" + } + }, + { + "lineNumber": 24, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "`` inside``", + "errorRange": [ + 7, + 11 + ], + "fixInfo": { + "editColumn": 9, + "deleteCount": 7, + "insertText": "inside" + } + }, + { + "lineNumber": 25, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "` code`", + "errorRange": [ + 19, + 7 + ], + "fixInfo": { + "editColumn": 20, + "deleteCount": 5, + "insertText": "code" + } + }, + { + "lineNumber": 26, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "` elements`", + "errorRange": [ + 26, + 11 + ], + "fixInfo": { + "editColumn": 27, + "deleteCount": 9, + "insertText": "elements" + } + }, + { + "lineNumber": 27, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "`` code``", + "errorRange": [ + 21, + 9 + ], + "fixInfo": { + "editColumn": 23, + "deleteCount": 5, + "insertText": "code" + } + }, + { + "lineNumber": 28, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "`` ` embedded backtick``", + "errorRange": [ + 1, + 25 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 21, + "insertText": " ` embedded backtick" + } + }, + { + "lineNumber": 29, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "``embedded backtick` ``", + "errorRange": [ + 1, + 24 + ], + "fixInfo": { + "editColumn": 3, + "deleteCount": 20, + "insertText": "embedded backtick` " + } + }, + { + "lineNumber": 38, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "` code", + "errorRange": [ + 6, + 6 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 5, + "insertText": "code" + } + }, + { + "lineNumber": 44, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "span `", + "errorRange": [ + 1, + 7 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 6, + "insertText": "span" + } + }, + { + "lineNumber": 53, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "span code ```", + "errorRange": [ + 1, + 13 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 10, + "insertText": "span code" + } + }, + { + "lineNumber": 55, + "ruleNames": [ + "MD038", + "no-space-in-code" + ], + "ruleDescription": "Spaces inside code span elements", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md038", + "errorDetail": null, + "errorContext": "```` code", + "errorRange": [ + 11, + 9 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 5, + "insertText": "code" + } + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD039", + "no-space-in-links" + ], + "ruleDescription": "Spaces inside link text", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", + "errorDetail": null, + "errorContext": "[ inside ]", + "errorRange": [ + 7, + 10 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 8, + "insertText": "inside" + } + }, + { + "lineNumber": 60, + "ruleNames": [ + "MD039", + "no-space-in-links" + ], + "ruleDescription": "Spaces inside link text", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", + "errorDetail": null, + "errorContext": "[ space]", + "errorRange": [ + 6, + 8 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 6, + "insertText": "space" + } + }, + { + "lineNumber": 60, + "ruleNames": [ + "MD039", + "no-space-in-links" + ], + "ruleDescription": "Spaces inside link text", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", + "errorDetail": null, + "errorContext": "[space ]", + "errorRange": [ + 26, + 8 + ], + "fixInfo": { + "editColumn": 27, + "deleteCount": 6, + "insertText": "space" + } + }, + { + "lineNumber": 60, + "ruleNames": [ + "MD039", + "no-space-in-links" + ], + "ruleDescription": "Spaces inside link text", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", + "errorDetail": null, + "errorContext": "[ space ]", + "errorRange": [ + 46, + 9 + ], + "fixInfo": { + "editColumn": 47, + "deleteCount": 7, + "insertText": "space" + } + }, + { + "lineNumber": 21, + "ruleNames": [ + "MD040", + "fenced-code-language" + ], + "ruleDescription": "Fenced code blocks should have a language specified", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md040", + "errorDetail": null, + "errorContext": "```", + "errorRange": null, + "fixInfo": null + } ] \ No newline at end of file diff --git a/test/detailed-results-MD041-MD050.results.json b/test/detailed-results-MD041-MD050.results.json index eccdb37e..70fa4e3a 100644 --- a/test/detailed-results-MD041-MD050.results.json +++ b/test/detailed-results-MD041-MD050.results.json @@ -1,119 +1,212 @@ [ - { - "lineNumber": 1, - "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ], - "ruleDescription": "First line in a file should be a top-level heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", - "errorDetail": null, - "errorContext": "Not a heading", - "errorRange": null - }, - { - "lineNumber": 3, - "ruleNames": [ "MD042", "no-empty-links" ], - "ruleDescription": "No empty links", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", - "errorDetail": null, - "errorContext": "[empty]()", - "errorRange": [4, 9] - }, - { - "lineNumber": 5, - "ruleNames": [ "MD042", "no-empty-links" ], - "ruleDescription": "No empty links", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", - "errorDetail": null, - "errorContext": "[empty]()", - "errorRange": [4, 10] - }, - { - "lineNumber": 7, - "ruleNames": [ "MD042", "no-empty-links" ], - "ruleDescription": "No empty links", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", - "errorDetail": null, - "errorContext": "[empty]()", - "errorRange": [4, 11] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD042", "no-empty-links" ], - "ruleDescription": "No empty links", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", - "errorDetail": null, - "errorContext": "[empty one]()", - "errorRange": [25, 13] - }, - { - "lineNumber": 31, - "ruleNames": [ "MD043", "required-headings", "required-headers" ], - "ruleDescription": "Required heading structure", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md043", - "errorDetail": null, - "errorContext": "# Heading", - "errorRange": null - }, - { - "lineNumber": 9, - "ruleNames": [ "MD044", "proper-names" ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: MARKDOWNLINT", - "errorContext": null, - "errorRange": [29, 12] - }, - { - "lineNumber": 12, - "ruleNames": [ "MD044", "proper-names" ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: Markdownlint", - "errorContext": null, - "errorRange": [7, 12] - }, - { - "lineNumber": 15, - "ruleNames": [ "MD044", "proper-names" ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: MarkDownLint", - "errorContext": null, - "errorRange": [1, 12] - }, - { - "lineNumber": 19, - "ruleNames": [ "MD045", "no-alt-text" ], - "ruleDescription": "Images should have alternate text (alt text)", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md045", - "errorDetail": null, - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 25, - "ruleNames": [ "MD046", "code-block-style" ], - "ruleDescription": "Code block style", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md046", - "errorDetail": "Expected: fenced; Actual: indented", - "errorContext": null, - "errorRange": null - }, - { - "lineNumber": 31, - "ruleNames": [ "MD047", "single-trailing-newline" ], - "ruleDescription": "Files should end with a single newline character", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md047", - "errorDetail": null, - "errorContext": null, - "errorRange": [ 25, 1 ] - }, - { - "lineNumber": 27, - "ruleNames": [ "MD048", "code-fence-style" ], - "ruleDescription": "Code fence style", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md048", - "errorDetail": "Expected: backtick; Actual: tilde", - "errorContext": null, - "errorRange": null + { + "lineNumber": 1, + "ruleNames": [ + "MD041", + "first-line-heading", + "first-line-h1" + ], + "ruleDescription": "First line in a file should be a top-level heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", + "errorDetail": null, + "errorContext": "Not a heading", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 3, + "ruleNames": [ + "MD042", + "no-empty-links" + ], + "ruleDescription": "No empty links", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", + "errorDetail": null, + "errorContext": "[empty]()", + "errorRange": [ + 4, + 9 + ], + "fixInfo": null + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD042", + "no-empty-links" + ], + "ruleDescription": "No empty links", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", + "errorDetail": null, + "errorContext": "[empty]()", + "errorRange": [ + 4, + 10 + ], + "fixInfo": null + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD042", + "no-empty-links" + ], + "ruleDescription": "No empty links", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", + "errorDetail": null, + "errorContext": "[empty]()", + "errorRange": [ + 4, + 11 + ], + "fixInfo": null + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD042", + "no-empty-links" + ], + "ruleDescription": "No empty links", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md042", + "errorDetail": null, + "errorContext": "[empty one]()", + "errorRange": [ + 25, + 13 + ], + "fixInfo": null + }, + { + "lineNumber": 31, + "ruleNames": [ + "MD043", + "required-headings", + "required-headers" + ], + "ruleDescription": "Required heading structure", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md043", + "errorDetail": null, + "errorContext": "# Heading", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: MARKDOWNLINT", + "errorContext": null, + "errorRange": [ + 29, + 12 + ], + "fixInfo": { + "editColumn": 29, + "deleteCount": 12, + "insertText": "markdownlint" } + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: Markdownlint", + "errorContext": null, + "errorRange": [ + 7, + 12 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 12, + "insertText": "markdownlint" + } + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: MarkDownLint", + "errorContext": null, + "errorRange": [ + 1, + 12 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 12, + "insertText": "markdownlint" + } + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD045", + "no-alt-text" + ], + "ruleDescription": "Images should have alternate text (alt text)", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md045", + "errorDetail": null, + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 25, + "ruleNames": [ + "MD046", + "code-block-style" + ], + "ruleDescription": "Code block style", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md046", + "errorDetail": "Expected: fenced; Actual: indented", + "errorContext": null, + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 31, + "ruleNames": [ + "MD047", + "single-trailing-newline" + ], + "ruleDescription": "Files should end with a single newline character", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md047", + "errorDetail": null, + "errorContext": null, + "errorRange": [ + 25, + 1 + ], + "fixInfo": { + "editColumn": 26, + "insertText": "\n" + } + }, + { + "lineNumber": 27, + "ruleNames": [ + "MD048", + "code-fence-style" + ], + "ruleDescription": "Code fence style", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md048", + "errorDetail": "Expected: backtick; Actual: tilde", + "errorContext": null, + "errorRange": null, + "fixInfo": null + } ] \ No newline at end of file diff --git a/test/detailed-results-bare-urls.results.json b/test/detailed-results-bare-urls.results.json index a32f5355..ba50b122 100644 --- a/test/detailed-results-bare-urls.results.json +++ b/test/detailed-results-bare-urls.results.json @@ -1,92 +1,122 @@ [ - { - "lineNumber": 3, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com", - "errorRange": [ - 15, - 19 - ] - }, - { - "lineNumber": 5, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/", - "errorRange": [ - 15, - 20 - ] - }, - { - "lineNumber": 7, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/?query=str...", - "errorRange": [ - 15, - 38 - ] - }, - { - "lineNumber": 9, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/info.htm", - "errorRange": [ - 15, - 28 - ] - }, - { - "lineNumber": 11, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com", - "errorRange": [ - 7, - 19 - ] - }, - { - "lineNumber": 13, - "ruleNames": [ - "MD034", - "no-bare-urls" - ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com", - "errorRange": [ - 11, - 19 - ] + { + "lineNumber": 3, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com", + "errorRange": [ + 15, + 19 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 19, + "insertText": "" } -] + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/", + "errorRange": [ + 15, + 20 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 20, + "insertText": "" + } + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/?query=str...", + "errorRange": [ + 15, + 38 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 38, + "insertText": "" + } + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/info.htm", + "errorRange": [ + 15, + 28 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 28, + "insertText": "" + } + }, + { + "lineNumber": 11, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com", + "errorRange": [ + 7, + 19 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 19, + "insertText": "" + } + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com", + "errorRange": [ + 11, + 19 + ], + "fixInfo": { + "editColumn": 11, + "deleteCount": 19, + "insertText": "" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-blanks-around-headings-0-2.results.json b/test/detailed-results-blanks-around-headings-0-2.results.json index 87b29b82..78e6c12e 100644 --- a/test/detailed-results-blanks-around-headings-0-2.results.json +++ b/test/detailed-results-blanks-around-headings-0-2.results.json @@ -1,20 +1,36 @@ [ - { - "lineNumber": 8, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 2; Actual: 1; Below", - "errorContext": "## Banana", - "errorRange": null - }, - { - "lineNumber": 21, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 2; Actual: 0; Below", - "errorContext": "Elderberry", - "errorRange": null + { + "lineNumber": 8, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 2; Actual: 1; Below", + "errorContext": "## Banana", + "errorRange": null, + "fixInfo": { + "lineNumber": 9, + "insertText": "\n" } -] + }, + { + "lineNumber": 21, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 2; Actual: 0; Below", + "errorContext": "Elderberry", + "errorRange": null, + "fixInfo": { + "lineNumber": 23, + "insertText": "\n\n" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-blanks-around-headings-3-0.results.json b/test/detailed-results-blanks-around-headings-3-0.results.json index 7c558c18..5264c149 100644 --- a/test/detailed-results-blanks-around-headings-3-0.results.json +++ b/test/detailed-results-blanks-around-headings-3-0.results.json @@ -1,20 +1,34 @@ [ - { - "lineNumber": 19, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 3; Actual: 2; Above", - "errorContext": "## Durian ##", - "errorRange": null - }, - { - "lineNumber": 22, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 3; Actual: 1; Above", - "errorContext": "Elderberry", - "errorRange": null + { + "lineNumber": 19, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 3; Actual: 2; Above", + "errorContext": "## Durian ##", + "errorRange": null, + "fixInfo": { + "insertText": "\n" } -] + }, + { + "lineNumber": 22, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 3; Actual: 1; Above", + "errorContext": "Elderberry", + "errorRange": null, + "fixInfo": { + "insertText": "\n\n" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-blanks-around-headings.results.json b/test/detailed-results-blanks-around-headings.results.json index ccaf5225..e006d0ed 100644 --- a/test/detailed-results-blanks-around-headings.results.json +++ b/test/detailed-results-blanks-around-headings.results.json @@ -1,29 +1,68 @@ [ - { - "lineNumber": 7, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Below", - "errorContext": "## Banana", - "errorRange": null - }, - { - "lineNumber": 13, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Above", - "errorContext": "## Durian ##", - "errorRange": null - }, - { - "lineNumber": 18, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Above", - "errorContext": "Elderberry", - "errorRange": null + { + "lineNumber": 7, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Below", + "errorContext": "## Banana", + "errorRange": null, + "fixInfo": { + "lineNumber": 8, + "insertText": "\n" } -] + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Above", + "errorContext": "## Durian ##", + "errorRange": null, + "fixInfo": { + "insertText": "\n" + } + }, + { + "lineNumber": 18, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Above", + "errorContext": "Elderberry", + "errorRange": null, + "fixInfo": { + "insertText": "\n" + } + }, + { + "lineNumber": 18, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Below", + "errorContext": "Elderberry", + "errorRange": null, + "fixInfo": { + "lineNumber": 20, + "insertText": "\n" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-code-fences-in-blockquotes.results.json b/test/detailed-results-code-fences-in-blockquotes.results.json index b8011391..77619e6e 100644 --- a/test/detailed-results-code-fences-in-blockquotes.results.json +++ b/test/detailed-results-code-fences-in-blockquotes.results.json @@ -1,74 +1,98 @@ [ - { - "lineNumber": 4, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "```markdown", - "errorRange": null - }, - { - "lineNumber": 6, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "```", - "errorRange": null - }, - { - "lineNumber": 10, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "> ```markdown", - "errorRange": null - }, - { - "lineNumber": 12, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "> ```", - "errorRange": null - }, - { - "lineNumber": 15, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "> > ```markdown", - "errorRange": null - }, - { - "lineNumber": 17, - "ruleNames": [ - "MD031", - "blanks-around-fences" - ], - "ruleDescription": "Fenced code blocks should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", - "errorDetail": null, - "errorContext": "> > ```", - "errorRange": null + { + "lineNumber": 4, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "```markdown", + "errorRange": null, + "fixInfo": { + "lineNumber": 4, + "insertText": "\n" } -] + }, + { + "lineNumber": 6, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "```", + "errorRange": null, + "fixInfo": { + "lineNumber": 7, + "insertText": "\n" + } + }, + { + "lineNumber": 10, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "> ```markdown", + "errorRange": null, + "fixInfo": { + "lineNumber": 10, + "insertText": ">\n" + } + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "> ```", + "errorRange": null, + "fixInfo": { + "lineNumber": 13, + "insertText": ">\n" + } + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "> > ```markdown", + "errorRange": null, + "fixInfo": { + "lineNumber": 15, + "insertText": "> >\n" + } + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD031", + "blanks-around-fences" + ], + "ruleDescription": "Fenced code blocks should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md031", + "errorDetail": null, + "errorContext": "> > ```", + "errorRange": null, + "fixInfo": { + "lineNumber": 18, + "insertText": "> >\n" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-default-spaces-MD010.results.json b/test/detailed-results-default-spaces-MD010.results.json index b0a97c51..c3e627a9 100644 --- a/test/detailed-results-default-spaces-MD010.results.json +++ b/test/detailed-results-default-spaces-MD010.results.json @@ -1,29 +1,62 @@ [ { - "errorContext": null, - "errorDetail": "Column: 1", - "errorRange": [1, 13], "lineNumber": 1, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], "ruleDescription": "Hard tabs", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "ruleNames": ["MD010", "no-hard-tabs"] + "errorDetail": "Column: 1", + "errorContext": null, + "errorRange": [ + 1, + 13 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 13, + "insertText": " " + } }, { - "errorContext": null, - "errorDetail": "Column: 5", - "errorRange": [5, 2], "lineNumber": 2, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], "ruleDescription": "Hard tabs", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "ruleNames": ["MD010", "no-hard-tabs"] + "errorDetail": "Column: 5", + "errorContext": null, + "errorRange": [ + 5, + 2 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 2, + "insertText": " " + } }, { - "errorContext": null, - "errorDetail": "Column: 27", - "errorRange": [27, 3], "lineNumber": 3, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], "ruleDescription": "Hard tabs", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "ruleNames": ["MD010", "no-hard-tabs"] + "errorDetail": "Column: 27", + "errorContext": null, + "errorRange": [ + 27, + 3 + ], + "fixInfo": { + "editColumn": 27, + "deleteCount": 3, + "insertText": " " + } } -] +] \ No newline at end of file diff --git a/test/detailed-results-fixing-with-front-matter.results.json b/test/detailed-results-fixing-with-front-matter.results.json index 9a376aa9..dc102923 100644 --- a/test/detailed-results-fixing-with-front-matter.results.json +++ b/test/detailed-results-fixing-with-front-matter.results.json @@ -1,47 +1,93 @@ [ - { - "lineNumber": 6, - "ruleNames": [ "MD009", "no-trailing-spaces" ], - "ruleDescription": "Trailing spaces", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", - "errorDetail": "Expected: 0 or 2; Actual: 3", - "errorContext": null, - "errorRange": [ 15, 3 ] - }, - { - "lineNumber": 5, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Below", - "errorContext": "# Fixing with Front Matter", - "errorRange": null - }, - { - "lineNumber": 9, - "ruleNames": [ "MD022", "blanks-around-headings", "blanks-around-headers" ], - "ruleDescription": "Headings should be surrounded by blank lines", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", - "errorDetail": "Expected: 1; Actual: 0; Above", - "errorContext": "## Nested Heading", - "errorRange": null - }, - { - "lineNumber": 8, - "ruleNames": [ "MD039", "no-space-in-links" ], - "ruleDescription": "Spaces inside link text", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", - "errorDetail": null, - "errorContext": "[ link ]", - "errorRange": [ 6, 8 ] - }, - { - "lineNumber": 11, - "ruleNames": [ "MD047", "single-trailing-newline" ], - "ruleDescription": "Files should end with a single newline character", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md047", - "errorDetail": null, - "errorContext": null, - "errorRange": [ 4, 1 ] + { + "lineNumber": 6, + "ruleNames": [ + "MD009", + "no-trailing-spaces" + ], + "ruleDescription": "Trailing spaces", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", + "errorDetail": "Expected: 0 or 2; Actual: 3", + "errorContext": null, + "errorRange": [ + 15, + 3 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 3 } -] + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Below", + "errorContext": "# Fixing with Front Matter", + "errorRange": null, + "fixInfo": { + "lineNumber": 6, + "insertText": "\n" + } + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD022", + "blanks-around-headings", + "blanks-around-headers" + ], + "ruleDescription": "Headings should be surrounded by blank lines", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md022", + "errorDetail": "Expected: 1; Actual: 0; Above", + "errorContext": "## Nested Heading", + "errorRange": null, + "fixInfo": { + "insertText": "\n" + } + }, + { + "lineNumber": 8, + "ruleNames": [ + "MD039", + "no-space-in-links" + ], + "ruleDescription": "Spaces inside link text", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md039", + "errorDetail": null, + "errorContext": "[ link ]", + "errorRange": [ + 6, + 8 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 6, + "insertText": "link" + } + }, + { + "lineNumber": 11, + "ruleNames": [ + "MD047", + "single-trailing-newline" + ], + "ruleDescription": "Files should end with a single newline character", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md047", + "errorDetail": null, + "errorContext": null, + "errorRange": [ + 4, + 1 + ], + "fixInfo": { + "editColumn": 5, + "insertText": "\n" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-front-matter.results.json b/test/detailed-results-front-matter.results.json index 4f343481..3b96c35b 100644 --- a/test/detailed-results-front-matter.results.json +++ b/test/detailed-results-front-matter.results.json @@ -1,20 +1,35 @@ [ - { - "lineNumber": 6, - "ruleNames": [ "MD009", "no-trailing-spaces" ], - "ruleDescription": "Trailing spaces", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", - "errorDetail": "Expected: 0; Actual: 1", - "errorContext": null, - "errorRange": [5, 1] - }, - { - "lineNumber": 4, - "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ], - "ruleDescription": "First line in a file should be a top-level heading", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", - "errorDetail": null, - "errorContext": "Text", - "errorRange": null + { + "lineNumber": 6, + "ruleNames": [ + "MD009", + "no-trailing-spaces" + ], + "ruleDescription": "Trailing spaces", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md009", + "errorDetail": "Expected: 0; Actual: 1", + "errorContext": null, + "errorRange": [ + 5, + 1 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 1 } -] + }, + { + "lineNumber": 4, + "ruleNames": [ + "MD041", + "first-line-heading", + "first-line-h1" + ], + "ruleDescription": "First line in a file should be a top-level heading", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md041", + "errorDetail": null, + "errorContext": "Text", + "errorRange": null, + "fixInfo": null + } +] \ No newline at end of file diff --git a/test/detailed-results-html-tags.results.json b/test/detailed-results-html-tags.results.json index bef47797..3c4366eb 100644 --- a/test/detailed-results-html-tags.results.json +++ b/test/detailed-results-html-tags.results.json @@ -1,173 +1,322 @@ [ - { - "lineNumber": 5, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 1, 4 ] - }, - { - "lineNumber": 7, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 6, 4 ] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: p", - "errorContext": null, - "errorRange": [ 1, 3 ] - }, - { - "lineNumber": 19, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 7, 4 ] - }, - { - "lineNumber": 23, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 7, 4 ] - }, - { - "lineNumber": 24, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 36, 4 ] - }, - { - "lineNumber": 29, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 9, 4 ] - }, - { - "lineNumber": 31, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 14, 4 ] - }, - { - "lineNumber": 35, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 1, 4 ] - }, - { - "lineNumber": 37, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 6, 4 ] - }, - { - "lineNumber": 41, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 6, 4 ] - }, - { - "lineNumber": 43, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 35, 4 ] - }, - { - "lineNumber": 49, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: problem", - "errorContext": null, - "errorRange": [ 3, 9 ] - }, - { - "lineNumber": 55, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: problem", - "errorContext": null, - "errorRange": [ 8, 9 ] - }, - { - "lineNumber": 61, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 8, 4 ] - }, - { - "lineNumber": 84, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: em", - "errorContext": null, - "errorRange": [ 18, 4 ] - }, - { - "lineNumber": 90, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: a", - "errorContext": null, - "errorRange": [ 6, 18 ] - }, - { - "lineNumber": 91, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: img", - "errorContext": null, - "errorRange": [ 6, 20 ] - }, - { - "lineNumber": 101, - "ruleNames": [ "MD033", "no-inline-html" ], - "ruleDescription": "Inline HTML", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", - "errorDetail": "Element: foo-bar-baz", - "errorContext": null, - "errorRange": [ 1, 13 ] - } -] + { + "lineNumber": 5, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 6, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: p", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 7, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 23, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 7, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 24, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 36, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 29, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 9, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 31, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 14, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 35, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 37, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 6, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 41, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 6, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 41, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 56, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 43, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 35, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 49, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: problem", + "errorContext": null, + "errorRange": [ + 3, + 9 + ], + "fixInfo": null + }, + { + "lineNumber": 55, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: problem", + "errorContext": null, + "errorRange": [ + 8, + 9 + ], + "fixInfo": null + }, + { + "lineNumber": 61, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 8, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 84, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: em", + "errorContext": null, + "errorRange": [ + 18, + 4 + ], + "fixInfo": null + }, + { + "lineNumber": 90, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: a", + "errorContext": null, + "errorRange": [ + 6, + 18 + ], + "fixInfo": null + }, + { + "lineNumber": 91, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: img", + "errorContext": null, + "errorRange": [ + 6, + 20 + ], + "fixInfo": null + }, + { + "lineNumber": 101, + "ruleNames": [ + "MD033", + "no-inline-html" + ], + "ruleDescription": "Inline HTML", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md033", + "errorDetail": "Element: foo-bar-baz", + "errorContext": null, + "errorRange": [ + 1, + 13 + ], + "fixInfo": null + } +] \ No newline at end of file diff --git a/test/detailed-results-links.results.json b/test/detailed-results-links.results.json index 9c173032..9d6c721a 100644 --- a/test/detailed-results-links.results.json +++ b/test/detailed-results-links.results.json @@ -1,110 +1,275 @@ [ - { - "lineNumber": 30, - "ruleNames": [ "MD011", "no-reversed-links" ], - "ruleDescription": "Reversed link syntax", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", - "errorDetail": "(Incorrect link syntax)[https://www.example.com/]", - "errorContext": null, - "errorRange": [ 1, 49 ] - }, - { - "lineNumber": 3, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/", - "errorRange": [ 6, 20 ] - }, - { - "lineNumber": 5, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/bare", - "errorRange": [ 42, 24 ] - }, - { - "lineNumber": 7, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/bare", - "errorRange": [ 6, 24 ] - }, - { - "lineNumber": 9, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/", - "errorRange": [ 48, 20 ] - }, - { - "lineNumber": 11, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/bare", - "errorRange": [ 44, 24 ] - }, - { - "lineNumber": 13, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/dir", - "errorRange": [ 6, 23 ] - }, - { - "lineNumber": 14, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/file.txt", - "errorRange": [ 6, 28 ] - }, - { - "lineNumber": 16, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/dir/dir/fi...", - "errorRange": [ 6, 44 ] - }, - { - "lineNumber": 24, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/same", - "errorRange": [ 43, 24 ] - }, - { - "lineNumber": 26, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/same", - "errorRange": null - }, - { - "lineNumber": 28, - "ruleNames": [ "MD034", "no-bare-urls" ], - "ruleDescription": "Bare URL used", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", - "errorDetail": null, - "errorContext": "https://example.com/first", - "errorRange": [ 6, 25 ] + { + "lineNumber": 30, + "ruleNames": [ + "MD011", + "no-reversed-links" + ], + "ruleDescription": "Reversed link syntax", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md011", + "errorDetail": "(Incorrect link syntax)[https://www.example.com/]", + "errorContext": null, + "errorRange": [ + 1, + 49 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 49, + "insertText": "[Incorrect link syntax](https://www.example.com/)" } -] + }, + { + "lineNumber": 3, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/", + "errorRange": [ + 6, + 20 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 20, + "insertText": "" + } + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/bare", + "errorRange": [ + 42, + 24 + ], + "fixInfo": { + "editColumn": 42, + "deleteCount": 24, + "insertText": "" + } + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/bare", + "errorRange": [ + 6, + 24 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 24, + "insertText": "" + } + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/", + "errorRange": [ + 48, + 20 + ], + "fixInfo": { + "editColumn": 48, + "deleteCount": 20, + "insertText": "" + } + }, + { + "lineNumber": 11, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/bare", + "errorRange": [ + 44, + 24 + ], + "fixInfo": { + "editColumn": 44, + "deleteCount": 24, + "insertText": "" + } + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/dir", + "errorRange": [ + 6, + 23 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 23, + "insertText": "" + } + }, + { + "lineNumber": 14, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/file.txt", + "errorRange": [ + 6, + 28 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 28, + "insertText": "" + } + }, + { + "lineNumber": 16, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/dir/dir/fi...", + "errorRange": [ + 6, + 44 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 44, + "insertText": "" + } + }, + { + "lineNumber": 24, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/same", + "errorRange": [ + 43, + 24 + ], + "fixInfo": { + "editColumn": 43, + "deleteCount": 24, + "insertText": "" + } + }, + { + "lineNumber": 26, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/same", + "errorRange": null, + "fixInfo": null + }, + { + "lineNumber": 28, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/first", + "errorRange": [ + 6, + 25 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 25, + "insertText": "" + } + }, + { + "lineNumber": 28, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/second", + "errorRange": [ + 42, + 26 + ], + "fixInfo": { + "editColumn": 42, + "deleteCount": 26, + "insertText": "" + } + }, + { + "lineNumber": 28, + "ruleNames": [ + "MD034", + "no-bare-urls" + ], + "ruleDescription": "Bare URL used", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md034", + "errorDetail": null, + "errorContext": "https://example.com/third", + "errorRange": [ + 85, + 25 + ], + "fixInfo": { + "editColumn": 85, + "deleteCount": 25, + "insertText": "" + } + } +] \ No newline at end of file diff --git a/test/detailed-results-no-tabs-edge-case-MD010.results.json b/test/detailed-results-no-tabs-edge-case-MD010.results.json index b0a97c51..a6a8cfbd 100644 --- a/test/detailed-results-no-tabs-edge-case-MD010.results.json +++ b/test/detailed-results-no-tabs-edge-case-MD010.results.json @@ -1,29 +1,62 @@ [ { - "errorContext": null, - "errorDetail": "Column: 1", - "errorRange": [1, 13], "lineNumber": 1, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], "ruleDescription": "Hard tabs", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "ruleNames": ["MD010", "no-hard-tabs"] + "errorDetail": "Column: 1", + "errorContext": null, + "errorRange": [ + 1, + 13 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 13, + "insertText": "" + } }, { - "errorContext": null, - "errorDetail": "Column: 5", - "errorRange": [5, 2], "lineNumber": 2, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], "ruleDescription": "Hard tabs", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "ruleNames": ["MD010", "no-hard-tabs"] + "errorDetail": "Column: 5", + "errorContext": null, + "errorRange": [ + 5, + 2 + ], + "fixInfo": { + "editColumn": 5, + "deleteCount": 2, + "insertText": "" + } }, { - "errorContext": null, - "errorDetail": "Column: 27", - "errorRange": [27, 3], "lineNumber": 3, + "ruleNames": [ + "MD010", + "no-hard-tabs" + ], "ruleDescription": "Hard tabs", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md010", - "ruleNames": ["MD010", "no-hard-tabs"] + "errorDetail": "Column: 27", + "errorContext": null, + "errorRange": [ + 27, + 3 + ], + "fixInfo": { + "editColumn": 27, + "deleteCount": 3, + "insertText": "" + } } -] +] \ No newline at end of file diff --git a/test/detailed-results-ordered-list-item-prefix-single.results.json b/test/detailed-results-ordered-list-item-prefix-single.results.json index e2c5d51c..f6052b30 100644 --- a/test/detailed-results-ordered-list-item-prefix-single.results.json +++ b/test/detailed-results-ordered-list-item-prefix-single.results.json @@ -1,11 +1,18 @@ [ - { - "lineNumber": 3, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 1; Actual: 9; Style: 1/1/1", - "errorContext": null, - "errorRange": [1, 3] - } -] + { + "lineNumber": 3, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 1; Actual: 9; Style: 1/1/1", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + } +] \ No newline at end of file diff --git a/test/detailed-results-ordered-list-item-prefix-zero.results.json b/test/detailed-results-ordered-list-item-prefix-zero.results.json index 79fafa14..08999c00 100644 --- a/test/detailed-results-ordered-list-item-prefix-zero.results.json +++ b/test/detailed-results-ordered-list-item-prefix-zero.results.json @@ -1,56 +1,98 @@ [ - { - "lineNumber": 11, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 12, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 13, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 17, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 18, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 2; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - }, - { - "lineNumber": 19, - "ruleNames": [ "MD029", "ol-prefix" ], - "ruleDescription": "Ordered list item prefix", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", - "errorDetail": "Expected: 0; Actual: 3; Style: 0/0/0", - "errorContext": null, - "errorRange": [1, 3] - } -] + { + "lineNumber": 11, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 12, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 1; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 18, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 2; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD029", + "ol-prefix" + ], + "ruleDescription": "Ordered list item prefix", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md029", + "errorDetail": "Expected: 0; Actual: 3; Style: 0/0/0", + "errorContext": null, + "errorRange": [ + 1, + 3 + ], + "fixInfo": null + } +] \ No newline at end of file diff --git a/test/detailed-results-proper-names.results.json b/test/detailed-results-proper-names.results.json index 59939884..3212c0d8 100644 --- a/test/detailed-results-proper-names.results.json +++ b/test/detailed-results-proper-names.results.json @@ -1,242 +1,322 @@ [ - { - "lineNumber": 3, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: Markdownlint", - "errorContext": null, - "errorRange": [ - 6, - 12 - ] - }, - { - "lineNumber": 5, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: Node.js; Actual: node.JS", - "errorContext": null, - "errorRange": [ - 6, - 7 - ] - }, - { - "lineNumber": 7, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 6, - 4 - ] - }, - { - "lineNumber": 9, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 13, - 4 - ] - }, - { - "lineNumber": 11, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: Markdownlint", - "errorContext": null, - "errorRange": [ - 7, - 12 - ] - }, - { - "lineNumber": 13, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: Node.js; Actual: node.JS", - "errorContext": null, - "errorRange": [ - 7, - 7 - ] - }, - { - "lineNumber": 15, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 7, - 4 - ] - }, - { - "lineNumber": 17, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 14, - 4 - ] - }, - { - "lineNumber": 19, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: Markdownlint", - "errorContext": null, - "errorRange": [ - 8, - 12 - ] - }, - { - "lineNumber": 21, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: Node.js; Actual: node.JS", - "errorContext": null, - "errorRange": [ - 8, - 7 - ] - }, - { - "lineNumber": 23, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 8, - 4 - ] - }, - { - "lineNumber": 25, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 15, - 4 - ] - }, - { - "lineNumber": 27, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: markdownlint; Actual: Markdownlint", - "errorContext": null, - "errorRange": [ - 1, - 12 - ] - }, - { - "lineNumber": 29, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: Node.js; Actual: node.JS", - "errorContext": null, - "errorRange": [ - 1, - 7 - ] - }, - { - "lineNumber": 31, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 1, - 4 - ] - }, - { - "lineNumber": 33, - "ruleNames": [ - "MD044", - "proper-names" - ], - "ruleDescription": "Proper names should have the correct capitalization", - "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", - "errorDetail": "Expected: .NET; Actual: .net", - "errorContext": null, - "errorRange": [ - 8, - 4 - ] + { + "lineNumber": 3, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: Markdownlint", + "errorContext": null, + "errorRange": [ + 6, + 12 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 12, + "insertText": "markdownlint" } -] + }, + { + "lineNumber": 5, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: Node.js; Actual: node.JS", + "errorContext": null, + "errorRange": [ + 6, + 7 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 7, + "insertText": "Node.js" + } + }, + { + "lineNumber": 7, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 6, + 4 + ], + "fixInfo": { + "editColumn": 6, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 9, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 13, + 4 + ], + "fixInfo": { + "editColumn": 13, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 11, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: Markdownlint", + "errorContext": null, + "errorRange": [ + 7, + 12 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 12, + "insertText": "markdownlint" + } + }, + { + "lineNumber": 13, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: Node.js; Actual: node.JS", + "errorContext": null, + "errorRange": [ + 7, + 7 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 7, + "insertText": "Node.js" + } + }, + { + "lineNumber": 15, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 7, + 4 + ], + "fixInfo": { + "editColumn": 7, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 17, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 14, + 4 + ], + "fixInfo": { + "editColumn": 14, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 19, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: Markdownlint", + "errorContext": null, + "errorRange": [ + 8, + 12 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 12, + "insertText": "markdownlint" + } + }, + { + "lineNumber": 21, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: Node.js; Actual: node.JS", + "errorContext": null, + "errorRange": [ + 8, + 7 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 7, + "insertText": "Node.js" + } + }, + { + "lineNumber": 23, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 8, + 4 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 25, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 15, + 4 + ], + "fixInfo": { + "editColumn": 15, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 27, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: markdownlint; Actual: Markdownlint", + "errorContext": null, + "errorRange": [ + 1, + 12 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 12, + "insertText": "markdownlint" + } + }, + { + "lineNumber": 29, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: Node.js; Actual: node.JS", + "errorContext": null, + "errorRange": [ + 1, + 7 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 7, + "insertText": "Node.js" + } + }, + { + "lineNumber": 31, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 1, + 4 + ], + "fixInfo": { + "editColumn": 1, + "deleteCount": 4, + "insertText": ".NET" + } + }, + { + "lineNumber": 33, + "ruleNames": [ + "MD044", + "proper-names" + ], + "ruleDescription": "Proper names should have the correct capitalization", + "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/Rules.md#md044", + "errorDetail": "Expected: .NET; Actual: .net", + "errorContext": null, + "errorRange": [ + 8, + 4 + ], + "fixInfo": { + "editColumn": 8, + "deleteCount": 4, + "insertText": ".NET" + } + } +] \ No newline at end of file diff --git a/test/markdownlint-test-scenarios.js b/test/markdownlint-test-scenarios.js index 1254813e..64a71754 100644 --- a/test/markdownlint-test-scenarios.js +++ b/test/markdownlint-test-scenarios.js @@ -45,7 +45,7 @@ function createTestForFile(file) { return markdownlintPromise({ "files": [ file ], config, - "resultVersion": detailedResults ? 2 : 3 + "resultVersion": 3 }); }) .then( From d029c46a7629f09f3553f95f2259dcd6915a8f17 Mon Sep 17 00:00:00 2001 From: David Anson Date: Mon, 14 Jun 2021 22:59:41 -0700 Subject: [PATCH 20/36] Remove test-repos exclusion that has been fixed in the repo. --- test/markdownlint-test-repos.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/markdownlint-test-repos.js b/test/markdownlint-test-repos.js index fbfb0e05..02327e39 100644 --- a/test/markdownlint-test-repos.js +++ b/test/markdownlint-test-repos.js @@ -134,12 +134,7 @@ if (existsSync(dotnetDocsDir)) { const rootDir = dotnetDocsDir; const globPatterns = [ join(rootDir, "**/*.md"), - "!" + join(rootDir, "samples/**/*.md"), - // MD044 newly detects an issue in this file - "!" + join( - rootDir, - "docs/framework/wcf/feature-details/configuring-iis-for-wcf.md" - ) + "!" + join(rootDir, "samples/**/*.md") ]; const configPath = join(rootDir, ".markdownlint.json"); return lintTestRepo(t, globPatterns, configPath); From 77d0105b4a19fb3c6e555e32added478aa94e93a Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 15 Jun 2021 12:33:55 -0700 Subject: [PATCH 21/36] Correct typo in JSON schema `type` keyword (#406) --- schema/build-config-schema.js | 2 +- schema/markdownlint-config-schema.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/schema/build-config-schema.js b/schema/build-config-schema.js index 0b6b5567..fbebe5af 100644 --- a/schema/build-config-schema.js +++ b/schema/build-config-schema.js @@ -32,7 +32,7 @@ const schema = { } }, "additionalProperties": { - "type:": [ + "type": [ "boolean", "object" ] diff --git a/schema/markdownlint-config-schema.json b/schema/markdownlint-config-schema.json index 77e85157..a434e7cd 100644 --- a/schema/markdownlint-config-schema.json +++ b/schema/markdownlint-config-schema.json @@ -1561,7 +1561,7 @@ } }, "additionalProperties": { - "type:": [ + "type": [ "boolean", "object" ] From 646a67b8bd5d7cf47a66256a23fb496b9f358dad Mon Sep 17 00:00:00 2001 From: David Anson Date: Tue, 15 Jun 2021 22:25:51 -0700 Subject: [PATCH 22/36] Add more test coverage for additionalProperties in config schema. --- test/markdownlint-test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/markdownlint-test.js b/test/markdownlint-test.js index 32b73edc..174e43f3 100644 --- a/test/markdownlint-test.js +++ b/test/markdownlint-test.js @@ -1010,6 +1010,22 @@ test("validateConfigSchemaAllowsUnknownProperties", (t) => { }); }); +test("validateConfigSchemaAppliesToUnknownProperties", (t) => { + t.plan(4); + for (const allowed of [ true, {} ]) { + t.true( + // @ts-ignore + tv4.validate({ "property": allowed }, configSchema), + `Unknown property value ${allowed} blocked`); + } + for (const blocked of [ 2, "string" ]) { + t.false( + // @ts-ignore + tv4.validate({ "property": blocked }, configSchema), + `Unknown property value ${blocked} allowed`); + } +}); + test("validateConfigExampleJson", (t) => { t.plan(2); From 706f48bd258a98dc8420085ab43c8b9fb8780e18 Mon Sep 17 00:00:00 2001 From: David Anson Date: Thu, 17 Jun 2021 21:50:03 -0700 Subject: [PATCH 23/36] Re-implement MD011/no-reversed-links for better accuracy (range and fixInfo are now always valid) (fixes #398). --- demo/markdownlint-browser.js | 88 +++++++++++-------- helpers/helpers.js | 41 +++++++++ lib/md011.js | 53 +++++------ lib/md044.js | 27 ++---- ...eversed-link-issue-with-markdownlint-12.md | 2 - test/reversed_link.md | 45 ++++++++-- 6 files changed, 165 insertions(+), 91 deletions(-) diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 641c098e..3c12f285 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -519,6 +519,36 @@ module.exports.addErrorContext = function addErrorContext(onError, lineNumber, c } addError(onError, lineNumber, null, context, range, fixInfo); }; +/** + * Returns an array of code span ranges. + * + * @param {string[]} lines Lines to scan for code span ranges. + * @returns {number[][]} Array of ranges (line, index, length). + */ +module.exports.inlineCodeSpanRanges = function (lines) { + var exclusions = []; + forEachInlineCodeSpan(lines.join("\n"), function (code, lineIndex, columnIndex) { + var codeLines = code.split(newLineRe); + // eslint-disable-next-line unicorn/no-for-loop + for (var i = 0; i < codeLines.length; i++) { + exclusions.push([lineIndex + i, columnIndex, codeLines[i].length]); + columnIndex = 0; + } + }); + return exclusions; +}; +/** + * Determines whether the specified range overlaps another range. + * + * @param {number[][]} ranges Array of ranges (line, index, length). + * @param {number} lineIndex Line index to check. + * @param {number} index Index to check. + * @param {number} length Length to check. + * @returns {boolean} True iff the specified range overlaps. + */ +module.exports.overlapsAnyRange = function (ranges, lineIndex, index, length) { return (!ranges.every(function (span) { return ((lineIndex !== span[0]) || + (index + length < span[1]) || + (index > span[1] + span[2])); })); }; // Returns a range object for a line by applying a RegExp module.exports.rangeFromRegExp = function rangeFromRegExp(line, regexp) { var range = null; @@ -2177,30 +2207,30 @@ module.exports = { "use strict"; // @ts-check -var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addError = _a.addError, forEachInlineChild = _a.forEachInlineChild, unescapeMarkdown = _a.unescapeMarkdown; -var reversedLinkRe = /\(([^)]+)\)\[([^\]^][^\]]*)]/g; +var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addError = _a.addError, forEachLine = _a.forEachLine, inlineCodeSpanRanges = _a.inlineCodeSpanRanges, overlapsAnyRange = _a.overlapsAnyRange; +var lineMetadata = __webpack_require__(/*! ./cache */ "../lib/cache.js").lineMetadata; +var reversedLinkRe = /(? span[1] + span[2])); })) { + if (!overlapsAnyRange(exclusions, lineIndex, index, length_1)) { addErrorDetailIf(onError, lineIndex + 1, name_1, nameMatch, null, null, [index + 1, length_1], { "editColumn": index + 1, "deleteCount": length_1, @@ -3811,9 +3832,6 @@ module.exports = { }); } exclusions.push([lineIndex, index, length_1]); - }; - while ((match = nameRe.exec(line)) !== null) { - _loop_2(); } } }); diff --git a/helpers/helpers.js b/helpers/helpers.js index 5c6f58e6..e0f13406 100644 --- a/helpers/helpers.js +++ b/helpers/helpers.js @@ -523,6 +523,47 @@ module.exports.addErrorContext = function addErrorContext( addError(onError, lineNumber, null, context, range, fixInfo); }; +/** + * Returns an array of code span ranges. + * + * @param {string[]} lines Lines to scan for code span ranges. + * @returns {number[][]} Array of ranges (line, index, length). + */ +module.exports.inlineCodeSpanRanges = (lines) => { + const exclusions = []; + forEachInlineCodeSpan( + lines.join("\n"), + (code, lineIndex, columnIndex) => { + const codeLines = code.split(newLineRe); + // eslint-disable-next-line unicorn/no-for-loop + for (let i = 0; i < codeLines.length; i++) { + exclusions.push( + [ lineIndex + i, columnIndex, codeLines[i].length ] + ); + columnIndex = 0; + } + } + ); + return exclusions; +}; + +/** + * Determines whether the specified range overlaps another range. + * + * @param {number[][]} ranges Array of ranges (line, index, length). + * @param {number} lineIndex Line index to check. + * @param {number} index Index to check. + * @param {number} length Length to check. + * @returns {boolean} True iff the specified range overlaps. + */ +module.exports.overlapsAnyRange = (ranges, lineIndex, index, length) => ( + !ranges.every((span) => ( + (lineIndex !== span[0]) || + (index + length < span[1]) || + (index > span[1] + span[2]) + )) +); + // Returns a range object for a line by applying a RegExp module.exports.rangeFromRegExp = function rangeFromRegExp(line, regexp) { let range = null; diff --git a/lib/md011.js b/lib/md011.js index 37941d17..ff794e74 100644 --- a/lib/md011.js +++ b/lib/md011.js @@ -2,40 +2,41 @@ "use strict"; -const { addError, forEachInlineChild, unescapeMarkdown } = +const { addError, forEachLine, inlineCodeSpanRanges, overlapsAnyRange } = require("../helpers"); +const { lineMetadata } = require("./cache"); -const reversedLinkRe = /\(([^)]+)\)\[([^\]^][^\]]*)]/g; +const reversedLinkRe = + /(? { - const { lineNumber, content } = token; - let match = null; - while ((match = reversedLinkRe.exec(content)) !== null) { - const [ reversedLink, linkText, linkDestination ] = match; - const line = params.lines[lineNumber - 1]; - const column = unescapeMarkdown(line).indexOf(reversedLink) + 1; - const length = reversedLink.length; - const range = column ? [ column, length ] : null; - const fixInfo = column ? - { - "editColumn": column, - "deleteCount": length, - "insertText": `[${linkText}](${linkDestination})` - } : - null; - addError( - onError, - lineNumber, - reversedLink, - null, - range, - fixInfo - ); + const exclusions = inlineCodeSpanRanges(params.lines); + forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => { + if (!inCode && !onFence) { + let match = null; + while ((match = reversedLinkRe.exec(line)) !== null) { + const [ reversedLink, linkText, linkDestination ] = match; + const index = match.index; + const length = match[0].length; + if (!overlapsAnyRange(exclusions, lineIndex, index, length)) { + addError( + onError, + lineIndex + 1, + reversedLink, + null, + [ index + 1, length ], + { + "editColumn": index + 1, + "deleteCount": length, + "insertText": `[${linkText}](${linkDestination})` + } + ); + } + } } }); } diff --git a/lib/md044.js b/lib/md044.js index af3b1ce7..365b4aeb 100644 --- a/lib/md044.js +++ b/lib/md044.js @@ -2,8 +2,9 @@ "use strict"; -const { addErrorDetailIf, bareUrlRe, escapeForRegExp, forEachLine, linkRe, - linkReferenceRe, newLineRe, forEachInlineCodeSpan } = require("../helpers"); +const { addErrorDetailIf, bareUrlRe, escapeForRegExp, forEachLine, + inlineCodeSpanRanges, overlapsAnyRange, linkRe, linkReferenceRe } = + require("../helpers"); const { lineMetadata } = require("./cache"); module.exports = { @@ -36,19 +37,7 @@ module.exports = { } }); if (!includeCodeBlocks) { - forEachInlineCodeSpan( - params.lines.join("\n"), - (code, lineIndex, columnIndex) => { - const codeLines = code.split(newLineRe); - // eslint-disable-next-line unicorn/no-for-loop - for (let i = 0; i < codeLines.length; i++) { - exclusions.push( - [ lineIndex + i, columnIndex, codeLines[i].length ] - ); - columnIndex = 0; - } - } - ); + exclusions.push(...inlineCodeSpanRanges(params.lines)); } for (const name of names) { const escapedName = escapeForRegExp(name); @@ -64,13 +53,7 @@ module.exports = { const [ , leftMatch, nameMatch ] = match; const index = match.index + leftMatch.length; const length = nameMatch.length; - if ( - exclusions.every((span) => ( - (lineIndex !== span[0]) || - (index + length < span[1]) || - (index > span[1] + span[2]) - )) - ) { + if (!overlapsAnyRange(exclusions, lineIndex, index, length)) { addErrorDetailIf( onError, lineIndex + 1, diff --git a/test/reversed-link-issue-with-markdownlint-12.md b/test/reversed-link-issue-with-markdownlint-12.md index bd78a80c..2383d467 100644 --- a/test/reversed-link-issue-with-markdownlint-12.md +++ b/test/reversed-link-issue-with-markdownlint-12.md @@ -4,8 +4,6 @@ |-------------|-----------------| |`(?:\["'\](?<1>\[^"'\]*)["']|(?<1>\S+))`|...| -{MD011:5} - |Pattern|Description| |-------------|-----------------| |`(?:\["'\](?<1>\[^"'\]*)["']\|(?<1>\S+))`|...| diff --git a/test/reversed_link.md b/test/reversed_link.md index d27d69ea..e71c9725 100644 --- a/test/reversed_link.md +++ b/test/reversed_link.md @@ -1,17 +1,26 @@ # reversed_link +Go to [this website](https://www.example.com) + Go to (this website)[https://www.example.com] {MD011} +Go to (this)[website](https://www.example.com) + However, this shouldn't trigger inside code blocks: myObj.getFiles("test")[0] +Nor code fences: + +```js +myObj.getFiles(test)[0]; +``` + Nor inline code: `myobj.getFiles("test")[0]` Two (issues)[https://www.example.com/one] in {MD011} the (same text)[https://www.example.com/two]. {MD011} - Two (issues)[https://www.example.com/three] on the (same line)[https://www.example.com/four]. {MD011} `code code @@ -31,16 +40,40 @@ var IDENT_RE = '([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*'; {MD011} begin: /\B(([\/.])[\w\-.\/=]+)+/, {MD011} -{begin: '%r\\(', end: '\\)[a-z]*'} {MD011} +{begin: '%r\\(', end: '\\)[a-z]*'} return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str); {MD011} ## Escaped Parens -(reversed)[link] {MD011} +(reversed)[link] -a ) a ( a )[a]~ {MD011} +a ) a ( a )[a]~ - +a
) a ( a )[a]~
-a
) a ( a )[a]~
{MD011} +## Backslash Escapes + +xxx(xxx)[xxx] {MD011} + +xxx\(xxx)[xxx] + +xxx(xxx\)[xxx] + +xxx(xxx)\[xxx] + +xxx(xxx)[xxx\] + +## Consecutive Links + +text [link](destination) text [link](destination) text +text [link](destination)[link](destination) text +text [link](destination)[link](destination)[link](destination) text + +text (reversed)[link] text (reversed)[link] text {MD011} + + From 7d409263672eabacdd56e473877a9adea7bcabb4 Mon Sep 17 00:00:00 2001 From: David Anson Date: Thu, 17 Jun 2021 22:01:27 -0700 Subject: [PATCH 24/36] Cache results of inlineCodeSpanRanges for use by MD011/MD044. --- demo/markdownlint-browser.js | 43 ++++++++++++++++++++++-------------- helpers/helpers.js | 4 ++-- lib/cache.js | 31 +++++++++++++++++--------- lib/markdownlint.js | 3 ++- lib/md011.js | 7 +++--- lib/md044.js | 7 +++--- 6 files changed, 56 insertions(+), 39 deletions(-) diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 3c12f285..bc8f8ac3 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -303,14 +303,14 @@ module.exports.forEachLine = function forEachLine(lineMetadata, handler) { }); }; // Returns (nested) lists as a flat array (in order) -module.exports.flattenLists = function flattenLists(params) { +module.exports.flattenLists = function flattenLists(tokens) { var flattenedLists = []; var stack = []; var current = null; var nesting = 0; var nestingStack = []; var lastWithMap = { "map": [0, 1] }; - params.tokens.forEach(function (token) { + tokens.forEach(function (token) { if (isMathBlock(token) && token.map[1]) { // markdown-it-texmath plugin does not account for math_block_end token.map[1]++; @@ -760,13 +760,6 @@ module.exports.applyFixes = function applyFixes(input, errors) { "use strict"; // @ts-check -var lineMetadata = null; -module.exports.lineMetadata = function (value) { - if (value) { - lineMetadata = value; - } - return lineMetadata; -}; var flattenedLists = null; module.exports.flattenedLists = function (value) { if (value) { @@ -774,9 +767,24 @@ module.exports.flattenedLists = function (value) { } return flattenedLists; }; +var inlineCodeSpanRanges = null; +module.exports.inlineCodeSpanRanges = function (value) { + if (value) { + inlineCodeSpanRanges = value; + } + return inlineCodeSpanRanges; +}; +var lineMetadata = null; +module.exports.lineMetadata = function (value) { + if (value) { + lineMetadata = value; + } + return lineMetadata; +}; module.exports.clear = function () { - lineMetadata = null; flattenedLists = null; + inlineCodeSpanRanges = null; + lineMetadata = null; }; @@ -1268,7 +1276,8 @@ function lintContent(ruleList, name, content, md, config, frontMatter, handleRul frontMatterLines: frontMatterLines }; cache.lineMetadata(helpers.getLineMetadata(params)); - cache.flattenedLists(helpers.flattenLists(params)); + cache.flattenedLists(helpers.flattenLists(params.tokens)); + cache.inlineCodeSpanRanges(helpers.inlineCodeSpanRanges(params.lines)); // Function to run for each rule var result = (resultVersion === 0) ? {} : []; // eslint-disable-next-line jsdoc/require-jsdoc @@ -2207,15 +2216,15 @@ module.exports = { "use strict"; // @ts-check -var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addError = _a.addError, forEachLine = _a.forEachLine, inlineCodeSpanRanges = _a.inlineCodeSpanRanges, overlapsAnyRange = _a.overlapsAnyRange; -var lineMetadata = __webpack_require__(/*! ./cache */ "../lib/cache.js").lineMetadata; +var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addError = _a.addError, forEachLine = _a.forEachLine, overlapsAnyRange = _a.overlapsAnyRange; +var _b = __webpack_require__(/*! ./cache */ "../lib/cache.js"), inlineCodeSpanRanges = _b.inlineCodeSpanRanges, lineMetadata = _b.lineMetadata; var reversedLinkRe = /(? { + tokens.forEach((token) => { if (isMathBlock(token) && token.map[1]) { // markdown-it-texmath plugin does not account for math_block_end token.map[1]++; diff --git a/lib/cache.js b/lib/cache.js index bd5ebe8a..a2ad39af 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -2,14 +2,6 @@ "use strict"; -let lineMetadata = null; -module.exports.lineMetadata = (value) => { - if (value) { - lineMetadata = value; - } - return lineMetadata; -}; - let flattenedLists = null; module.exports.flattenedLists = (value) => { if (value) { @@ -18,7 +10,24 @@ module.exports.flattenedLists = (value) => { return flattenedLists; }; -module.exports.clear = () => { - lineMetadata = null; - flattenedLists = null; +let inlineCodeSpanRanges = null; +module.exports.inlineCodeSpanRanges = (value) => { + if (value) { + inlineCodeSpanRanges = value; + } + return inlineCodeSpanRanges; +}; + +let lineMetadata = null; +module.exports.lineMetadata = (value) => { + if (value) { + lineMetadata = value; + } + return lineMetadata; +}; + +module.exports.clear = () => { + flattenedLists = null; + inlineCodeSpanRanges = null; + lineMetadata = null; }; diff --git a/lib/markdownlint.js b/lib/markdownlint.js index ebc86282..a94e4c51 100644 --- a/lib/markdownlint.js +++ b/lib/markdownlint.js @@ -516,7 +516,8 @@ function lintContent( frontMatterLines }; cache.lineMetadata(helpers.getLineMetadata(params)); - cache.flattenedLists(helpers.flattenLists(params)); + cache.flattenedLists(helpers.flattenLists(params.tokens)); + cache.inlineCodeSpanRanges(helpers.inlineCodeSpanRanges(params.lines)); // Function to run for each rule const result = (resultVersion === 0) ? {} : []; // eslint-disable-next-line jsdoc/require-jsdoc diff --git a/lib/md011.js b/lib/md011.js index ff794e74..94bd87ca 100644 --- a/lib/md011.js +++ b/lib/md011.js @@ -2,9 +2,8 @@ "use strict"; -const { addError, forEachLine, inlineCodeSpanRanges, overlapsAnyRange } = - require("../helpers"); -const { lineMetadata } = require("./cache"); +const { addError, forEachLine, overlapsAnyRange } = require("../helpers"); +const { inlineCodeSpanRanges, lineMetadata } = require("./cache"); const reversedLinkRe = /(? { if (!inCode && !onFence) { let match = null; diff --git a/lib/md044.js b/lib/md044.js index 365b4aeb..2d8da0e4 100644 --- a/lib/md044.js +++ b/lib/md044.js @@ -3,9 +3,8 @@ "use strict"; const { addErrorDetailIf, bareUrlRe, escapeForRegExp, forEachLine, - inlineCodeSpanRanges, overlapsAnyRange, linkRe, linkReferenceRe } = - require("../helpers"); -const { lineMetadata } = require("./cache"); + overlapsAnyRange, linkRe, linkReferenceRe } = require("../helpers"); +const { inlineCodeSpanRanges, lineMetadata } = require("./cache"); module.exports = { "names": [ "MD044", "proper-names" ], @@ -37,7 +36,7 @@ module.exports = { } }); if (!includeCodeBlocks) { - exclusions.push(...inlineCodeSpanRanges(params.lines)); + exclusions.push(...inlineCodeSpanRanges()); } for (const name of names) { const escapedName = escapeForRegExp(name); From 752e7141c8acc173b99acef8cad597fee51ad919 Mon Sep 17 00:00:00 2001 From: David Anson Date: Wed, 30 Jun 2021 21:21:23 -0700 Subject: [PATCH 25/36] Add test case for MD044/proper-names based on new issue (closes #409). --- test/proper-names-substrings.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/proper-names-substrings.md diff --git a/test/proper-names-substrings.md b/test/proper-names-substrings.md new file mode 100644 index 00000000..fb737616 --- /dev/null +++ b/test/proper-names-substrings.md @@ -0,0 +1,15 @@ +# Proper Names as Substrings + +The proper case is: @aws-control-tower + +Similarly, aws-vault and AWS and @aws-control-tower are all correct. + + From b10147f16b58782eb29ea51ad70dd768860142ce Mon Sep 17 00:00:00 2001 From: David Anson Date: Thu, 5 Aug 2021 22:01:29 -0700 Subject: [PATCH 26/36] Remove helpers.utf8Encoding because it annoys the latest TypeScript compiler. --- demo/markdownlint-browser.js | 10 ++++------ helpers/helpers.js | 3 --- lib/markdownlint.js | 8 ++++---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index bc8f8ac3..40ab0e0b 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -55,8 +55,6 @@ var linkRe = /(\[(?:[^[\]]|\[[^\]]*\])*\])(\(\S*\)|\[\S*\])?/g; module.exports.linkRe = linkRe; // Regular expression for link reference definition lines module.exports.linkReferenceRe = /^ {0,3}\[[^\]]+]:\s.*$/; -// readFile options for reading with the UTF-8 encoding -module.exports.utf8Encoding = "utf8"; // All punctuation characters (normal and full-width) var allPunctuation = ".,;:!?。,;:!?"; module.exports.allPunctuation = allPunctuation; @@ -1463,10 +1461,10 @@ function lintFile(ruleList, file, md, config, frontMatter, handleRuleFailures, n // Make a/synchronous call to read file if (synchronous) { // @ts-ignore - lintContentWrapper(null, fs.readFileSync(file, helpers.utf8Encoding)); + lintContentWrapper(null, fs.readFileSync(file, "utf8")); } else { - fs.readFile(file, helpers.utf8Encoding, lintContentWrapper); + fs.readFile(file, "utf8", lintContentWrapper); } } /** @@ -1683,7 +1681,7 @@ function readConfig(file, parsers, callback) { parsers = null; } // Read file - fs.readFile(file, helpers.utf8Encoding, function (err, content) { + fs.readFile(file, "utf8", function (err, content) { if (err) { return callback(err); } @@ -1730,7 +1728,7 @@ function readConfigPromise(file, parsers) { function readConfigSync(file, parsers) { // Read file // @ts-ignore - var content = fs.readFileSync(file, helpers.utf8Encoding); + var content = fs.readFileSync(file, "utf8"); // Try to parse file var _a = parseConfiguration(file, content, parsers), config = _a.config, message = _a.message; if (!config) { diff --git a/helpers/helpers.js b/helpers/helpers.js index ee86d103..a1b10952 100644 --- a/helpers/helpers.js +++ b/helpers/helpers.js @@ -35,9 +35,6 @@ module.exports.linkRe = linkRe; // Regular expression for link reference definition lines module.exports.linkReferenceRe = /^ {0,3}\[[^\]]+]:\s.*$/; -// readFile options for reading with the UTF-8 encoding -module.exports.utf8Encoding = "utf8"; - // All punctuation characters (normal and full-width) const allPunctuation = ".,;:!?。,;:!?"; module.exports.allPunctuation = allPunctuation; diff --git a/lib/markdownlint.js b/lib/markdownlint.js index a94e4c51..b4cb77d5 100644 --- a/lib/markdownlint.js +++ b/lib/markdownlint.js @@ -711,9 +711,9 @@ function lintFile( // Make a/synchronous call to read file if (synchronous) { // @ts-ignore - lintContentWrapper(null, fs.readFileSync(file, helpers.utf8Encoding)); + lintContentWrapper(null, fs.readFileSync(file, "utf8")); } else { - fs.readFile(file, helpers.utf8Encoding, lintContentWrapper); + fs.readFile(file, "utf8", lintContentWrapper); } } @@ -968,7 +968,7 @@ function readConfig(file, parsers, callback) { parsers = null; } // Read file - fs.readFile(file, helpers.utf8Encoding, (err, content) => { + fs.readFile(file, "utf8", (err, content) => { if (err) { return callback(err); } @@ -1021,7 +1021,7 @@ function readConfigPromise(file, parsers) { function readConfigSync(file, parsers) { // Read file // @ts-ignore - const content = fs.readFileSync(file, helpers.utf8Encoding); + const content = fs.readFileSync(file, "utf8"); // Try to parse file const { config, message } = parseConfiguration(file, content, parsers); if (!config) { From 211f09afbcd4f0ced8103f9dc9798d07740e6a2f Mon Sep 17 00:00:00 2001 From: David Anson Date: Thu, 12 Aug 2021 19:38:03 -0700 Subject: [PATCH 27/36] Allow custom file system implementation to be passed when linting or reading configuration. --- .eslintrc.json | 2 +- README.md | 34 ++++++-- demo/markdownlint-browser.js | 60 ++++++++----- lib/markdownlint.d.ts | 13 ++- lib/markdownlint.js | 57 +++++++----- test/markdownlint-test.js | 163 +++++++++++++++++++++++++++++++++++ 6 files changed, 277 insertions(+), 52 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 86878e12..b8fd627b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -39,7 +39,7 @@ "max-depth": "off", "max-lines": "off", "max-lines-per-function": "off", - "max-params": ["error", 10], + "max-params": ["off"], "max-statements": "off", "multiline-comment-style": ["error", "separate-lines"], "multiline-ternary": "off", diff --git a/README.md b/README.md index 189381ec..1054ef62 100644 --- a/README.md +++ b/README.md @@ -294,7 +294,8 @@ function markdownlint(options) { ... } Type: `Object` -Configures the function. +Configures the function. All properties are optional, but at least one +of `files` or `strings` should be set to provide input. ##### options.customRules @@ -534,6 +535,16 @@ Each item in the top-level `Array` should be of the form: [ require("markdown-it-plugin"), plugin_param_0, plugin_param_1, ... ] ``` +##### options.fs + +Type: `Object` implementing the [file system API](https://nodejs.org/api/fs.html) + +In advanced scenarios, it may be desirable to bypass the default file system API. +If a custom file system implementation is provided, `markdownlint` will use that +instead of invoking `require("fs")`. + +Note: The only methods called are `readFile` and `readFileSync`. + #### callback Type: `Function` taking (`Error`, `Object`) @@ -566,10 +577,11 @@ Asynchronous API: * * @param {string} file Configuration file name. * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing function(s). + * @param {Object} [fs] File system implementation. * @param {ReadConfigCallback} [callback] Callback (err, result) function. * @returns {void} */ -function readConfig(file, parsers, callback) { ... } +function readConfig(file, parsers, fs, callback) { ... } ``` Synchronous API: @@ -580,13 +592,14 @@ Synchronous API: * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. */ -function readConfigSync(file, parsers) { ... } +function readConfigSync(file, parsers, fs) { ... } ``` Promise API (in the `promises` namespace like Node.js's -[`fs` Promises API](https://nodejs.org/api/fs.html#fs_fs_promises_api)): +[`fs` Promises API](https://nodejs.org/api/fs.html#fs_promises_api)): ```js /** @@ -594,9 +607,10 @@ Promise API (in the `promises` namespace like Node.js's * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Promise} Configuration object. */ -function readConfig(file, parsers) { ... } +function readConfig(file, parsers, fs) { ... } ``` #### file @@ -627,6 +641,16 @@ For example: [ JSON.parse, require("toml").parse, require("js-yaml").load ] ``` +#### fs + +Type: *Optional* `Object` implementing the [file system API](https://nodejs.org/api/fs.html) + +In advanced scenarios, it may be desirable to bypass the default file system API. +If a custom file system implementation is provided, `markdownlint` will use that +instead of invoking `require("fs")`. + +Note: The only methods called are `readFile`, `readFileSync`, and `accessSync`. + #### callback Type: `Function` taking (`Error`, `Object`) diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 40ab0e0b..5080492b 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -813,7 +813,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) { to[j] = from[i]; return to; }; -var fs = __webpack_require__(/*! fs */ "?ec0a"); var path = __webpack_require__(/*! path */ "?b85c"); var promisify = __webpack_require__(/*! util */ "?96a2").promisify; var markdownIt = __webpack_require__(/*! markdown-it */ "markdown-it"); @@ -1446,11 +1445,12 @@ function lintContent(ruleList, name, content, md, config, frontMatter, handleRul * @param {boolean} handleRuleFailures Whether to handle exceptions in rules. * @param {boolean} noInlineConfig Whether to allow inline configuration. * @param {number} resultVersion Version of the LintResults object to return. + * @param {Object} fs File system implementation. * @param {boolean} synchronous Whether to execute synchronously. * @param {Function} callback Callback (err, result) function. * @returns {void} */ -function lintFile(ruleList, file, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, synchronous, callback) { +function lintFile(ruleList, file, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, fs, synchronous, callback) { // eslint-disable-next-line jsdoc/require-jsdoc function lintContentWrapper(err, content) { if (err) { @@ -1460,7 +1460,6 @@ function lintFile(ruleList, file, md, config, frontMatter, handleRuleFailures, n } // Make a/synchronous call to read file if (synchronous) { - // @ts-ignore lintContentWrapper(null, fs.readFileSync(file, "utf8")); } else { @@ -1507,6 +1506,7 @@ function lintInput(options, synchronous, callback) { // @ts-ignore md.use.apply(md, plugin); }); + var fs = options.fs || __webpack_require__(/*! fs */ "?ec0a"); var results = newResults(ruleList); var done = false; // Linting of strings is always synchronous @@ -1526,7 +1526,7 @@ function lintInput(options, synchronous, callback) { if (synchronous) { // Lint files synchronously while (!done && (syncItem = files.shift())) { - lintFile(ruleList, syncItem, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, synchronous, syncCallback); + lintFile(ruleList, syncItem, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, fs, synchronous, syncCallback); } return done || callback(null, results); } @@ -1540,7 +1540,7 @@ function lintInput(options, synchronous, callback) { } else if (asyncItem) { concurrency++; - lintFile(ruleList, asyncItem, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, synchronous, function (err, result) { + lintFile(ruleList, asyncItem, md, config, frontMatter, handleRuleFailures, noInlineConfig, resultVersion, fs, synchronous, function (err, result) { concurrency--; if (err) { done = true; @@ -1644,24 +1644,24 @@ function parseConfiguration(name, content, parsers) { * * @param {string} configFile Configuration file name. * @param {string} referenceId Referenced identifier to resolve. + * @param {Object} fs File system implementation. * @returns {string} Resolved path to file. */ -function resolveConfigExtends(configFile, referenceId) { +function resolveConfigExtends(configFile, referenceId, fs) { var configFileDirname = path.dirname(configFile); var resolvedExtendsFile = path.resolve(configFileDirname, referenceId); try { - if (fs.statSync(resolvedExtendsFile).isFile()) { - return resolvedExtendsFile; - } + fs.accessSync(resolvedExtendsFile); + return resolvedExtendsFile; } catch (_a) { - // If not a file or fs.statSync throws, try require.resolve + // Not a file, try require.resolve } try { return dynamicRequire.resolve(referenceId, { "paths": [configFileDirname] }); } catch (_b) { - // If require.resolve throws, return resolvedExtendsFile + // Unable to resolve, return resolvedExtendsFile } return resolvedExtendsFile; } @@ -1671,14 +1671,24 @@ function resolveConfigExtends(configFile, referenceId) { * @param {string} file Configuration file name. * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing * function(s). + * @param {Object} [fs] File system implementation. * @param {ReadConfigCallback} [callback] Callback (err, result) function. * @returns {void} */ -function readConfig(file, parsers, callback) { +function readConfig(file, parsers, fs, callback) { if (!callback) { - // @ts-ignore - callback = parsers; - parsers = null; + if (fs) { + callback = fs; + fs = null; + } + else { + // @ts-ignore + callback = parsers; + parsers = null; + } + } + if (!fs) { + fs = __webpack_require__(/*! fs */ "?ec0a"); } // Read file fs.readFile(file, "utf8", function (err, content) { @@ -1695,8 +1705,8 @@ function readConfig(file, parsers, callback) { var configExtends = config["extends"]; if (configExtends) { delete config["extends"]; - var resolvedExtends = resolveConfigExtends(file, configExtends); - return readConfig(resolvedExtends, parsers, function (errr, extendsConfig) { + var resolvedExtends = resolveConfigExtends(file, configExtends, fs); + return readConfig(resolvedExtends, parsers, fs, function (errr, extendsConfig) { if (errr) { return callback(errr); } @@ -1712,22 +1722,26 @@ var readConfigPromisify = promisify && promisify(readConfig); * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Promise} Configuration object. */ -function readConfigPromise(file, parsers) { +function readConfigPromise(file, parsers, fs) { // @ts-ignore - return readConfigPromisify(file, parsers); + return readConfigPromisify(file, parsers, fs); } /** * Read specified configuration file synchronously. * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. */ -function readConfigSync(file, parsers) { +function readConfigSync(file, parsers, fs) { + if (!fs) { + fs = __webpack_require__(/*! fs */ "?ec0a"); + } // Read file - // @ts-ignore var content = fs.readFileSync(file, "utf8"); // Try to parse file var _a = parseConfiguration(file, content, parsers), config = _a.config, message = _a.message; @@ -1738,8 +1752,8 @@ function readConfigSync(file, parsers) { var configExtends = config["extends"]; if (configExtends) { delete config["extends"]; - var resolvedExtends = resolveConfigExtends(file, configExtends); - return __assign(__assign({}, readConfigSync(resolvedExtends, parsers)), config); + var resolvedExtends = resolveConfigExtends(file, configExtends, fs); + return __assign(__assign({}, readConfigSync(resolvedExtends, parsers, fs)), config); } return config; } diff --git a/lib/markdownlint.d.ts b/lib/markdownlint.d.ts index e344bd0d..be83dd54 100644 --- a/lib/markdownlint.d.ts +++ b/lib/markdownlint.d.ts @@ -52,6 +52,10 @@ type Options = { * Additional plugins. */ markdownItPlugins?: Plugin[]; + /** + * File system implementation. + */ + fs?: any; }; /** * Called with the result of the lint operation. @@ -70,18 +74,20 @@ declare function markdownlintSync(options: Options): LintResults; * @param {string} file Configuration file name. * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing * function(s). + * @param {Object} [fs] File system implementation. * @param {ReadConfigCallback} [callback] Callback (err, result) function. * @returns {void} */ -declare function readConfig(file: string, parsers: ConfigurationParser[] | ReadConfigCallback, callback?: ReadConfigCallback): void; +declare function readConfig(file: string, parsers: ConfigurationParser[] | ReadConfigCallback, fs?: any, callback?: ReadConfigCallback): void; /** * Read specified configuration file synchronously. * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. */ -declare function readConfigSync(file: string, parsers?: ConfigurationParser[]): Configuration; +declare function readConfigSync(file: string, parsers?: ConfigurationParser[], fs?: any): Configuration; /** * Gets the (semantic) version of the library. * @@ -364,6 +370,7 @@ declare function markdownlintPromise(options: Options): Promise; * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Promise} Configuration object. */ -declare function readConfigPromise(file: string, parsers?: ConfigurationParser[]): Promise; +declare function readConfigPromise(file: string, parsers?: ConfigurationParser[], fs?: any): Promise; diff --git a/lib/markdownlint.js b/lib/markdownlint.js index b4cb77d5..dab39ed1 100644 --- a/lib/markdownlint.js +++ b/lib/markdownlint.js @@ -2,7 +2,6 @@ "use strict"; -const fs = require("fs"); const path = require("path"); const { promisify } = require("util"); const markdownIt = require("markdown-it"); @@ -685,6 +684,7 @@ function lintContent( * @param {boolean} handleRuleFailures Whether to handle exceptions in rules. * @param {boolean} noInlineConfig Whether to allow inline configuration. * @param {number} resultVersion Version of the LintResults object to return. + * @param {Object} fs File system implementation. * @param {boolean} synchronous Whether to execute synchronously. * @param {Function} callback Callback (err, result) function. * @returns {void} @@ -698,6 +698,7 @@ function lintFile( handleRuleFailures, noInlineConfig, resultVersion, + fs, synchronous, callback) { // eslint-disable-next-line jsdoc/require-jsdoc @@ -710,7 +711,6 @@ function lintFile( } // Make a/synchronous call to read file if (synchronous) { - // @ts-ignore lintContentWrapper(null, fs.readFileSync(file, "utf8")); } else { fs.readFile(file, "utf8", lintContentWrapper); @@ -756,6 +756,7 @@ function lintInput(options, synchronous, callback) { // @ts-ignore md.use(...plugin); }); + const fs = options.fs || require("fs"); const results = newResults(ruleList); let done = false; // Linting of strings is always synchronous @@ -795,6 +796,7 @@ function lintInput(options, synchronous, callback) { handleRuleFailures, noInlineConfig, resultVersion, + fs, synchronous, syncCallback ); @@ -819,6 +821,7 @@ function lintInput(options, synchronous, callback) { handleRuleFailures, noInlineConfig, resultVersion, + fs, synchronous, (err, result) => { concurrency--; @@ -929,17 +932,17 @@ function parseConfiguration(name, content, parsers) { * * @param {string} configFile Configuration file name. * @param {string} referenceId Referenced identifier to resolve. + * @param {Object} fs File system implementation. * @returns {string} Resolved path to file. */ -function resolveConfigExtends(configFile, referenceId) { +function resolveConfigExtends(configFile, referenceId, fs) { const configFileDirname = path.dirname(configFile); const resolvedExtendsFile = path.resolve(configFileDirname, referenceId); try { - if (fs.statSync(resolvedExtendsFile).isFile()) { - return resolvedExtendsFile; - } + fs.accessSync(resolvedExtendsFile); + return resolvedExtendsFile; } catch { - // If not a file or fs.statSync throws, try require.resolve + // Not a file, try require.resolve } try { return dynamicRequire.resolve( @@ -947,7 +950,7 @@ function resolveConfigExtends(configFile, referenceId) { { "paths": [ configFileDirname ] } ); } catch { - // If require.resolve throws, return resolvedExtendsFile + // Unable to resolve, return resolvedExtendsFile } return resolvedExtendsFile; } @@ -958,14 +961,23 @@ function resolveConfigExtends(configFile, referenceId) { * @param {string} file Configuration file name. * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing * function(s). + * @param {Object} [fs] File system implementation. * @param {ReadConfigCallback} [callback] Callback (err, result) function. * @returns {void} */ -function readConfig(file, parsers, callback) { +function readConfig(file, parsers, fs, callback) { if (!callback) { - // @ts-ignore - callback = parsers; - parsers = null; + if (fs) { + callback = fs; + fs = null; + } else { + // @ts-ignore + callback = parsers; + parsers = null; + } + } + if (!fs) { + fs = require("fs"); } // Read file fs.readFile(file, "utf8", (err, content) => { @@ -982,8 +994,8 @@ function readConfig(file, parsers, callback) { const configExtends = config.extends; if (configExtends) { delete config.extends; - const resolvedExtends = resolveConfigExtends(file, configExtends); - return readConfig(resolvedExtends, parsers, (errr, extendsConfig) => { + const resolvedExtends = resolveConfigExtends(file, configExtends, fs); + return readConfig(resolvedExtends, parsers, fs, (errr, extendsConfig) => { if (errr) { return callback(errr); } @@ -1004,11 +1016,12 @@ const readConfigPromisify = promisify && promisify(readConfig); * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Promise} Configuration object. */ -function readConfigPromise(file, parsers) { +function readConfigPromise(file, parsers, fs) { // @ts-ignore - return readConfigPromisify(file, parsers); + return readConfigPromisify(file, parsers, fs); } /** @@ -1016,11 +1029,14 @@ function readConfigPromise(file, parsers) { * * @param {string} file Configuration file name. * @param {ConfigurationParser[]} [parsers] Parsing function(s). + * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. */ -function readConfigSync(file, parsers) { +function readConfigSync(file, parsers, fs) { + if (!fs) { + fs = require("fs"); + } // Read file - // @ts-ignore const content = fs.readFileSync(file, "utf8"); // Try to parse file const { config, message } = parseConfiguration(file, content, parsers); @@ -1031,9 +1047,9 @@ function readConfigSync(file, parsers) { const configExtends = config.extends; if (configExtends) { delete config.extends; - const resolvedExtends = resolveConfigExtends(file, configExtends); + const resolvedExtends = resolveConfigExtends(file, configExtends, fs); return { - ...readConfigSync(resolvedExtends, parsers), + ...readConfigSync(resolvedExtends, parsers, fs), ...config }; } @@ -1156,6 +1172,7 @@ module.exports = markdownlint; * @property {boolean} [noInlineConfig] True to ignore HTML directives. * @property {number} [resultVersion] Results object version. * @property {Plugin[]} [markdownItPlugins] Additional plugins. + * @property {Object} [fs] File system implementation. */ /** diff --git a/test/markdownlint-test.js b/test/markdownlint-test.js index 174e43f3..dbe1c4a8 100644 --- a/test/markdownlint-test.js +++ b/test/markdownlint-test.js @@ -652,11 +652,13 @@ test.cb("readmeHeadings", (t) => { "##### options.noInlineConfig", "##### options.resultVersion", "##### options.markdownItPlugins", + "##### options.fs", "#### callback", "#### result", "### Config", "#### file", "#### parsers", + "#### fs", "#### callback", "#### result", "## Usage", @@ -798,6 +800,40 @@ test.cb("missingStringValue", (t) => { }); }); +test("customFileSystemSync", (t) => { + t.plan(2); + const file = "/dir/file.md"; + const fsApi = { + "readFileSync": (p) => { + t.is(p, file); + return "# Heading"; + } + }; + const result = markdownlint.sync({ + "files": file, + "fs": fsApi + }); + t.deepEqual(result[file].length, 1, "Did not report violations."); +}); + +test.cb("customFileSystemAsync", (t) => { + t.plan(3); + const file = "/dir/file.md"; + const fsApi = { + "readFile": (p, o, cb) => { + t.is(p, file); + cb(null, "# Heading"); + } + }; + markdownlint({ + "files": file, + "fs": fsApi + }, function callback(err, result) { + t.falsy(err); + t.deepEqual(result[file].length, 1, "Did not report violations."); + t.end(); + }); +}); test.cb("readme", (t) => { t.plan(115); const tagToRules = {}; @@ -1105,6 +1141,52 @@ test.cb("configMultipleWithRequireResolve", (t) => { }); }); +test.cb("configCustomFileSystem", (t) => { + t.plan(5); + const file = "/dir/file.json"; + const extended = "/dir/extended.json"; + const fileContent = { + "extends": extended, + "default": true, + "MD001": false + }; + const extendedContent = { + "MD001": true, + "MD002": true + }; + const fsApi = { + "accessSync": (p) => { + t.is(p, extended); + }, + "readFile": (p, o, cb) => { + switch (p) { + case file: + t.is(p, file); + return cb(null, JSON.stringify(fileContent)); + case extended: + t.is(p, extended); + return cb(null, JSON.stringify(extendedContent)); + default: + return t.fail(); + } + } + }; + markdownlint.readConfig( + file, + null, + fsApi, + function callback(err, actual) { + t.falsy(err); + const expected = { + ...extendedContent, + ...fileContent + }; + delete expected.extends; + t.deepEqual(actual, expected, "Config object not correct."); + t.end(); + }); +}); + test.cb("configBadFile", (t) => { t.plan(4); markdownlint.readConfig("./test/config/config-badfile.json", @@ -1358,6 +1440,45 @@ test("configMultipleHybridSync", (t) => { t.like(actual, expected, "Config object not correct."); }); +test("configCustomFileSystemSync", (t) => { + t.plan(4); + const file = "/dir/file.json"; + const extended = "/dir/extended.json"; + const fileContent = { + "extends": extended, + "default": true, + "MD001": false + }; + const extendedContent = { + "MD001": true, + "MD002": true + }; + const fsApi = { + "accessSync": (p) => { + t.is(p, extended); + }, + "readFileSync": (p) => { + switch (p) { + case file: + t.is(p, file); + return JSON.stringify(fileContent); + case extended: + t.is(p, extended); + return JSON.stringify(extendedContent); + default: + return t.fail(); + } + } + }; + const actual = markdownlint.readConfigSync(file, null, fsApi); + const expected = { + ...extendedContent, + ...fileContent + }; + delete expected.extends; + t.deepEqual(actual, expected, "Config object not correct."); +}); + test("configBadHybridSync", (t) => { t.plan(1); t.throws( @@ -1385,6 +1506,48 @@ test.cb("configSinglePromise", (t) => { }); }); +test.cb("configCustomFileSystemPromise", (t) => { + t.plan(4); + const file = "/dir/file.json"; + const extended = "/dir/extended.json"; + const fileContent = { + "extends": extended, + "default": true, + "MD001": false + }; + const extendedContent = { + "MD001": true, + "MD002": true + }; + const fsApi = { + "accessSync": (p) => { + t.is(p, extended); + }, + "readFile": (p, o, cb) => { + switch (p) { + case file: + t.is(p, file); + return cb(null, JSON.stringify(fileContent)); + case extended: + t.is(p, extended); + return cb(null, JSON.stringify(extendedContent)); + default: + return t.fail(); + } + } + }; + markdownlint.promises.readConfig(file, null, fsApi) + .then((actual) => { + const expected = { + ...extendedContent, + ...fileContent + }; + delete expected.extends; + t.deepEqual(actual, expected, "Config object not correct."); + t.end(); + }); +}); + test.cb("configBadFilePromise", (t) => { t.plan(2); markdownlint.promises.readConfig("./test/config/config-badfile.json") From 709e3148366000ab374939c9cc0ce2583611d114 Mon Sep 17 00:00:00 2001 From: David Anson Date: Thu, 12 Aug 2021 20:43:18 -0700 Subject: [PATCH 28/36] Update readConfig to use fs.access so the async path is fully async. --- README.md | 2 +- demo/markdownlint-browser.js | 36 ++++++++++++++--- lib/markdownlint.d.ts | 10 +++-- lib/markdownlint.js | 76 +++++++++++++++++++++++++++++------- test/markdownlint-test.js | 12 +++--- 5 files changed, 108 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 1054ef62..86fc318c 100644 --- a/README.md +++ b/README.md @@ -649,7 +649,7 @@ In advanced scenarios, it may be desirable to bypass the default file system API If a custom file system implementation is provided, `markdownlint` will use that instead of invoking `require("fs")`. -Note: The only methods called are `readFile`, `readFileSync`, and `accessSync`. +Note: The only methods called are `readFile`, `readFileSync`, `access`, and `accessSync`. #### callback diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 5080492b..3560c174 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -1638,6 +1638,33 @@ function parseConfiguration(name, content, parsers) { message: message }; } +/** + * Resolve referenced "extends" path in a configuration file + * using path.resolve() with require.resolve() as a fallback. + * + * @param {string} configFile Configuration file name. + * @param {string} referenceId Referenced identifier to resolve. + * @param {Object} fs File system implementation. + * @param {ResolveConfigExtendsCallback} [callback] Callback (err, result) + * function. + * @returns {void} + */ +function resolveConfigExtends(configFile, referenceId, fs, callback) { + var configFileDirname = path.dirname(configFile); + var resolvedExtendsFile = path.resolve(configFileDirname, referenceId); + fs.access(resolvedExtendsFile, function (err) { + if (err) { + // Not a file, try require.resolve + try { + return callback(null, dynamicRequire.resolve(referenceId, { "paths": [configFileDirname] })); + } + catch (_a) { + // Unable to resolve, use resolvedExtendsFile + } + } + return callback(null, resolvedExtendsFile); + }); +} /** * Resolve referenced "extends" path in a configuration file * using path.resolve() with require.resolve() as a fallback. @@ -1647,7 +1674,7 @@ function parseConfiguration(name, content, parsers) { * @param {Object} fs File system implementation. * @returns {string} Resolved path to file. */ -function resolveConfigExtends(configFile, referenceId, fs) { +function resolveConfigExtendsSync(configFile, referenceId, fs) { var configFileDirname = path.dirname(configFile); var resolvedExtendsFile = path.resolve(configFileDirname, referenceId); try { @@ -1705,13 +1732,12 @@ function readConfig(file, parsers, fs, callback) { var configExtends = config["extends"]; if (configExtends) { delete config["extends"]; - var resolvedExtends = resolveConfigExtends(file, configExtends, fs); - return readConfig(resolvedExtends, parsers, fs, function (errr, extendsConfig) { + return resolveConfigExtends(file, configExtends, fs, function (_, resolvedExtends) { return readConfig(resolvedExtends, parsers, fs, function (errr, extendsConfig) { if (errr) { return callback(errr); } return callback(null, __assign(__assign({}, extendsConfig), config)); - }); + }); }); } return callback(null, config); }); @@ -1752,7 +1778,7 @@ function readConfigSync(file, parsers, fs) { var configExtends = config["extends"]; if (configExtends) { delete config["extends"]; - var resolvedExtends = resolveConfigExtends(file, configExtends, fs); + var resolvedExtends = resolveConfigExtendsSync(file, configExtends, fs); return __assign(__assign({}, readConfigSync(resolvedExtends, parsers, fs)), config); } return config; diff --git a/lib/markdownlint.d.ts b/lib/markdownlint.d.ts index be83dd54..7c9d19b7 100644 --- a/lib/markdownlint.d.ts +++ b/lib/markdownlint.d.ts @@ -8,7 +8,7 @@ export = markdownlint; */ declare function markdownlint(options: Options, callback: LintCallback): void; declare namespace markdownlint { - export { markdownlintSync as sync, readConfig, readConfigSync, getVersion, promises, RuleFunction, RuleParams, MarkdownItToken, RuleOnError, RuleOnErrorInfo, RuleOnErrorFixInfo, Rule, Options, Plugin, ToStringCallback, LintResults, LintError, FixInfo, LintCallback, Configuration, RuleConfiguration, ConfigurationParser, ReadConfigCallback }; + export { markdownlintSync as sync, readConfig, readConfigSync, getVersion, promises, RuleFunction, RuleParams, MarkdownItToken, RuleOnError, RuleOnErrorInfo, RuleOnErrorFixInfo, Rule, Options, Plugin, ToStringCallback, LintResults, LintError, FixInfo, LintCallback, Configuration, RuleConfiguration, ConfigurationParser, ReadConfigCallback, ResolveConfigExtendsCallback }; } /** * Configuration options. @@ -58,7 +58,7 @@ type Options = { fs?: any; }; /** - * Called with the result of the lint operation. + * Called with the result of the lint function. */ type LintCallback = (err: Error | null, results?: LintResults) => void; /** @@ -355,9 +355,13 @@ type RuleConfiguration = boolean | any; */ type ConfigurationParser = (text: string) => Configuration; /** - * Called with the result of the readConfig operation. + * Called with the result of the readConfig function. */ type ReadConfigCallback = (err: Error | null, config?: Configuration) => void; +/** + * Called with the result of the resolveConfigExtends function. + */ +type ResolveConfigExtendsCallback = (err: Error | null, path?: string) => void; /** * Lint specified Markdown files. * diff --git a/lib/markdownlint.js b/lib/markdownlint.js index dab39ed1..6b2c6db0 100644 --- a/lib/markdownlint.js +++ b/lib/markdownlint.js @@ -926,6 +926,36 @@ function parseConfiguration(name, content, parsers) { }; } +/** + * Resolve referenced "extends" path in a configuration file + * using path.resolve() with require.resolve() as a fallback. + * + * @param {string} configFile Configuration file name. + * @param {string} referenceId Referenced identifier to resolve. + * @param {Object} fs File system implementation. + * @param {ResolveConfigExtendsCallback} [callback] Callback (err, result) + * function. + * @returns {void} + */ +function resolveConfigExtends(configFile, referenceId, fs, callback) { + const configFileDirname = path.dirname(configFile); + const resolvedExtendsFile = path.resolve(configFileDirname, referenceId); + fs.access(resolvedExtendsFile, (err) => { + if (err) { + // Not a file, try require.resolve + try { + return callback(null, dynamicRequire.resolve( + referenceId, + { "paths": [ configFileDirname ] } + )); + } catch { + // Unable to resolve, use resolvedExtendsFile + } + } + return callback(null, resolvedExtendsFile); + }); +} + /** * Resolve referenced "extends" path in a configuration file * using path.resolve() with require.resolve() as a fallback. @@ -935,7 +965,7 @@ function parseConfiguration(name, content, parsers) { * @param {Object} fs File system implementation. * @returns {string} Resolved path to file. */ -function resolveConfigExtends(configFile, referenceId, fs) { +function resolveConfigExtendsSync(configFile, referenceId, fs) { const configFileDirname = path.dirname(configFile); const resolvedExtendsFile = path.resolve(configFileDirname, referenceId); try { @@ -994,16 +1024,25 @@ function readConfig(file, parsers, fs, callback) { const configExtends = config.extends; if (configExtends) { delete config.extends; - const resolvedExtends = resolveConfigExtends(file, configExtends, fs); - return readConfig(resolvedExtends, parsers, fs, (errr, extendsConfig) => { - if (errr) { - return callback(errr); - } - return callback(null, { - ...extendsConfig, - ...config - }); - }); + return resolveConfigExtends( + file, + configExtends, + fs, + (_, resolvedExtends) => readConfig( + resolvedExtends, + parsers, + fs, + (errr, extendsConfig) => { + if (errr) { + return callback(errr); + } + return callback(null, { + ...extendsConfig, + ...config + }); + } + ) + ); } return callback(null, config); }); @@ -1047,7 +1086,7 @@ function readConfigSync(file, parsers, fs) { const configExtends = config.extends; if (configExtends) { delete config.extends; - const resolvedExtends = resolveConfigExtends(file, configExtends, fs); + const resolvedExtends = resolveConfigExtendsSync(file, configExtends, fs); return { ...readConfigSync(resolvedExtends, parsers, fs), ...config @@ -1221,7 +1260,7 @@ module.exports = markdownlint; */ /** - * Called with the result of the lint operation. + * Called with the result of the lint function. * * @callback LintCallback * @param {Error | null} err Error object or null. @@ -1251,10 +1290,19 @@ module.exports = markdownlint; */ /** - * Called with the result of the readConfig operation. + * Called with the result of the readConfig function. * * @callback ReadConfigCallback * @param {Error | null} err Error object or null. * @param {Configuration} [config] Configuration object. * @returns {void} */ + +/** + * Called with the result of the resolveConfigExtends function. + * + * @callback ResolveConfigExtendsCallback + * @param {Error | null} err Error object or null. + * @param {string} [path] Resolved path to file. + * @returns {void} + */ diff --git a/test/markdownlint-test.js b/test/markdownlint-test.js index dbe1c4a8..b00cc857 100644 --- a/test/markdownlint-test.js +++ b/test/markdownlint-test.js @@ -1155,8 +1155,9 @@ test.cb("configCustomFileSystem", (t) => { "MD002": true }; const fsApi = { - "accessSync": (p) => { - t.is(p, extended); + "access": (p, m, cb) => { + t.is(path.resolve(p), extended); + return (cb || m)(); }, "readFile": (p, o, cb) => { switch (p) { @@ -1455,7 +1456,7 @@ test("configCustomFileSystemSync", (t) => { }; const fsApi = { "accessSync": (p) => { - t.is(p, extended); + t.is(path.resolve(p), extended); }, "readFileSync": (p) => { switch (p) { @@ -1520,8 +1521,9 @@ test.cb("configCustomFileSystemPromise", (t) => { "MD002": true }; const fsApi = { - "accessSync": (p) => { - t.is(p, extended); + "access": (p, m, cb) => { + t.is(path.resolve(p), extended); + return (cb || m)(); }, "readFile": (p, o, cb) => { switch (p) { From 92111e09cf5990c2bfda7d3bba4c879a55b6c5d4 Mon Sep 17 00:00:00 2001 From: David Anson Date: Thu, 12 Aug 2021 20:50:10 -0700 Subject: [PATCH 29/36] Resolve Windows-specific test failure due to path comparison. --- test/markdownlint-test.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/markdownlint-test.js b/test/markdownlint-test.js index b00cc857..7813a722 100644 --- a/test/markdownlint-test.js +++ b/test/markdownlint-test.js @@ -1143,8 +1143,8 @@ test.cb("configMultipleWithRequireResolve", (t) => { test.cb("configCustomFileSystem", (t) => { t.plan(5); - const file = "/dir/file.json"; - const extended = "/dir/extended.json"; + const file = path.resolve("/dir/file.json"); + const extended = path.resolve("/dir/extended.json"); const fileContent = { "extends": extended, "default": true, @@ -1156,7 +1156,7 @@ test.cb("configCustomFileSystem", (t) => { }; const fsApi = { "access": (p, m, cb) => { - t.is(path.resolve(p), extended); + t.is(p, extended); return (cb || m)(); }, "readFile": (p, o, cb) => { @@ -1443,8 +1443,8 @@ test("configMultipleHybridSync", (t) => { test("configCustomFileSystemSync", (t) => { t.plan(4); - const file = "/dir/file.json"; - const extended = "/dir/extended.json"; + const file = path.resolve("/dir/file.json"); + const extended = path.resolve("/dir/extended.json"); const fileContent = { "extends": extended, "default": true, @@ -1456,7 +1456,7 @@ test("configCustomFileSystemSync", (t) => { }; const fsApi = { "accessSync": (p) => { - t.is(path.resolve(p), extended); + t.is(p, extended); }, "readFileSync": (p) => { switch (p) { @@ -1509,8 +1509,8 @@ test.cb("configSinglePromise", (t) => { test.cb("configCustomFileSystemPromise", (t) => { t.plan(4); - const file = "/dir/file.json"; - const extended = "/dir/extended.json"; + const file = path.resolve("/dir/file.json"); + const extended = path.resolve("/dir/extended.json"); const fileContent = { "extends": extended, "default": true, @@ -1522,7 +1522,7 @@ test.cb("configCustomFileSystemPromise", (t) => { }; const fsApi = { "access": (p, m, cb) => { - t.is(path.resolve(p), extended); + t.is(p, extended); return (cb || m)(); }, "readFile": (p, o, cb) => { From 580e57ddeec0d59e65b2872a7e70622fb03858df Mon Sep 17 00:00:00 2001 From: David Anson Date: Fri, 13 Aug 2021 22:18:39 -0700 Subject: [PATCH 30/36] Add Prettier.md to document compatibility issues (fixes #410). --- doc/Prettier.md | 23 +++++++++++++++++++++++ doc/Rules.md | 4 ++++ test/markdownlint-test.js | 2 ++ 3 files changed, 29 insertions(+) create mode 100644 doc/Prettier.md diff --git a/doc/Prettier.md b/doc/Prettier.md new file mode 100644 index 00000000..5221995e --- /dev/null +++ b/doc/Prettier.md @@ -0,0 +1,23 @@ +# Using markdownlint with Prettier + +[`Prettier`](https://prettier.io) is a popular code formatter. For the most part, +it works seamlessly with `markdownlint`. Special situations are documented +below. + +## List item indentation + +The default settings of `markdownlint` and `Prettier` are compatible and don't +result in any linting violations. If `Prettier` is used with `--tab-width` set +to `4`, the following `markdownlint` configuration can be used: + +```json +{ + "MD007": { + "indent": 4 + }, + "MD030": { + "ul_single": 3, + "ul_multi": 3 + } +} +``` diff --git a/doc/Rules.md b/doc/Rules.md index 1cc8d5fb..7ca6afb8 100644 --- a/doc/Rules.md +++ b/doc/Rules.md @@ -329,6 +329,8 @@ issue for multi-markdown parsers, which require 4-space indents. More informatio and . +Note: See [Prettier.md](Prettier.md) for compatibility information. + ## MD009 - Trailing spaces @@ -1183,6 +1185,8 @@ for your selected document style. Rationale: Violations of this rule can lead to improperly rendered content. +Note: See [Prettier.md](Prettier.md) for compatibility information. + ## MD031 - Fenced code blocks should be surrounded by blank lines diff --git a/test/markdownlint-test.js b/test/markdownlint-test.js index 7813a722..b3956673 100644 --- a/test/markdownlint-test.js +++ b/test/markdownlint-test.js @@ -80,6 +80,7 @@ test.cb("projectFilesNoInlineConfig", (t) => { "README.md", "CONTRIBUTING.md", "doc/CustomRules.md", + "doc/Prettier.md", "helpers/README.md" ], "noInlineConfig": true, @@ -94,6 +95,7 @@ test.cb("projectFilesNoInlineConfig", (t) => { "README.md": [], "CONTRIBUTING.md": [], "doc/CustomRules.md": [], + "doc/Prettier.md": [], "helpers/README.md": [] }; t.deepEqual(actual, expected, "Issue(s) with project files."); From c0218b24891067f2cfbdb8c5a44c6adef3be1dab Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 22 Aug 2021 15:15:20 -0700 Subject: [PATCH 31/36] Add MDN Web Docs to Examples in README.md. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 86fc318c..12d08d49 100644 --- a/README.md +++ b/README.md @@ -867,6 +867,7 @@ following projects or one of the tools in the [Related section](#Related): * [CodiMD](https://github.com/hackmdio/codimd) ([Search repository](https://github.com/hackmdio/codimd/search?q=markdownlint)) * [ESLint](https://eslint.org/) ([Search repository](https://github.com/eslint/eslint/search?q=markdownlint)) * [Garden React Components](https://zendeskgarden.github.io/react-components/) ([Search repository](https://github.com/zendeskgarden/react-components/search?q=markdownlint)) +* [MDN Web Docs](https://developer.mozilla.org/) ([Search repository](https://github.com/mdn/content/search?q=markdownlint)) * [MkDocs](https://www.mkdocs.org/) ([Search repository](https://github.com/mkdocs/mkdocs/search?q=markdownlint)) * [Mocha](https://mochajs.org/) ([Search repository](https://github.com/mochajs/mocha/search?q=markdownlint)) * [Reactable](https://glittershark.github.io/reactable/) ([Search repository](https://github.com/glittershark/reactable/search?q=markdownlint)) From c99ced2a7d39e3e591da2ff20f6ef4b6239f1ea1 Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 22 Aug 2021 15:28:28 -0700 Subject: [PATCH 32/36] Update MD037/no-space-in-emphasis to ignore emphasis on code fences and not report violations for scenarios that span an empty code fence (fixes #381). --- demo/markdownlint-browser.js | 12 ++++++++++-- lib/md037.js | 16 ++++++++++++++-- ...ces-inside-emphasis-markers-multiple-lines.md | 7 +++++++ test/spaces_inside_emphasis_markers.md | 4 ++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 3560c174..8ba6e018 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -3412,11 +3412,19 @@ module.exports = { resetRunTracking(); forEachLine(lineMetadata(), function (line, lineIndex, inCode, onFence, inTable, inItem, onBreak, inMath) { var onItemStart = (inItem === 1); - if (inCode || inTable || onBreak || onItemStart || isBlankLine(line)) { + if (inCode || + onFence || + inTable || + onBreak || + onItemStart || + isBlankLine(line)) { // Emphasis resets when leaving a block resetRunTracking(); } - if (inCode || onBreak || inMath) { + if (inCode || + onFence || + onBreak || + inMath) { // Emphasis has no meaning here return; } diff --git a/lib/md037.js b/lib/md037.js index 5d34afbf..14c5c032 100644 --- a/lib/md037.js +++ b/lib/md037.js @@ -78,11 +78,23 @@ module.exports = { lineMetadata(), (line, lineIndex, inCode, onFence, inTable, inItem, onBreak, inMath) => { const onItemStart = (inItem === 1); - if (inCode || inTable || onBreak || onItemStart || isBlankLine(line)) { + if ( + inCode || + onFence || + inTable || + onBreak || + onItemStart || + isBlankLine(line) + ) { // Emphasis resets when leaving a block resetRunTracking(); } - if (inCode || onBreak || inMath) { + if ( + inCode || + onFence || + onBreak || + inMath + ) { // Emphasis has no meaning here return; } diff --git a/test/spaces-inside-emphasis-markers-multiple-lines.md b/test/spaces-inside-emphasis-markers-multiple-lines.md index 4616ff55..18e43b1b 100644 --- a/test/spaces-inside-emphasis-markers-multiple-lines.md +++ b/test/spaces-inside-emphasis-markers-multiple-lines.md @@ -120,3 +120,10 @@ multi-line emphasis scenario * that should * not trigger violations * either`. + + +*text +```text +``` +text * + diff --git a/test/spaces_inside_emphasis_markers.md b/test/spaces_inside_emphasis_markers.md index 237c15ad..6735a2c3 100644 --- a/test/spaces_inside_emphasis_markers.md +++ b/test/spaces_inside_emphasis_markers.md @@ -341,3 +341,7 @@ text [reference*link] star * star text | x** y | x** y | | x _ y | x _ y | | x__ y | x__ y | + +```yaml /* autogenerated */ +# YAML... +``` From 227750e0ee67fb665dfb787f1c33f42dbc2fe9fc Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 22 Aug 2021 17:41:04 -0700 Subject: [PATCH 33/36] Update dependency: markdown-it to 12.2.0. --- demo/markdownlint-browser.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 8ba6e018..b3eefa1e 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -4099,7 +4099,7 @@ module.exports = rules; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"markdownlint","version":"0.23.1","description":"A Node.js style checker and lint tool for Markdown/CommonMark files.","main":"lib/markdownlint.js","types":"lib/markdownlint.d.ts","author":"David Anson (https://dlaa.me/)","license":"MIT","homepage":"https://github.com/DavidAnson/markdownlint","repository":{"type":"git","url":"https://github.com/DavidAnson/markdownlint.git"},"bugs":"https://github.com/DavidAnson/markdownlint/issues","scripts":{"build-config":"npm run build-config-schema && npm run build-config-example","build-config-example":"node schema/build-config-example.js","build-config-schema":"node schema/build-config-schema.js","build-declaration":"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf \'lib/{c,md,r}*.d.ts\' \'helpers/*.d.ts\'","build-demo":"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats","build-example":"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2","ci":"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code","clean-test-repos":"rimraf test-repos","clone-test-repos-dotnet-docs":"cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet","clone-test-repos-eslint-eslint":"cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet","clone-test-repos-mkdocs-mkdocs":"cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet","clone-test-repos-mochajs-mocha":"cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet","clone-test-repos-pi-hole-docs":"cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet","clone-test-repos-v8-v8-dev":"cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet","clone-test-repos-webhintio-hint":"cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet","clone-test-repos-webpack-webpack-js-org":"cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet","clone-test-repos":"mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org","clone-test-repos-large":"npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev","declaration":"npm run build-declaration && npm run test-declaration","example":"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint","lint":"eslint --max-warnings 0 .","lint-test-repos":"ava --timeout=5m test/markdownlint-test-repos.js","test":"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js","test-cover":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test","test-declaration":"cd example/typescript && tsc && node type-check.js","test-extra":"ava --timeout=5m test/markdownlint-test-extra.js"},"engines":{"node":">=10"},"dependencies":{"markdown-it":"12.0.6"},"devDependencies":{"ava":"~3.15.0","c8":"~7.7.2","cpy-cli":"~3.1.1","eslint":"~7.28.0","eslint-plugin-jsdoc":"~35.1.3","eslint-plugin-node":"~11.1.0","eslint-plugin-unicorn":"~33.0.1","globby":"~11.0.3","js-yaml":"~4.1.0","markdown-it-for-inline":"~0.1.1","markdown-it-sub":"~1.0.0","markdown-it-sup":"~1.0.0","markdown-it-texmath":"~0.9.0","markdownlint-rule-helpers":"~0.14.0","npm-run-all":"~4.1.5","rimraf":"~3.0.2","strip-json-comments":"~3.1.1","toml":"~3.0.0","ts-loader":"~9.2.3","tv4":"~1.3.0","typescript":"~4.3.2","webpack":"~5.38.1","webpack-cli":"~4.7.2"},"keywords":["markdown","lint","md","CommonMark","markdownlint"]}'); +module.exports = JSON.parse('{"name":"markdownlint","version":"0.23.1","description":"A Node.js style checker and lint tool for Markdown/CommonMark files.","main":"lib/markdownlint.js","types":"lib/markdownlint.d.ts","author":"David Anson (https://dlaa.me/)","license":"MIT","homepage":"https://github.com/DavidAnson/markdownlint","repository":{"type":"git","url":"https://github.com/DavidAnson/markdownlint.git"},"bugs":"https://github.com/DavidAnson/markdownlint/issues","scripts":{"build-config":"npm run build-config-schema && npm run build-config-example","build-config-example":"node schema/build-config-example.js","build-config-schema":"node schema/build-config-schema.js","build-declaration":"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf \'lib/{c,md,r}*.d.ts\' \'helpers/*.d.ts\'","build-demo":"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats","build-example":"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2","ci":"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code","clean-test-repos":"rimraf test-repos","clone-test-repos-dotnet-docs":"cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet","clone-test-repos-eslint-eslint":"cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet","clone-test-repos-mkdocs-mkdocs":"cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet","clone-test-repos-mochajs-mocha":"cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet","clone-test-repos-pi-hole-docs":"cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet","clone-test-repos-v8-v8-dev":"cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet","clone-test-repos-webhintio-hint":"cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet","clone-test-repos-webpack-webpack-js-org":"cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet","clone-test-repos":"mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org","clone-test-repos-large":"npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev","declaration":"npm run build-declaration && npm run test-declaration","example":"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint","lint":"eslint --max-warnings 0 .","lint-test-repos":"ava --timeout=5m test/markdownlint-test-repos.js","test":"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js","test-cover":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test","test-declaration":"cd example/typescript && tsc && node type-check.js","test-extra":"ava --timeout=5m test/markdownlint-test-extra.js"},"engines":{"node":">=10"},"dependencies":{"markdown-it":"12.2.0"},"devDependencies":{"ava":"~3.15.0","c8":"~7.7.2","cpy-cli":"~3.1.1","eslint":"~7.28.0","eslint-plugin-jsdoc":"~35.1.3","eslint-plugin-node":"~11.1.0","eslint-plugin-unicorn":"~33.0.1","globby":"~11.0.3","js-yaml":"~4.1.0","markdown-it-for-inline":"~0.1.1","markdown-it-sub":"~1.0.0","markdown-it-sup":"~1.0.0","markdown-it-texmath":"~0.9.0","markdownlint-rule-helpers":"~0.14.0","npm-run-all":"~4.1.5","rimraf":"~3.0.2","strip-json-comments":"~3.1.1","toml":"~3.0.0","ts-loader":"~9.2.3","tv4":"~1.3.0","typescript":"~4.3.2","webpack":"~5.38.1","webpack-cli":"~4.7.2"},"keywords":["markdown","lint","md","CommonMark","markdownlint"]}'); /***/ }), diff --git a/package.json b/package.json index 639b10c9..d8e12729 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "node": ">=10" }, "dependencies": { - "markdown-it": "12.0.6" + "markdown-it": "12.2.0" }, "devDependencies": { "ava": "~3.15.0", From a8228ecd805225bad1e8e64cf961248d9108e36c Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 22 Aug 2021 18:03:26 -0700 Subject: [PATCH 34/36] Update dependencies: c8 to 7.8.0, eslint to 7.32.0, eslint-plugin-jsdoc to 36.0.7, eslint-plugin-unicorn to 35.0.0, globby to 11.0.4, markdown-it-texmath to 0.9.1, ts-loader to 9.2.5, typescript to 4.3.5, webpack to 5.51.1, webpack-cli to 4.8.0. --- .eslintrc.json | 39 ++++++++++++++++++++++++++++++++++++ demo/markdownlint-browser.js | 23 +++++++++++---------- lib/markdownlint.d.ts | 1 + lib/markdownlint.js | 1 + package.json | 20 +++++++++--------- 5 files changed, 63 insertions(+), 21 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index b8fd627b..0c799131 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -70,15 +70,47 @@ "vars-on-top": "off", "wrap-regex": "off", + "jsdoc/check-access": "error", + "jsdoc/check-alignment": "error", "jsdoc/check-examples": "error", "jsdoc/check-indentation": "error", "jsdoc/check-line-alignment": "error", + "jsdoc/check-param-names": "error", + "jsdoc/check-property-names": "error", "jsdoc/check-syntax": "error", + "jsdoc/check-tag-names": "error", + "jsdoc/check-types": "error", + "jsdoc/check-values": "error", + "jsdoc/empty-tags": "error", + "jsdoc/implements-on-classes": "error", "jsdoc/match-description": "error", + "jsdoc/multiline-blocks": "error", + "jsdoc/newline-after-description": "error", "jsdoc/no-bad-blocks": "error", "jsdoc/no-defaults": "error", + "jsdoc/no-multi-asterisks": "error", + "jsdoc/no-undefined-types": "error", + "jsdoc/require-asterisk-prefix": "error", "jsdoc/require-description": "error", "jsdoc/require-description-complete-sentence": "error", + "jsdoc/require-jsdoc": "error", + "jsdoc/require-param": "error", + "jsdoc/require-param-description": "error", + "jsdoc/require-param-name": "error", + "jsdoc/require-param-type": "error", + "jsdoc/require-property": "error", + "jsdoc/require-property-description": "error", + "jsdoc/require-property-name": "error", + "jsdoc/require-property-type": "error", + "jsdoc/require-returns": "error", + "jsdoc/require-returns-check": "error", + "jsdoc/require-returns-description": "error", + "jsdoc/require-returns-type": "error", + "jsdoc/require-throws": "error", + "jsdoc/require-yields": "error", + "jsdoc/require-yields-check": "error", + "jsdoc/tag-lines": "error", + "jsdoc/valid-types": "error", "node/handle-callback-err": "error", "node/no-callback-literal": "error", @@ -139,6 +171,7 @@ "unicorn/no-abusive-eslint-disable": "error", "unicorn/no-array-callback-reference": "off", "unicorn/no-array-for-each": "off", + "unicorn/no-array-method-this-argument": "error", "unicorn/no-array-push-push": "error", "unicorn/no-array-reduce": "error", "unicorn/no-console-spaces": "error", @@ -159,6 +192,8 @@ "unicorn/no-unreadable-array-destructuring": "error", "unicorn/no-unsafe-regex": "off", "unicorn/no-unused-properties": "error", + "unicorn/no-useless-length-check": "error", + "unicorn/no-useless-spread": "error", "unicorn/no-useless-undefined": "error", "unicorn/no-zero-fractions": "error", "unicorn/number-literal-case": "error", @@ -169,6 +204,7 @@ "unicorn/prefer-array-flat-map": "error", "unicorn/prefer-array-index-of": "error", "unicorn/prefer-array-some": "error", + "unicorn/prefer-at": "off", "unicorn/prefer-date-now": "error", "unicorn/prefer-default-parameters": "error", "unicorn/prefer-dom-node-append": "error", @@ -183,6 +219,7 @@ "unicorn/prefer-negative-index": "error", "unicorn/prefer-node-protocol": "error", "unicorn/prefer-number-properties": "error", + "unicorn/prefer-object-from-entries": "error", "unicorn/prefer-object-has-own": "error", "unicorn/prefer-optional-catch-binding": "error", "unicorn/prefer-prototype-methods": "error", @@ -197,10 +234,12 @@ "unicorn/prefer-string-trim-start-end": "error", "unicorn/prefer-switch": "off", "unicorn/prefer-ternary": "error", + "unicorn/prefer-top-level-await": "error", "unicorn/prefer-type-error": "error", "unicorn/prevent-abbreviations": "off", "unicorn/require-array-join-separator": "error", "unicorn/require-number-to-fixed-digits-argument": "error", + "unicorn/require-post-message-target-origin": "error", "unicorn/string-content": "error", "unicorn/throw-new-error": "error" }, diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index b3eefa1e..f5b00dfa 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -1762,6 +1762,7 @@ function readConfigPromise(file, parsers, fs) { * @param {ConfigurationParser[]} [parsers] Parsing function(s). * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. + * @throws An Error if processing fails. */ function readConfigSync(file, parsers, fs) { if (!fs) { @@ -4090,17 +4091,6 @@ rules.forEach(function (rule) { module.exports = rules; -/***/ }), - -/***/ "../package.json": -/*!***********************!*\ - !*** ../package.json ***! - \***********************/ -/***/ ((module) => { - -"use strict"; -module.exports = JSON.parse('{"name":"markdownlint","version":"0.23.1","description":"A Node.js style checker and lint tool for Markdown/CommonMark files.","main":"lib/markdownlint.js","types":"lib/markdownlint.d.ts","author":"David Anson (https://dlaa.me/)","license":"MIT","homepage":"https://github.com/DavidAnson/markdownlint","repository":{"type":"git","url":"https://github.com/DavidAnson/markdownlint.git"},"bugs":"https://github.com/DavidAnson/markdownlint/issues","scripts":{"build-config":"npm run build-config-schema && npm run build-config-example","build-config-example":"node schema/build-config-example.js","build-config-schema":"node schema/build-config-schema.js","build-declaration":"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf \'lib/{c,md,r}*.d.ts\' \'helpers/*.d.ts\'","build-demo":"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats","build-example":"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2","ci":"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code","clean-test-repos":"rimraf test-repos","clone-test-repos-dotnet-docs":"cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet","clone-test-repos-eslint-eslint":"cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet","clone-test-repos-mkdocs-mkdocs":"cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet","clone-test-repos-mochajs-mocha":"cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet","clone-test-repos-pi-hole-docs":"cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet","clone-test-repos-v8-v8-dev":"cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet","clone-test-repos-webhintio-hint":"cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet","clone-test-repos-webpack-webpack-js-org":"cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet","clone-test-repos":"mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org","clone-test-repos-large":"npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev","declaration":"npm run build-declaration && npm run test-declaration","example":"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint","lint":"eslint --max-warnings 0 .","lint-test-repos":"ava --timeout=5m test/markdownlint-test-repos.js","test":"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js","test-cover":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test","test-declaration":"cd example/typescript && tsc && node type-check.js","test-extra":"ava --timeout=5m test/markdownlint-test-extra.js"},"engines":{"node":">=10"},"dependencies":{"markdown-it":"12.2.0"},"devDependencies":{"ava":"~3.15.0","c8":"~7.7.2","cpy-cli":"~3.1.1","eslint":"~7.28.0","eslint-plugin-jsdoc":"~35.1.3","eslint-plugin-node":"~11.1.0","eslint-plugin-unicorn":"~33.0.1","globby":"~11.0.3","js-yaml":"~4.1.0","markdown-it-for-inline":"~0.1.1","markdown-it-sub":"~1.0.0","markdown-it-sup":"~1.0.0","markdown-it-texmath":"~0.9.0","markdownlint-rule-helpers":"~0.14.0","npm-run-all":"~4.1.5","rimraf":"~3.0.2","strip-json-comments":"~3.1.1","toml":"~3.0.0","ts-loader":"~9.2.3","tv4":"~1.3.0","typescript":"~4.3.2","webpack":"~5.38.1","webpack-cli":"~4.7.2"},"keywords":["markdown","lint","md","CommonMark","markdownlint"]}'); - /***/ }), /***/ "markdown-it": @@ -4152,6 +4142,17 @@ module.exports = markdownit; /* (ignored) */ +/***/ }), + +/***/ "../package.json": +/*!***********************!*\ + !*** ../package.json ***! + \***********************/ +/***/ ((module) => { + +"use strict"; +module.exports = JSON.parse('{"name":"markdownlint","version":"0.23.1","description":"A Node.js style checker and lint tool for Markdown/CommonMark files.","main":"lib/markdownlint.js","types":"lib/markdownlint.d.ts","author":"David Anson (https://dlaa.me/)","license":"MIT","homepage":"https://github.com/DavidAnson/markdownlint","repository":{"type":"git","url":"https://github.com/DavidAnson/markdownlint.git"},"bugs":"https://github.com/DavidAnson/markdownlint/issues","scripts":{"build-config":"npm run build-config-schema && npm run build-config-example","build-config-example":"node schema/build-config-example.js","build-config-schema":"node schema/build-config-schema.js","build-declaration":"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf \'lib/{c,md,r}*.d.ts\' \'helpers/*.d.ts\'","build-demo":"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats","build-example":"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2","ci":"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code","clean-test-repos":"rimraf test-repos","clone-test-repos-dotnet-docs":"cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet","clone-test-repos-eslint-eslint":"cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet","clone-test-repos-mkdocs-mkdocs":"cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet","clone-test-repos-mochajs-mocha":"cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet","clone-test-repos-pi-hole-docs":"cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet","clone-test-repos-v8-v8-dev":"cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet","clone-test-repos-webhintio-hint":"cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet","clone-test-repos-webpack-webpack-js-org":"cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet","clone-test-repos":"mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org","clone-test-repos-large":"npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev","declaration":"npm run build-declaration && npm run test-declaration","example":"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint","lint":"eslint --max-warnings 0 .","lint-test-repos":"ava --timeout=5m test/markdownlint-test-repos.js","test":"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js","test-cover":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test","test-declaration":"cd example/typescript && tsc && node type-check.js","test-extra":"ava --timeout=5m test/markdownlint-test-extra.js"},"engines":{"node":">=10"},"dependencies":{"markdown-it":"12.2.0"},"devDependencies":{"ava":"~3.15.0","c8":"~7.8.0","cpy-cli":"~3.1.1","eslint":"~7.32.0","eslint-plugin-jsdoc":"~36.0.7","eslint-plugin-node":"~11.1.0","eslint-plugin-unicorn":"~35.0.0","globby":"~11.0.4","js-yaml":"~4.1.0","markdown-it-for-inline":"~0.1.1","markdown-it-sub":"~1.0.0","markdown-it-sup":"~1.0.0","markdown-it-texmath":"~0.9.1","markdownlint-rule-helpers":"~0.14.0","npm-run-all":"~4.1.5","rimraf":"~3.0.2","strip-json-comments":"~3.1.1","toml":"~3.0.0","ts-loader":"~9.2.5","tv4":"~1.3.0","typescript":"~4.3.5","webpack":"~5.51.1","webpack-cli":"~4.8.0"},"keywords":["markdown","lint","md","CommonMark","markdownlint"]}'); + /***/ }) /******/ }); diff --git a/lib/markdownlint.d.ts b/lib/markdownlint.d.ts index 7c9d19b7..f59ef569 100644 --- a/lib/markdownlint.d.ts +++ b/lib/markdownlint.d.ts @@ -86,6 +86,7 @@ declare function readConfig(file: string, parsers: ConfigurationParser[] | ReadC * @param {ConfigurationParser[]} [parsers] Parsing function(s). * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. + * @throws An Error if processing fails. */ declare function readConfigSync(file: string, parsers?: ConfigurationParser[], fs?: any): Configuration; /** diff --git a/lib/markdownlint.js b/lib/markdownlint.js index 6b2c6db0..7f181142 100644 --- a/lib/markdownlint.js +++ b/lib/markdownlint.js @@ -1070,6 +1070,7 @@ function readConfigPromise(file, parsers, fs) { * @param {ConfigurationParser[]} [parsers] Parsing function(s). * @param {Object} [fs] File system implementation. * @returns {Configuration} Configuration object. + * @throws An Error if processing fails. */ function readConfigSync(file, parsers, fs) { if (!fs) { diff --git a/package.json b/package.json index d8e12729..326b2ef9 100644 --- a/package.json +++ b/package.json @@ -48,28 +48,28 @@ }, "devDependencies": { "ava": "~3.15.0", - "c8": "~7.7.2", + "c8": "~7.8.0", "cpy-cli": "~3.1.1", - "eslint": "~7.28.0", - "eslint-plugin-jsdoc": "~35.1.3", + "eslint": "~7.32.0", + "eslint-plugin-jsdoc": "~36.0.7", "eslint-plugin-node": "~11.1.0", - "eslint-plugin-unicorn": "~33.0.1", - "globby": "~11.0.3", + "eslint-plugin-unicorn": "~35.0.0", + "globby": "~11.0.4", "js-yaml": "~4.1.0", "markdown-it-for-inline": "~0.1.1", "markdown-it-sub": "~1.0.0", "markdown-it-sup": "~1.0.0", - "markdown-it-texmath": "~0.9.0", + "markdown-it-texmath": "~0.9.1", "markdownlint-rule-helpers": "~0.14.0", "npm-run-all": "~4.1.5", "rimraf": "~3.0.2", "strip-json-comments": "~3.1.1", "toml": "~3.0.0", - "ts-loader": "~9.2.3", + "ts-loader": "~9.2.5", "tv4": "~1.3.0", - "typescript": "~4.3.2", - "webpack": "~5.38.1", - "webpack-cli": "~4.7.2" + "typescript": "~4.3.5", + "webpack": "~5.51.1", + "webpack-cli": "~4.8.0" }, "keywords": [ "markdown", From e72b2ba985de3cf0e49767e5a12516fb01c25c8d Mon Sep 17 00:00:00 2001 From: David Anson Date: Sun, 22 Aug 2021 22:26:12 -0700 Subject: [PATCH 35/36] Update MD011/no-reversed-links to remove RegExp negative lookbehind assertion which is not supported on Safari. --- demo/markdownlint-browser.js | 14 ++++++++------ lib/md011.js | 16 ++++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index f5b00dfa..3c948a2c 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -2257,7 +2257,7 @@ module.exports = { var _a = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), addError = _a.addError, forEachLine = _a.forEachLine, overlapsAnyRange = _a.overlapsAnyRange; var _b = __webpack_require__(/*! ./cache */ "../lib/cache.js"), inlineCodeSpanRanges = _b.inlineCodeSpanRanges, lineMetadata = _b.lineMetadata; -var reversedLinkRe = /(? Date: Sun, 22 Aug 2021 22:35:50 -0700 Subject: [PATCH 36/36] Update to version 0.24.0. --- README.md | 3 +++ demo/markdownlint-browser.js | 4 ++-- helpers/package.json | 2 +- package.json | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 12d08d49..3439ca31 100644 --- a/README.md +++ b/README.md @@ -965,6 +965,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more information. information for MD004/ul-style, improve MD018/MD019/MD020/MD021/MD037/MD041, improve HTML comment handling, update test runner and test suite, update dependencies. * 0.23.1 - Work around lack of webpack support for dynamic calls to `require` (`.resolve`). +* 0.24.0 - Remove support for end-of-life Node version 10, add support for custom file system + module, improve MD010/MD011/MD037/MD043/MD044, improve TypeScript declaration file + and JSON schema, update dependencies. [npm-image]: https://img.shields.io/npm/v/markdownlint.svg [npm-url]: https://www.npmjs.com/package/markdownlint diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 3c948a2c..3fd61ef7 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -1,4 +1,4 @@ -/*! markdownlint 0.23.1 https://github.com/DavidAnson/markdownlint @license MIT */ +/*! markdownlint 0.24.0 https://github.com/DavidAnson/markdownlint @license MIT */ var markdownlint; /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ @@ -4153,7 +4153,7 @@ module.exports = markdownit; /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"markdownlint","version":"0.23.1","description":"A Node.js style checker and lint tool for Markdown/CommonMark files.","main":"lib/markdownlint.js","types":"lib/markdownlint.d.ts","author":"David Anson (https://dlaa.me/)","license":"MIT","homepage":"https://github.com/DavidAnson/markdownlint","repository":{"type":"git","url":"https://github.com/DavidAnson/markdownlint.git"},"bugs":"https://github.com/DavidAnson/markdownlint/issues","scripts":{"build-config":"npm run build-config-schema && npm run build-config-example","build-config-example":"node schema/build-config-example.js","build-config-schema":"node schema/build-config-schema.js","build-declaration":"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf \'lib/{c,md,r}*.d.ts\' \'helpers/*.d.ts\'","build-demo":"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats","build-example":"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2","ci":"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code","clean-test-repos":"rimraf test-repos","clone-test-repos-dotnet-docs":"cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet","clone-test-repos-eslint-eslint":"cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet","clone-test-repos-mkdocs-mkdocs":"cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet","clone-test-repos-mochajs-mocha":"cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet","clone-test-repos-pi-hole-docs":"cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet","clone-test-repos-v8-v8-dev":"cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet","clone-test-repos-webhintio-hint":"cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet","clone-test-repos-webpack-webpack-js-org":"cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet","clone-test-repos":"mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org","clone-test-repos-large":"npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev","declaration":"npm run build-declaration && npm run test-declaration","example":"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint","lint":"eslint --max-warnings 0 .","lint-test-repos":"ava --timeout=5m test/markdownlint-test-repos.js","test":"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js","test-cover":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test","test-declaration":"cd example/typescript && tsc && node type-check.js","test-extra":"ava --timeout=5m test/markdownlint-test-extra.js"},"engines":{"node":">=10"},"dependencies":{"markdown-it":"12.2.0"},"devDependencies":{"ava":"~3.15.0","c8":"~7.8.0","cpy-cli":"~3.1.1","eslint":"~7.32.0","eslint-plugin-jsdoc":"~36.0.7","eslint-plugin-node":"~11.1.0","eslint-plugin-unicorn":"~35.0.0","globby":"~11.0.4","js-yaml":"~4.1.0","markdown-it-for-inline":"~0.1.1","markdown-it-sub":"~1.0.0","markdown-it-sup":"~1.0.0","markdown-it-texmath":"~0.9.1","markdownlint-rule-helpers":"~0.14.0","npm-run-all":"~4.1.5","rimraf":"~3.0.2","strip-json-comments":"~3.1.1","toml":"~3.0.0","ts-loader":"~9.2.5","tv4":"~1.3.0","typescript":"~4.3.5","webpack":"~5.51.1","webpack-cli":"~4.8.0"},"keywords":["markdown","lint","md","CommonMark","markdownlint"]}'); +module.exports = JSON.parse('{"name":"markdownlint","version":"0.24.0","description":"A Node.js style checker and lint tool for Markdown/CommonMark files.","main":"lib/markdownlint.js","types":"lib/markdownlint.d.ts","author":"David Anson (https://dlaa.me/)","license":"MIT","homepage":"https://github.com/DavidAnson/markdownlint","repository":{"type":"git","url":"https://github.com/DavidAnson/markdownlint.git"},"bugs":"https://github.com/DavidAnson/markdownlint/issues","scripts":{"build-config":"npm run build-config-schema && npm run build-config-example","build-config-example":"node schema/build-config-example.js","build-config-schema":"node schema/build-config-schema.js","build-declaration":"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf \'lib/{c,md,r}*.d.ts\' \'helpers/*.d.ts\'","build-demo":"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats","build-example":"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2","ci":"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code","clean-test-repos":"rimraf test-repos","clone-test-repos-dotnet-docs":"cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet","clone-test-repos-eslint-eslint":"cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet","clone-test-repos-mkdocs-mkdocs":"cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet","clone-test-repos-mochajs-mocha":"cd test-repos && git clone https://github.com/mochajs/mocha mochajs-mocha --depth 1 --no-tags --quiet","clone-test-repos-pi-hole-docs":"cd test-repos && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet","clone-test-repos-v8-v8-dev":"cd test-repos && git clone https://github.com/v8/v8.dev v8-v8-dev --depth 1 --no-tags --quiet","clone-test-repos-webhintio-hint":"cd test-repos && git clone https://github.com/webhintio/hint webhintio-hint --depth 1 --no-tags --quiet","clone-test-repos-webpack-webpack-js-org":"cd test-repos && git clone https://github.com/webpack/webpack.js.org webpack-webpack-js-org --depth 1 --no-tags --quiet","clone-test-repos":"mkdir test-repos && cd test-repos && npm run clone-test-repos-eslint-eslint && npm run clone-test-repos-mkdocs-mkdocs && npm run clone-test-repos-mochajs-mocha && npm run clone-test-repos-pi-hole-docs && npm run clone-test-repos-webhintio-hint && npm run clone-test-repos-webpack-webpack-js-org","clone-test-repos-large":"npm run clone-test-repos && cd test-repos && npm run clone-test-repos-dotnet-docs && npm run clone-test-repos-v8-v8-dev","declaration":"npm run build-declaration && npm run test-declaration","example":"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint","lint":"eslint --max-warnings 0 .","lint-test-repos":"ava --timeout=5m test/markdownlint-test-repos.js","test":"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js","test-cover":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test","test-declaration":"cd example/typescript && tsc && node type-check.js","test-extra":"ava --timeout=5m test/markdownlint-test-extra.js"},"engines":{"node":">=10"},"dependencies":{"markdown-it":"12.2.0"},"devDependencies":{"ava":"~3.15.0","c8":"~7.8.0","cpy-cli":"~3.1.1","eslint":"~7.32.0","eslint-plugin-jsdoc":"~36.0.7","eslint-plugin-node":"~11.1.0","eslint-plugin-unicorn":"~35.0.0","globby":"~11.0.4","js-yaml":"~4.1.0","markdown-it-for-inline":"~0.1.1","markdown-it-sub":"~1.0.0","markdown-it-sup":"~1.0.0","markdown-it-texmath":"~0.9.1","markdownlint-rule-helpers":"~0.14.0","npm-run-all":"~4.1.5","rimraf":"~3.0.2","strip-json-comments":"~3.1.1","toml":"~3.0.0","ts-loader":"~9.2.5","tv4":"~1.3.0","typescript":"~4.3.5","webpack":"~5.51.1","webpack-cli":"~4.8.0"},"keywords":["markdown","lint","md","CommonMark","markdownlint"]}'); /***/ }) diff --git a/helpers/package.json b/helpers/package.json index 489fdeb7..5b25454e 100644 --- a/helpers/package.json +++ b/helpers/package.json @@ -1,6 +1,6 @@ { "name": "markdownlint-rule-helpers", - "version": "0.14.0", + "version": "0.15.0", "description": "A collection of markdownlint helper functions for custom rules", "main": "helpers.js", "author": "David Anson (https://dlaa.me/)", diff --git a/package.json b/package.json index 326b2ef9..838a578c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "markdownlint", - "version": "0.23.1", + "version": "0.24.0", "description": "A Node.js style checker and lint tool for Markdown/CommonMark files.", "main": "lib/markdownlint.js", "types": "lib/markdownlint.d.ts",