pre-commit hook prettier (vs npx prettier) questions
See original GitHub issueFirst, running npm run prettier-md does not yield the same results as what the pre-commit hook does (hook installation explained in https://dvc.org/doc/user-guide/contributing-documentation). Should it? And how do we equalize them if so?
For example with npm the bullet lists are standardized to * while with the pre-commit hook they’re -. I understand we want the latter.
UPDATE: I needed to run npm install as my node_modules prettier version was outdated. npx prettier --write <file pattern>. Apparently oesn’t necessarily behave the same as the pre-commit hook (which specifies a prettier version in .pre-commit-config.yaml) so
- I think we should remind people in the contribution guides to
npm ioften.
Secondly, the pre-commit hook introduces extra indentation in YAML block e.g.
md5: df06d8d51e6483ed5a74d3979f8fe42e
outs:
-- cache: true
- md5: b8f4d5a78e55e88906d5f4aeaf43802e.dir
- metric: false
- path: pics
+ - cache: true
+ md5: b8f4d5a78e55e88906d5f4aeaf43802e.dir
+ metric: false
+ path: pics
wdir: .
(from …/commands-reference/add.md) but those are just copy-paste of actual DVC-files so
[ ] I think those should not be changed by the linter.No longer needed per https://github.com/iterative/dvc.org/pull/378#pullrequestreview-241516633
- Last, we need to run
prettieronce we’re sure how to and that it’s behaving correctly on all .md files with
$ npm run prettier-md
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (8 by maintainers)

Top Related StackOverflow Question
@algomaster99 Looks like husky is a good option to keep everything under package.json control. I like it. 👍 After that we can even enable a JS linter with it as far as I understand.
@jorgeorpinel I agree that we should keep the version same. Allow patches, but not major changes.
@algomaster99 would you like to briefly mention the option to use husky here? Thanks