Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve pre-commit hook and docs #1774

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- id: standard
name: standard
description: JavaScript style guide, linter, and formatter
entry: standard --fix
language: node
files: "\\.(\
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -692,17 +692,22 @@ fi

### Use a `pre-commit` hook

The [pre-commit](https://pre-commit.com/) library allows hooks to be declared within a `.pre-commit-config.yaml` configuration file in the repo, and therefore more easily maintained across a team.
The [pre-commit](https://pre-commit.com/) framework allows hooks to be declared within a `.pre-commit-config.yaml` configuration file in the repo, and therefore more easily maintained across a team.
It handles installing and running Standard JS on all JavaScript files.

Users of pre-commit can simply add `standard` to their `.pre-commit-config.yaml` file, which will automatically fix `.js`, `.jsx`, `.ts`, `.tsx`, `.mjs` and `.cjs` files:

```yaml
- repo: https://github.com/standard/standard
rev: master
hooks:
- id: standard
```

After adding this configuration, run `pre-commit autoupdate --repo https://github.com/standard/standard` to pin to the latest version.

Alternatively, for more advanced styling configurations, use `standard` within the [eslint hook](https://github.com/pre-commit/mirrors-eslint):

```yaml
- repo: https://github.com/pre-commit/mirrors-eslint
rev: master
Expand Down