Update build scripts to use improved settings

Closes GH-286

Reviewed-by: Titus Wormer <tituswormer@gmail.com>
This commit is contained in:
Jack Bates 2022-03-31 09:37:59 -07:00 committed by GitHub
parent f0d651784d
commit a9ef2082fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 342 additions and 345 deletions

View File

@ -42,7 +42,7 @@
* @copyright 2015 Titus Wormer
* @license MIT
* @example
* {"name": "ok.md", "setting": 4}
* {"name": "ok.md", "config": 4}
*
* > Hello
*
@ -50,7 +50,7 @@
*
* > World
* @example
* {"name": "ok.md", "setting": 2}
* {"name": "ok.md", "config": 2}
*
* > Hello
*

View File

@ -157,24 +157,6 @@ Due to this, its recommended to configure this rule with `2`.
##### `ok.md`
When configured with `2`.
###### In
```markdown
> Hello
Paragraph.
> World
```
###### Out
No messages.
##### `ok.md`
When configured with `4`.
###### In
@ -191,6 +173,24 @@ Paragraph.
No messages.
##### `ok.md`
When configured with `2`.
###### In
```markdown
> Hello
Paragraph.
> World
```
###### Out
No messages.
##### `not-ok.md`
###### In

View File

@ -37,19 +37,19 @@
* @copyright 2015 Titus Wormer
* @license MIT
* @example
* {"name": "ok.md", "setting": {"checked": "x"}, "gfm": true}
* {"name": "ok.md", "config": {"checked": "x"}, "gfm": true}
*
* - [x] List item
* - [x] List item
*
* @example
* {"name": "ok.md", "setting": {"checked": "X"}, "gfm": true}
* {"name": "ok.md", "config": {"checked": "X"}, "gfm": true}
*
* - [X] List item
* - [X] List item
*
* @example
* {"name": "ok.md", "setting": {"unchecked": " "}, "gfm": true}
* {"name": "ok.md", "config": {"unchecked": " "}, "gfm": true}
*
* - [ ] List item
* - [ ] List item
@ -57,7 +57,7 @@
* - [ ]
*
* @example
* {"name": "ok.md", "setting": {"unchecked": "\t"}, "gfm": true}
* {"name": "ok.md", "config": {"unchecked": "\t"}, "gfm": true}
*
* - [»] List item
* - [»] List item
@ -77,12 +77,12 @@
* 4:5: Unchecked checkboxes should use ` ` as a marker
*
* @example
* {"setting": {"unchecked": "💩"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
* {"config": {"unchecked": "💩"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
*
* 1:1: Incorrect unchecked checkbox marker `💩`: use either `'\t'`, or `' '`
*
* @example
* {"setting": {"checked": "💩"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
* {"config": {"checked": "💩"}, "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
*
* 1:1: Incorrect checked checkbox marker `💩`: use either `'x'`, or `'X'`
*/

View File

@ -49,7 +49,7 @@
* @license MIT
*
* @example
* {"setting": "indented", "name": "ok.md"}
* {"config": "indented", "name": "ok.md"}
*
* alpha()
*
@ -58,7 +58,7 @@
* bravo()
*
* @example
* {"setting": "indented", "name": "not-ok.md", "label": "input"}
* {"config": "indented", "name": "not-ok.md", "label": "input"}
*
* ```
* alpha()
@ -71,13 +71,13 @@
* ```
*
* @example
* {"setting": "indented", "name": "not-ok.md", "label": "output"}
* {"config": "indented", "name": "not-ok.md", "label": "output"}
*
* 1:1-3:4: Code blocks should be indented
* 7:1-9:4: Code blocks should be indented
*
* @example
* {"setting": "fenced", "name": "ok.md"}
* {"config": "fenced", "name": "ok.md"}
*
* ```
* alpha()
@ -90,7 +90,7 @@
* ```
*
* @example
* {"setting": "fenced", "name": "not-ok-fenced.md", "label": "input"}
* {"config": "fenced", "name": "not-ok-fenced.md", "label": "input"}
*
* alpha()
*
@ -99,7 +99,7 @@
* bravo()
*
* @example
* {"setting": "fenced", "name": "not-ok-fenced.md", "label": "output"}
* {"config": "fenced", "name": "not-ok-fenced.md", "label": "output"}
*
* 1:1-1:12: Code blocks should be fenced
* 5:1-5:12: Code blocks should be fenced
@ -121,7 +121,7 @@
* 5:1-7:4: Code blocks should be indented
*
* @example
* {"setting": "💩", "name": "not-ok-incorrect.md", "label": "output", "positionless": true}
* {"config": "💩", "name": "not-ok-incorrect.md", "label": "output", "positionless": true}
*
* 1:1: Incorrect code block style `💩`: use either `'consistent'`, `'fenced'`, or `'indented'`
*/

View File

@ -40,32 +40,32 @@
* @copyright 2015 Titus Wormer
* @license MIT
* @example
* {"setting": "*", "name": "ok.md"}
* {"config": "*", "name": "ok.md"}
*
* *foo*
*
* @example
* {"setting": "*", "name": "not-ok.md", "label": "input"}
* {"config": "*", "name": "not-ok.md", "label": "input"}
*
* _foo_
*
* @example
* {"setting": "*", "name": "not-ok.md", "label": "output"}
* {"config": "*", "name": "not-ok.md", "label": "output"}
*
* 1:1-1:6: Emphasis should use `*` as a marker
*
* @example
* {"setting": "_", "name": "ok.md"}
* {"config": "_", "name": "ok.md"}
*
* _foo_
*
* @example
* {"setting": "_", "name": "not-ok.md", "label": "input"}
* {"config": "_", "name": "not-ok.md", "label": "input"}
*
* *foo*
*
* @example
* {"setting": "_", "name": "not-ok.md", "label": "output"}
* {"config": "_", "name": "not-ok.md", "label": "output"}
*
* 1:1-1:6: Emphasis should use `_` as a marker
*
@ -81,7 +81,7 @@
* 2:1-2:6: Emphasis should use `*` as a marker
*
* @example
* {"setting": "💩", "name": "not-ok.md", "label": "output", "positionless": true}
* {"config": "💩", "name": "not-ok.md", "label": "output", "positionless": true}
*
* 1:1: Incorrect emphasis marker `💩`: use either `'consistent'`, `'*'`, or `'_'`
*/

View File

@ -50,47 +50,47 @@
* 1:1-3:4: Missing code language flag
*
* @example
* {"name": "ok.md", "setting": {"allowEmpty": true}}
* {"name": "ok.md", "config": {"allowEmpty": true}}
*
* ```
* alpha()
* ```
*
* @example
* {"name": "not-ok.md", "setting": {"allowEmpty": false}, "label": "input"}
* {"name": "not-ok.md", "config": {"allowEmpty": false}, "label": "input"}
*
* ```
* alpha()
* ```
*
* @example
* {"name": "not-ok.md", "setting": {"allowEmpty": false}, "label": "output"}
* {"name": "not-ok.md", "config": {"allowEmpty": false}, "label": "output"}
*
* 1:1-3:4: Missing code language flag
*
* @example
* {"name": "ok.md", "setting": ["alpha"]}
* {"name": "ok.md", "config": ["alpha"]}
*
* ```alpha
* bravo()
* ```
*
* @example
* {"name": "ok.md", "setting": {"flags":["alpha"]}}
* {"name": "ok.md", "config": {"flags":["alpha"]}}
*
* ```alpha
* bravo()
* ```
*
* @example
* {"name": "not-ok.md", "setting": ["charlie"], "label": "input"}
* {"name": "not-ok.md", "config": ["charlie"], "label": "input"}
*
* ```alpha
* bravo()
* ```
*
* @example
* {"name": "not-ok.md", "setting": ["charlie"], "label": "output"}
* {"name": "not-ok.md", "config": ["charlie"], "label": "output"}
*
* 1:1-3:4: Incorrect code language flag
*/

View File

@ -41,7 +41,7 @@
* bravo()
*
* @example
* {"name": "ok.md", "setting": "`"}
* {"name": "ok.md", "config": "`"}
*
* ```alpha
* bravo()
@ -52,7 +52,7 @@
* ```
*
* @example
* {"name": "ok.md", "setting": "~"}
* {"name": "ok.md", "config": "~"}
*
* ~~~alpha
* bravo()
@ -95,7 +95,7 @@
* 5:1-7:4: Fenced code should use `~` as a marker
*
* @example
* {"name": "not-ok-incorrect.md", "setting": "💩", "label": "output", "positionless": true}
* {"name": "not-ok-incorrect.md", "config": "💩", "label": "output", "positionless": true}
*
* 1:1: Incorrect fenced code marker `💩`: use either `'consistent'`, `` '`' ``, or `'~'`
*/

View File

@ -38,7 +38,7 @@
* 1:1: Incorrect extension: use `md`
*
* @example
* {"name": "readme.mkd", "setting": "mkd"}
* {"name": "readme.mkd", "config": "mkd"}
*/
/**

View File

@ -68,40 +68,40 @@
* 1:1-1:17: First heading level should be `1`
*
* @example
* {"name": "ok.md", "setting": 2}
* {"name": "ok.md", "config": 2}
*
* ## Delta
*
* Paragraph.
*
* @example
* {"name": "ok-html.md", "setting": 2}
* {"name": "ok-html.md", "config": 2}
*
* <h2>Echo</h2>
*
* Paragraph.
*
* @example
* {"name": "not-ok.md", "setting": 2, "label": "input"}
* {"name": "not-ok.md", "config": 2, "label": "input"}
*
* # Foxtrot
*
* Paragraph.
*
* @example
* {"name": "not-ok.md", "setting": 2, "label": "output"}
* {"name": "not-ok.md", "config": 2, "label": "output"}
*
* 1:1-1:10: First heading level should be `2`
*
* @example
* {"name": "not-ok-html.md", "setting": 2, "label": "input"}
* {"name": "not-ok-html.md", "config": 2, "label": "input"}
*
* <h1>Golf</h1>
*
* Paragraph.
*
* @example
* {"name": "not-ok-html.md", "setting": 2, "label": "output"}
* {"name": "not-ok-html.md", "config": 2, "label": "output"}
*
* 1:1-1:14: First heading level should be `2`
*/

View File

@ -135,74 +135,6 @@ a value of `2` can be defined here.
##### `ok.md`
When configured with `2`.
###### In
```markdown
## Delta
Paragraph.
```
###### Out
No messages.
##### `ok-html.md`
When configured with `2`.
###### In
```markdown
<h2>Echo</h2>
Paragraph.
```
###### Out
No messages.
##### `not-ok.md`
When configured with `2`.
###### In
```markdown
# Foxtrot
Paragraph.
```
###### Out
```text
1:1-1:10: First heading level should be `2`
```
##### `not-ok-html.md`
When configured with `2`.
###### In
```markdown
<h1>Golf</h1>
Paragraph.
```
###### Out
```text
1:1-1:14: First heading level should be `2`
```
##### `ok.md`
###### In
```markdown
@ -273,6 +205,74 @@ Paragraph.
1:1-1:17: First heading level should be `1`
```
##### `ok.md`
When configured with `2`.
###### In
```markdown
## Delta
Paragraph.
```
###### Out
No messages.
##### `ok-html.md`
When configured with `2`.
###### In
```markdown
<h2>Echo</h2>
Paragraph.
```
###### Out
No messages.
##### `not-ok.md`
When configured with `2`.
###### In
```markdown
# Foxtrot
Paragraph.
```
###### Out
```text
1:1-1:10: First heading level should be `2`
```
##### `not-ok-html.md`
When configured with `2`.
###### In
```markdown
<h1>Golf</h1>
Paragraph.
```
###### Out
```text
1:1-1:14: First heading level should be `2`
```
## Compatibility
Projects maintained by the unified collective are compatible with all maintained

View File

@ -62,7 +62,7 @@
* @copyright 2015 Titus Wormer
* @license MIT
* @example
* {"name": "ok.md", "setting": "atx"}
* {"name": "ok.md", "config": "atx"}
*
* # Alpha
*
@ -71,7 +71,7 @@
* ### Charlie
*
* @example
* {"name": "ok.md", "setting": "atx-closed"}
* {"name": "ok.md", "config": "atx-closed"}
*
* # Delta ##
*
@ -80,7 +80,7 @@
* ### Foxtrot ###
*
* @example
* {"name": "ok.md", "setting": "setext"}
* {"name": "ok.md", "config": "setext"}
*
* Golf
* ====
@ -107,7 +107,7 @@
* 6:1-6:13: Headings should use setext
*
* @example
* {"name": "not-ok.md", "setting": "💩", "label": "output", "positionless": true}
* {"name": "not-ok.md", "config": "💩", "label": "output", "positionless": true}
*
* 1:1: Incorrect heading style type `💩`: use either `'consistent'`, `'atx'`, `'atx-closed'`, or `'setext'`
*/

View File

@ -45,22 +45,22 @@
* Bravo
*
* @example
* {"name": "not-ok-unix.md", "label": "input", "setting": "unix", "positionless": true}
* {"name": "not-ok-unix.md", "label": "input", "config": "unix", "positionless": true}
*
* Alpha
*
* @example
* {"name": "not-ok-unix.md", "label": "output", "setting": "unix"}
* {"name": "not-ok-unix.md", "label": "output", "config": "unix"}
*
* 1:7: Expected linebreaks to be unix (`\n`), not windows (`\r\n`)
*
* @example
* {"name": "not-ok-windows.md", "label": "input", "setting": "windows", "positionless": true}
* {"name": "not-ok-windows.md", "label": "input", "config": "windows", "positionless": true}
*
* Alpha
*
* @example
* {"name": "not-ok-windows.md", "label": "output", "setting": "windows"}
* {"name": "not-ok-windows.md", "label": "output", "config": "windows"}
*
* 1:6: Expected linebreaks to be windows (`\r\n`), not unix (`\n`)
*/

View File

@ -44,7 +44,7 @@
* @copyright 2015 Titus Wormer
* @license MIT
* @example
* {"name": "ok.md", "setting": "\""}
* {"name": "ok.md", "config": "\""}
*
* [Example](http://example.com#without-title)
* [Example](http://example.com "Example Domain")
@ -57,17 +57,17 @@
* [Example](#Heading-(optional))
*
* @example
* {"name": "not-ok.md", "label": "input", "setting": "\""}
* {"name": "not-ok.md", "label": "input", "config": "\""}
*
* [Example]: http://example.com 'Example Domain'
*
* @example
* {"name": "not-ok.md", "label": "output", "setting": "\""}
* {"name": "not-ok.md", "label": "output", "config": "\""}
*
* 1:31-1:47: Titles should use `"` as a quote
*
* @example
* {"name": "ok.md", "setting": "'"}
* {"name": "ok.md", "config": "'"}
*
* [Example](http://example.com#without-title)
* [Example](http://example.com 'Example Domain')
@ -76,17 +76,17 @@
* [Example]: http://example.com 'Example Domain'
*
* @example
* {"name": "not-ok.md", "label": "input", "setting": "'"}
* {"name": "not-ok.md", "label": "input", "config": "'"}
*
* [Example]: http://example.com "Example Domain"
*
* @example
* {"name": "not-ok.md", "label": "output", "setting": "'"}
* {"name": "not-ok.md", "label": "output", "config": "'"}
*
* 1:31-1:47: Titles should use `'` as a quote
*
* @example
* {"name": "ok.md", "setting": "()"}
* {"name": "ok.md", "config": "()"}
*
* [Example](http://example.com#without-title)
* [Example](http://example.com (Example Domain))
@ -95,12 +95,12 @@
* [Example]: http://example.com (Example Domain)
*
* @example
* {"name": "not-ok.md", "label": "input", "setting": "()"}
* {"name": "not-ok.md", "label": "input", "config": "()"}
*
* [Example](http://example.com 'Example Domain')
*
* @example
* {"name": "not-ok.md", "label": "output", "setting": "()"}
* {"name": "not-ok.md", "label": "output", "config": "()"}
*
* 1:30-1:46: Titles should use `()` as a quote
*
@ -116,7 +116,7 @@
* 2:30-2:46: Titles should use `"` as a quote
*
* @example
* {"name": "not-ok.md", "setting": "💩", "label": "output", "positionless": true}
* {"name": "not-ok.md", "config": "💩", "label": "output", "positionless": true}
*
* 1:1: Incorrect link title style marker `💩`: use either `'consistent'`, `'"'`, `'\''`, or `'()'`
*/

View File

@ -79,7 +79,7 @@
* ····item.
*
* @example
* {"name": "ok.md", "setting": "mixed"}
* {"name": "ok.md", "config": "mixed"}
*
* *·List item.
*
@ -96,7 +96,7 @@
* ····item.
*
* @example
* {"name": "ok.md", "setting": "space"}
* {"name": "ok.md", "config": "space"}
*
* *·List item.
*
@ -113,39 +113,39 @@
* ··item.
*
* @example
* {"name": "not-ok.md", "setting": "space", "label": "input"}
* {"name": "not-ok.md", "config": "space", "label": "input"}
*
* *···List
* ····item.
*
* @example
* {"name": "not-ok.md", "setting": "space", "label": "output"}
* {"name": "not-ok.md", "config": "space", "label": "output"}
*
* 1:5: Incorrect list-item indent: remove 2 spaces
*
* @example
* {"name": "not-ok.md", "setting": "tab-size", "label": "input"}
* {"name": "not-ok.md", "config": "tab-size", "label": "input"}
*
* *·List
* ··item.
*
* @example
* {"name": "not-ok.md", "setting": "tab-size", "label": "output"}
* {"name": "not-ok.md", "config": "tab-size", "label": "output"}
*
* 1:3: Incorrect list-item indent: add 2 spaces
*
* @example
* {"name": "not-ok.md", "setting": "mixed", "label": "input"}
* {"name": "not-ok.md", "config": "mixed", "label": "input"}
*
* *···List item.
*
* @example
* {"name": "not-ok.md", "setting": "mixed", "label": "output"}
* {"name": "not-ok.md", "config": "mixed", "label": "output"}
*
* 1:5: Incorrect list-item indent: remove 2 spaces
*
* @example
* {"name": "not-ok.md", "setting": "💩", "label": "output", "positionless": true}
* {"name": "not-ok.md", "config": "💩", "label": "output", "positionless": true}
*
* 1:1: Incorrect list-item indent style `💩`: use either `'tab-size'`, `'space'`, or `'mixed'`
*/

View File

@ -83,7 +83,7 @@
* 12:11-14:1: Extraneous new line after list item
*
* @example
* {"name": "ok.md", "setting": {"checkBlanks": true}}
* {"name": "ok.md", "config": {"checkBlanks": true}}
*
* A tight list:
*
@ -103,7 +103,7 @@
* > Block quote
*
* @example
* {"name": "not-ok.md", "setting": {"checkBlanks": true}, "label": "input"}
* {"name": "not-ok.md", "config": {"checkBlanks": true}, "label": "input"}
*
* A tight list:
*
@ -124,7 +124,7 @@
* > Block quote
*
* @example
* {"name": "not-ok.md", "setting": {"checkBlanks": true}, "label": "output"}
* {"name": "not-ok.md", "config": {"checkBlanks": true}, "label": "output"}
*
* 5:15-6:1: Missing new line after list item
* 8:18-9:1: Missing new line after list item

View File

@ -34,12 +34,12 @@
* # ![Alpha bravo charlie delta echo foxtrot golf hotel](http://example.com/nato.png)
*
* @example
* {"name": "not-ok.md", "setting": 40, "label": "input"}
* {"name": "not-ok.md", "config": 40, "label": "input"}
*
* # Alpha bravo charlie delta echo foxtrot golf hotel
*
* @example
* {"name": "not-ok.md", "setting": 40, "label": "output"}
* {"name": "not-ok.md", "config": 40, "label": "output"}
*
* 1:1-1:52: Use headings shorter than `40`
*/

View File

@ -139,6 +139,20 @@ which reads every heading out loud).
## Examples
##### `ok.md`
###### In
```markdown
# Alpha bravo charlie delta echo foxtrot golf hotel
# ![Alpha bravo charlie delta echo foxtrot golf hotel](http://example.com/nato.png)
```
###### Out
No messages.
##### `not-ok.md`
When configured with `40`.
@ -155,20 +169,6 @@ When configured with `40`.
1:1-1:52: Use headings shorter than `40`
```
##### `ok.md`
###### In
```markdown
# Alpha bravo charlie delta echo foxtrot golf hotel
# ![Alpha bravo charlie delta echo foxtrot golf hotel](http://example.com/nato.png)
```
###### Out
No messages.
## Compatibility
Projects maintained by the unified collective are compatible with all maintained

View File

@ -58,7 +58,7 @@
* [foo]: <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>
*
* @example
* {"name": "not-ok.md", "setting": 80, "label": "input", "positionless": true}
* {"name": "not-ok.md", "config": 80, "label": "input", "positionless": true}
*
* This line is simply not tooooooooooooooooooooooooooooooooooooooooooooooooooooooo
* long.
@ -74,7 +74,7 @@
* `alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscar.papa()` and such.
*
* @example
* {"name": "not-ok.md", "setting": 80, "label": "output", "positionless": true}
* {"name": "not-ok.md", "config": 80, "label": "output", "positionless": true}
*
* 4:86: Line must be at most 80 characters
* 6:99: Line must be at most 80 characters
@ -83,7 +83,7 @@
* 12:99: Line must be at most 80 characters
*
* @example
* {"name": "ok-mixed-line-endings.md", "setting": 10, "positionless": true}
* {"name": "ok-mixed-line-endings.md", "config": 10, "positionless": true}
*
* 0123456789
* 0123456789
@ -91,7 +91,7 @@
* 01234
*
* @example
* {"name": "not-ok-mixed-line-endings.md", "setting": 10, "label": "input", "positionless": true}
* {"name": "not-ok-mixed-line-endings.md", "config": 10, "label": "input", "positionless": true}
*
* 012345678901
* 012345678901
@ -99,7 +99,7 @@
* 01234567890
*
* @example
* {"name": "not-ok-mixed-line-endings.md", "setting": 10, "label": "output", "positionless": true}
* {"name": "not-ok-mixed-line-endings.md", "config": 10, "label": "output", "positionless": true}
*
* 1:13: Line must be at most 10 characters
* 2:13: Line must be at most 10 characters

View File

@ -138,6 +138,78 @@ Whether to wrap prose or not is a stylistic choice.
## Examples
##### `ok.md`
###### In
> 👉 **Note**: this example uses GFM ([`remark-gfm`][gfm]).
```markdown
This line is simply not toooooooooooooooooooooooooooooooooooooooooooo
long.
This is also fine: <http://this-long-url-with-a-long-domain.co.uk/a-long-path?query=variables>
<http://this-link-is-fine.com>
`alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscarPapaQuebec.romeo()`
[foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables)
<http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>
![foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables)
| An | exception | is | line | length | in | long | tables | because | those | cant | just |
| -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- |
| be | helped | | | | | | | | | | . |
<a><b><i><p><q><s><u>alpha bravo charlie delta echo foxtrot golf</u></s></q></p></i></b></a>
The following is also fine (note the `.`), because there is no whitespace.
<http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>.
In addition, definitions are also fine:
[foo]: <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>
```
###### Out
No messages.
##### `not-ok.md`
When configured with `80`.
###### In
```markdown
This line is simply not tooooooooooooooooooooooooooooooooooooooooooooooooooooooo
long.
Just like thiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis one.
And this one is also very wrong: because the link starts aaaaaaafter the column: <http://line.com>
<http://this-long-url-with-a-long-domain-is-not-ok.co.uk/a-long-path?query=variables> and such.
And this one is also very wrong: because the code starts aaaaaaafter the column: `alpha.bravo()`
`alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscar.papa()` and such.
```
###### Out
```text
4:86: Line must be at most 80 characters
6:99: Line must be at most 80 characters
8:96: Line must be at most 80 characters
10:97: Line must be at most 80 characters
12:99: Line must be at most 80 characters
```
##### `ok-mixed-line-endings.md`
When configured with `10`.
@ -185,78 +257,6 @@ When configured with `10`.
4:12: Line must be at most 10 characters
```
##### `not-ok.md`
When configured with `80`.
###### In
```markdown
This line is simply not tooooooooooooooooooooooooooooooooooooooooooooooooooooooo
long.
Just like thiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiis one.
And this one is also very wrong: because the link starts aaaaaaafter the column: <http://line.com>
<http://this-long-url-with-a-long-domain-is-not-ok.co.uk/a-long-path?query=variables> and such.
And this one is also very wrong: because the code starts aaaaaaafter the column: `alpha.bravo()`
`alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscar.papa()` and such.
```
###### Out
```text
4:86: Line must be at most 80 characters
6:99: Line must be at most 80 characters
8:96: Line must be at most 80 characters
10:97: Line must be at most 80 characters
12:99: Line must be at most 80 characters
```
##### `ok.md`
###### In
> 👉 **Note**: this example uses GFM ([`remark-gfm`][gfm]).
```markdown
This line is simply not toooooooooooooooooooooooooooooooooooooooooooo
long.
This is also fine: <http://this-long-url-with-a-long-domain.co.uk/a-long-path?query=variables>
<http://this-link-is-fine.com>
`alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscarPapaQuebec.romeo()`
[foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables)
<http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>
![foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables)
| An | exception | is | line | length | in | long | tables | because | those | cant | just |
| -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- |
| be | helped | | | | | | | | | | . |
<a><b><i><p><q><s><u>alpha bravo charlie delta echo foxtrot golf</u></s></q></p></i></b></a>
The following is also fine (note the `.`), because there is no whitespace.
<http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>.
In addition, definitions are also fine:
[foo]: <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>
```
###### Out
No messages.
## Compatibility
Projects maintained by the unified collective are compatible with all maintained

View File

@ -31,7 +31,7 @@
* 1:1: Do not use `_` in a file name
*
* @example
* {"name": "README.md", "label": "output", "setting": "\\.a-z0-9", "positionless": true}
* {"name": "README.md", "label": "output", "config": "\\.a-z0-9", "positionless": true}
*
* 1:1: Do not use `R` in a file name
*

View File

@ -25,7 +25,7 @@
* # Hello
*
* @example
* {"name": "ok.md", "setting": ",;:!?"}
* {"name": "ok.md", "config": ",;:!?"}
*
* # Hello
*

View File

@ -60,7 +60,7 @@
* 5:3-5:10: Missing blank line before block node
*
* @example
* {"name": "tight.md", "setting": {"exceptTightLists": true}, "label": "input"}
* {"name": "tight.md", "config": {"exceptTightLists": true}, "label": "input"}
*
* # Foo
* ## Bar
@ -71,7 +71,7 @@
* Paragraph.
*
* @example
* {"name": "tight.md", "setting": {"exceptTightLists": true}, "label": "output"}
* {"name": "tight.md", "config": {"exceptTightLists": true}, "label": "output"}
*
* 2:1-2:7: Missing blank line before block node
*/

View File

@ -23,21 +23,21 @@
* @copyright 2015 Titus Wormer
* @license MIT
* @example
* {"name": "ok.md", "setting": 1}
* {"name": "ok.md", "config": 1}
*
* # Foo
*
* ## Bar
*
* @example
* {"name": "not-ok.md", "setting": 1, "label": "input"}
* {"name": "not-ok.md", "config": 1, "label": "input"}
*
* # Foo
*
* # Bar
*
* @example
* {"name": "not-ok.md", "setting": 1, "label": "output"}
* {"name": "not-ok.md", "config": 1, "label": "output"}
*
* 3:1-3:6: Dont use multiple top level headings (1:1)
*/

View File

@ -56,7 +56,7 @@
* [foo]: https://example.com
*
* @example
* {"name": "ok-allow.md", "setting": {"allow": ["...", "…"]}}
* {"name": "ok-allow.md", "config": {"allow": ["...", "…"]}}
*
* > Eliding a portion of a quoted passage [] is acceptable.
*

View File

@ -48,14 +48,14 @@
* * Foo
*
* @example
* {"name": "ok.md", "setting": "."}
* {"name": "ok.md", "config": "."}
*
* 1. Foo
*
* 2. Bar
*
* @example
* {"name": "ok.md", "setting": ")"}
* {"name": "ok.md", "config": ")"}
*
* 1) Foo
*
@ -74,7 +74,7 @@
* 3:1-3:8: Marker style should be `.`
*
* @example
* {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
* {"name": "not-ok.md", "label": "output", "config": "💩", "positionless": true}
*
* 1:1: Incorrect ordered list item marker style `💩`: use either `'.'` or `')'`
*/

View File

@ -60,7 +60,7 @@
* * Anton
*
* @example
* {"name": "ok.md", "setting": "one"}
* {"name": "ok.md", "config": "one"}
*
* 1. Foo
* 1. Bar
@ -73,7 +73,7 @@
* 1. Charlie
*
* @example
* {"name": "ok.md", "setting": "single"}
* {"name": "ok.md", "config": "single"}
*
* 1. Foo
* 1. Bar
@ -92,7 +92,7 @@
* 0. Foxtrot
*
* @example
* {"name": "ok.md", "setting": "ordered"}
* {"name": "ok.md", "config": "ordered"}
*
* 1. Foo
* 2. Bar
@ -111,40 +111,40 @@
* 2. Foxtrot
*
* @example
* {"name": "not-ok.md", "setting": "one", "label": "input"}
* {"name": "not-ok.md", "config": "one", "label": "input"}
*
* 1. Foo
* 2. Bar
*
* @example
* {"name": "not-ok.md", "setting": "one", "label": "output"}
* {"name": "not-ok.md", "config": "one", "label": "output"}
*
* 2:1-2:8: Marker should be `1`, was `2`
*
* @example
* {"name": "also-not-ok.md", "setting": "one", "label": "input"}
* {"name": "also-not-ok.md", "config": "one", "label": "input"}
*
* 2. Foo
* 1. Bar
*
* @example
* {"name": "also-not-ok.md", "setting": "one", "label": "output"}
* {"name": "also-not-ok.md", "config": "one", "label": "output"}
*
* 1:1-1:8: Marker should be `1`, was `2`
*
* @example
* {"name": "not-ok.md", "setting": "ordered", "label": "input"}
* {"name": "not-ok.md", "config": "ordered", "label": "input"}
*
* 1. Foo
* 1. Bar
*
* @example
* {"name": "not-ok.md", "setting": "ordered", "label": "output"}
* {"name": "not-ok.md", "config": "ordered", "label": "output"}
*
* 2:1-2:8: Marker should be `2`, was `1`
*
* @example
* {"name": "not-ok.md", "setting": "💩", "label": "output", "positionless": true}
* {"name": "not-ok.md", "config": "💩", "label": "output", "positionless": true}
*
* 1:1: Incorrect ordered list item marker value `💩`: use either `'ordered'`, `'one'`, or `'single'`
*/

View File

@ -43,14 +43,14 @@
* @copyright 2015 Titus Wormer
* @license MIT
* @example
* {"name": "ok.md", "setting": "* * *"}
* {"name": "ok.md", "config": "* * *"}
*
* * * *
*
* * * *
*
* @example
* {"name": "ok.md", "setting": "_______"}
* {"name": "ok.md", "config": "_______"}
*
* _______
*
@ -69,7 +69,7 @@
* 3:1-3:6: Rules should use `***`
*
* @example
* {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
* {"name": "not-ok.md", "label": "output", "config": "💩", "positionless": true}
*
* 1:1: Incorrect preferred rule style: provide a correct markdown rule or `'consistent'`
*/

View File

@ -36,32 +36,32 @@
* @copyright 2021 Denis Augsburger
* @license MIT
* @example
* {"setting": "~", "name": "ok.md", "gfm": true}
* {"config": "~", "name": "ok.md", "gfm": true}
*
* ~foo~
*
* @example
* {"setting": "~", "name": "not-ok.md", "label": "input", "gfm": true}
* {"config": "~", "name": "not-ok.md", "label": "input", "gfm": true}
*
* ~~foo~~
*
* @example
* {"setting": "~", "name": "not-ok.md", "label": "output", "gfm": true}
* {"config": "~", "name": "not-ok.md", "label": "output", "gfm": true}
*
* 1:1-1:8: Strikethrough should use `~` as a marker
*
* @example
* {"setting": "~~", "name": "ok.md", "gfm": true}
* {"config": "~~", "name": "ok.md", "gfm": true}
*
* ~~foo~~
*
* @example
* {"setting": "~~", "name": "not-ok.md", "label": "input", "gfm": true}
* {"config": "~~", "name": "not-ok.md", "label": "input", "gfm": true}
*
* ~foo~
*
* @example
* {"setting": "~~", "name": "not-ok.md", "label": "output", "gfm": true}
* {"config": "~~", "name": "not-ok.md", "label": "output", "gfm": true}
*
* 1:1-1:6: Strikethrough should use `~~` as a marker
*
@ -77,7 +77,7 @@
* 2:1-2:6: Strikethrough should use `~~` as a marker
*
* @example
* {"setting": "💩", "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
* {"config": "💩", "name": "not-ok.md", "label": "output", "positionless": true, "gfm": true}
*
* 1:1: Incorrect strikethrough marker `💩`: use either `'consistent'`, `'~'`, or `'~~'`
*/

View File

@ -50,12 +50,12 @@
* __foo__ and __bar__.
*
* @example
* {"name": "ok.md", "setting": "*"}
* {"name": "ok.md", "config": "*"}
*
* **foo**.
*
* @example
* {"name": "ok.md", "setting": "_"}
* {"name": "ok.md", "config": "_"}
*
* __foo__.
*
@ -70,7 +70,7 @@
* 1:13-1:20: Strong should use `*` as a marker
*
* @example
* {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
* {"name": "not-ok.md", "label": "output", "config": "💩", "positionless": true}
*
* 1:1: Incorrect strong marker `💩`: use either `'consistent'`, `'*'`, or `'_'`
*/

View File

@ -36,14 +36,14 @@
* @copyright 2015 Titus Wormer
* @license MIT
* @example
* {"name": "ok.md", "setting": "padded", "gfm": true}
* {"name": "ok.md", "config": "padded", "gfm": true}
*
* | A | B |
* | ----- | ----- |
* | Alpha | Bravo |
*
* @example
* {"name": "not-ok.md", "label": "input", "setting": "padded", "gfm": true}
* {"name": "not-ok.md", "label": "input", "config": "padded", "gfm": true}
*
* | A | B |
* | :----|----: |
@ -60,7 +60,7 @@
* | Echo | Foxtrot | Golf | Hotel |
*
* @example
* {"name": "not-ok.md", "label": "output", "setting": "padded", "gfm": true}
* {"name": "not-ok.md", "label": "output", "config": "padded", "gfm": true}
*
* 3:8: Cell should be padded
* 3:9: Cell should be padded
@ -73,14 +73,14 @@
* 13:30: Cell should be padded with 1 space, not 2
*
* @example
* {"name": "ok.md", "setting": "compact", "gfm": true}
* {"name": "ok.md", "config": "compact", "gfm": true}
*
* |A |B |
* |-----|-----|
* |Alpha|Bravo|
*
* @example
* {"name": "not-ok.md", "label": "input", "setting": "compact", "gfm": true}
* {"name": "not-ok.md", "label": "input", "config": "compact", "gfm": true}
*
* | A | B |
* | -----| -----|
@ -91,14 +91,14 @@
* |Charlie|Delta |
*
* @example
* {"name": "not-ok.md", "label": "output", "setting": "compact", "gfm": true}
* {"name": "not-ok.md", "label": "output", "config": "compact", "gfm": true}
*
* 3:2: Cell should be compact
* 3:11: Cell should be compact
* 7:16: Cell should be compact
*
* @example
* {"name": "ok-padded.md", "setting": "consistent", "gfm": true}
* {"name": "ok-padded.md", "config": "consistent", "gfm": true}
*
* | A | B |
* | ----- | ----- |
@ -109,7 +109,7 @@
* | Charlie | Delta |
*
* @example
* {"name": "not-ok-padded.md", "label": "input", "setting": "consistent", "gfm": true}
* {"name": "not-ok-padded.md", "label": "input", "config": "consistent", "gfm": true}
*
* | A | B |
* | ----- | ----- |
@ -120,12 +120,12 @@
* |Charlie | Delta |
*
* @example
* {"name": "not-ok-padded.md", "label": "output", "setting": "consistent", "gfm": true}
* {"name": "not-ok-padded.md", "label": "output", "config": "consistent", "gfm": true}
*
* 7:2: Cell should be padded
*
* @example
* {"name": "ok-compact.md", "setting": "consistent", "gfm": true}
* {"name": "ok-compact.md", "config": "consistent", "gfm": true}
*
* |A |B |
* |-----|-----|
@ -136,7 +136,7 @@
* |Charlie|Delta|
*
* @example
* {"name": "not-ok-compact.md", "label": "input", "setting": "consistent", "gfm": true}
* {"name": "not-ok-compact.md", "label": "input", "config": "consistent", "gfm": true}
*
* |A |B |
* |-----|-----|
@ -147,17 +147,17 @@
* |Charlie|Delta |
*
* @example
* {"name": "not-ok-compact.md", "label": "output", "setting": "consistent", "gfm": true}
* {"name": "not-ok-compact.md", "label": "output", "config": "consistent", "gfm": true}
*
* 7:16: Cell should be compact
*
* @example
* {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true, "gfm": true}
* {"name": "not-ok.md", "label": "output", "config": "💩", "positionless": true, "gfm": true}
*
* 1:1: Incorrect table cell padding style `💩`, expected `'padded'`, `'compact'`, or `'consistent'`
*
* @example
* {"name": "empty.md", "label": "input", "setting": "padded", "gfm": true}
* {"name": "empty.md", "label": "input", "config": "padded", "gfm": true}
*
* <!-- Empty cells are OK, but those surrounding them may not be. -->
*
@ -166,14 +166,14 @@
* | Charlie| | Echo|
*
* @example
* {"name": "empty.md", "label": "output", "setting": "padded", "gfm": true}
* {"name": "empty.md", "label": "output", "config": "padded", "gfm": true}
*
* 3:25: Cell should be padded
* 5:10: Cell should be padded
* 5:25: Cell should be padded
*
* @example
* {"name": "missing-body.md", "setting": "padded", "gfm": true}
* {"name": "missing-body.md", "config": "padded", "gfm": true}
*
* <!-- Missing cells are fine as well. -->
*

View File

@ -54,17 +54,17 @@
* 3. Baz
*
* @example
* {"name": "ok.md", "setting": "*"}
* {"name": "ok.md", "config": "*"}
*
* * Foo
*
* @example
* {"name": "ok.md", "setting": "-"}
* {"name": "ok.md", "config": "-"}
*
* - Foo
*
* @example
* {"name": "ok.md", "setting": "+"}
* {"name": "ok.md", "config": "+"}
*
* + Foo
*
@ -82,7 +82,7 @@
* 3:1-3:6: Marker style should be `*`
*
* @example
* {"name": "not-ok.md", "label": "output", "setting": "💩", "positionless": true}
* {"name": "not-ok.md", "label": "output", "config": "💩", "positionless": true}
*
* 1:1: Incorrect unordered list item marker style `💩`: use either `'-'`, `'*'`, or `'+'`
*/

View File

@ -15,20 +15,18 @@ export interface RuleMeta {
url?: string | undefined
}
export function lintRule<Tree extends Node = Node, Settings = unknown>(
export function lintRule<Tree extends Node = Node, Options = unknown>(
name: string | RuleMeta,
rule: Rule<Tree, Settings>
rule: Rule<Tree, Options>
): Plugin<
| void[]
| [Settings | Label | Severity]
| [boolean | Label | Severity, Settings],
void[] | [Options | Label | Severity] | [boolean | Label | Severity, Options],
Tree
>
export type Rule<Tree extends Node = Node, Settings = unknown> = (
export type Rule<Tree extends Node = Node, Options = unknown> = (
node: Tree,
file: VFile,
settings: Settings
options: Options
) => Promise<Tree | undefined | void> | Tree | undefined | void
export {Severity, Label} from './lib/index.js'

View File

@ -39,8 +39,8 @@ export function lintRule(meta, rule) {
return plugin
/** @type {import('unified').Plugin<[unknown]|Array<void>>} */
function plugin(raw) {
const [severity, options] = coerce(ruleId, raw)
function plugin(config) {
const [severity, options] = coerce(ruleId, config)
if (!severity) return
@ -76,26 +76,26 @@ export function lintRule(meta, rule) {
* Coerce a value to a severity--options tuple.
*
* @param {string} name
* @param {unknown} value
* @param {unknown} config
* @returns {SeverityTuple}
*/
function coerce(name, value) {
function coerce(name, config) {
/** @type {Array<unknown>} */
let result
if (value === null || value === undefined) {
if (config === null || config === undefined) {
result = [1]
} else if (
Array.isArray(value) &&
Array.isArray(config) &&
// `isArray(unknown)` is turned into `Array<any>`:
// type-coverage:ignore-next-line
primitives.has(typeof value[0])
primitives.has(typeof config[0])
) {
// `isArray(unknown)` is turned into `Array<any>`:
// type-coverage:ignore-next-line
result = [...value]
result = [...config]
} else {
result = [1, value]
result = [1, config]
}
let level = result[0]

View File

@ -567,11 +567,11 @@ presets(root).then((presetObjects) => {
let first = true
/** @type {string} */
let setting
let configuration
for (setting in tests) {
if (own.call(tests, setting)) {
const fixtures = tests[setting]
for (configuration in tests) {
if (own.call(tests, configuration)) {
const fixtures = tests[configuration]
if (first) {
children.push({
@ -588,7 +588,8 @@ presets(root).then((presetObjects) => {
for (fileName in fixtures) {
if (own.call(fixtures, fileName)) {
const fixture = fixtures[fileName]
const label = inspect(JSON.parse(setting))
/** @type {{config: unknown}} */
const {config} = JSON.parse(configuration)
let clean = fixture.input
children.push({
@ -597,12 +598,12 @@ presets(root).then((presetObjects) => {
children: [{type: 'inlineCode', value: fileName}]
})
if (label !== 'true') {
if (config !== true) {
children.push({
type: 'paragraph',
children: [
{type: 'text', value: 'When configured with '},
{type: 'inlineCode', value: label},
{type: 'inlineCode', value: inspect(config)},
{type: 'text', value: '.'}
]
})

View File

@ -12,7 +12,6 @@
* @typedef Check
* @property {string} input
* @property {Array<string>} output
* @property {string} setting
* @property {boolean} gfm
* @property {boolean} positionless
*/
@ -77,7 +76,7 @@ export function rule(filePath) {
while (++index < examples.length) {
const lines = examples[index].split('\n')
/** @type {{name: string, label?: 'input'|'output', setting?: unknown, positionless?: boolean, gfm?: boolean}} */
/** @type {{name: string, label?: 'input'|'output', config?: unknown, positionless?: boolean, gfm?: boolean}} */
let info
try {
@ -92,15 +91,17 @@ export function rule(filePath) {
}
const exampleValue = strip(lines.join('\n').replace(/^\r?\n/g, ''))
const setting = JSON.stringify(info.setting || true)
const configuration = JSON.stringify({config: info.config || true})
const name = info.name
const context = setting in tests ? tests[setting] : (tests[setting] = {})
const context =
configuration in tests
? tests[configuration]
: (tests[configuration] = {})
if (!info.label) {
context[name] = {
positionless: info.positionless || false,
gfm: info.gfm || false,
setting,
input: exampleValue,
output: []
}
@ -123,14 +124,11 @@ export function rule(filePath) {
context[name] = {
positionless: info.positionless || false,
gfm: info.gfm || false,
setting: '',
input: '',
output: []
}
}
context[name].setting = setting
if (info.label === 'output') {
context[name][info.label] = exampleValue.split('\n')
} else {

24
test.js
View File

@ -296,15 +296,15 @@ test('rules', async (t) => {
function assertRule(t, rule, info) {
const tests = info.tests
/** @type {string} */
let setting
let configuration
for (setting in tests) {
if (own.call(tests, setting)) {
const checks = tests[setting]
/** @type {unknown} */
const options = JSON.parse(setting)
for (configuration in tests) {
if (own.call(tests, configuration)) {
const checks = tests[configuration]
/** @type {{config: unknown}} */
const {config} = JSON.parse(configuration)
t.test(setting, (t) => {
t.test(configuration, (t) => {
/** @type {string} */
let name
@ -314,7 +314,7 @@ function assertRule(t, rule, info) {
const check = checks[name]
t.test(name, (t) => {
assertFixture(t, rule, info, check, basename, options)
assertFixture(t, rule, info, check, basename, config)
})
}
}
@ -331,15 +331,15 @@ function assertRule(t, rule, info) {
* @param {Rule} info
* @param {Check} fixture
* @param {string} basename
* @param {unknown} settings
* @param {unknown} config
*/
/* eslint-disable-next-line max-params */
function assertFixture(t, rule, info, fixture, basename, settings) {
function assertFixture(t, rule, info, fixture, basename, config) {
const ruleId = info.ruleId
const file = toVFile(basename)
const expected = fixture.output
const positionless = fixture.positionless
let proc = remark().use(rule, settings)
let proc = remark().use(rule, config)
if (fixture.gfm) proc.use(remarkGfm)
@ -392,7 +392,7 @@ function assertFixture(t, rule, info, fixture, basename, settings) {
file.messages = []
proc = remark()
.use(() => (tree) => removePosition(tree))
.use(rule, settings)
.use(rule, config)
if (fixture.gfm) proc.use(remarkGfm)
proc.processSync(file)