Skip to content

docs(site): document lint-staged workflows #317

Description

@kopach

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions