JamieMason / JamieMason/syncpack

docs(site): document lint-staged workflows

Open
#317 6 comments 0 reactions 0 assignees View on GitHub
Priority: High Status: To Do Type: Docs
Dominant language
Rust
Stars
2.1k
Forks
72
PR merge metrics
No merged PRs in 30d

Description

### 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:

```json
"lint-staged": {
"package.json": [
"pnpm syncpack fix --source"
]
}
```
and two `package.json` files staged, lint-staged ends up running something like:

```sh
pnpm syncpack fix --source path/1/package.json path/2/package.json
```

This fails with:

```sh
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

- [x] I agree to follow the [Code of Conduct](https://github.com/JamieMason/syncpack/blob/main/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Research direction

Start at the syncpack fix CLI entry point and the handling of the --source option. Reproduce the lint-staged command with multiple package.json paths to inspect the current argument error. Done means trailing paths are accepted as additional sources while the existing single-source behavior continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.