mirror of
https://github.com/remarkjs/remark-lint.git
synced 2024-09-11 19:57:15 +03:00
no-empty-url: check urls from definitions
Closes GH-299. Reviewed-by: Titus Wormer <tituswormer@gmail.com>
This commit is contained in:
parent
6ca7eeff07
commit
5bdc23b1a7
@ -26,6 +26,10 @@
|
||||
*
|
||||
* ![charlie](http://delta.com/echo.png "foxtrot").
|
||||
*
|
||||
* [zulu][yankee].
|
||||
*
|
||||
* [yankee]: http://xray.com
|
||||
*
|
||||
* @example
|
||||
* {"name": "not-ok.md", "label": "input"}
|
||||
*
|
||||
@ -33,11 +37,16 @@
|
||||
*
|
||||
* ![hotel]().
|
||||
*
|
||||
* [zulu][yankee].
|
||||
*
|
||||
* [yankee]: <>
|
||||
*
|
||||
* @example
|
||||
* {"name": "not-ok.md", "label": "output"}
|
||||
*
|
||||
* 1:1-1:9: Don’t use links without URL
|
||||
* 3:1-3:11: Don’t use images without URL
|
||||
* 7:1-7:13: Don’t use definitions without URL
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -57,7 +66,9 @@ const remarkLintNoEmptyUrl = lintRule(
|
||||
(tree, file) => {
|
||||
visit(tree, (node) => {
|
||||
if (
|
||||
(node.type === 'link' || node.type === 'image') &&
|
||||
(node.type === 'link' ||
|
||||
node.type === 'image' ||
|
||||
node.type === 'definition') &&
|
||||
!generated(node) &&
|
||||
!node.url
|
||||
) {
|
||||
|
@ -136,6 +136,10 @@ It’s recommended to fill them out.
|
||||
[alpha](http://bravo.com).
|
||||
|
||||
![charlie](http://delta.com/echo.png "foxtrot").
|
||||
|
||||
[zulu][yankee].
|
||||
|
||||
[yankee]: http://xray.com
|
||||
```
|
||||
|
||||
###### Out
|
||||
@ -150,6 +154,10 @@ No messages.
|
||||
[golf]().
|
||||
|
||||
![hotel]().
|
||||
|
||||
[zulu][yankee].
|
||||
|
||||
[yankee]: <>
|
||||
```
|
||||
|
||||
###### Out
|
||||
@ -157,6 +165,7 @@ No messages.
|
||||
```text
|
||||
1:1-1:9: Don’t use links without URL
|
||||
3:1-3:11: Don’t use images without URL
|
||||
7:1-7:13: Don’t use definitions without URL
|
||||
```
|
||||
|
||||
## Compatibility
|
||||
|
Loading…
Reference in New Issue
Block a user