-
-
Notifications
You must be signed in to change notification settings - Fork 501
Refactoring and cleanup #3835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring and cleanup #3835
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Uh oh!
There was an error while loading. Please reload this page.