From ccea69188b601a50e6bc4fbdf3f83595411a9aa1 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Sun, 17 Dec 2023 12:11:20 +0100 Subject: [PATCH] list-item-indent: change default to `one` --- package.json | 2 +- .../remark-lint-list-item-indent/index.js | 55 ++++++++++++------ .../remark-lint-list-item-indent/readme.md | 58 ++++++++++++++----- 3 files changed, 81 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index 20a59cad..8d5a9a35 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/packages/remark-lint-list-item-indent/index.js b/packages/remark-lint-list-item-indent/index.js index d83251f4..5d082c00 100644 --- a/packages/remark-lint-list-item-indent/index.js +++ b/packages/remark-lint-list-item-indent/index.js @@ -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. diff --git a/packages/remark-lint-list-item-indent/readme.md b/packages/remark-lint-list-item-indent/readme.md index 120061e4..cb510294 100644 --- a/packages/remark-lint-list-item-indent/readme.md +++ b/packages/remark-lint-list-item-indent/readme.md @@ -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'`.