Skip to content

Commit

Permalink
Refactor to use @import
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 15, 2024
1 parent a87a9d1 commit ea19649
Show file tree
Hide file tree
Showing 78 changed files with 120 additions and 166 deletions.
6 changes: 3 additions & 3 deletions doc/create-a-custom-rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ touch .remarkrc.js
```js
// .remarkrc.js
/**
* @typedef {import('unified').Preset} Preset
* @import {Preset} from 'unified'
*/

/** @type {Preset} */
Expand Down Expand Up @@ -200,7 +200,7 @@ nodes that we have generated ourselves and do not belong to the `doc.md`.

```js
/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import {lintRule} from 'unified-lint-rule'
Expand Down Expand Up @@ -247,7 +247,7 @@ You can do that by importing your rule and adding it in `plugins` array:
```js
// .remarkrc.js
/**
* @typedef {import('unified').Preset} Preset
* @import {Preset} from 'unified'
*/

import remarkLintNoGifAllowed from './rules/no-gif-allowed.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-blockquote-indentation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-checkbox-character-style/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-checkbox-content-indent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import {phrasing} from 'mdast-util-phrasing'
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-code-block-style/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-definition-case/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import {phrasing} from 'mdast-util-phrasing'
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-definition-spacing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import {longestStreak} from 'longest-streak'
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-emphasis-marker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-fenced-code-flag/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-fenced-code-marker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-file-extension/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
6 changes: 2 additions & 4 deletions packages/remark-lint-final-definition/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,10 @@
*/

/**
* @typedef {import('mdast').Nodes} Nodes
* @typedef {import('mdast').Root} Root
* @import {Nodes, Root} from 'mdast'
* @import {} from 'mdast-util-mdx'
*/

/// <reference types="mdast-util-mdx" />

import {ok as assert} from 'devlop'
import {phrasing} from 'mdast-util-phrasing'
import {lintRule} from 'unified-lint-rule'
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-final-newline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import {ok as assert} from 'devlop'
Expand Down
6 changes: 2 additions & 4 deletions packages/remark-lint-first-heading-level/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,15 @@
*/

/**
* @typedef {import('mdast').Heading} Heading
* @typedef {import('mdast').Root} Root
* @import {Heading, Root} from 'mdast'
* @import {} from 'mdast-util-mdx'
*/

/**
* @typedef {1 | 2 | 3 | 4 | 5 | 6} Options
* Configuration.
*/

/// <reference types="mdast-util-mdx" />

import {lintRule} from 'unified-lint-rule'
import {EXIT, visitParents} from 'unist-util-visit-parents'

Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-hard-break-spaces/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import {lintRule} from 'unified-lint-rule'
Expand Down
7 changes: 2 additions & 5 deletions packages/remark-lint-heading-increment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,10 @@
*/

/**
* @typedef {import('mdast').Heading} Heading
* @typedef {import('mdast').Nodes} Nodes
* @typedef {import('mdast').Root} Root
* @import {Heading, Nodes, Root} from 'mdast'
* @import {} from 'mdast-util-mdx'
*/

/// <reference types="mdast-util-mdx" />

import {ok as assert} from 'devlop'
import {lintRule} from 'unified-lint-rule'
import {visitParents} from 'unist-util-visit-parents'
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-heading-style/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-linebreak-style/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-link-title-style/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-list-item-bullet-indent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import pluralize from 'pluralize'
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-list-item-content-indent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import {phrasing} from 'mdast-util-phrasing'
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-list-item-indent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/remark-lint-list-item-spacing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@
*/

/**
* @typedef {import('mdast').ListItem} ListItem
* @typedef {import('mdast').Root} Root
* @import {ListItem, Root} from 'mdast'
*/

/**
Expand Down
5 changes: 2 additions & 3 deletions packages/remark-lint-maximum-heading-length/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
* @import {} from 'mdast-util-mdx'
*/

/// <reference types="mdast-util-mdx" />

import {toString} from 'mdast-util-to-string'
import {lintRule} from 'unified-lint-rule'
import {position} from 'unist-util-position'
Expand Down
5 changes: 2 additions & 3 deletions packages/remark-lint-maximum-line-length/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,10 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
* @import {} from 'mdast-util-mdx'
*/

/// <reference types="mdast-util-mdx" />

import pluralize from 'pluralize'
import {lintRule} from 'unified-lint-rule'
import {pointEnd, pointStart} from 'unist-util-position'
Expand Down
5 changes: 2 additions & 3 deletions packages/remark-lint-no-blockquote-without-marker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,10 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
* @import {} from 'mdast-util-directive'
*/

/// <reference types="mdast-util-directive" />

import {ok as assert} from 'devlop'
import {phrasing} from 'mdast-util-phrasing'
import pluralize from 'pluralize'
Expand Down
8 changes: 3 additions & 5 deletions packages/remark-lint-no-consecutive-blank-lines/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,11 @@
*/

/**
* @typedef {import('mdast').Nodes} Nodes
* @typedef {import('mdast').Root} Root
* @import {Nodes, Root} from 'mdast'
* @import {} from 'mdast-util-directive'
* @import {} from 'mdast-util-mdx'
*/

/// <reference types="mdast-util-directive" />
/// <reference types="mdast-util-mdx" />

import {phrasing} from 'mdast-util-phrasing'
import pluralize from 'pluralize'
import {lintRule} from 'unified-lint-rule'
Expand Down
3 changes: 1 addition & 2 deletions packages/remark-lint-no-duplicate-defined-urls/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
*/

/**
* @typedef {import('mdast').Nodes} Nodes
* @typedef {import('mdast').Root} Root
* @import {Nodes, Root} from 'mdast'
*/

import {ok as assert} from 'devlop'
Expand Down
3 changes: 1 addition & 2 deletions packages/remark-lint-no-duplicate-definitions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@
*/

/**
* @typedef {import('mdast').Nodes} Nodes
* @typedef {import('mdast').Root} Root
* @import {Nodes, Root} from 'mdast'
*/

import {ok as assert} from 'devlop'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,10 @@
*/

/**
* @typedef {import('mdast').Heading} Heading
* @typedef {import('mdast').Nodes} Nodes
* @typedef {import('mdast').Root} Root
* @import {Heading, Nodes, Root} from 'mdast'
* @import {} from 'mdast-util-mdx'
*/

/// <reference types="mdast-util-mdx" />

import {ok as assert} from 'devlop'
import {toString} from 'mdast-util-to-string'
import {lintRule} from 'unified-lint-rule'
Expand Down
6 changes: 2 additions & 4 deletions packages/remark-lint-no-duplicate-headings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@
*/

/**
* @typedef {import('mdast').Nodes} Nodes
* @typedef {import('mdast').Root} Root
* @import {Nodes, Root} from 'mdast'
* @import {} from 'mdast-util-mdx'
*/

/// <reference types="mdast-util-mdx" />

import {ok as assert} from 'devlop'
import {toString} from 'mdast-util-to-string'
import {lintRule} from 'unified-lint-rule'
Expand Down
3 changes: 1 addition & 2 deletions packages/remark-lint-no-emphasis-as-heading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @typedef {import('mdast').RootContent} RootContent
* @import {RootContent, Root} from 'mdast'
*/

import {phrasing} from 'mdast-util-phrasing'
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-no-empty-url/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import {lintRule} from 'unified-lint-rule'
Expand Down
2 changes: 1 addition & 1 deletion packages/remark-lint-no-file-name-articles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import {lintRule} from 'unified-lint-rule'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/

/**
* @typedef {import('mdast').Root} Root
* @import {Root} from 'mdast'
*/

import {lintRule} from 'unified-lint-rule'
Expand Down
Loading

0 comments on commit ea19649

Please sign in to comment.