list-item-indent: change default to one

This commit is contained in:
Titus Wormer 2023-12-17 12:11:20 +01:00
parent 07140bd905
commit ccea69188b
No known key found for this signature in database
GPG Key ID: E6E581152ED04E2E
3 changed files with 81 additions and 34 deletions

View File

@ -190,7 +190,7 @@
"remark-validate-links",
[
"remark-lint-list-item-indent",
"space"
"one"
],
"./script/plugin/list-of-plugins.js",
"./script/plugin/list-of-presets.js"

View File

@ -19,7 +19,7 @@
*
* ###### Parameters
*
* * `options` ([`Options`][api-options], default: `'tab'`)
* * `options` ([`Options`][api-options], default: `'one'`)
* preferred style
*
* ###### Returns
@ -30,12 +30,12 @@
*
* Configuration (TypeScript type).
*
* * `'one'`
* prefer a single space
* * `'tab'`
* prefer spaces the size of the next tab stop
* * `'mixed'`
* prefer `'one'` for tight lists and `'tab'` for loose lists
* * `'one'`
* prefer the size of the bullet and a single space
* * `'tab'`
* prefer the size of the bullet and a single space to the next tab stop
*
* ###### Type
*
@ -70,11 +70,11 @@
* CommonMark made that a *lot* better,
* but there remain (documented but complex) edge cases and some behavior
* intuitive.
* Due to this, the default of this list is `'tab'`, which worked the best
* in most markdown parsers *and* in CommonMark.
* Due to this, `'tab'` works the best in most markdown parsers *and* in
* CommonMark.
* Currently the situation between markdown parsers is better,
* so choosing `'one'`, which seems to be the most common style used by
* authors,
* so the default `'one'`,
* which seems to be the most common style used by authors,
* is okay.
*
* ## Fix
@ -95,8 +95,8 @@
* @example
* {"name": "ok.md"}
*
* *List
* item.
* *List
* item.
*
* Paragraph.
*
@ -105,11 +105,11 @@
*
* Paragraph.
*
* *List
* item.
* *List
* item.
*
* *List
* item.
* *List
* item.
*
* @example
* {"name": "ok.md", "config": "mixed"}
@ -146,6 +146,25 @@
* item.
*
* @example
* {"config": "tab", "name": "ok.md"}
*
* *List
* item.
*
* Paragraph.
*
* 11.List
* item.
*
* Paragraph.
*
* *List
* item.
*
* *List
* item.
*
* @example
* {"name": "not-ok.md", "config": "one", "label": "input"}
*
* *List
@ -205,14 +224,14 @@ const remarkLintListItemIndent = lintRule(
/**
* @param {Root} tree
* Tree.
* @param {Options | null | undefined} [options='tab']
* Configuration (default: `'tab'`).
* @param {Options | null | undefined} [options='one']
* Configuration (default: `'one'`).
* @returns {undefined}
* Nothing.
*/
function (tree, file, options) {
const value = String(file)
const option = options || 'tab'
const option = options || 'one'
/* c8 ignore next 13 -- previous names. */
// @ts-expect-error: old name.

View File

@ -132,7 +132,7 @@ Warn when the whitespace after list item markers violate a given style.
###### Parameters
* `options` ([`Options`][api-options], default: `'tab'`)
* `options` ([`Options`][api-options], default: `'one'`)
— preferred style
###### Returns
@ -143,12 +143,12 @@ Transform ([`Transformer` from `unified`][github-unified-transformer]).
Configuration (TypeScript type).
* `'one'`
— prefer a single space
* `'tab'`
— prefer spaces the size of the next tab stop
* `'mixed'`
— prefer `'one'` for tight lists and `'tab'` for loose lists
* `'one'`
— prefer the size of the bullet and a single space
* `'tab'`
— prefer the size of the bullet and a single space to the next tab stop
###### Type
@ -183,11 +183,11 @@ especially with how they interact with indented code.
CommonMark made that a *lot* better,
but there remain (documented but complex) edge cases and some behavior
intuitive.
Due to this, the default of this list is `'tab'`, which worked the best
in most markdown parsers *and* in CommonMark.
Due to this, `'tab'` works the best in most markdown parsers *and* in
CommonMark.
Currently the situation between markdown parsers is better,
so choosing `'one'`, which seems to be the most common style used by
authors,
so the default `'one'`,
which seems to be the most common style used by authors,
is okay.
## Fix
@ -203,8 +203,8 @@ by default.
###### In
```markdown
*␠␠␠List
␠␠␠␠item.
*␠List
␠␠item.
Paragraph.
@ -213,11 +213,11 @@ Paragraph.
Paragraph.
*␠␠␠List
␠␠␠␠item.
*␠List
␠␠item.
*␠␠␠List
␠␠␠␠item.
*␠List
␠␠item.
```
###### Out
@ -276,6 +276,34 @@ Paragraph.
No messages.
##### `ok.md`
When configured with `'tab'`.
###### In
```markdown
*␠␠␠List
␠␠␠␠item.
Paragraph.
11.␠List
␠␠␠␠item.
Paragraph.
*␠␠␠List
␠␠␠␠item.
*␠␠␠List
␠␠␠␠item.
```
###### Out
No messages.
##### `not-ok.md`
When configured with `'one'`.