Skip to content

Commit 5bdc23b

Browse files
authoredOct 26, 2022
no-empty-url: check urls from definitions
Closes GH-299. Reviewed-by: Titus Wormer <tituswormer@gmail.com>
1 parent 6ca7eef commit 5bdc23b

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
 

‎packages/remark-lint-no-empty-url/index.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,27 @@
2626
*
2727
* ![charlie](http://delta.com/echo.png "foxtrot").
2828
*
29+
* [zulu][yankee].
30+
*
31+
* [yankee]: http://xray.com
32+
*
2933
* @example
3034
* {"name": "not-ok.md", "label": "input"}
3135
*
3236
* [golf]().
3337
*
3438
* ![hotel]().
3539
*
40+
* [zulu][yankee].
41+
*
42+
* [yankee]: <>
43+
*
3644
* @example
3745
* {"name": "not-ok.md", "label": "output"}
3846
*
3947
* 1:1-1:9: Don’t use links without URL
4048
* 3:1-3:11: Don’t use images without URL
49+
* 7:1-7:13: Don’t use definitions without URL
4150
*/
4251

4352
/**
@@ -57,7 +66,9 @@ const remarkLintNoEmptyUrl = lintRule(
5766
(tree, file) => {
5867
visit(tree, (node) => {
5968
if (
60-
(node.type === 'link' || node.type === 'image') &&
69+
(node.type === 'link' ||
70+
node.type === 'image' ||
71+
node.type === 'definition') &&
6172
!generated(node) &&
6273
!node.url
6374
) {

‎packages/remark-lint-no-empty-url/readme.md

+9
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ It’s recommended to fill them out.
136136
[alpha](http://bravo.com).
137137

138138
![charlie](http://delta.com/echo.png "foxtrot").
139+
140+
[zulu][yankee].
141+
142+
[yankee]: http://xray.com
139143
```
140144

141145
###### Out
@@ -150,13 +154,18 @@ No messages.
150154
[golf]().
151155

152156
![hotel]().
157+
158+
[zulu][yankee].
159+
160+
[yankee]: <>
153161
```
154162

155163
###### Out
156164

157165
```text
158166
1:1-1:9: Don’t use links without URL
159167
3:1-3:11: Don’t use images without URL
168+
7:1-7:13: Don’t use definitions without URL
160169
```
161170

162171
## Compatibility

0 commit comments

Comments
 (0)
Please sign in to comment.