doc: format and ran prettier on precommit.md

Change-Id: Ibcff373bc817f2b67abbb45b85ae7ccb34b5bcfd
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/768318
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
Julie Qiu 2020-06-11 13:16:04 -04:00 коммит произвёл Julie Qiu
Родитель e82bfc4516
Коммит 2cc778a6a3
1 изменённых файлов: 13 добавлений и 11 удалений

Просмотреть файл

@ -1,22 +1,24 @@
### Install pre-commit hook
The `all.bash` script runs quickly enough so that you can use it as a git
pre-commit hook. If you don't already have a pre-commit hook, you can install it with
pre-commit hook. If you don't already have a pre-commit hook, you can install
it with
```
ln -s -f ../../all.bash .git/hooks/pre-commit
```
Google workstations start with a small shell script as a pre-commit hook. To add
`all.bash` to it, edit `.git/hooks/pre-commit` and add the line
Google workstations start with a small shell script as a pre-commit hook. To
add `all.bash` to it, edit `.git/hooks/pre-commit` and add the line
```
./all.bash
```
You may prefer to run `all.bash` only when you push (which happens when you run
`git codereview mail`). You'll need a small script to discard the arguments that
the pre-push hook is called with. Make this the contents of `.git/hooks/pre-push`:
`git codereview mail`). You'll need a small script to discard the arguments
that the pre-push hook is called with. Make this the contents of
`.git/hooks/pre-push`:
```
#!/bin/sh
@ -31,14 +33,14 @@ chmod +x .git/hooks/pre-push
### Running Linters/Formatters/Tests
The `all.bash` script can be used to selectively run actions on the source (e.g.
linters, code formatters, or tests). Run `./all.bash help` to see a list of
supported actions.
The `all.bash` script can be used to selectively run actions on the source
(e.g. linters, code formatters, or tests). Run `./all.bash help` to see a list
of supported actions.
Some actions are not run by the default invocation of `./all.bash` that is
executed in the commit hook. Notably, the `prettier` command is not run, because
it has a dependency on nodejs, which is otherwise not needed and which not all
developers have installed on their system.
executed in the commit hook. Notably, the `prettier` command is not run,
because it has a dependency on nodejs, which is otherwise not needed and which
not all developers have installed on their system.
If you are modifying CSS or Javascript, install prettier as described at
https://prettier.io/docs/en/install.html, and run `./all.bash prettier` to