mirror of
https://github.com/LiuYuYang01/ThriveX-Blog.git
synced 2026-05-06 22:03:08 +08:00
refactor(my): 重构个人页面组件结构
将组件从`component`目录移动到`components`目录,保持项目结构一致性 更新相关样式和类型引用路径 添加Next.js ESLint插件并调整ESLint配置 修复评论表单ref类型错误
This commit is contained in:
@@ -5,6 +5,7 @@ import pluginReact from 'eslint-plugin-react';
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import reactRefresh from 'eslint-plugin-react-refresh';
|
||||
import nextPlugin from '@next/eslint-plugin-next';
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
@@ -24,17 +25,18 @@ export default defineConfig([
|
||||
},
|
||||
tseslint.configs.recommended,
|
||||
pluginReact.configs.flat.recommended,
|
||||
nextPlugin.configs.recommended,
|
||||
{
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'no-unused-vars': 'off', // 关闭未使用变量的检查
|
||||
'@typescript-eslint/no-explicit-any': 'warn', // 改为警告,鼓励使用具体类型
|
||||
'no-unused-vars': 'warn', // 改为警告,提醒未使用的变量
|
||||
'react-refresh/only-export-components': 'off',
|
||||
'react/display-name': 'off',
|
||||
'react/prop-types': 'off', // TypeScript 项目不需要 prop-types 验证
|
||||
// 约束js使用单引号,允许jsx双引号
|
||||
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
|
||||
'jsx-quotes': ['error', 'prefer-double'],
|
||||
'react-hooks/exhaustive-deps': 'off',
|
||||
'react-hooks/exhaustive-deps': 'warn', // 改为警告,提醒依赖数组
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
41
package-lock.json
generated
41
package-lock.json
generated
@@ -59,6 +59,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.31.0",
|
||||
"@next/eslint-plugin-next": "^16.1.6",
|
||||
"@types/aos": "^3.0.7",
|
||||
"@types/canvas-confetti": "^1.6.4",
|
||||
"@types/markdown-navbar": "^1.4.4",
|
||||
@@ -2899,6 +2900,46 @@
|
||||
"integrity": "sha512-Te1wbiJ//I40T7UePOUG8QBwh+VVMCc0OTuqesOcD3849TVOVOyX4Hdrkx7wcpLpy/LOABIcGyLX5P/SzzXhFA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@next/eslint-plugin-next": {
|
||||
"version": "16.1.6",
|
||||
"resolved": "https://registry.npmmirror.com/@next/eslint-plugin-next/-/eslint-plugin-next-16.1.6.tgz",
|
||||
"integrity": "sha512-/Qq3PTagA6+nYVfryAtQ7/9FEr/6YVyvOtl6rZnGsbReGLf0jZU6gkpr1FuChAQpvV46a78p4cmHOVP8mbfSMQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fast-glob": "3.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/eslint-plugin-next/node_modules/fast-glob": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.3.1.tgz",
|
||||
"integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@nodelib/fs.stat": "^2.0.2",
|
||||
"@nodelib/fs.walk": "^1.2.3",
|
||||
"glob-parent": "^5.1.2",
|
||||
"merge2": "^1.3.0",
|
||||
"micromatch": "^4.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/eslint-plugin-next/node_modules/glob-parent": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@next/swc-darwin-arm64": {
|
||||
"version": "15.1.9",
|
||||
"resolved": "https://registry.npmmirror.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.9.tgz",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.31.0",
|
||||
"@next/eslint-plugin-next": "^16.1.6",
|
||||
"@types/aos": "^3.0.7",
|
||||
"@types/canvas-confetti": "^1.6.4",
|
||||
"@types/markdown-navbar": "^1.4.4",
|
||||
|
||||
@@ -173,7 +173,7 @@ const CommentForm = ({ articleId }: Props) => {
|
||||
className="tw_form w-full p-4 min-h-36"
|
||||
ref={(e) => {
|
||||
register('content').ref(e);
|
||||
(contentRef as any).current = e;
|
||||
contentRef.current = e;
|
||||
}}
|
||||
/>
|
||||
<span className="text-red-400 text-sm pl-3">{errors.content?.message}</span>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useEffect, useState, useRef } from 'react';
|
||||
import { Input, Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure, Select, SelectItem, Textarea, RadioGroup, Radio } from '@heroui/react';
|
||||
import { Controller, SubmitHandler, useForm } from 'react-hook-form';
|
||||
import { Wall } from '@/types/app/wall';
|
||||
import { Cate, Wall } from '@/types/app/wall';
|
||||
import { addWallDataAPI, getCateListAPI } from '@/api/wall';
|
||||
import { Bounce, toast, ToastContainer, ToastOptions } from 'react-toastify';
|
||||
import HCaptchaType from '@hcaptcha/react-hcaptcha';
|
||||
|
||||
Reference in New Issue
Block a user