Skip to content

Commit 4af823a

Browse files
committedJan 20, 2025··
Refactor to use interface for exposed types
1 parent 3a57a5b commit 4af823a

File tree

6 files changed

+40
-13
lines changed

6 files changed

+40
-13
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
coverage/
77
node_modules/
88
yarn.lock
9+
!/index.d.ts

‎index.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type {Options as MicromarkOptions} from 'micromark-extension-gfm'
2+
import type {Options as MdastOptions} from 'mdast-util-gfm'
3+
4+
export {default} from './lib/index.js'
5+
6+
/**
7+
* Configuration for `remark-gfm`.
8+
*
9+
* Currently supports `singleTilde` as a parse option and
10+
* `tableCellPadding`, `tablePipeAlign`, and `stringLength` as
11+
* a serialization option.
12+
*/
13+
export interface Options extends MicromarkOptions, MdastOptions {}

‎index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
/**
2-
* @typedef {import('./lib/index.js').Options} Options
3-
*/
4-
1+
// Note: types exposed from `index.d.ts`.
52
export {default} from './lib/index.js'

‎lib/index.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
/**
2-
* @import {Options as MdastOptions} from 'mdast-util-gfm'
32
* @import {Root} from 'mdast'
4-
* @import {Options as MicromarkOptions} from 'micromark-extension-gfm'
3+
* @import {Options} from 'remark-gfm'
54
* @import {} from 'remark-parse'
65
* @import {} from 'remark-stringify'
76
* @import {Processor} from 'unified'
87
*/
98

10-
/**
11-
* @typedef {MicromarkOptions & MdastOptions} Options
12-
* Configuration.
13-
*/
14-
159
import {gfmFromMarkdown, gfmToMarkdown} from 'mdast-util-gfm'
1610
import {gfm} from 'micromark-extension-gfm'
1711

‎package.json

+23-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
},
3030
"exports": "./index.js",
3131
"files": [
32-
"index.d.ts.map",
3332
"index.d.ts",
3433
"index.js",
3534
"lib/"
@@ -86,6 +85,29 @@
8685
"version": "4.0.0",
8786
"xo": {
8887
"overrides": [
88+
{
89+
"files": [
90+
"**/*.d.ts"
91+
],
92+
"rules": {
93+
"@typescript-eslint/array-type": [
94+
"error",
95+
{
96+
"default": "generic"
97+
}
98+
],
99+
"@typescript-eslint/ban-types": [
100+
"error",
101+
{
102+
"extendDefaults": true
103+
}
104+
],
105+
"@typescript-eslint/consistent-type-definitions": [
106+
"error",
107+
"interface"
108+
]
109+
}
110+
},
89111
{
90112
"files": [
91113
"test/**/*.js"

‎tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
"target": "es2022"
1313
},
1414
"exclude": ["coverage/", "node_modules/"],
15-
"include": ["**/*.js"]
15+
"include": ["**/*.js", "index.d.ts"]
1616
}

0 commit comments

Comments
 (0)
Please sign in to comment.