Skip to content

Commit d4bbe5b

Browse files
committed
fix(eslint): make it happy
1 parent f8de441 commit d4bbe5b

3 files changed

Lines changed: 11 additions & 16 deletions

File tree

eslint.config.mjs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
1-
import typescriptEslint from '@typescript-eslint/eslint-plugin'
2-
import typescriptParser from '@typescript-eslint/parser'
1+
import eslintTs from 'typescript-eslint'
32
import prettier from 'eslint-config-prettier'
43

5-
export default [
4+
export default eslintTs.config(
5+
eslintTs.configs.recommended,
66
{
77
ignores: ['lib', 'validators']
88
},
9-
109
prettier,
11-
1210
{
1311
languageOptions: {
14-
parser: typescriptParser,
1512
parserOptions: {
1613
ecmaVersion: 'latest',
1714
sourceType: 'module'
1815
},
1916
globals: {}
2017
},
21-
plugins: {
22-
'@typescript-eslint': typescriptEslint
23-
},
2418
rules: {
2519
'@typescript-eslint/no-unused-vars': [
2620
'warn',
@@ -30,10 +24,11 @@ export default [
3024
caughtErrorsIgnorePattern: '^_'
3125
}
3226
],
27+
'@typescript-eslint/no-explicit-any': 0,
3328

3429
'no-useless-escape': 0,
3530
'prefer-const': 2,
3631
'no-unused-vars': 0
3732
}
3833
}
39-
]
34+
)

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ export type Options = {
2121
baseURI?: string
2222
}
2323

24-
function getConverter(opts?: Options) {
24+
export function getHTML2MarkdownConverter(opts?: Options) {
2525
const {
2626
toMdast: toMdastOptions = {},
2727
stringify: stringifyOptions = {},
2828
baseURI = null
2929
} = opts || {}
3030

3131
const remarkInit: Processor<HastRoot> = unified()
32-
// @ts-ignore
32+
// @ts-expect-error Cannot be correctly typed
3333
.data('toMarkdownExtensions', [gfmToMarkdown()])
3434
.use(rehypeParse)
3535
const remark = baseURI
3636
? remarkInit.use(rehypeInsertBaseURI, baseURI || '/')
3737
: remarkInit
3838

3939
const remarkParser = remark
40-
// @ts-ignore
40+
// @ts-expect-error Cannot be correctly typed
4141
.use(rehype2remark, {
4242
handlers: {
4343
pre: toMdastCodeBlock,
@@ -63,14 +63,14 @@ function getConverter(opts?: Options) {
6363
}
6464

6565
export function html2Markdown(html: string, opts?: Options): string {
66-
const c = getConverter(opts)
66+
const c = getHTML2MarkdownConverter(opts)
6767
return c
6868
.processSync(html)
6969
.toString() // unescape task list checkbox
7070
.replace(/\\\[(x| )\]/g, '[$1]')
7171
}
7272

7373
export function parseMarkdown(html: string): HastRoot {
74-
const c = getConverter()
74+
const c = getHTML2MarkdownConverter()
7575
return c.parse(html)
7676
}

src/remark-stringify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const remarkStringify: Plugin<
2222
// passed by users.
2323
// https://github.com/remarkjs/remark/blob/618a9ad1d44aa106bd2a8c61ebf8589cfe97fa16/packages/remark-stringify/lib/index.js#L32
2424
//
25-
// @ts-ignore
25+
// @ts-expect-error: Cannot be correctly typed
2626
extensions: (this.data('toMarkdownExtensions') ||
2727
[]) as ToMarkdownOptions['extensions']
2828
})

0 commit comments

Comments
 (0)