Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR performs a comprehensive refactoring and cleanup of the codebase, focusing on code organization, module system modernization, and type safety improvements. The changes improve maintainability without altering functionality.
Key changes:
- Reorganizes utility functions into a dedicated
src/utils/directory with focused single-purpose modules - Converts build scripts from CommonJS to ESM (
.mjsfiles) - Adds TypeScript configuration for build scripts and enables
isolatedModulescompiler option - Improves type safety by removing custom type definitions in favor of Prettier's built-in types
- Updates documentation to reflect current architecture
Reviewed changes
Copilot reviewed 22 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Added isolatedModules compiler option for better module compatibility |
| tsconfig.scripts.json | New TypeScript configuration for ESM build scripts |
| src/utils/workspace.ts | Moved and renamed getConfig to getWorkspaceConfig, removed isAboveV3 |
| src/utils/versions.ts | New module for version comparison utilities (extracted isAboveV3) |
| src/utils/resolve-config-plugins.ts | Extracted plugin resolution logic to dedicated utility module |
| src/utils/global-node-paths.ts | Moved global node path resolution functions from separate file |
| src/utils/get-parser-from-language.ts | Updated import path for types |
| src/types.d.ts | Simplified type definitions to reuse Prettier's built-in types |
| src/extension.ts | Updated import to use getWorkspaceConfig |
| src/PrettierEditService.ts | Updated imports for refactored utilities |
| src/ModuleResolver.ts | Updated imports and improved type safety in error handling |
| src/BrowserModuleResolver.ts | Added meriyah plugin and name fields to language definitions |
| scripts/*.mjs | Converted scripts from CommonJS to ESM |
| esbuild.mjs | Converted to ESM and improved worker file copying logic |
| package.json | Updated script references to use .mjs extensions |
| .eslintrc.js | Added ESLint configuration for .mjs files |
| test files | Added shouldRetry parameter for flaky test handling |
| documentation | Updated to reflect architectural changes |
Comments suppressed due to low confidence (1)
esbuild.mjs:182
- Using
fs.watchFile()creates a watcher that is never cleaned up, leading to a potential resource leak. The watcher should be disposed when the build process exits. Consider storing the watcher and callingfs.unwatchFile()in a cleanup handler, or use the esbuild watch API's built-in file watching capabilities instead.
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.
Uh oh!
There was an error while loading. Please reload this page.