From 49b99becf1a4b0ebb6c24f4a688dc8d399ed9f38 Mon Sep 17 00:00:00 2001 From: iseki Date: Sun, 12 Jan 2025 12:35:24 +0800 Subject: [PATCH] ci(check): run lint (#24) --- .github/workflows/check.yml | 1 + cspell.config.yaml | 2 +- docs/components.json | 2 +- docs/components/ui/hover-border-gradient.tsx | 103 +++++++++---------- docs/lib/utils.ts | 4 +- packages/tool/src/generate-text.ts | 1 + 6 files changed, 57 insertions(+), 56 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1703496..16af09f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -21,3 +21,4 @@ jobs: registry-url: https://registry.npmjs.org - run: pnpm install --frozen-lockfile - run: pnpm -r build + - run: pnpm lint diff --git a/cspell.config.yaml b/cspell.config.yaml index 06c350a..0dcaa17 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -1,4 +1,4 @@ -version: "0.2" +version: '0.2' ignorePaths: [] dictionaryDefinitions: [] dictionaries: [] diff --git a/docs/components.json b/docs/components.json index ac52bc3..3dfa9e1 100644 --- a/docs/components.json +++ b/docs/components.json @@ -17,4 +17,4 @@ "examples": "@/components/examples", "blocks": "@/components/blocks" } -} \ No newline at end of file +} diff --git a/docs/components/ui/hover-border-gradient.tsx b/docs/components/ui/hover-border-gradient.tsx index 5e49807..4b4044f 100644 --- a/docs/components/ui/hover-border-gradient.tsx +++ b/docs/components/ui/hover-border-gradient.tsx @@ -1,99 +1,98 @@ -"use client"; -import React, { useState, useEffect, useRef } from "react"; +'use client' +import { cn } from '@/lib/utils' +import { motion } from 'framer-motion' +import React, { useEffect, useState } from 'react' -import { motion } from "framer-motion"; -import { cn } from "@/lib/utils"; - -type Direction = "TOP" | "LEFT" | "BOTTOM" | "RIGHT"; +type Direction = 'BOTTOM' | 'LEFT' | 'RIGHT' | 'TOP' export function HoverBorderGradient({ + as: Tag = 'button', children, - containerClassName, className, - as: Tag = "button", - duration = 1, clockwise = true, + containerClassName, + duration = 1, ...props }: React.PropsWithChildren< { - as?: React.ElementType; - containerClassName?: string; - className?: string; - duration?: number; - clockwise?: boolean; + as?: React.ElementType + className?: string + clockwise?: boolean + containerClassName?: string + duration?: number } & React.HTMLAttributes >) { - const [hovered, setHovered] = useState(false); - const [direction, setDirection] = useState("TOP"); + const [hovered, setHovered] = useState(false) + const [direction, setDirection] = useState('TOP') const rotateDirection = (currentDirection: Direction): Direction => { - const directions: Direction[] = ["TOP", "LEFT", "BOTTOM", "RIGHT"]; - const currentIndex = directions.indexOf(currentDirection); + const directions: Direction[] = ['TOP', 'LEFT', 'BOTTOM', 'RIGHT'] + const currentIndex = directions.indexOf(currentDirection) const nextIndex = clockwise ? (currentIndex - 1 + directions.length) % directions.length - : (currentIndex + 1) % directions.length; - return directions[nextIndex]; - }; + : (currentIndex + 1) % directions.length + return directions[nextIndex] + } const movingMap: Record = { - TOP: "radial-gradient(20.7% 50% at 50% 0%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)", - LEFT: "radial-gradient(16.6% 43.1% at 0% 50%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)", BOTTOM: - "radial-gradient(20.7% 50% at 50% 100%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)", + 'radial-gradient(20.7% 50% at 50% 100%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)', + LEFT: 'radial-gradient(16.6% 43.1% at 0% 50%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)', RIGHT: - "radial-gradient(16.2% 41.199999999999996% at 100% 50%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)", - }; + 'radial-gradient(16.2% 41.199999999999996% at 100% 50%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)', + TOP: 'radial-gradient(20.7% 50% at 50% 0%, hsl(0, 0%, 100%) 0%, rgba(255, 255, 255, 0) 100%)', + } - const highlight = - "radial-gradient(75% 181.15942028985506% at 50% 50%, #3275F8 0%, rgba(255, 255, 255, 0) 100%)"; + const highlight + = 'radial-gradient(75% 181.15942028985506% at 50% 50%, #3275F8 0%, rgba(255, 255, 255, 0) 100%)' useEffect(() => { if (!hovered) { const interval = setInterval(() => { - setDirection((prevState) => rotateDirection(prevState)); - }, duration * 1000); - return () => clearInterval(interval); + setDirection(prevState => rotateDirection(prevState)) + }, duration * 1000) + return () => clearInterval(interval) } - }, [hovered]); + }, [hovered]) return ( ) => { - setHovered(true); - }} - onMouseLeave={() => setHovered(false)} className={cn( - "relative flex rounded-full border content-center bg-black/20 hover:bg-black/10 transition duration-500 dark:bg-white/20 items-center flex-col flex-nowrap gap-10 h-min justify-center overflow-visible p-px decoration-clone w-fit", - containerClassName + 'relative flex rounded-full border content-center bg-black/20 hover:bg-black/10 transition duration-500 dark:bg-white/20 items-center flex-col flex-nowrap gap-10 h-min justify-center overflow-visible p-px decoration-clone w-fit', + containerClassName, )} + onMouseEnter={(_: React.MouseEvent) => { + setHovered(true) + }} + onMouseLeave={() => setHovered(false)} {...props} >
{children}
- ); + ) } diff --git a/docs/lib/utils.ts b/docs/lib/utils.ts index d084cca..d32b0fe 100644 --- a/docs/lib/utils.ts +++ b/docs/lib/utils.ts @@ -1,5 +1,5 @@ -import { type ClassValue, clsx } from "clsx" -import { twMerge } from "tailwind-merge" +import { type ClassValue, clsx } from 'clsx' +import { twMerge } from 'tailwind-merge' export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) diff --git a/packages/tool/src/generate-text.ts b/packages/tool/src/generate-text.ts index 587e695..17b35a3 100644 --- a/packages/tool/src/generate-text.ts +++ b/packages/tool/src/generate-text.ts @@ -1,4 +1,5 @@ import type { Schema } from '@typeschema/main' +// eslint-disable-next-line unused-imports/no-unused-imports import type { GenerateTextOptions as _GTO } from '@xsai/generate-text' import type { ToolResult } from '.'