diff options
author | 2023-07-03 05:59:43 -0700 | |
---|---|---|
committer | 2023-07-03 20:59:43 +0800 | |
commit | 2fea174303ca60f4765c6294d99ebc7a19e73403 (patch) | |
tree | 671f1f27d6d0827e51aaa20704b7f6154ad5d053 /packages/markdown | |
parent | fc6826ff7620b0c5e419de93ef7c463a12fe3652 (diff) | |
download | astro-2fea174303ca60f4765c6294d99ebc7a19e73403.tar.gz astro-2fea174303ca60f4765c6294d99ebc7a19e73403.tar.zst astro-2fea174303ca60f4765c6294d99ebc7a19e73403.zip |
feat: use typescript-eslint@v6's reworked configs (#7425)
Diffstat (limited to 'packages/markdown')
-rw-r--r-- | packages/markdown/component/test/astro-markdown.test.js | 2 | ||||
-rw-r--r-- | packages/markdown/remark/src/index.ts | 5 | ||||
-rw-r--r-- | packages/markdown/remark/src/rehype-collect-headings.ts | 2 | ||||
-rw-r--r-- | packages/markdown/remark/src/remark-prism.ts | 1 | ||||
-rw-r--r-- | packages/markdown/remark/src/remark-shiki.ts | 2 | ||||
-rw-r--r-- | packages/markdown/remark/tsconfig.json | 2 |
6 files changed, 6 insertions, 8 deletions
diff --git a/packages/markdown/component/test/astro-markdown.test.js b/packages/markdown/component/test/astro-markdown.test.js index 21c839b34..72546802f 100644 --- a/packages/markdown/component/test/astro-markdown.test.js +++ b/packages/markdown/component/test/astro-markdown.test.js @@ -1,6 +1,6 @@ import { expect } from 'chai'; import * as cheerio from 'cheerio'; -import { loadFixture, fixLineEndings } from './test-utils.js'; +import { loadFixture } from './test-utils.js'; describe('Astro Markdown', () => { let fixture; diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts index 0a21e1c98..aa02f8ea9 100644 --- a/packages/markdown/remark/src/index.ts +++ b/packages/markdown/remark/src/index.ts @@ -147,7 +147,7 @@ export async function renderMarkdown( function prefixError(err: any, prefix: string) { // If the error is an object with a `message` property, attempt to prefix the message - if (err && err.message) { + if (err?.message) { try { err.message = `${prefix}:\n${err.message}`; return err; @@ -160,9 +160,8 @@ function prefixError(err: any, prefix: string) { const wrappedError = new Error(`${prefix}${err ? `: ${err}` : ''}`); try { wrappedError.stack = err.stack; - // @ts-expect-error wrappedError.cause = err; - } catch (error) { + } catch { // It's ok if we could not set the stack or cause - the message is the most important part } diff --git a/packages/markdown/remark/src/rehype-collect-headings.ts b/packages/markdown/remark/src/rehype-collect-headings.ts index 9e3c8005e..862400545 100644 --- a/packages/markdown/remark/src/rehype-collect-headings.ts +++ b/packages/markdown/remark/src/rehype-collect-headings.ts @@ -20,7 +20,7 @@ export function rehypeHeadingIds(): ReturnType<RehypePlugin> { if (node.type !== 'element') return; const { tagName } = node; if (tagName[0] !== 'h') return; - const [_, level] = tagName.match(/h([0-6])/) ?? []; + const [, level] = tagName.match(/h([0-6])/) ?? []; if (!level) return; const depth = Number.parseInt(level); diff --git a/packages/markdown/remark/src/remark-prism.ts b/packages/markdown/remark/src/remark-prism.ts index 80037a3e3..6147d9ee9 100644 --- a/packages/markdown/remark/src/remark-prism.ts +++ b/packages/markdown/remark/src/remark-prism.ts @@ -1,6 +1,5 @@ import { runHighlighterWithAstro } from '@astrojs/prism/dist/highlighter'; import { visit } from 'unist-util-visit'; -const noVisit = new Set(['root', 'html', 'text']); type MaybeString = string | null | undefined; diff --git a/packages/markdown/remark/src/remark-shiki.ts b/packages/markdown/remark/src/remark-shiki.ts index 8035635f9..28e362e34 100644 --- a/packages/markdown/remark/src/remark-shiki.ts +++ b/packages/markdown/remark/src/remark-shiki.ts @@ -80,7 +80,7 @@ const remarkShiki = async ( lang = 'plaintext'; } - let html = highlighter!.codeToHtml(node.value, { lang }); + let html = highlighter.codeToHtml(node.value, { lang }); // Q: Couldn't these regexes match on a user's inputted code blocks? // A: Nope! All rendered HTML is properly escaped. diff --git a/packages/markdown/remark/tsconfig.json b/packages/markdown/remark/tsconfig.json index dcf815105..9a8c6d8cb 100644 --- a/packages/markdown/remark/tsconfig.json +++ b/packages/markdown/remark/tsconfig.json @@ -3,7 +3,7 @@ "include": ["src"], "compilerOptions": { "allowJs": true, - "target": "ES2021", + "target": "ES2022", "module": "ES2022", "outDir": "./dist" } |