fix: support file list input for format command to bypass OS limits #391
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.
Add support for '@file' syntax to read format targets from a file Implement batch processing to handle large numbers of files Maintain compatibility with direct command-line arguments
This change allows the format command to process an arbitrarily large number of files by reading targets from a file, bypassing OS command line length limits. It addresses issues with pre-commit hooks and other tooling when formatting many files at once.
Note: This introduces a limitation where files starting with '@' cannot be directly specified as format targets. Users must use the full file path for such files.
Closes #387
Changes are visible to end-users: yes
Test plan
Manually ran the script with
@args.txt
which 400,000 lines ofpackage.json
. The file was formatted 40 times as expected and the OS limit for line length was not reached.Support for '@file' syntax to read format targets from a file. This allows users to specify more files that would be allowed by the OS line limit (such as during a pre-commit check).
Note: Files starting with '@' now require full path specification