Skip to content

Commit

Permalink
Refactor to use @imports
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jan 20, 2025
1 parent da38235 commit 76559f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/// <reference types="remark-parse" />
/// <reference types="remark-stringify" />

/**
* @typedef {import('mdast').Root} Root
* @typedef {import('mdast-util-gfm').Options} MdastOptions
* @typedef {import('micromark-extension-gfm').Options} MicromarkOptions
* @typedef {import('unified').Processor<Root>} Processor
* @import {Options as MdastOptions} from 'mdast-util-gfm'
* @import {Root} from 'mdast'
* @import {Options as MicromarkOptions} from 'micromark-extension-gfm'
* @import {} from 'remark-parse'
* @import {} from 'remark-stringify'
* @import {Processor} from 'unified'
*/

/**
Expand All @@ -31,7 +30,7 @@ const emptyOptions = {}
export default function remarkGfm(options) {
// @ts-expect-error: TS is wrong about `this`.
// eslint-disable-next-line unicorn/no-this-assignment
const self = /** @type {Processor} */ (this)
const self = /** @type {Processor<Root>} */ (this)
const settings = options || emptyOptions
const data = self.data()

Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @typedef {import('mdast').Root} Root
* @typedef {import('remark-gfm').Options} Options
* @import {Root} from 'mdast'
* @import {Options} from 'remark-gfm'
*/

import assert from 'node:assert/strict'
Expand Down

0 comments on commit 76559f9

Please sign in to comment.