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

View File

@ -13,12 +13,12 @@ export async function generateFeed(config: SiteConfig): Promise<void> {
const feed: Feed = new Feed({ const feed: Feed = new Feed({
id: meta.hostname, id: meta.hostname,
link: meta.hostname, link: meta.hostname,
title: `FMHY blog`, title: 'FMHY blog',
description: meta.description, description: meta.description,
language: 'en-US', language: 'en-US',
image: 'https://github.com/fmhy.png', image: 'https://github.com/fmhy.png',
favicon: `${meta.hostname}/favicon.ico`, favicon: `${meta.hostname}/favicon.ico`,
copyright: `Copyright (c) 2023-present FMHY` copyright: 'Copyright (c) 2023-present FMHY'
}) })
const posts: ContentData[] = await createContentLoader('posts/*.md', { 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? // FIXME: tasky: possibly write less horror jank?
export function base64DecodePlugin(md: MarkdownRenderer) { export function base64DecodePlugin(md: MarkdownRenderer) {
@ -7,7 +7,7 @@ export function base64DecodePlugin(md: MarkdownRenderer) {
// Save the original rule for backticks // Save the original rule for backticks
const defaultRender = const defaultRender =
md.renderer.rules.code_inline || md.renderer.rules.code_inline ||
function (tokens, idx, options, env, self) { function (tokens, idx, options, _env, self) {
return self.renderToken(tokens, idx, options) return self.renderToken(tokens, idx, options)
} }

View File

@ -11,8 +11,7 @@ export function toggleStarredPlugin(md: MarkdownRenderer) {
contentToken.content.startsWith(':star:') contentToken.content.startsWith(':star:')
) { ) {
return `<li class="starred">` 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' import { corsEventHandler } from 'nitro-cors'
export default corsEventHandler((_event) => {}, { export default corsEventHandler(
(_event) => {
/** no-op */
},
{
origin: '*', origin: '*',
methods: '*' methods: '*'
}) }
)

View File

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

View File

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

View File

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