sheerun / prettier-standard

Formats with Prettier and lints with ESLint+Standard! (✿◠‿◠)
MIT License
868 stars 44 forks source link

--staged option #77

Closed JaKXz closed 4 years ago

JaKXz commented 5 years ago

It would be cool if there was a --staged option, like https://github.com/azz/pretty-quick so I don't have to add a pre-commit hook to a project that the team doesn't want hooks on.

sheerun commented 5 years ago

Yes, PR is welcome! (it should use lint-staged underneath so partially staged files are supported)

sheerun commented 5 years ago

Similar --changed and --since flags has been introduced in 13.0.0

For now you can use lint-staged to get your behavior

JaKXz commented 5 years ago

Would --changed --since HEAD~1 Do the trick?

sheerun commented 5 years ago

prettier-standard --changed is enough, but it would also format non-staged changes.

if you want to format just staged changes please use lint-staged for now

sheerun commented 5 years ago

Also remember that prettier currently has some servere issues with range formatting:

Because of this --since HEAD should be currently more stable than --changes, but it formats whole contents of changed files, not only changed lines.