Skip to content

Commit 4083e38

Browse files
committed
support markdownlint case
1 parent 8c4a583 commit 4083e38

File tree

6 files changed

+59
-22
lines changed

6 files changed

+59
-22
lines changed

.markdownlint.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"default": true,
3+
"extends": "markdownlint/style/prettier",
4+
"MD026": false,
5+
"search-replace": {
6+
"rules": [
7+
{
8+
"name": "found-todo",
9+
"message": "Don't use todo",
10+
"searchPattern": "/TODO/gi"
11+
}
12+
]
13+
}
14+
}

.trunk/configs/.markdownlint.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.trunk/trunk.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ lint:
2727
enabled:
2828
- checkov@3.2.141
2929
- git-diff-check
30-
- markdownlint@0.41.0
3130
- prettier@3.3.2
3231
- shellcheck@0.10.0
3332
- shfmt@3.6.0
3433
- trivy@0.52.2
3534
- trufflehog@3.78.1
3635
- yamllint@1.35.1
3736
# TODO linters
37+
- markdownlint@0.41.0
3838
- cspell@8.9.0
3939
- codespell@2.3.0
4040
- vale@3.6.0
@@ -64,3 +64,4 @@ lint:
6464
- styles/**
6565
- .semgrep.yaml
6666
- toolbox.toml
67+
- .markdownlint.json

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
An exploration of different ways to build a TODO linter, including:
44

5-
- [trunk-toolbox](#trunk-toolbox)
6-
- [custom `grep` linter](#grep-linter)
5+
- [markdownlint](#markdownlint)
76
- [CSpell](#cspell)
87
- [codespell](#codespell)
98
- [Vale](#vale)
109
- [Semgrep](#semgrep)
10+
- [trunk-toolbox](#trunk-toolbox)
11+
- [custom `grep` linter](#grep-linter)
1112

1213
## Prerequisites
1314

@@ -25,6 +26,22 @@ plugins:
2526
uri: https://github.com/trunk-io/todo-linter-demo
2627
```
2728
29+
## markdownlint
30+
31+
This markdownlint linter setup is dependent on:
32+
33+
- `.markdownlint.json`
34+
35+
```bash
36+
trunk check --filter=markdownlint test_data.md
37+
```
38+
39+
To run outside Trunk, run:
40+
41+
```bash
42+
.trunk/tools/markdownlint test_data.md
43+
```
44+
2845
## CSpell
2946

3047
This CSpell linter setup is dependent on:

plugin.yaml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
version: 0.1
2+
tools:
3+
definitions:
4+
- name: markdownlint
5+
extra_packages: [markdownlint-rule-search-replace]
26
lint:
37
definitions:
8+
- name: markdownlint
9+
commands:
10+
- name: lint
11+
run: markdownlint ${target} --json -r markdownlint-rule-search-replace
12+
- name: codespell
13+
direct_configs:
14+
- .codespellrc
15+
- todo_dict.txt
16+
- name: vale
17+
direct_configs:
18+
- .vale.ini
19+
- styles/base/todo.yml
20+
- name: semgrep
21+
commands:
22+
- name: check
23+
# Add our custom rules
24+
run:
25+
semgrep --config=auto --config=.semgrep.yaml --sarif --output=${tmpfile}
26+
--include=${target}
427
- name: todo-grep-wrapped
528
description: Uses grep to look for TODOs
629
files: [ALL]
@@ -21,21 +44,6 @@ lint:
2144
run: 'sed -E "s/([^:]*):([0-9]+):(.*)/\1:\2:0: [error] Found \3 in line (TODO)/"'
2245
output: regex
2346
parse_regex: "((?P<path>.*):(?P<line>-?\\d+):(?P<col>-?\\d+): \\[(?P<severity>.*)\\] (?P<message>.*) \\((?P<code>.*)\\))"
24-
- name: codespell
25-
direct_configs:
26-
- .codespellrc
27-
- todo_dict.txt
28-
- name: vale
29-
direct_configs:
30-
- .vale.ini
31-
- styles/base/todo.yml
32-
- name: semgrep
33-
commands:
34-
- name: check
35-
# Add our custom rules
36-
run:
37-
semgrep --config=auto --config=.semgrep.yaml --sarif --output=${tmpfile}
38-
--include=${target}
3947
exported_configs:
4048
- configs:
4149
- cspell.yaml

test_data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ Look at all the ways to check for todo!
2020

2121
<!-- trunk-ignore-begin(todo-grep-wrapped,codespell,cspell,vale,semgrep,trunk-toolbox) -->
2222

23-
Let's ignore this TODO though.
23+
Let's ignore this TODO though
2424

2525
<!-- trunk-ignore-end(todo-grep-wrapped,codespell,cspell,vale,semgrep,trunk-toolbox) -->

0 commit comments

Comments
 (0)