refactor: code refactor#1684
Open
Mister-Hope wants to merge 1 commit intomainfrom
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR appears to be a broad “modernize / cleanup” sweep across the monorepo, updating code to newer JS/TS idioms, tightening types, and adjusting a few test and tooling patterns.
Changes:
- Modernize string/array handling (e.g.,
replaceAll,slice,Set.has) and minor naming cleanups for clarity. - Update tests for clearer mocks/types (e.g.,
expectTypeOf,String.rawfor Windows paths,vi.mock(import(...))pattern). - Small tooling/config adjustments (tsconfig, ESLint override, chokidar watcher import style) and minor client DOM API tweaks.
Reviewed changes
Copilot reviewed 39 out of 40 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Removes root baseUrl entry while keeping path mappings. |
| packages/utils/tests/module/isChildPath.spec.ts | Uses String.raw for Windows path test cases to avoid escape issues. |
| packages/utils/tests/console/withSpinner.spec.ts | Switches ora mock to vi.mock(import('ora'), ...). |
| packages/utils/src/module/transformPathToFileName.ts | Uses replaceAll for slash replacement. |
| packages/utils/src/module/sanitizeFileName.ts | Uses nullish coalescing (??) for drive letter fallback. |
| packages/utils/src/module/importFile.ts | Renames callback param for readability (m → module). |
| packages/utils/src/console/withSpinner.ts | Renames caught error variable for clarity (e → err). |
| packages/shared/tests/typeGuards.spec.ts | Uses function reference in describe for naming. |
| packages/shared/src/utils/routes/inferRoutePath.ts | Uses slice with negative indices for cleaner suffix removal. |
| packages/shared/src/utils/resolveHeadIdentifier.ts | Replaces arrays with Set for tag membership checks. |
| packages/shared/src/utils/omit.ts | Improves generic naming (U → Keys) for readability. |
| packages/markdown/tests/plugins/assetsPlugin.spec.ts | Uses replaceAll in test expectations. |
| packages/markdown/src/plugins/assetsPlugin/assetsPlugin.ts | Uses replaceAll for global regex replacements and descriptor normalization. |
| packages/core/tests/pluginApi/createHookQueue.spec.ts | Simplifies async mocks (removes redundant Promise.resolve). |
| packages/core/tests/page/resolvePageContent.spec.ts | Renames caught error variable (e → err). |
| packages/core/tests/page/renderPageToVue.spec.ts | Uses function reference in describe for naming. |
| packages/core/tests/app/resolveAppWriteTemp.spec.ts | Updates mock style to vi.mock(import(...)) and uses function reference in describe. |
| packages/core/tests/app/createDevApp.spec.ts | Uses expectTypeOf(...).toBeFunction() for stronger type assertions. |
| packages/core/tests/app/createBuildApp.spec.ts | Uses expectTypeOf(...).toBeFunction() for stronger type assertions. |
| packages/core/src/types/pluginApi/pluginApi.ts | Renames mapped type key variable (K → Key). |
| packages/core/src/types/pluginApi/hooks.ts | Renames inferred generic variables for clarity (U/V → Return/Value) and mapped key var (K → Key). |
| packages/core/src/types/app/options.ts | Removes redundant @required JSDoc markers on required interface fields. |
| packages/core/src/pluginApi/createPluginApiRegisterHooks.ts | Removes unused destructured fields. |
| packages/core/src/pluginApi/createHookQueue.ts | Renames caught error variable (e → err). |
| packages/core/src/page/resolvePageContent.ts | Renames caught error variable (e → err) and logs accordingly. |
| packages/core/src/app/resolveAppWriteTemp.ts | Reorders item.current conditional for readability without changing behavior. |
| packages/client/src/setupUpdateHead.ts | Uses textContent instead of innerText and append instead of appendChild. |
| packages/client/src/setupGlobalComputed.ts | Simplifies async loader to return the value directly. |
| packages/client/src/components/RouteLink.ts | Uses slice and adds an explicit empty rejection handler to silence navigation errors. |
| packages/client/src/components/Content.ts | Renames callback param for readability (m → module). |
| packages/cli/src/commands/dev/watchUserConfigFile.ts | Switches to import { watch } from 'chokidar' and uses watch(...) directly. |
| packages/cli/src/commands/dev/watchPageFiles.ts | Switches to import { watch } from 'chokidar' and uses watch(...) directly. |
| packages/bundler-webpack/src/build/renderPagePreloadLinks.ts | Minor ternary refactor for readability. |
| packages/bundler-webpack/src/build/renderPagePrefetchLinks.ts | Renames callback param for clarity in some(...). |
| packages/bundler-webpack/src/build/createClientPlugin.ts | Renames variables for clarity and removes redundant array spread. |
| packages/bundler-webpack/src/build/createClientConfig.ts | Renames callback param for clarity. |
| packages/bundler-vite/src/plugins/vuepressConfigPlugin.ts | Minor refactor of alias return expression (no functional change). |
| packages/bundler-vite/src/build/renderPagePreloadLinks.ts | Minor ternary refactor for readability. |
| eslint.config.ts | Disables @typescript-eslint/require-await with explanatory comment. |
| e2e/docs/.vuepress/components/OnContentUpdated.vue | Adds block scoping to switch cases (braces) for clarity/consistency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.