diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 4c2f17edc..d8b2f581a 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -37,7 +37,7 @@ jobs: - name: Build preview if: ${{ steps.surge-token.outputs.enabled == 'true' }} run: | - npm install + npm install --legacy-peer-deps npm run build - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec if: ${{ steps.surge-token.outputs.enabled == 'true' }} diff --git a/eslint.config.mjs b/eslint.config.mjs index 40f08ec94..a298e8e02 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,4 +1,5 @@ import js from '@eslint/js'; +import { fixupConfigRules } from '@eslint/compat'; import { defineConfig } from 'eslint/config'; import { dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -40,8 +41,8 @@ export default defineConfig([ files: ['**/*.{js,jsx,ts,tsx}'], extends: [ js.configs.recommended, - react.configs.flat.recommended, - react.configs.flat['jsx-runtime'], + ...fixupConfigRules(react.configs.flat.recommended), + ...fixupConfigRules(react.configs.flat['jsx-runtime']), prettier, ], plugins: { diff --git a/package.json b/package.json index 71663f894..136642785 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,8 @@ "clsx": "^2.1.1" }, "devDependencies": { - "@eslint/js": "^9.39.4", + "@eslint/js": "^10.0.1", + "@eslint/compat": "^2.1.0", "@rc-component/father-plugin": "^2.2.0", "@rc-component/np": "^1.0.4", "@testing-library/dom": "^10.4.1", @@ -130,10 +131,10 @@ "@types/react": "^19.2.17", "@types/react-dom": "^19.2.3", "cross-env": "^10.1.0", - "date-fns": "2.x", + "date-fns": "4.x", "dayjs": "1.x", "dumi": "^2.4.38", - "eslint": "^9.39.4", + "eslint": "^10.6.0", "eslint-config-prettier": "^10.1.8", "eslint-plugin-jest": "^29.15.4", "eslint-plugin-react": "^7.37.5", @@ -148,7 +149,7 @@ "luxon": "3.x", "mockdate": "^3.0.2", "moment": "^2.24.0", - "moment-timezone": "^0.5.45", + "moment-timezone": "^0.6.2", "prettier": "^3.9.4", "rc-test": "^7.1.3", "react": "^19.2.7", diff --git a/src/generate/dateFns.ts b/src/generate/dateFns.ts index 5156450bb..c1c97d91c 100644 --- a/src/generate/dateFns.ts +++ b/src/generate/dateFns.ts @@ -24,7 +24,9 @@ import { setYear, startOfWeek, getMilliseconds, + type Day, type Locale, + type Month, } from 'date-fns'; import * as locales from 'date-fns/locale'; import type { GenerateConfig } from '.'; @@ -112,12 +114,14 @@ const generateConfig: GenerateConfig = { }, getShortWeekDays: (locale) => { const clone = getLocale(locale); - return Array.from({ length: 7 }).map((_, i) => clone.localize.day(i, { width: 'short' })); + return Array.from({ length: 7 }).map((_, i) => + clone.localize.day(i as Day, { width: 'short' }), + ); }, getShortMonths: (locale) => { const clone = getLocale(locale); return Array.from({ length: 12 }).map((_, i) => - clone.localize.month(i, { width: 'abbreviated' }), + clone.localize.month(i as Month, { width: 'abbreviated' }), ); }, format: (locale, date, format) => { diff --git a/src/hooks/useLocale.ts b/src/hooks/useLocale.ts index 751c4d167..ec232b326 100644 --- a/src/hooks/useLocale.ts +++ b/src/hooks/useLocale.ts @@ -8,8 +8,6 @@ export function fillTimeFormat( showMillisecond: boolean, showMeridiem: boolean, ) { - let timeFormat = ''; - // Base HH:mm:ss const cells = []; @@ -23,7 +21,7 @@ export function fillTimeFormat( cells.push('ss'); } - timeFormat = cells.join(':'); + let timeFormat = cells.join(':'); // Millisecond if (showMillisecond) {