-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for markdownlint-cli2 (#879)
This pull request introduces a new linter, `markdownlint-cli2`, and updates the documentation and configuration files accordingly. The most important changes include adding the new linter to the `README.md`, creating configuration and test files for `markdownlint-cli2`, and updating existing linter configurations. ### Introduction of `markdownlint-cli2`: * **Configuration and Test Files:** - Created a basic test for `markdownlint-cli2` in `linters/markdownlint-cli2/markdownlint.test.ts`. - Defined the `markdownlint-cli2` tool and its configurations in `linters/markdownlint-cli2/plugin.yaml`. - Added a JSON configuration file for `markdownlint-cli2` in `linters/markdownlint-cli2/test_data/.markdownlint-cli2.jsonc`. - Provided test data and expected output for `markdownlint-cli2` in `linters/markdownlint-cli2/test_data/basic.in.md` and `linters/markdownlint-cli2/test_data/markdownlint_cli2_v0.14.0_basic.check.shot`. [[1]](diffhunk://#diff-6d06de89ac9581b3de417feab835ac7b52f10e532843efb099cc4b01d3434177R1-R11) [[2]](diffhunk://#diff-ca893877499930e4cb50e87128752a099619bfca0015eeb580efa09f525a2578R1-R43) ### Documentation Updates: * **README.md:** - Updated the Markdown linters list to include `markdownlint-cli2` in `README.md`. ### Removal of Old Configurations: * **Old Linter Configurations:** - Removed outdated `markdownlint-cli2` configurations from `linters/markdownlint/plugin.yaml`.
- Loading branch information
Showing
8 changed files
with
164 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ node_modules/ | |
|
||
# Typescript | ||
out/ | ||
|
||
junit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { linterCheckTest } from "tests"; | ||
|
||
linterCheckTest({ linterName: "markdownlint-cli2" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
version: 0.1 | ||
tools: | ||
definitions: | ||
- name: markdownlint-cli2 | ||
runtime: node | ||
package: markdownlint-cli2 | ||
shims: [markdownlint-cli2] | ||
known_good_version: 0.14.0 | ||
|
||
lint: | ||
definitions: | ||
- name: markdownlint-cli2 | ||
files: [markdown] | ||
tools: [markdownlint-cli2] | ||
description: A style checker and lint tool for markdown files | ||
commands: | ||
- name: lint | ||
# Custom parser type defined in the trunk cli to handle markdownlint's JSON output. | ||
output: regex | ||
read_output_from: stderr | ||
parse_regex: | ||
"(?P<path>[^:]+):(?P<line>[\\d+]+)(?::(?P<col>[\\d+]+))? (?P<code>[^ ]+) | ||
(?P<message>.*)\n" | ||
run: markdownlint-cli2 ${target} --json | ||
success_codes: [0, 1] | ||
batch: true | ||
cache_results: true | ||
suggest_if: config_present | ||
direct_configs: | ||
- .markdownlint-cli2.jsonc | ||
- .markdownlint-cli2.yaml | ||
- .markdownlint-cli2.cjs | ||
- .markdownlint-cli2.mjs | ||
affects_cache: | ||
- package.json | ||
- .markdownlint.jsonc | ||
- .markdownlint.json | ||
- .markdownlint.yaml | ||
- .markdownlint.yml | ||
- .markdownlint.cjs | ||
- .markdownlint.mjs | ||
issue_url_format: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#{} | ||
known_good_version: 0.14.0 | ||
version_command: | ||
parse_regex: ${semver} | ||
run: markdownlint --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"config": { | ||
"extends": "markdownlint/style/prettier" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# bad.md | ||
|
||
# This file fails some rules | ||
|
||
Line is OK- Make a realy long line that breaks the layout rules completely. Make a realy long line | ||
that breaks | ||
But this should be ignored because of config | ||
|
||
|
||
Line is too long (over 120) A B C D E F G A B C D E F G A B C D E F G A B C D E F G A B C D E F G A | ||
B C D E F G A B C D E F G A B C D E F G |
43 changes: 43 additions & 0 deletions
43
linters/markdownlint-cli2/test_data/markdownlint_cli2_v0.14.0_basic.check.shot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Testing linter markdownlint-cli2 test basic 1`] = ` | ||
{ | ||
"issues": [ | ||
{ | ||
"code": "MD025/single-title/single-h1", | ||
"column": "1", | ||
"file": "test_data/basic.in.md", | ||
"issueClass": "ISSUE_CLASS_EXISTING", | ||
"issueUrl": "https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#MD025/single-title/single-h1", | ||
"level": "LEVEL_HIGH", | ||
"line": "3", | ||
"linter": "markdownlint-cli2", | ||
"message": "Multiple top-level headings in the same document [Context: "This file fails some rules"]", | ||
"targetType": "markdown", | ||
}, | ||
], | ||
"lintActions": [ | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "markdown", | ||
"linter": "markdownlint-cli2", | ||
"paths": [ | ||
"test_data/basic.in.md", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "markdown", | ||
"linter": "markdownlint-cli2", | ||
"paths": [ | ||
"test_data/basic.in.md", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
], | ||
"taskFailures": [], | ||
"unformattedFiles": [], | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters