diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index cffac6cc..ba630374 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -33,7 +33,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 40f08ec9..a298e8e0 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 576696cb..0e14c5a2 100644 --- a/package.json +++ b/package.json @@ -46,13 +46,14 @@ "*": "prettier --write --ignore-unknown" }, "dependencies": { - "@babel/runtime": "^7.29.7", + "@babel/runtime": "^8.0.0", "@rc-component/motion": "^1.1.4", "@rc-component/util": "^1.11.1", "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", @@ -63,7 +64,7 @@ "@types/react": "^19.2.17", "@types/react-dom": "^19.2.3", "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", diff --git a/src/hooks/useItems.tsx b/src/hooks/useItems.tsx index d3647e4c..8032e2aa 100644 --- a/src/hooks/useItems.tsx +++ b/src/hooks/useItems.tsx @@ -77,12 +77,7 @@ const convertItemsToNodes = (items: ItemType[], props: Props) => { rawOnItemClick?.(value); }; - let isActive = false; - if (accordion) { - isActive = activeKey[0] === key; - } else { - isActive = activeKey.indexOf(key) > -1; - } + const isActive = accordion ? activeKey[0] === key : activeKey.indexOf(key) > -1; return ( -1; - } + const isActive = accordion ? activeKey[0] === key : activeKey.indexOf(key) > -1; const mergeCollapsible = childCollapsible ?? collapsible;