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 Jul 5, 2024
1 parent c346a5c commit 874f0ac
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 18 deletions.
21 changes: 20 additions & 1 deletion dev/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
export {gfmStrikethroughHtml} from './lib/html.js'
export {gfmStrikethrough, type Options} from './lib/syntax.js'
export {gfmStrikethrough} from './lib/syntax.js'

/**
* Configuration (optional).
*/
export interface Options {
/**
* Whether to support strikethrough with a single tilde (default: `true`).
*
* Single tildes work on github.com, but are technically prohibited by the
* GFM spec.
*/
singleTilde?: boolean | null | undefined
}

/**
* Augment.
*/
declare module 'micromark-util-types' {
/**
* Token types.
*/
interface TokenTypeMap {
strikethroughSequence: 'strikethroughSequence'
strikethroughSequenceTemporary: 'strikethroughSequenceTemporary'
Expand Down
2 changes: 1 addition & 1 deletion dev/lib/html.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
* @import {HtmlExtension} from 'micromark-util-types'
*/

/**
Expand Down
17 changes: 2 additions & 15 deletions dev/lib/syntax.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
/**
* @typedef {import('micromark-util-types').Event} Event
* @typedef {import('micromark-util-types').Extension} Extension
* @typedef {import('micromark-util-types').Resolver} Resolver
* @typedef {import('micromark-util-types').State} State
* @typedef {import('micromark-util-types').Token} Token
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
*
* @typedef Options
* Configuration (optional).
* @property {boolean | null | undefined} [singleTilde=true]
* Whether to support strikethrough with a single tilde (default: `true`).
*
* Single tildes work on github.com, but are technically prohibited by the
* GFM spec.
* @import {Options} from 'micromark-extension-gfm-strikethrough'
* @import {Event, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'
*/

import {ok as assert} from 'devlop'
Expand Down
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,22 @@
{
"files": "**/*.ts",
"rules": {
"@typescript-eslint/consistent-type-definitions": 0
"@typescript-eslint/array-type": [
"error",
{
"default": "generic"
}
],
"@typescript-eslint/ban-types": [
"error",
{
"extendDefaults": true
}
],
"@typescript-eslint/consistent-type-definitions": [
"error",
"interface"
]
}
},
{
Expand Down

0 comments on commit 874f0ac

Please sign in to comment.