mirror of
https://github.com/remarkjs/remark-lint.git
synced 2024-10-03 22:57:15 +03:00
Remove remark-lint-no-inline-padding
This commit is contained in:
parent
9cdda80913
commit
906012ec16
@ -40,8 +40,4 @@ rules and **remark-lint**’s rules.
|
||||
| MD034 | no-literal-urls | - |
|
||||
| MD035 | rule-style | - |
|
||||
| MD036 | no-emphasis-as-heading | remark-lint only warns when the emphasis is followed by a colon, but that might change. |
|
||||
| MD037 | no-inline-padding | - |
|
||||
| MD038 | no-inline-padding | - |
|
||||
| MD039 | no-inline-padding | - |
|
||||
| MD039 | no-inline-padding | - |
|
||||
| MD040 | fenced-code-flag | - |
|
||||
|
@ -80,7 +80,6 @@
|
||||
"packages/remark-lint-no-heading-like-paragraph/",
|
||||
"packages/remark-lint-no-heading-punctuation/",
|
||||
"packages/remark-lint-no-html/",
|
||||
"packages/remark-lint-no-inline-padding/",
|
||||
"packages/remark-lint-no-literal-urls/",
|
||||
"packages/remark-lint-no-missing-blank-lines/",
|
||||
"packages/remark-lint-no-multiple-toplevel-headings/",
|
||||
|
@ -1,2 +0,0 @@
|
||||
ignore-scripts=true
|
||||
package-lock=false
|
@ -1,73 +0,0 @@
|
||||
/**
|
||||
* Deprecated.
|
||||
*
|
||||
* ## API
|
||||
*
|
||||
* to do: remove.
|
||||
*
|
||||
* [api-remark-lint-no-inline-padding]: #api
|
||||
*
|
||||
* @module no-inline-padding
|
||||
* @author Titus Wormer
|
||||
* @copyright 2015 Titus Wormer
|
||||
* @license MIT
|
||||
* @deprecated
|
||||
* **Stability: Legacy**.
|
||||
* This rule is no longer recommended for use.
|
||||
* With CommonMark, inlines can no longer be padded.
|
||||
* Otherwise they don’t parse.
|
||||
*
|
||||
* @example
|
||||
* {"name": "ok.md"}
|
||||
*
|
||||
* Alpha [bravo](http://echo.fox/trot)
|
||||
*
|
||||
* @example
|
||||
* {"name": "not-ok.md", "label": "input"}
|
||||
*
|
||||
* Alpha [ bravo ](http://echo.fox/trot)
|
||||
*
|
||||
* @example
|
||||
* {"name": "not-ok.md", "label": "output"}
|
||||
*
|
||||
* 1:7-1:38: Don’t pad `link` with inner spaces
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('mdast').Root} Root
|
||||
*/
|
||||
|
||||
import {toString} from 'mdast-util-to-string'
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import {position} from 'unist-util-position'
|
||||
import {visit} from 'unist-util-visit'
|
||||
|
||||
const remarkLintNoInlinePadding = lintRule(
|
||||
{
|
||||
origin: 'remark-lint:no-inline-padding',
|
||||
url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-inline-padding#readme'
|
||||
},
|
||||
/**
|
||||
* @param {Root} tree
|
||||
* Tree.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
function (tree, file) {
|
||||
// Note: `emphasis`, `strong`, `delete` (GFM) can’t have padding anymore
|
||||
// since CM.
|
||||
visit(tree, function (node) {
|
||||
const place = position(node)
|
||||
|
||||
if ((node.type === 'link' || node.type === 'linkReference') && place) {
|
||||
const value = toString(node)
|
||||
|
||||
if (value.charAt(0) === ' ' || value.charAt(value.length - 1) === ' ') {
|
||||
file.message('Don’t pad `' + node.type + '` with inner spaces', place)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
export default remarkLintNoInlinePadding
|
@ -1,54 +0,0 @@
|
||||
{
|
||||
"name": "remark-lint-no-inline-padding",
|
||||
"version": "4.1.2",
|
||||
"description": "remark-lint rule to warn when inline nodes are padded with spaces",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"inline",
|
||||
"lint",
|
||||
"padding",
|
||||
"remark",
|
||||
"remark-lint",
|
||||
"remark-lint-rule",
|
||||
"rule"
|
||||
],
|
||||
"repository": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-inline-padding",
|
||||
"bugs": "https://github.com/remarkjs/remark-lint/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
},
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com>"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"index.d.ts.map",
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@types/mdast": "^4.0.0",
|
||||
"mdast-util-to-string": "^4.0.0",
|
||||
"unified-lint-rule": "^2.0.0",
|
||||
"unist-util-position": "^5.0.0",
|
||||
"unist-util-visit": "^5.0.0"
|
||||
},
|
||||
"scripts": {},
|
||||
"typeCoverage": {
|
||||
"atLeast": 100,
|
||||
"detail": true,
|
||||
"ignoreCatch": true,
|
||||
"strict": true
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"rules": {
|
||||
"capitalized-comments": "off",
|
||||
"unicorn/prefer-at": "off"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,213 +0,0 @@
|
||||
<!--This file is generated-->
|
||||
|
||||
# remark-lint-no-inline-padding
|
||||
|
||||
[![Build][badge-build-image]][badge-build-url]
|
||||
[![Coverage][badge-coverage-image]][badge-coverage-url]
|
||||
[![Downloads][badge-downloads-image]][badge-downloads-url]
|
||||
[![Size][badge-size-image]][badge-size-url]
|
||||
[![Sponsors][badge-funding-sponsors-image]][badge-funding-url]
|
||||
[![Backers][badge-funding-backers-image]][badge-funding-url]
|
||||
[![Chat][badge-chat-image]][badge-chat-url]
|
||||
|
||||
Deprecated.
|
||||
|
||||
## Contents
|
||||
|
||||
* [Presets](#presets)
|
||||
* [Install](#install)
|
||||
* [Use](#use)
|
||||
* [API](#api)
|
||||
* [Examples](#examples)
|
||||
* [Compatibility](#compatibility)
|
||||
* [Contribute](#contribute)
|
||||
* [License](#license)
|
||||
|
||||
## Presets
|
||||
|
||||
This plugin is included in the following presets:
|
||||
|
||||
| Preset | Options |
|
||||
| - | - |
|
||||
| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | |
|
||||
| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-recommended) | |
|
||||
|
||||
## Install
|
||||
|
||||
This package is [ESM only][github-gist-esm].
|
||||
In Node.js (version 16+),
|
||||
install with [npm][npm-install]:
|
||||
|
||||
```sh
|
||||
npm install remark-lint-no-inline-padding
|
||||
```
|
||||
|
||||
In Deno with [`esm.sh`][esm-sh]:
|
||||
|
||||
```js
|
||||
import remarkLintNoInlinePadding from 'https://esm.sh/remark-lint-no-inline-padding@4'
|
||||
```
|
||||
|
||||
In browsers with [`esm.sh`][esm-sh]:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import remarkLintNoInlinePadding from 'https://esm.sh/remark-lint-no-inline-padding@4?bundle'
|
||||
</script>
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
On the API:
|
||||
|
||||
```js
|
||||
import remarkLint from 'remark-lint'
|
||||
import remarkLintNoInlinePadding from 'remark-lint-no-inline-padding'
|
||||
import remarkParse from 'remark-parse'
|
||||
import remarkStringify from 'remark-stringify'
|
||||
import {read} from 'to-vfile'
|
||||
import {unified} from 'unified'
|
||||
import {reporter} from 'vfile-reporter'
|
||||
|
||||
const file = await read('example.md')
|
||||
|
||||
await unified()
|
||||
.use(remarkParse)
|
||||
.use(remarkLint)
|
||||
.use(remarkLintNoInlinePadding)
|
||||
.use(remarkStringify)
|
||||
.process(file)
|
||||
|
||||
console.error(reporter(file))
|
||||
```
|
||||
|
||||
On the CLI:
|
||||
|
||||
```sh
|
||||
remark --frail --use remark-lint --use remark-lint-no-inline-padding .
|
||||
```
|
||||
|
||||
On the CLI in a config file (here a `package.json`):
|
||||
|
||||
```diff
|
||||
…
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
…
|
||||
"remark-lint",
|
||||
+ "remark-lint-no-inline-padding",
|
||||
…
|
||||
]
|
||||
}
|
||||
…
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package exports no identifiers.
|
||||
It exports no additional [TypeScript][typescript] types.
|
||||
The default export is
|
||||
[`remarkLintNoInlinePadding`][api-remark-lint-no-inline-padding].
|
||||
|
||||
to do: remove.
|
||||
|
||||
## Examples
|
||||
|
||||
##### `ok.md`
|
||||
|
||||
###### In
|
||||
|
||||
```markdown
|
||||
Alpha [bravo](http://echo.fox/trot)
|
||||
```
|
||||
|
||||
###### Out
|
||||
|
||||
No messages.
|
||||
|
||||
##### `not-ok.md`
|
||||
|
||||
###### In
|
||||
|
||||
```markdown
|
||||
Alpha [ bravo ](http://echo.fox/trot)
|
||||
```
|
||||
|
||||
###### Out
|
||||
|
||||
```text
|
||||
1:7-1:38: Don’t pad `link` with inner spaces
|
||||
```
|
||||
|
||||
## Compatibility
|
||||
|
||||
Projects maintained by the unified collective are compatible with maintained
|
||||
versions of Node.js.
|
||||
|
||||
When we cut a new major release, we drop support for unmaintained versions of
|
||||
Node.
|
||||
This means we try to keep the current release line,
|
||||
`remark-lint-no-inline-padding@4`,
|
||||
compatible with Node.js 12.
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md`][github-dotfiles-contributing] in [`remarkjs/.github`][github-dotfiles-health] for ways
|
||||
to get started.
|
||||
See [`support.md`][github-dotfiles-support] for ways to get help.
|
||||
|
||||
This project has a [code of conduct][github-dotfiles-coc].
|
||||
By interacting with this repository, organization, or community you agree to
|
||||
abide by its terms.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][file-license] © [Titus Wormer][author]
|
||||
|
||||
[api-remark-lint-no-inline-padding]: #api
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[badge-build-image]: https://github.com/remarkjs/remark-lint/workflows/main/badge.svg
|
||||
|
||||
[badge-build-url]: https://github.com/remarkjs/remark-lint/actions
|
||||
|
||||
[badge-chat-image]: https://img.shields.io/badge/chat-discussions-success.svg
|
||||
|
||||
[badge-chat-url]: https://github.com/remarkjs/remark/discussions
|
||||
|
||||
[badge-coverage-image]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg
|
||||
|
||||
[badge-coverage-url]: https://codecov.io/github/remarkjs/remark-lint
|
||||
|
||||
[badge-downloads-image]: https://img.shields.io/npm/dm/remark-lint-no-inline-padding.svg
|
||||
|
||||
[badge-downloads-url]: https://www.npmjs.com/package/remark-lint-no-inline-padding
|
||||
|
||||
[badge-funding-backers-image]: https://opencollective.com/unified/backers/badge.svg
|
||||
|
||||
[badge-funding-sponsors-image]: https://opencollective.com/unified/sponsors/badge.svg
|
||||
|
||||
[badge-funding-url]: https://opencollective.com/unified
|
||||
|
||||
[badge-size-image]: https://img.shields.io/bundlejs/size/remark-lint-no-inline-padding
|
||||
|
||||
[badge-size-url]: https://bundlejs.com/?q=remark-lint-no-inline-padding
|
||||
|
||||
[esm-sh]: https://esm.sh
|
||||
|
||||
[file-license]: https://github.com/remarkjs/remark-lint/blob/main/license
|
||||
|
||||
[github-dotfiles-coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md
|
||||
|
||||
[github-dotfiles-contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md
|
||||
|
||||
[github-dotfiles-health]: https://github.com/remarkjs/.github
|
||||
|
||||
[github-dotfiles-support]: https://github.com/remarkjs/.github/blob/main/support.md
|
||||
|
||||
[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
||||
|
||||
[npm-install]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[typescript]: https://www.typescriptlang.org
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json"
|
||||
}
|
@ -145,7 +145,6 @@ import remarkLintNoFileNameIrregularCharacters from 'remark-lint-no-file-name-ir
|
||||
import remarkLintNoFileNameMixedCase from 'remark-lint-no-file-name-mixed-case'
|
||||
import remarkLintNoFileNameOuterDashes from 'remark-lint-no-file-name-outer-dashes'
|
||||
import remarkLintNoHeadingPunctuation from 'remark-lint-no-heading-punctuation'
|
||||
import remarkLintNoInlinePadding from 'remark-lint-no-inline-padding'
|
||||
import remarkLintNoLiteralUrls from 'remark-lint-no-literal-urls'
|
||||
import remarkLintNoMultipleToplevelHeadings from 'remark-lint-no-multiple-toplevel-headings'
|
||||
import remarkLintNoShellDollars from 'remark-lint-no-shell-dollars'
|
||||
@ -270,9 +269,6 @@ const remarkPresetLintMarkdownStyleGuide = {
|
||||
// https://cirosantilli.com/markdown-style-guide/#separate-consecutive-elements.
|
||||
// Not checked.
|
||||
|
||||
// https://cirosantilli.com/markdown-style-guide/#span-elements
|
||||
remarkLintNoInlinePadding,
|
||||
|
||||
// https://cirosantilli.com/markdown-style-guide/#reference-style-links
|
||||
remarkLintNoShortcutReferenceImage,
|
||||
remarkLintNoShortcutReferenceLink,
|
||||
|
@ -60,7 +60,6 @@
|
||||
"remark-lint-no-file-name-mixed-case": "^2.0.0",
|
||||
"remark-lint-no-file-name-outer-dashes": "^2.0.0",
|
||||
"remark-lint-no-heading-punctuation": "^3.0.0",
|
||||
"remark-lint-no-inline-padding": "^4.0.0",
|
||||
"remark-lint-no-literal-urls": "^3.0.0",
|
||||
"remark-lint-no-multiple-toplevel-headings": "^3.0.0",
|
||||
"remark-lint-no-shell-dollars": "^3.0.0",
|
||||
|
@ -159,7 +159,6 @@ This preset includes the following plugins:
|
||||
| [`remark-lint-no-file-name-mixed-case`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-file-name-mixed-case) | |
|
||||
| [`remark-lint-no-file-name-outer-dashes`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-file-name-outer-dashes) | |
|
||||
| [`remark-lint-no-heading-punctuation`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-punctuation) | `':.'` |
|
||||
| [`remark-lint-no-inline-padding`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-inline-padding) | |
|
||||
| [`remark-lint-no-literal-urls`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-literal-urls) | |
|
||||
| [`remark-lint-no-multiple-toplevel-headings`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-multiple-toplevel-headings) | |
|
||||
| [`remark-lint-no-shell-dollars`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-shell-dollars) | |
|
||||
|
@ -34,7 +34,6 @@ import remarkLintListItemIndent from 'remark-lint-list-item-indent'
|
||||
import remarkLintNoBlockquoteWithoutMarker from 'remark-lint-no-blockquote-without-marker'
|
||||
import remarkLintNoDuplicateDefinitions from 'remark-lint-no-duplicate-definitions'
|
||||
import remarkLintNoHeadingContentIndent from 'remark-lint-no-heading-content-indent'
|
||||
import remarkLintNoInlinePadding from 'remark-lint-no-inline-padding'
|
||||
import remarkLintNoLiteralUrls from 'remark-lint-no-literal-urls'
|
||||
import remarkLintNoShortcutReferenceImage from 'remark-lint-no-shortcut-reference-image'
|
||||
import remarkLintNoShortcutReferenceLink from 'remark-lint-no-shortcut-reference-link'
|
||||
@ -58,7 +57,6 @@ const remarkPresetLintRecommended = {
|
||||
remarkLintHardBreakSpaces,
|
||||
remarkLintNoDuplicateDefinitions,
|
||||
remarkLintNoHeadingContentIndent,
|
||||
remarkLintNoInlinePadding,
|
||||
remarkLintNoShortcutReferenceImage,
|
||||
remarkLintNoShortcutReferenceLink,
|
||||
remarkLintNoUndefinedReferences,
|
||||
|
@ -37,7 +37,6 @@
|
||||
"remark-lint-no-blockquote-without-marker": "^5.0.0",
|
||||
"remark-lint-no-duplicate-definitions": "^3.0.0",
|
||||
"remark-lint-no-heading-content-indent": "^4.0.0",
|
||||
"remark-lint-no-inline-padding": "^4.0.0",
|
||||
"remark-lint-no-literal-urls": "^3.0.0",
|
||||
"remark-lint-no-shortcut-reference-image": "^3.0.0",
|
||||
"remark-lint-no-shortcut-reference-link": "^3.0.0",
|
||||
|
@ -48,7 +48,6 @@ This preset includes the following plugins:
|
||||
| [`remark-lint-no-blockquote-without-marker`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-blockquote-without-marker) | |
|
||||
| [`remark-lint-no-duplicate-definitions`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-duplicate-definitions) | |
|
||||
| [`remark-lint-no-heading-content-indent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-content-indent) | |
|
||||
| [`remark-lint-no-inline-padding`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-inline-padding) | |
|
||||
| [`remark-lint-no-literal-urls`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-literal-urls) | |
|
||||
| [`remark-lint-no-shortcut-reference-image`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-shortcut-reference-image) | |
|
||||
| [`remark-lint-no-shortcut-reference-link`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-shortcut-reference-link) | |
|
||||
|
@ -145,7 +145,6 @@ The rules that are maintained here:
|
||||
* [`remark-lint-no-heading-like-paragraph`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-like-paragraph) — for too many hashes (h7+ “headings”)
|
||||
* [`remark-lint-no-heading-punctuation`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-punctuation) — warn when headings end in illegal characters
|
||||
* [`remark-lint-no-html`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-html) — warn when HTML nodes are used
|
||||
* [`remark-lint-no-inline-padding`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-inline-padding) — warn when inline nodes are padded with spaces
|
||||
* [`remark-lint-no-literal-urls`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-literal-urls) — warn when URLs without angle brackets are used
|
||||
* [`remark-lint-no-missing-blank-lines`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-missing-blank-lines) — warn when missing blank lines
|
||||
* [`remark-lint-no-multiple-toplevel-headings`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-multiple-toplevel-headings) — warn when multiple top level headings are used
|
||||
|
@ -38,8 +38,6 @@
|
||||
*
|
||||
* @typedef PluginInfo
|
||||
* Plugin.
|
||||
* @property {boolean} deprecated
|
||||
* Whether the plugin is deprecated.
|
||||
* @property {string} description
|
||||
* Description.
|
||||
* @property {string} name
|
||||
@ -112,16 +110,12 @@ async function addPlugin(name) {
|
||||
let description = ''
|
||||
/** @type {string | undefined} */
|
||||
let ruleId
|
||||
let deprecated = false
|
||||
|
||||
if (name === 'remark-lint') {
|
||||
// Empty.
|
||||
} else {
|
||||
ruleId = name.slice('remark-lint-'.length)
|
||||
|
||||
const deprecatedTag = tags.find(function (d) {
|
||||
return d.tag === 'deprecated'
|
||||
})
|
||||
const moduleTag = tags.find(function (d) {
|
||||
return d.tag === 'module'
|
||||
})
|
||||
@ -129,19 +123,14 @@ async function addPlugin(name) {
|
||||
assert(moduleTag, 'expected `@module` in JSDoc')
|
||||
assert.equal(moduleTag.name, ruleId, 'expected correct `@module`')
|
||||
|
||||
description = deprecatedTag
|
||||
? deprecatedTag.description
|
||||
: fileInfo.description
|
||||
|
||||
assert(description, 'expected description (or `@deprecated`)')
|
||||
description = fileInfo.description
|
||||
assert(description, 'expected description')
|
||||
|
||||
description = strip(description).trim()
|
||||
deprecated = Boolean(deprecatedTag)
|
||||
}
|
||||
|
||||
/** @type {PluginInfo} */
|
||||
const result = {
|
||||
deprecated,
|
||||
description,
|
||||
name,
|
||||
ruleId,
|
||||
|
@ -44,7 +44,7 @@ export default function remarkListOfRules() {
|
||||
''
|
||||
)
|
||||
|
||||
if (!info.ruleId || /^deprecated/i.test(description)) return
|
||||
if (!info.ruleId) return
|
||||
|
||||
assert(typeof pack.repository === 'string')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user