Description
I'm using syncpack fix in a monorepo with lint-staged and ran into a limitation when multiple package.json files are staged.
lint-staged passes all matched files as positional arguments to the configured command. With a config like:
"lint-staged": {
"package.json": [
"pnpm syncpack fix --source"
]
}
and two package.json files staged, lint-staged ends up running something like:
pnpm syncpack fix --source path/1/package.json path/2/package.json
This fails with:
error: unexpected argument 'path/2/package.json' found
because syncpack fix does not accept positional file arguments after the options - it only accepts single --source value.
Suggested Solution
Instead of erroring on package.json as an unexpected argument, syncpack could treat all trailing positional file paths as additional sources
Optional comments
No response
Code of Conduct
Description
I'm using
syncpack fixin a monorepo withlint-stagedand ran into a limitation when multiplepackage.jsonfiles are staged.lint-stagedpasses all matched files as positional arguments to the configured command. With a config like:and two
package.jsonfiles staged, lint-staged ends up running something like:This fails with:
error: unexpected argument 'path/2/package.json' foundbecause
syncpackfix does not accept positional file arguments after the options - it only accepts single--sourcevalue.Suggested Solution
Instead of erroring on
package.jsonas an unexpected argument,syncpackcould treat all trailing positional file paths as additional sourcesOptional comments
No response
Code of Conduct