From 96326a58552c1c584d17b43049b17c78f048fa11 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sun, 11 Feb 2024 02:24:54 +0800 Subject: [PATCH] style: lint fix --- docs/README.md | 2 +- .../plugin-notes-data/src/node/prepareNotesData.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/README.md b/docs/README.md index 840f44f6..7cfed14e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,6 @@ --- home: true -banner: http://file.mo7.cc/api/public/bz +banner: https://file.mo7.cc/api/public/bz bannerMask: light: 0.1 dark: 0.3 diff --git a/plugins/plugin-notes-data/src/node/prepareNotesData.ts b/plugins/plugin-notes-data/src/node/prepareNotesData.ts index ba611ae8..fbd9e73c 100644 --- a/plugins/plugin-notes-data/src/node/prepareNotesData.ts +++ b/plugins/plugin-notes-data/src/node/prepareNotesData.ts @@ -114,7 +114,7 @@ function initSidebarByAuto( note: NotesItemOptions, pages: NotePage[], ): NotesSidebarItem[] { - let tempPages = pages.map(page => { + let tempPages = pages.map((page) => { return { ...page, splitPath: page.relativePath.split('/') } }) @@ -125,15 +125,16 @@ function initSidebarByAuto( tempPages = tempPages.sort((prev, next) => { const pi = prev.splitPath?.[nowIndex]?.match(/(\d+)\.(?=[^/]+$)/)?.[1] const ni = next.splitPath?.[nowIndex]?.match(/(\d+)\.(?=[^/]+$)/)?.[1] - if (!pi || !ni) return 0 - return parseFloat(pi) < parseFloat(ni) ? -1 : 1 + if (!pi || !ni) + return 0 + return Number.parseFloat(pi) < Number.parseFloat(ni) ? -1 : 1 }) nowIndex++ } - pages = tempPages.map(page => { - delete page.splitPath; + pages = tempPages.map((page) => { + delete (page as any).splitPath return page })