mirror of
https://github.com/saicaca/fuwari.git
synced 2026-01-11 23:02:53 +01:00
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:
committed by
GitHub
parent
c106a639f4
commit
b016bd096c
@@ -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: <explanation>
|
||||
entry: any
|
||||
title: string
|
||||
url: string
|
||||
|
||||
@@ -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}/`
|
||||
}
|
||||
---
|
||||
|
||||
@@ -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: <explanation>
|
||||
let img
|
||||
if (isLocal) {
|
||||
const files = import.meta.glob<ImageMetadata>('../../**', {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user