chore: linting

This commit is contained in:
taskylizard 2024-07-10 04:05:54 +00:00
parent 9f39e9663d
commit 048fa9e4a8
No known key found for this signature in database
GPG Key ID: 1820131ED1A24120
8 changed files with 35 additions and 49 deletions

View File

@ -14,7 +14,7 @@ export const commitRef = process.env.CF_PAGES
}">${process.env.CF_PAGES_COMMIT_SHA.slice(0, 8)}</a>`
: 'dev'
export const feedback = `<a href="/feedback" class="feedback-footer">Made with ❤</a>`
export const feedback = `<a href="/feedback" class="feedback-footer">Made with ❤</a>`
export const search: DefaultTheme.Config['search'] = {
options: {
@ -22,6 +22,7 @@ export const search: DefaultTheme.Config['search'] = {
options: {
tokenize: (text) => text.split(/[\n\r #%*,=/:;?[\]{}()&]+/u), // simplified charset: removed [-_.@] and non-english chars (diacritics etc.)
processTerm: (term, fieldName) => {
// biome-ignore lint/style/noParameterAssign: h
term = term
.trim()
.toLowerCase()

View File

@ -13,12 +13,12 @@ export async function generateFeed(config: SiteConfig): Promise<void> {
const feed: Feed = new Feed({
id: meta.hostname,
link: meta.hostname,
title: `FMHY blog`,
title: 'FMHY blog',
description: meta.description,
language: 'en-US',
image: 'https://github.com/fmhy.png',
favicon: `${meta.hostname}/favicon.ico`,
copyright: `Copyright (c) 2023-present FMHY`
copyright: 'Copyright (c) 2023-present FMHY'
})
const posts: ContentData[] = await createContentLoader('posts/*.md', {

View File

@ -1,4 +1,4 @@
import { type MarkdownRenderer } from 'vitepress'
import type { MarkdownRenderer } from 'vitepress'
// FIXME: tasky: possibly write less horror jank?
export function base64DecodePlugin(md: MarkdownRenderer) {
@ -7,7 +7,7 @@ export function base64DecodePlugin(md: MarkdownRenderer) {
// Save the original rule for backticks
const defaultRender =
md.renderer.rules.code_inline ||
function (tokens, idx, options, env, self) {
function (tokens, idx, options, _env, self) {
return self.renderToken(tokens, idx, options)
}

View File

@ -11,8 +11,7 @@ export function toggleStarredPlugin(md: MarkdownRenderer) {
contentToken.content.startsWith(':star:')
) {
return `<li class="starred">`
} else {
return self.renderToken(tokens, index, options)
}
return self.renderToken(tokens, index, options)
}
}

View File

@ -1,6 +1,11 @@
import { corsEventHandler } from 'nitro-cors'
export default corsEventHandler((_event) => {}, {
origin: '*',
methods: '*'
})
export default corsEventHandler(
(_event) => {
/** no-op */
},
{
origin: '*',
methods: '*'
}
)

View File

@ -1,4 +1,4 @@
import { type Theme } from 'vitepress'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import Layout from './Layout.vue'
import Post from './PostLayout.vue'

View File

@ -4,6 +4,7 @@ export function groupBy<T, K extends keyof any>(
): Record<K, T[]> {
return arr.reduce(
(groups, item) => {
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
;(groups[key(item)] ||= []).push(item)
return groups
},

View File

@ -1,51 +1,31 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"extends": ["@taskylizard/biome-config"],
"files": {
"ignore": [".vitepress/**/*.vue", ".vitepress/vue-shim.d.ts"]
},
"formatter": {
"enabled": false
},
"javascript": {
"globals": [
"defineNitroConfig",
"eventHandler",
"useRuntimeConfig",
"readValidatedBody",
"defineEventHandler"
]
},
"linter": {
"rules": {
"style": {
"noDefaultExport": "off",
"useNamingConvention": {
"level": "error",
"useFilenamingConvention": {
"level": "info",
"options": {
"strictCase": false,
"conventions": [
{
"selector": {
"kind": "typeParameter"
},
"formats": ["PascalCase"]
},
{
"selector": {
"kind": "any"
},
"match": "[ab_]|(.{2,})"
},
{
"selector": {
"kind": "objectLiteralMember"
},
"match": ".*"
},
{
"selector": {
"kind": "typeMember"
},
"match": ".*"
},
{
"selector": {
"kind": "variable"
},
"match": ".*"
}
]
"filenameCases": ["camelCase", "PascalCase"]
}
}
},
"noDefaultExport": "off"
}
}
}