diff --git a/src/components/PostCard.astro b/src/components/PostCard.astro index a175f764..5e314ef8 100644 --- a/src/components/PostCard.astro +++ b/src/components/PostCard.astro @@ -1,14 +1,15 @@ --- -import path from 'path' +import path from 'node:path' +import { Icon } from 'astro-icon/components' +import I18nKey from '../i18n/i18nKey' +import { i18n } from '../i18n/translation' +import { getDir } from '../utils/url-utils' import PostMetadata from './PostMeta.astro' import ImageWrapper from './misc/ImageWrapper.astro' -import { Icon } from 'astro-icon/components' -import { i18n } from '../i18n/translation' -import I18nKey from '../i18n/i18nKey' -import { getDir } from '../utils/url-utils' interface Props { class?: string + // biome-ignore lint/suspicious/noExplicitAny: entry: any title: string url: string diff --git a/src/components/control/Pagination.astro b/src/components/control/Pagination.astro index 0f438038..1e418a1f 100644 --- a/src/components/control/Pagination.astro +++ b/src/components/control/Pagination.astro @@ -19,8 +19,8 @@ const VISIBLE = ADJ_DIST * 2 + 1 // for test let count = 1 -let l = page.currentPage, - r = page.currentPage +let l = page.currentPage +let r = page.currentPage while (0 < l - 1 && r + 1 <= page.lastPage && count + 2 <= VISIBLE) { count += 2 l-- @@ -37,15 +37,15 @@ while (r + 1 <= page.lastPage && count < VISIBLE) { let pages: number[] = [] if (l > 1) pages.push(1) -if (l == 3) pages.push(2) +if (l === 3) pages.push(2) if (l > 3) pages.push(HIDDEN) for (let i = l; i <= r; i++) pages.push(i) if (r < page.lastPage - 2) pages.push(HIDDEN) -if (r == page.lastPage - 2) pages.push(page.lastPage - 1) +if (r === page.lastPage - 2) pages.push(page.lastPage - 1) if (r < page.lastPage) pages.push(page.lastPage) const getPageUrl = (p: number) => { - if (p == 1) return '/' + if (p === 1) return '/' return `/${p}/` } --- diff --git a/src/components/misc/ImageWrapper.astro b/src/components/misc/ImageWrapper.astro index 610554f4..c12077e6 100644 --- a/src/components/misc/ImageWrapper.astro +++ b/src/components/misc/ImageWrapper.astro @@ -1,5 +1,5 @@ --- -import path from 'path' +import path from 'node:path' interface Props { id?: string src: string @@ -24,6 +24,7 @@ const isPublic = src.startsWith('/') // TODO temporary workaround for images dynamic import // https://github.com/withastro/astro/issues/3373 +// biome-ignore lint/suspicious/noImplicitAnyLet: let img if (isLocal) { const files = import.meta.glob('../../**', { diff --git a/src/components/widget/TOC.astro b/src/components/widget/TOC.astro index 8ac3e5af..eb555788 100644 --- a/src/components/widget/TOC.astro +++ b/src/components/widget/TOC.astro @@ -18,7 +18,7 @@ const className = Astro.props.class const removeTailingHash = (text: string) => { let lastIndexOfHash = text.lastIndexOf('#'); - if (lastIndexOfHash != text.length - 1) { + if (lastIndexOfHash !== text.length - 1) { return text; } diff --git a/src/plugins/rehype-component-admonition.mjs b/src/plugins/rehype-component-admonition.mjs index 2f5c9121..d2e63eb1 100644 --- a/src/plugins/rehype-component-admonition.mjs +++ b/src/plugins/rehype-component-admonition.mjs @@ -19,14 +19,15 @@ export function AdmonitionComponent(properties, children, type) { ) let label = null - if (properties && properties['has-directive-label']) { + if (properties?.['has-directive-label']) { label = children[0] // The first child is the label + // biome-ignore lint/style/noParameterAssign: children = children.slice(1) label.tagName = 'div' // Change the tag

to

} - return h(`blockquote`, { class: `admonition bdm-${type}` }, [ - h('span', { class: `bdm-title` }, label ? label : type.toUpperCase()), + return h("blockquote", { class: `admonition bdm-${type}` }, [ + h('span', { class: "bdm-title" }, label ? label : type.toUpperCase()), ...children, ]) } diff --git a/src/plugins/rehype-component-github-card.mjs b/src/plugins/rehype-component-github-card.mjs index 3923f194..c5f2007d 100644 --- a/src/plugins/rehype-component-github-card.mjs +++ b/src/plugins/rehype-component-github-card.mjs @@ -32,7 +32,7 @@ export function GithubCardComponent(properties, children) { 'Waiting...', ) - const nTitle = h(`div`, { class: 'gc-titlebar' }, [ + const nTitle = h("div", { class: 'gc-titlebar' }, [ h('div', { class: 'gc-titlebar-left' }, [ h('div', { class: 'gc-owner' }, [ nAvatar, diff --git a/src/plugins/remark-directive-rehype.js b/src/plugins/remark-directive-rehype.js index 2d6b5503..b7e84a09 100644 --- a/src/plugins/remark-directive-rehype.js +++ b/src/plugins/remark-directive-rehype.js @@ -1,4 +1,3 @@ -// biome-ignore lint/suspicious/noShadowRestrictedNames: import { h } from 'hastscript' import { visit } from 'unist-util-visit' @@ -10,6 +9,7 @@ export function parseDirectiveNode() { node.type === 'leafDirective' || node.type === 'textDirective' ) { + // biome-ignore lint/suspicious/noAssignInExpressions: const data = node.data || (node.data = {}) node.attributes = node.attributes || {} if ( diff --git a/src/plugins/remark-excerpt.js b/src/plugins/remark-excerpt.js index c88a0459..addcfd73 100644 --- a/src/plugins/remark-excerpt.js +++ b/src/plugins/remark-excerpt.js @@ -1,10 +1,11 @@ +// biome-ignore lint/suspicious/noShadowRestrictedNames: import { toString } from 'mdast-util-to-string' /* Use the post's first paragraph as the excerpt */ export function remarkExcerpt() { return (tree, { data }) => { let excerpt = '' - for (let node of tree.children) { + for (const node of tree.children) { if (node.type !== 'paragraph') { continue }