feat: 更新 eslint 配置
This commit is contained in:
2
.husky/pre-commit
Executable file
2
.husky/pre-commit
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
npx lint-staged
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion, AnimatePresence } from 'framer-motion';
|
||||||
|
import Image from 'next/image';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import utc from 'dayjs/plugin/utc';
|
import utc from 'dayjs/plugin/utc';
|
||||||
import timezone from 'dayjs/plugin/timezone';
|
import timezone from 'dayjs/plugin/timezone';
|
||||||
@@ -227,19 +228,25 @@ export function DonateTabs() {
|
|||||||
justifyContent: 'center'
|
justifyContent: 'center'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{method === 'alipay' ? (
|
<div style={{ width: '100%', height: '100%', position: 'relative' }}>
|
||||||
<img
|
{method === 'alipay' ? (
|
||||||
src={zhifubaoImg.src}
|
<Image
|
||||||
alt="支付宝收款码"
|
src={zhifubaoImg}
|
||||||
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
alt="支付宝收款码"
|
||||||
/>
|
fill
|
||||||
) : (
|
sizes="184px"
|
||||||
<img
|
style={{ objectFit: 'contain' }}
|
||||||
src={weixinImg.src}
|
/>
|
||||||
alt="微信收款码"
|
) : (
|
||||||
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
<Image
|
||||||
/>
|
src={weixinImg}
|
||||||
)}
|
alt="微信收款码"
|
||||||
|
fill
|
||||||
|
sizes="184px"
|
||||||
|
style={{ objectFit: 'contain' }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export default function FundTrendChart({ code, isExpanded, onToggleExpand }) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
return () => { active = false; };
|
return () => { active = false; };
|
||||||
}, [code, range, isExpanded]);
|
}, [code, range, isExpanded, data.length]);
|
||||||
|
|
||||||
const ranges = [
|
const ranges = [
|
||||||
{ label: '近1月', value: '1m' },
|
{ label: '近1月', value: '1m' },
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default function HoldingEditModal({ fund, holding, onClose, onSave }) {
|
|||||||
setProfit(p.toFixed(2));
|
setProfit(p.toFixed(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [holding, fund]);
|
}, [holding, fund, dwjz]);
|
||||||
|
|
||||||
const handleModeChange = (newMode) => {
|
const handleModeChange = (newMode) => {
|
||||||
if (newMode === mode) return;
|
if (newMode === mode) return;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
|
import Image from 'next/image';
|
||||||
import { CloseIcon } from './Icons';
|
import { CloseIcon } from './Icons';
|
||||||
import weChatGroupImg from '../assets/weChatGroup.jpg';
|
import weChatGroupImg from '../assets/weChatGroup.jpg';
|
||||||
|
|
||||||
@@ -34,7 +35,12 @@ export default function WeChatModal({ onClose }) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
||||||
<img src={weChatGroupImg.src} alt="WeChat Group" style={{ maxWidth: '100%', borderRadius: '8px' }} />
|
<Image
|
||||||
|
src={weChatGroupImg}
|
||||||
|
alt="WeChat Group"
|
||||||
|
sizes="(max-width: 360px) 100vw, 360px"
|
||||||
|
style={{ width: '100%', height: 'auto', borderRadius: '8px' }}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p className="muted" style={{ textAlign: 'center', marginTop: 16, fontSize: '14px' }}>
|
<p className="muted" style={{ textAlign: 'center', marginTop: 16, fontSize: '14px' }}>
|
||||||
扫码加入群聊,获取最新更新与交流
|
扫码加入群聊,获取最新更新与交流
|
||||||
|
|||||||
19
app/page.jsx
19
app/page.jsx
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useEffect, useRef, useState, useMemo, useLayoutEffect, useCallback } from 'react';
|
import { useEffect, useRef, useState, useMemo, useLayoutEffect, useCallback } from 'react';
|
||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion, AnimatePresence } from 'framer-motion';
|
||||||
|
import Image from 'next/image';
|
||||||
import { createWorker } from 'tesseract.js';
|
import { createWorker } from 'tesseract.js';
|
||||||
import { createAvatar } from '@dicebear/core';
|
import { createAvatar } from '@dicebear/core';
|
||||||
import { glass } from '@dicebear/collection';
|
import { glass } from '@dicebear/collection';
|
||||||
@@ -514,8 +515,8 @@ export default function HomePage() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
checkTradingDay();
|
checkTradingDay();
|
||||||
// 每分钟检查一次
|
// 每30分钟检查一次
|
||||||
const timer = setInterval(checkTradingDay, 60000);
|
const timer = setInterval(checkTradingDay, 60000 * 30);
|
||||||
return () => clearInterval(timer);
|
return () => clearInterval(timer);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -2768,10 +2769,13 @@ export default function HomePage() {
|
|||||||
{user ? (
|
{user ? (
|
||||||
<div className="user-avatar-small">
|
<div className="user-avatar-small">
|
||||||
{userAvatar ? (
|
{userAvatar ? (
|
||||||
<img
|
<Image
|
||||||
src={userAvatar}
|
src={userAvatar}
|
||||||
alt="用户头像"
|
alt="用户头像"
|
||||||
style={{ width: '100%', height: '100%', borderRadius: '50%' }}
|
width={20}
|
||||||
|
height={20}
|
||||||
|
unoptimized
|
||||||
|
style={{ borderRadius: '50%' }}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
(user.email?.charAt(0).toUpperCase() || 'U')
|
(user.email?.charAt(0).toUpperCase() || 'U')
|
||||||
@@ -2797,10 +2801,13 @@ export default function HomePage() {
|
|||||||
<div className="user-menu-header">
|
<div className="user-menu-header">
|
||||||
<div className="user-avatar-large">
|
<div className="user-avatar-large">
|
||||||
{userAvatar ? (
|
{userAvatar ? (
|
||||||
<img
|
<Image
|
||||||
src={userAvatar}
|
src={userAvatar}
|
||||||
alt="用户头像"
|
alt="用户头像"
|
||||||
style={{ width: '100%', height: '100%', borderRadius: '50%' }}
|
width={40}
|
||||||
|
height={40}
|
||||||
|
unoptimized
|
||||||
|
style={{ borderRadius: '50%' }}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
(user.email?.charAt(0).toUpperCase() || 'U')
|
(user.email?.charAt(0).toUpperCase() || 'U')
|
||||||
|
|||||||
20
eslint.config.mjs
Normal file
20
eslint.config.mjs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import nextCoreWebVitals from 'eslint-config-next/core-web-vitals';
|
||||||
|
|
||||||
|
const config = [
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
'.next/**',
|
||||||
|
'out/**',
|
||||||
|
'dist/**',
|
||||||
|
'coverage/**'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
...nextCoreWebVitals,
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'react-hooks/set-state-in-effect': 'off'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
export default config;
|
||||||
5383
package-lock.json
generated
5383
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@@ -5,7 +5,10 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start"
|
"start": "next start",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"lint:fix": "eslint . --fix",
|
||||||
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dicebear/collection": "^9.3.1",
|
"@dicebear/collection": "^9.3.1",
|
||||||
@@ -24,6 +27,15 @@
|
|||||||
"node": ">=20.9.0"
|
"node": ">=20.9.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-plugin-react-compiler": "^1.0.0"
|
"babel-plugin-react-compiler": "^1.0.0",
|
||||||
|
"eslint": "^9.0.0",
|
||||||
|
"eslint-config-next": "^16.1.5",
|
||||||
|
"husky": "^9.1.7",
|
||||||
|
"lint-staged": "^16.2.7"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.{js,jsx,ts,tsx}": [
|
||||||
|
"eslint"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user