fix: biome linter error (#369)

* fix(remark-excerpt): change loop variable to const for better readability

* fix(rehype-component-github-card): correct string quotes for consistency in title element

* fix(remark-directive-rehype): update biome-ignore comment for clarity on linting rule

* fix(rehype-component-admonition): use optional chaining for properties check and improve formatting

* fix(Pagination): improve equality checks and enhance code readability

* fix(TOC): correct equality check for consistency in removeTailingHash function

* fix(ImageWrapper): update import path to use 'node:path' for consistency

* fix(PostCard): update import path to use 'node:path' for consistency
This commit is contained in:
Katsuyuki Karasawa
2025-04-01 20:29:38 +09:00
committed by GitHub
parent c106a639f4
commit b016bd096c
8 changed files with 22 additions and 18 deletions

View File

@@ -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: <explanation>
children = children.slice(1)
label.tagName = 'div' // Change the tag <p> to <div>
}
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,
])
}

View File

@@ -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,

View File

@@ -1,4 +1,3 @@
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
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: <explanation>
const data = node.data || (node.data = {})
node.attributes = node.attributes || {}
if (

View File

@@ -1,10 +1,11 @@
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
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
}