From fe42ae183e761d2869fa38032483d38d1275d592 Mon Sep 17 00:00:00 2001 From: Jack Bates Date: Fri, 25 Mar 2022 10:50:16 -0700 Subject: [PATCH] Disambiguate setting and settings --- .../index.js | 4 +- .../readme.md | 12 +- .../index.js | 12 +- .../remark-lint-code-block-style/index.js | 14 +-- packages/remark-lint-emphasis-marker/index.js | 14 +-- .../remark-lint-fenced-code-flag/index.js | 14 +-- .../remark-lint-fenced-code-marker/index.js | 6 +- packages/remark-lint-file-extension/index.js | 2 +- .../remark-lint-first-heading-level/index.js | 12 +- .../remark-lint-first-heading-level/readme.md | 72 ++++++------ packages/remark-lint-heading-style/index.js | 8 +- packages/remark-lint-linebreak-style/index.js | 8 +- .../remark-lint-link-title-style/index.js | 20 ++-- .../remark-lint-list-item-indent/index.js | 18 +-- .../remark-lint-list-item-spacing/index.js | 6 +- .../index.js | 4 +- .../readme.md | 20 ++-- .../remark-lint-maximum-line-length/index.js | 10 +- .../remark-lint-maximum-line-length/readme.md | 104 +++++++++--------- .../index.js | 2 +- .../index.js | 2 +- .../index.js | 4 +- .../index.js | 6 +- .../index.js | 2 +- .../index.js | 6 +- .../index.js | 20 ++-- packages/remark-lint-rule-style/index.js | 6 +- .../remark-lint-strikethrough-marker/index.js | 14 +-- packages/remark-lint-strong-marker/index.js | 6 +- .../remark-lint-table-cell-padding/index.js | 32 +++--- .../index.js | 8 +- packages/unified-lint-rule/index.d.ts | 12 +- packages/unified-lint-rule/lib/index.js | 18 +-- script/build-rules.js | 15 +-- script/util/rule.js | 14 +-- test.js | 24 ++-- 36 files changed, 274 insertions(+), 277 deletions(-) diff --git a/packages/remark-lint-blockquote-indentation/index.js b/packages/remark-lint-blockquote-indentation/index.js index d7c74a63..14c720e1 100644 --- a/packages/remark-lint-blockquote-indentation/index.js +++ b/packages/remark-lint-blockquote-indentation/index.js @@ -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 * diff --git a/packages/remark-lint-blockquote-indentation/readme.md b/packages/remark-lint-blockquote-indentation/readme.md index 3dd7f90a..3b16288f 100644 --- a/packages/remark-lint-blockquote-indentation/readme.md +++ b/packages/remark-lint-blockquote-indentation/readme.md @@ -157,16 +157,16 @@ Due to this, it’s recommended to configure this rule with `2`. ##### `ok.md` -When configured with `2`. +When configured with `4`. ###### In ```markdown -> Hello +> Hello Paragraph. -> World +> World ``` ###### Out @@ -175,16 +175,16 @@ No messages. ##### `ok.md` -When configured with `4`. +When configured with `2`. ###### In ```markdown -> Hello +> Hello Paragraph. -> World +> World ``` ###### Out diff --git a/packages/remark-lint-checkbox-character-style/index.js b/packages/remark-lint-checkbox-character-style/index.js index e323c6c3..0c6fe7d3 100644 --- a/packages/remark-lint-checkbox-character-style/index.js +++ b/packages/remark-lint-checkbox-character-style/index.js @@ -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'` */ diff --git a/packages/remark-lint-code-block-style/index.js b/packages/remark-lint-code-block-style/index.js index a84472c1..c41db83b 100644 --- a/packages/remark-lint-code-block-style/index.js +++ b/packages/remark-lint-code-block-style/index.js @@ -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'` */ diff --git a/packages/remark-lint-emphasis-marker/index.js b/packages/remark-lint-emphasis-marker/index.js index 2a9671e0..8463709f 100644 --- a/packages/remark-lint-emphasis-marker/index.js +++ b/packages/remark-lint-emphasis-marker/index.js @@ -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 `'_'` */ diff --git a/packages/remark-lint-fenced-code-flag/index.js b/packages/remark-lint-fenced-code-flag/index.js index 316fcd99..824ef285 100644 --- a/packages/remark-lint-fenced-code-flag/index.js +++ b/packages/remark-lint-fenced-code-flag/index.js @@ -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 */ diff --git a/packages/remark-lint-fenced-code-marker/index.js b/packages/remark-lint-fenced-code-marker/index.js index 118f4938..e52b8086 100644 --- a/packages/remark-lint-fenced-code-marker/index.js +++ b/packages/remark-lint-fenced-code-marker/index.js @@ -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 `'~'` */ diff --git a/packages/remark-lint-file-extension/index.js b/packages/remark-lint-file-extension/index.js index 5b4bd0a8..ba7f42ef 100644 --- a/packages/remark-lint-file-extension/index.js +++ b/packages/remark-lint-file-extension/index.js @@ -38,7 +38,7 @@ * 1:1: Incorrect extension: use `md` * * @example - * {"name": "readme.mkd", "setting": "mkd"} + * {"name": "readme.mkd", "config": "mkd"} */ /** diff --git a/packages/remark-lint-first-heading-level/index.js b/packages/remark-lint-first-heading-level/index.js index dbcf1d55..a7ad4ddf 100644 --- a/packages/remark-lint-first-heading-level/index.js +++ b/packages/remark-lint-first-heading-level/index.js @@ -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} * *

Echo

* * 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"} * *

Golf

* * 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` */ diff --git a/packages/remark-lint-first-heading-level/readme.md b/packages/remark-lint-first-heading-level/readme.md index c660081e..a3e38bf2 100644 --- a/packages/remark-lint-first-heading-level/readme.md +++ b/packages/remark-lint-first-heading-level/readme.md @@ -135,14 +135,10 @@ a value of `2` can be defined here. ##### `ok.md` -When configured with `2`. - ###### In ```markdown -## Delta - -Paragraph. +# The default is to expect a level one heading ``` ###### Out @@ -151,14 +147,26 @@ No messages. ##### `ok-html.md` -When configured with `2`. +###### In + +```markdown +

An HTML heading is also seen by this rule.

+``` + +###### Out + +No messages. + +##### `ok-delayed.md` ###### In ```markdown -

Echo

+You can use markdown content before the heading. -Paragraph. +
Or non-heading HTML
+ +

So the first heading, be it HTML or markdown, is checked

``` ###### Out @@ -167,12 +175,10 @@ No messages. ##### `not-ok.md` -When configured with `2`. - ###### In ```markdown -# Foxtrot +## Bravo Paragraph. ``` @@ -180,17 +186,15 @@ Paragraph. ###### Out ```text -1:1-1:10: First heading level should be `2` +1:1-1:9: First heading level should be `1` ``` ##### `not-ok-html.md` -When configured with `2`. - ###### In ```markdown -

Golf

+

Charlie

Paragraph. ``` @@ -198,15 +202,19 @@ Paragraph. ###### Out ```text -1:1-1:14: First heading level should be `2` +1:1-1:17: First heading level should be `1` ``` ##### `ok.md` +When configured with `2`. + ###### In ```markdown -# The default is to expect a level one heading +## Delta + +Paragraph. ``` ###### Out @@ -215,26 +223,14 @@ No messages. ##### `ok-html.md` -###### In - -```markdown -

An HTML heading is also seen by this rule.

-``` - -###### Out - -No messages. - -##### `ok-delayed.md` +When configured with `2`. ###### In ```markdown -You can use markdown content before the heading. - -
Or non-heading HTML
+

Echo

-

So the first heading, be it HTML or markdown, is checked

+Paragraph. ``` ###### Out @@ -243,10 +239,12 @@ No messages. ##### `not-ok.md` +When configured with `2`. + ###### In ```markdown -## Bravo +# Foxtrot Paragraph. ``` @@ -254,15 +252,17 @@ Paragraph. ###### Out ```text -1:1-1:9: First heading level should be `1` +1:1-1:10: First heading level should be `2` ``` ##### `not-ok-html.md` +When configured with `2`. + ###### In ```markdown -

Charlie

+

Golf

Paragraph. ``` @@ -270,7 +270,7 @@ Paragraph. ###### Out ```text -1:1-1:17: First heading level should be `1` +1:1-1:14: First heading level should be `2` ``` ## Compatibility diff --git a/packages/remark-lint-heading-style/index.js b/packages/remark-lint-heading-style/index.js index f2d2b915..4ed605ec 100644 --- a/packages/remark-lint-heading-style/index.js +++ b/packages/remark-lint-heading-style/index.js @@ -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'` */ diff --git a/packages/remark-lint-linebreak-style/index.js b/packages/remark-lint-linebreak-style/index.js index ba898420..d67751a5 100644 --- a/packages/remark-lint-linebreak-style/index.js +++ b/packages/remark-lint-linebreak-style/index.js @@ -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`) */ diff --git a/packages/remark-lint-link-title-style/index.js b/packages/remark-lint-link-title-style/index.js index e13c7219..9e639aaa 100644 --- a/packages/remark-lint-link-title-style/index.js +++ b/packages/remark-lint-link-title-style/index.js @@ -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 `'()'` */ diff --git a/packages/remark-lint-list-item-indent/index.js b/packages/remark-lint-list-item-indent/index.js index bec559bd..753b56dd 100644 --- a/packages/remark-lint-list-item-indent/index.js +++ b/packages/remark-lint-list-item-indent/index.js @@ -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'` */ diff --git a/packages/remark-lint-list-item-spacing/index.js b/packages/remark-lint-list-item-spacing/index.js index 8bb8f0ed..051734f2 100644 --- a/packages/remark-lint-list-item-spacing/index.js +++ b/packages/remark-lint-list-item-spacing/index.js @@ -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 diff --git a/packages/remark-lint-maximum-heading-length/index.js b/packages/remark-lint-maximum-heading-length/index.js index a40ea022..0147d884 100644 --- a/packages/remark-lint-maximum-heading-length/index.js +++ b/packages/remark-lint-maximum-heading-length/index.js @@ -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` */ diff --git a/packages/remark-lint-maximum-heading-length/readme.md b/packages/remark-lint-maximum-heading-length/readme.md index 11044fdb..c62fdad2 100644 --- a/packages/remark-lint-maximum-heading-length/readme.md +++ b/packages/remark-lint-maximum-heading-length/readme.md @@ -139,35 +139,35 @@ which reads every heading out loud). ## Examples -##### `not-ok.md` - -When configured with `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 -```text -1:1-1:52: Use headings shorter than `40` -``` +No messages. -##### `ok.md` +##### `not-ok.md` + +When configured with `40`. ###### 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. +```text +1:1-1:52: Use headings shorter than `40` +``` ## Compatibility diff --git a/packages/remark-lint-maximum-line-length/index.js b/packages/remark-lint-maximum-line-length/index.js index 05a86523..b6d826ec 100644 --- a/packages/remark-lint-maximum-line-length/index.js +++ b/packages/remark-lint-maximum-line-length/index.js @@ -58,7 +58,7 @@ * [foo]: * * @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 diff --git a/packages/remark-lint-maximum-line-length/readme.md b/packages/remark-lint-maximum-line-length/readme.md index 48790f01..aec51ec5 100644 --- a/packages/remark-lint-maximum-line-length/readme.md +++ b/packages/remark-lint-maximum-line-length/readme.md @@ -138,52 +138,46 @@ Whether to wrap prose or not is a stylistic choice. ## Examples -##### `ok-mixed-line-endings.md` - -When configured with `10`. +##### `ok.md` ###### In -> πŸ‘‰ **Note**: `␍␊` represents a carriage return and a line feed. - -> πŸ‘‰ **Note**: `␊` represents a line feed. +> πŸ‘‰ **Note**: this example uses GFM ([`remark-gfm`][gfm]). ```markdown -0123456789␍␊ -0123456789␊ -01234␍␊ -01234␊ -``` +This line is simply not toooooooooooooooooooooooooooooooooooooooooooo +long. -###### Out +This is also fine: -No messages. + -##### `not-ok-mixed-line-endings.md` +`alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscarPapaQuebec.romeo()` -When configured with `10`. +[foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) -###### In + -> πŸ‘‰ **Note**: `␍␊` represents a carriage return and a line feed. +![foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) -> πŸ‘‰ **Note**: `␊` represents a line feed. +| An | exception | is | line | length | in | long | tables | because | those | can’t | just | +| -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- | +| be | helped | | | | | | | | | | . | -```markdown -012345678901␍␊ -012345678901␊ -01234567890␍␊ -01234567890␊ +

alpha bravo charlie delta echo foxtrot golf

+ +The following is also fine (note the `.`), because there is no whitespace. + +. + +In addition, definitions are also fine: + +[foo]: ``` ###### Out -```text -1:13: Line must be at most 10 characters -2:13: Line must be at most 10 characters -3:12: Line must be at most 10 characters -4:12: Line must be at most 10 characters -``` +No messages. ##### `not-ok.md` @@ -216,46 +210,52 @@ And this one is also very wrong: because the code starts aaaaaaafter the column: 12:99: Line must be at most 80 characters ``` -##### `ok.md` - -###### In - -> πŸ‘‰ **Note**: this example uses GFM ([`remark-gfm`][gfm]). +##### `ok-mixed-line-endings.md` -```markdown -This line is simply not toooooooooooooooooooooooooooooooooooooooooooo -long. +When configured with `10`. -This is also fine: +###### In - +> πŸ‘‰ **Note**: `␍␊` represents a carriage return and a line feed. -`alphaBravoCharlieDeltaEchoFoxtrotGolfHotelIndiaJuliettKiloLimaMikeNovemberOscarPapaQuebec.romeo()` +> πŸ‘‰ **Note**: `␊` represents a line feed. -[foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) +```markdown +0123456789␍␊ +0123456789␊ +01234␍␊ +01234␊ +``` - +###### Out -![foo](http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables) +No messages. -| An | exception | is | line | length | in | long | tables | because | those | can’t | just | -| -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- | -| be | helped | | | | | | | | | | . | +##### `not-ok-mixed-line-endings.md` -

alpha bravo charlie delta echo foxtrot golf

+When configured with `10`. -The following is also fine (note the `.`), because there is no whitespace. +###### In -. +> πŸ‘‰ **Note**: `␍␊` represents a carriage return and a line feed. -In addition, definitions are also fine: +> πŸ‘‰ **Note**: `␊` represents a line feed. -[foo]: +```markdown +012345678901␍␊ +012345678901␊ +01234567890␍␊ +01234567890␊ ``` ###### Out -No messages. +```text +1:13: Line must be at most 10 characters +2:13: Line must be at most 10 characters +3:12: Line must be at most 10 characters +4:12: Line must be at most 10 characters +``` ## Compatibility diff --git a/packages/remark-lint-no-file-name-irregular-characters/index.js b/packages/remark-lint-no-file-name-irregular-characters/index.js index 039ff9be..f3023c2a 100644 --- a/packages/remark-lint-no-file-name-irregular-characters/index.js +++ b/packages/remark-lint-no-file-name-irregular-characters/index.js @@ -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 * diff --git a/packages/remark-lint-no-heading-punctuation/index.js b/packages/remark-lint-no-heading-punctuation/index.js index da6f51b9..5d43000c 100644 --- a/packages/remark-lint-no-heading-punctuation/index.js +++ b/packages/remark-lint-no-heading-punctuation/index.js @@ -25,7 +25,7 @@ * # Hello * * @example - * {"name": "ok.md", "setting": ",;:!?"} + * {"name": "ok.md", "config": ",;:!?"} * * # Hello… * diff --git a/packages/remark-lint-no-missing-blank-lines/index.js b/packages/remark-lint-no-missing-blank-lines/index.js index a682b678..02b39411 100644 --- a/packages/remark-lint-no-missing-blank-lines/index.js +++ b/packages/remark-lint-no-missing-blank-lines/index.js @@ -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 */ diff --git a/packages/remark-lint-no-multiple-toplevel-headings/index.js b/packages/remark-lint-no-multiple-toplevel-headings/index.js index fef6544c..1aab3df4 100644 --- a/packages/remark-lint-no-multiple-toplevel-headings/index.js +++ b/packages/remark-lint-no-multiple-toplevel-headings/index.js @@ -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: Don’t use multiple top level headings (1:1) */ diff --git a/packages/remark-lint-no-undefined-references/index.js b/packages/remark-lint-no-undefined-references/index.js index a2405d5a..8c0f72bd 100644 --- a/packages/remark-lint-no-undefined-references/index.js +++ b/packages/remark-lint-no-undefined-references/index.js @@ -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. * diff --git a/packages/remark-lint-ordered-list-marker-style/index.js b/packages/remark-lint-ordered-list-marker-style/index.js index 6efb8e02..4715e0c1 100644 --- a/packages/remark-lint-ordered-list-marker-style/index.js +++ b/packages/remark-lint-ordered-list-marker-style/index.js @@ -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 `')'` */ diff --git a/packages/remark-lint-ordered-list-marker-value/index.js b/packages/remark-lint-ordered-list-marker-value/index.js index 9536f588..f95160d4 100644 --- a/packages/remark-lint-ordered-list-marker-value/index.js +++ b/packages/remark-lint-ordered-list-marker-value/index.js @@ -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'` */ diff --git a/packages/remark-lint-rule-style/index.js b/packages/remark-lint-rule-style/index.js index 849e8fe7..760f5b49 100644 --- a/packages/remark-lint-rule-style/index.js +++ b/packages/remark-lint-rule-style/index.js @@ -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'` */ diff --git a/packages/remark-lint-strikethrough-marker/index.js b/packages/remark-lint-strikethrough-marker/index.js index 1f823ab7..b1b6751d 100644 --- a/packages/remark-lint-strikethrough-marker/index.js +++ b/packages/remark-lint-strikethrough-marker/index.js @@ -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 `'~~'` */ diff --git a/packages/remark-lint-strong-marker/index.js b/packages/remark-lint-strong-marker/index.js index 2dc5fe64..99d0c655 100644 --- a/packages/remark-lint-strong-marker/index.js +++ b/packages/remark-lint-strong-marker/index.js @@ -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 `'_'` */ diff --git a/packages/remark-lint-table-cell-padding/index.js b/packages/remark-lint-table-cell-padding/index.js index 5cf87240..e08a022a 100644 --- a/packages/remark-lint-table-cell-padding/index.js +++ b/packages/remark-lint-table-cell-padding/index.js @@ -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} * * * @@ -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} * * * diff --git a/packages/remark-lint-unordered-list-marker-style/index.js b/packages/remark-lint-unordered-list-marker-style/index.js index 4e3cb479..ed1714c1 100644 --- a/packages/remark-lint-unordered-list-marker-style/index.js +++ b/packages/remark-lint-unordered-list-marker-style/index.js @@ -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 `'+'` */ diff --git a/packages/unified-lint-rule/index.d.ts b/packages/unified-lint-rule/index.d.ts index 543953bb..7ee1944b 100644 --- a/packages/unified-lint-rule/index.d.ts +++ b/packages/unified-lint-rule/index.d.ts @@ -15,20 +15,18 @@ export interface RuleMeta { url?: string | undefined } -export function lintRule( +export function lintRule( name: string | RuleMeta, - rule: Rule + rule: Rule ): Plugin< - | void[] - | [Settings | Label | Severity] - | [boolean | Label | Severity, Settings], + void[] | [Options | Label | Severity] | [boolean | Label | Severity, Options], Tree > -export type Rule = ( +export type Rule = ( node: Tree, file: VFile, - settings: Settings + options: Options ) => Promise | Tree | undefined | void export {Severity, Label} from './lib/index.js' diff --git a/packages/unified-lint-rule/lib/index.js b/packages/unified-lint-rule/lib/index.js index 2862e2aa..f86eea68 100644 --- a/packages/unified-lint-rule/lib/index.js +++ b/packages/unified-lint-rule/lib/index.js @@ -39,8 +39,8 @@ export function lintRule(meta, rule) { return plugin /** @type {import('unified').Plugin<[unknown]|Array>} */ - 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} */ 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`: // type-coverage:ignore-next-line - primitives.has(typeof value[0]) + primitives.has(typeof config[0]) ) { // `isArray(unknown)` is turned into `Array`: // type-coverage:ignore-next-line - result = [...value] + result = [...config] } else { - result = [1, value] + result = [1, config] } let level = result[0] diff --git a/script/build-rules.js b/script/build-rules.js index a48d569a..4e6f0d85 100644 --- a/script/build-rules.js +++ b/script/build-rules.js @@ -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: '.'} ] }) diff --git a/script/util/rule.js b/script/util/rule.js index 8c9ed05b..0f605ab2 100755 --- a/script/util/rule.js +++ b/script/util/rule.js @@ -12,7 +12,6 @@ * @typedef Check * @property {string} input * @property {Array} 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 { diff --git a/test.js b/test.js index bfb3622d..a2501a3a 100644 --- a/test.js +++ b/test.js @@ -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)