Skip to content

fix: perform format operation in chunks - #115

Open
cellison-figma wants to merge 2 commits into
prettier:mainfrom
cellison-figma:ce/chunk-file-formatting
Open

fix: perform format operation in chunks#115
cellison-figma wants to merge 2 commits into
prettier:mainfrom
cellison-figma:ce/chunk-file-formatting

Conversation

@cellison-figma

Copy link
Copy Markdown

Description

Maps file formatting with concurrency, bound to passed in parallel worker count or CPU count minus one (as fallback). This replaces the previous unbounded Promise.allSettled & addresses an outstanding TODO comment. Cache reads, config resolution, file contents, and formatting jobs are still bound together. Errors still settle independently, and results retain their original file order.

The concurrency mapper has added tests to cover core functionality.

This resolves issue #114

@cellison-figma cellison-figma changed the title feat: perform format operation in chunks fix: perform format operation in chunks Jul 22, 2026
Comment thread src/map_settled_with_concurrency.ts Outdated
@cellison-figma
cellison-figma requested a review from 43081j August 17, 2026 13:18
@pkg-pr-new

pkg-pr-new Bot commented Aug 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

yarn add https://pkg.pr.new/@prettier/cli@115.tgz

commit: 1e711f9

Comment thread src/index.ts
}
} finally {
spinner?.update(fastRelativePath(rootPath, filePath));
const filesConcurrency = options.parallel ? options.parallelWorkers || Math.max(1, os.cpus().length - 1) : 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use os.availableParallelism()?

Prettier core still support Node.js v14, but it can be polyfilled in build step.

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.

3 participants