From 639f48496469cb901580b40b5e51544bee7450c7 Mon Sep 17 00:00:00 2001 From: Nexmoe <16796652+nexmoe@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:22:52 +0800 Subject: [PATCH] chore: lint --- components.json | 30 ++--- components/flow/Index.vue | 14 +- components/module/Image.vue | 20 ++- lib/utils.ts | 2 +- nuxt.config.ts | 4 +- package.json | 2 +- server/flowing.ts | 10 +- server/middleware/update-site-config.ts | 18 +-- tailwind.config.js | 166 ++++++++++++------------ utils/date.ts | 2 +- 10 files changed, 139 insertions(+), 129 deletions(-) diff --git a/components.json b/components.json index 4a3649b..c8d107c 100644 --- a/components.json +++ b/components.json @@ -1,16 +1,16 @@ { - "$schema": "https://shadcn-vue.com/schema.json", - "style": "default", - "typescript": true, - "tailwind": { - "config": "tailwind.config.js", - "css": "assets/css/tailwind.css", - "baseColor": "slate", - "cssVariables": true - }, - "framework": "nuxt", - "aliases": { - "components": "@/components", - "utils": "@/lib/utils" - } -} \ No newline at end of file + "$schema": "https://shadcn-vue.com/schema.json", + "style": "default", + "typescript": true, + "tailwind": { + "config": "tailwind.config.js", + "css": "assets/css/tailwind.css", + "baseColor": "slate", + "cssVariables": true + }, + "framework": "nuxt", + "aliases": { + "components": "@/components", + "utils": "@/lib/utils" + } +} diff --git a/components/flow/Index.vue b/components/flow/Index.vue index 41d4d9a..606a14d 100644 --- a/components/flow/Index.vue +++ b/components/flow/Index.vue @@ -21,11 +21,15 @@ provide('flow', props.flow)
-
- +
+ diff --git a/components/module/Image.vue b/components/module/Image.vue index 22255bc..e2fb531 100644 --- a/components/module/Image.vue +++ b/components/module/Image.vue @@ -5,7 +5,7 @@ import type { AppRouter } from '@/server/trpc/routers' type RouterOutput = inferRouterOutputs type ModuleOutput = RouterOutput['module']['get'] type FlowOutput = RouterOutput['flow']['get'] -type Module = Exclude; +type Module = Exclude interface Props { module: Module @@ -28,8 +28,10 @@ const text = computed(() => extractTextFromHTML(props.module.content))
- +
@@ -39,11 +41,15 @@ const text = computed(() => extractTextFromHTML(props.module.content))
-
+
diff --git a/lib/utils.ts b/lib/utils.ts index d32b0fe..c15e7f7 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -2,5 +2,5 @@ import { type ClassValue, clsx } from 'clsx' import { twMerge } from 'tailwind-merge' export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)) + return twMerge(clsx(inputs)) } diff --git a/nuxt.config.ts b/nuxt.config.ts index 7cb536a..6756f8a 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -20,7 +20,7 @@ export default defineNuxtConfig({ 'nuxt-icon', '@nuxtjs/seo', '@nuxtjs/tailwindcss', - 'shadcn-nuxt' + 'shadcn-nuxt', ], shadcn: { /** @@ -31,7 +31,7 @@ export default defineNuxtConfig({ * Directory that the component lives in. * @default "./components/ui" */ - componentDir: './components/ui' + componentDir: './components/ui', }, ogImage: { googleFontMirror: true, diff --git a/package.json b/package.json index 1374162..0f0e57d 100644 --- a/package.json +++ b/package.json @@ -73,4 +73,4 @@ ] } } -} \ No newline at end of file +} diff --git a/server/flowing.ts b/server/flowing.ts index f6b3c16..b321dc2 100644 --- a/server/flowing.ts +++ b/server/flowing.ts @@ -9,7 +9,7 @@ const prisma = new PrismaClient() /** * 计算两个字符串之间的Levenshtein距离。 * Levenshtein距离是一个字符串相似度的度量,表示从一个字符串转换成另一个字符串所需的最少编辑操作次数(插入、删除或替换字符)。 - * + * * @param a 字符串a,作为比较的基准。 * @param b 字符串b,与字符串a进行比较。 * @returns 两个字符串之间的Levenshtein距离,返回一个数字。 @@ -37,9 +37,9 @@ function levenshteinDistance(a: string, b: string): number { // 计算当前字符替换、插入或删除的代价 const cost = a[i - 1] === b[j - 1] ? 0 : 1 matrix[i][j] = Math.min( - matrix[i - 1][j] + 1, // 插入操作 - matrix[i][j - 1] + 1, // 删除操作 - matrix[i - 1][j - 1] + cost, // 替换操作 + matrix[i - 1][j] + 1, // 插入操作 + matrix[i][j - 1] + 1, // 删除操作 + matrix[i - 1][j - 1] + cost, // 替换操作 ) } } @@ -203,4 +203,4 @@ export async function flowingByFlowId(flowId: string) { }) if (flow) await flowingByFlow(flow) -} \ No newline at end of file +} diff --git a/server/middleware/update-site-config.ts b/server/middleware/update-site-config.ts index 087da5c..6e10d8a 100644 --- a/server/middleware/update-site-config.ts +++ b/server/middleware/update-site-config.ts @@ -2,14 +2,14 @@ import { appRouter } from '@/server/trpc/routers' export default eventHandler(async (e) => { - const caller = appRouter.createCaller({ prisma: e.context.prisma }) + const caller = appRouter.createCaller({ prisma: e.context.prisma }) - const config = await caller.config.get() - // eslint-disable-next-line no-console - console.log(config.siteName) - // updateSiteConfig({ - // name: config.siteName, - // description: config.siteDescription, - // url: config.siteUrl, - // }) + const config = await caller.config.get() + // eslint-disable-next-line no-console + console.log(config.siteName) + // updateSiteConfig({ + // name: config.siteName, + // description: config.siteDescription, + // url: config.siteUrl, + // }) }) diff --git a/tailwind.config.js b/tailwind.config.js index 7b23fc2..b7f0f1b 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,86 +1,86 @@ -const animate = require("tailwindcss-animate") +const animate = require('tailwindcss-animate') /** @type {import('tailwindcss').Config} */ module.exports = { - darkMode: ["class"], - safelist: ["dark"], - prefix: "", - - theme: { - container: { - center: true, - padding: "2rem", - screens: { - "2xl": "1400px", - }, - }, - extend: { - colors: { - border: "hsl(var(--border))", - input: "hsl(var(--input))", - ring: "hsl(var(--ring))", - background: "hsl(var(--background))", - foreground: "hsl(var(--foreground))", - primary: { - DEFAULT: "hsl(var(--primary))", - foreground: "hsl(var(--primary-foreground))", - }, - secondary: { - DEFAULT: "hsl(var(--secondary))", - foreground: "hsl(var(--secondary-foreground))", - }, - destructive: { - DEFAULT: "hsl(var(--destructive))", - foreground: "hsl(var(--destructive-foreground))", - }, - muted: { - DEFAULT: "hsl(var(--muted))", - foreground: "hsl(var(--muted-foreground))", - }, - accent: { - DEFAULT: "hsl(var(--accent))", - foreground: "hsl(var(--accent-foreground))", - }, - popover: { - DEFAULT: "hsl(var(--popover))", - foreground: "hsl(var(--popover-foreground))", - }, - card: { - DEFAULT: "hsl(var(--card))", - foreground: "hsl(var(--card-foreground))", - }, - }, - borderRadius: { - xl: "calc(var(--radius) + 4px)", - lg: "var(--radius)", - md: "calc(var(--radius) - 2px)", - sm: "calc(var(--radius) - 4px)", - }, - keyframes: { - "accordion-down": { - from: { height: 0 }, - to: { height: "var(--radix-accordion-content-height)" }, - }, - "accordion-up": { - from: { height: "var(--radix-accordion-content-height)" }, - to: { height: 0 }, - }, - "collapsible-down": { - from: { height: 0 }, - to: { height: 'var(--radix-collapsible-content-height)' }, - }, - "collapsible-up": { - from: { height: 'var(--radix-collapsible-content-height)' }, - to: { height: 0 }, - }, - }, - animation: { - "accordion-down": "accordion-down 0.2s ease-out", - "accordion-up": "accordion-up 0.2s ease-out", - "collapsible-down": "collapsible-down 0.2s ease-in-out", - "collapsible-up": "collapsible-up 0.2s ease-in-out", - }, - }, - }, - plugins: [animate], -} \ No newline at end of file + darkMode: ['class'], + safelist: ['dark'], + prefix: '', + + theme: { + container: { + center: true, + padding: '2rem', + screens: { + '2xl': '1400px', + }, + }, + extend: { + colors: { + border: 'hsl(var(--border))', + input: 'hsl(var(--input))', + ring: 'hsl(var(--ring))', + background: 'hsl(var(--background))', + foreground: 'hsl(var(--foreground))', + primary: { + DEFAULT: 'hsl(var(--primary))', + foreground: 'hsl(var(--primary-foreground))', + }, + secondary: { + DEFAULT: 'hsl(var(--secondary))', + foreground: 'hsl(var(--secondary-foreground))', + }, + destructive: { + DEFAULT: 'hsl(var(--destructive))', + foreground: 'hsl(var(--destructive-foreground))', + }, + muted: { + DEFAULT: 'hsl(var(--muted))', + foreground: 'hsl(var(--muted-foreground))', + }, + accent: { + DEFAULT: 'hsl(var(--accent))', + foreground: 'hsl(var(--accent-foreground))', + }, + popover: { + DEFAULT: 'hsl(var(--popover))', + foreground: 'hsl(var(--popover-foreground))', + }, + card: { + DEFAULT: 'hsl(var(--card))', + foreground: 'hsl(var(--card-foreground))', + }, + }, + borderRadius: { + xl: 'calc(var(--radius) + 4px)', + lg: 'var(--radius)', + md: 'calc(var(--radius) - 2px)', + sm: 'calc(var(--radius) - 4px)', + }, + keyframes: { + 'accordion-down': { + from: { height: 0 }, + to: { height: 'var(--radix-accordion-content-height)' }, + }, + 'accordion-up': { + from: { height: 'var(--radix-accordion-content-height)' }, + to: { height: 0 }, + }, + 'collapsible-down': { + from: { height: 0 }, + to: { height: 'var(--radix-collapsible-content-height)' }, + }, + 'collapsible-up': { + from: { height: 'var(--radix-collapsible-content-height)' }, + to: { height: 0 }, + }, + }, + animation: { + 'accordion-down': 'accordion-down 0.2s ease-out', + 'accordion-up': 'accordion-up 0.2s ease-out', + 'collapsible-down': 'collapsible-down 0.2s ease-in-out', + 'collapsible-up': 'collapsible-up 0.2s ease-in-out', + }, + }, + }, + plugins: [animate], +} diff --git a/utils/date.ts b/utils/date.ts index ee54780..9e4cc8c 100644 --- a/utils/date.ts +++ b/utils/date.ts @@ -1,5 +1,5 @@ import dayjs from 'dayjs' export function formatDateTime(source: string | number) { - return dayjs(source).format('MMMM DD, YYYY'); + return dayjs(source).format('MMMM DD, YYYY') }