Skip to content

Conversation

@ntotten
Copy link
Member

@ntotten ntotten commented Nov 28, 2025

  • organized utilities
  • scripts to mjs

Copilot AI review requested due to automatic review settings November 28, 2025 17:06
Copy link
Contributor

Copilot AI left a 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 (.mjs files)
  • Adds TypeScript configuration for build scripts and enables isolatedModules compiler 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 calling fs.unwatchFile() in a cleanup handler, or use the esbuild watch API's built-in file watching capabilities instead.

@ntotten ntotten merged commit 0ed9931 into main Nov 28, 2025
13 checks passed
@ntotten ntotten deleted the cleanup branch November 28, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants