no-empty-url: add check for #

This commit is contained in:
Titus Wormer 2023-12-15 16:25:42 +01:00
parent e9b3f7e8a2
commit 4057f15d4c
No known key found for this signature in database
GPG Key ID: E6E581152ED04E2E
2 changed files with 17 additions and 21 deletions

View File

@ -45,27 +45,25 @@
*
* ![charlie](http://delta.com/echo.png "foxtrot").
*
* [zulu][yankee].
* [golf][hotel].
*
* [yankee]: http://xray.com
* [india]: http://juliett.com
*
* @example
* {"name": "not-ok.md", "label": "input"}
*
* [golf]().
* [alpha]().
*
* ![hotel]().
* ![bravo](#).
*
* [zulu][yankee].
*
* [yankee]: <>
* [charlie]: <>
*
* @example
* {"name": "not-ok.md", "label": "output"}
*
* 1:1-1:9: Dont use links without URL
* 3:1-3:11: Dont use images without URL
* 7:1-7:13: Dont use definitions without URL
* 1:1-1:10: Dont use links without URL
* 3:1-3:12: Dont use images without URL
* 5:1-5:14: Dont use definitions without URL
*/
/**
@ -96,7 +94,7 @@ const remarkLintNoEmptyUrl = lintRule(
node.type === 'image' ||
node.type === 'link') &&
place &&
!node.url
(!node.url || node.url === '#' || node.url === '?')
) {
file.message('Dont use ' + node.type + 's without URL', place)
}

View File

@ -147,9 +147,9 @@ Its recommended to fill them out.
![charlie](http://delta.com/echo.png "foxtrot").
[zulu][yankee].
[golf][hotel].
[yankee]: http://xray.com
[india]: http://juliett.com
```
###### Out
@ -161,21 +161,19 @@ No messages.
###### In
```markdown
[golf]().
[alpha]().
![hotel]().
![bravo](#).
[zulu][yankee].
[yankee]: <>
[charlie]: <>
```
###### Out
```text
1:1-1:9: Dont use links without URL
3:1-3:11: Dont use images without URL
7:1-7:13: Dont use definitions without URL
1:1-1:10: Dont use links without URL
3:1-3:12: Dont use images without URL
5:1-5:14: Dont use definitions without URL
```
## Compatibility