Skip to content

Commit

Permalink
Mark no-auto-link-without-protocol as deprecated
Browse files Browse the repository at this point in the history
* Add internal support for deprecated packages in tooling
* Remove `remark-lint-no-auto-link-without-protocol` from presets
* Add info to `remark-lint-no-auto-link-without-protocol` on why it’s deprecated

Related to remarkjs/remark#863.
  • Loading branch information
wooorm committed Oct 8, 2021
1 parent 1c176e4 commit c5c3832
Show file tree
Hide file tree
Showing 13 changed files with 337 additions and 435 deletions.
1 change: 0 additions & 1 deletion doc/rules.md
Expand Up @@ -107,7 +107,6 @@ Rules][external].
* [`list-item-spacing`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-list-item-spacing) — warn when list looseness is incorrect
* [`maximum-heading-length`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-maximum-heading-length) — warn when headings are too long
* [`maximum-line-length`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-maximum-line-length) — warn when lines are too long
* [`no-auto-link-without-protocol`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-auto-link-without-protocol) — warn for angle bracketed links without protocol
* [`no-blockquote-without-marker`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-blockquote-without-marker) — warn when blank lines without markers (\`>\`) are found in a block quote
* [`no-consecutive-blank-lines`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-consecutive-blank-lines) — warn for too many consecutive blank lines
* [`no-duplicate-defined-urls`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-duplicate-defined-urls) — warn on definitions that define the same urls
Expand Down
18 changes: 6 additions & 12 deletions packages/remark-lint-no-auto-link-without-protocol/index.js
Expand Up @@ -3,18 +3,12 @@
* @copyright 2015 Titus Wormer
* @license MIT
* @module no-auto-link-without-protocol
* @fileoverview
* Warn for autolinks without protocol.
* Autolinks are URLs enclosed in `<` (less than) and `>` (greater than)
* characters.
*
* ## Fix
*
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify)
* adds a protocol where needed.
*
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
* @deprecated
* This rule is no longer recommended for use.
* With CommonMark, all autolinks (except for emails) are required to have a
* protocol.
* Otherwise they don’t parse.
* The previous suggestion to add a protocol to email autolinks was wrong.
*
* @example
* {"name": "ok.md"}
Expand Down
@@ -1,7 +1,7 @@
{
"name": "remark-lint-no-auto-link-without-protocol",
"version": "3.1.0",
"description": "remark-lint rule to warn for angle bracketed links without protocol",
"description": "Deprecated",
"license": "MIT",
"keywords": [
"remark",
Expand Down
115 changes: 5 additions & 110 deletions packages/remark-lint-no-auto-link-without-protocol/readme.md
Expand Up @@ -10,112 +10,11 @@
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]

Warn for autolinks without protocol.
Autolinks are URLs enclosed in `<` (less than) and `>` (greater than)
characters.

## Fix

[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify)
adds a protocol where needed.

See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
on how to automatically fix warnings for this rule.

## Presets

This rule is included in the following presets:

| Preset | Setting |
| - | - |
| [`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) | |

## Example

##### `ok.md`

###### In

```markdown
<http://www.example.com>
<mailto:foo@bar.com>

Most Markdown vendors don’t recognize the following as a link:
<www.example.com>
```

###### Out

No messages.

##### `not-ok.md`

###### In

```markdown
<foo@bar.com>
```

###### Out

```text
1:1-1:14: All automatic links must start with a protocol
```

## Install

This package is [ESM only][esm]:
Node 12+ is needed to use it and it must be `imported`ed instead of `required`d.

[npm][]:

```sh
npm install remark-lint-no-auto-link-without-protocol
```

This package exports no identifiers.
The default export is `remarkLintNoAutoLinkWithoutProtocol`.

## Use

You probably want to use it on the CLI through a config file:

```diff
"remarkConfig": {
"plugins": [
"lint",
+ "lint-no-auto-link-without-protocol",
]
}
```

Or use it on the CLI directly

```sh
remark -u lint -u lint-no-auto-link-without-protocol readme.md
```

Or use this on the API:

```diff
import {remark} from 'remark'
import {reporter} from 'vfile-reporter'
import remarkLint from 'remark-lint'
import remarkLintNoAutoLinkWithoutProtocol from 'remark-lint-no-auto-link-without-protocol'

remark()
.use(remarkLint)
+ .use(remarkLintNoAutoLinkWithoutProtocol)
.process('_Emphasis_ and **importance**')
.then((file) => {
console.error(reporter(file))
})
```
This rule is no longer recommended for use.
With CommonMark, all autolinks (except for emails) are required to have a
protocol.
Otherwise they don’t parse.
The previous suggestion to add a protocol to email autolinks was wrong.

## Contribute

Expand Down Expand Up @@ -157,10 +56,6 @@ abide by its terms.

[chat]: https://github.com/remarkjs/remark/discussions

[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

[npm]: https://docs.npmjs.com/cli/install

[health]: https://github.com/remarkjs/.github

[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md
Expand Down
6 changes: 1 addition & 5 deletions packages/remark-preset-lint-markdown-style-guide/index.js
Expand Up @@ -144,7 +144,6 @@ import remarkLintStrongMarker from 'remark-lint-strong-marker'
import remarkLintEmphasisMarker from 'remark-lint-emphasis-marker'
import remarkLintNoEmphasisAsHeading from 'remark-lint-no-emphasis-as-heading'
import remarkLintNoLiteralUrls from 'remark-lint-no-literal-urls'
import remarkLintNoAutoLinkWithoutProtocol from 'remark-lint-no-auto-link-without-protocol'

/** @type {Preset} */
const remarkPresetLintMarkdownStyleGuide = {
Expand Down Expand Up @@ -281,10 +280,7 @@ const remarkPresetLintMarkdownStyleGuide = {
remarkLintNoEmphasisAsHeading,

// http://www.cirosantilli.com/markdown-style-guide/#automatic-links-without-angle-brackets
remarkLintNoLiteralUrls,

// http://www.cirosantilli.com/markdown-style-guide/#content-of-automatic-links
remarkLintNoAutoLinkWithoutProtocol
remarkLintNoLiteralUrls

// http://www.cirosantilli.com/markdown-style-guide/#email-automatic-links.
// Not checked.
Expand Down
Expand Up @@ -54,7 +54,6 @@
"remark-lint-list-item-spacing": "^4.0.0",
"remark-lint-maximum-heading-length": "^3.0.0",
"remark-lint-maximum-line-length": "^3.0.0",
"remark-lint-no-auto-link-without-protocol": "^3.0.0",
"remark-lint-no-blockquote-without-marker": "^5.0.0",
"remark-lint-no-consecutive-blank-lines": "^4.0.0",
"remark-lint-no-duplicate-headings": "^3.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/remark-preset-lint-markdown-style-guide/readme.md
Expand Up @@ -154,7 +154,6 @@ This preset configures [`remark-lint`](https://github.com/remarkjs/remark-lint)
| [`remark-lint-emphasis-marker`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-emphasis-marker) | `'*'` |
| [`remark-lint-no-emphasis-as-heading`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-emphasis-as-heading) | |
| [`remark-lint-no-literal-urls`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-literal-urls) | |
| [`remark-lint-no-auto-link-without-protocol`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-auto-link-without-protocol) | |

## Install

Expand Down
3 changes: 0 additions & 3 deletions packages/remark-preset-lint-recommended/index.js
Expand Up @@ -12,7 +12,6 @@ import remarkLint from 'remark-lint'
import remarkLintFinalNewline from 'remark-lint-final-newline'
import remarkLintListItemBulletIndent from 'remark-lint-list-item-bullet-indent'
import remarkLintListItemIndent from 'remark-lint-list-item-indent'
import remarkLintNoAutoLinkWithoutProtocol from 'remark-lint-no-auto-link-without-protocol'
import remarkLintNoBlockquoteWithoutMarker from 'remark-lint-no-blockquote-without-marker'
import remarkLintNoLiteralUrls from 'remark-lint-no-literal-urls'
import remarkLintOrderedListMarkerStyle from 'remark-lint-ordered-list-marker-style'
Expand All @@ -34,8 +33,6 @@ const remarkPresetLintRecommended = {
// Rendering across vendors differs greatly if using other styles.
remarkLintListItemBulletIndent,
[remarkLintListItemIndent, 'tab-size'],
// Differs or unsupported across vendors.
remarkLintNoAutoLinkWithoutProtocol,
remarkLintNoBlockquoteWithoutMarker,
remarkLintNoLiteralUrls,
[remarkLintOrderedListMarkerStyle, '.'],
Expand Down
1 change: 0 additions & 1 deletion packages/remark-preset-lint-recommended/package.json
Expand Up @@ -38,7 +38,6 @@
"remark-lint-hard-break-spaces": "^3.0.0",
"remark-lint-list-item-bullet-indent": "^4.0.0",
"remark-lint-list-item-indent": "^3.0.0",
"remark-lint-no-auto-link-without-protocol": "^3.0.0",
"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",
Expand Down
1 change: 0 additions & 1 deletion packages/remark-preset-lint-recommended/readme.md
Expand Up @@ -22,7 +22,6 @@ This preset configures [`remark-lint`](https://github.com/remarkjs/remark-lint)
| [`remark-lint-final-newline`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-final-newline) | |
| [`remark-lint-list-item-bullet-indent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-list-item-bullet-indent) | |
| [`remark-lint-list-item-indent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-list-item-indent) | `'tab-size'` |
| [`remark-lint-no-auto-link-without-protocol`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-auto-link-without-protocol) | |
| [`remark-lint-no-blockquote-without-marker`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-blockquote-without-marker) | |
| [`remark-lint-no-literal-urls`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-literal-urls) | |
| [`remark-lint-ordered-list-marker-style`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-ordered-list-marker-style) | `'.'` |
Expand Down

0 comments on commit c5c3832

Please sign in to comment.