Skip to content

Commit

Permalink
Add instructions to dev docs for pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon committed Oct 18, 2023
1 parent 19c2571 commit f48cf0d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ What type of change does your PR introduce to Homepage?

- [ ] If adding a service widget or a change that requires it, I have added corresponding documentation changes.
- [ ] If adding a new widget I have reviewed the [guidelines](https://gethomepage.dev/latest/more/development/#service-widget-guidelines).
- [ ] If applicable, I have checked that all tests pass with e.g. `pnpm lint`.
- [ ] I have checked that all code style checks pass using pre-commit hooks and linting checks with `pnpm lint` (see development guidelines).
- [ ] If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Please see the [documentation regarding development](https://gethomepage.dev/lat

## Use a Consistent Coding Style

This project follows the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript), please follow it when submitting pull requests.
Please see information in the docs regarding [code formatting with pre-commit hooks](https://gethomepage.dev/latest/more/development.md#code-formatting-with-pre-commit-hooks).

## License

Expand Down
9 changes: 9 additions & 0 deletions docs/more/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ Once dependencies have been installed you can lint your code with
pnpm lint
```

## Code formatting with pre-commit hooks

To ensure a consistent style and formatting across the project source, the project utilizes Git [`pre-commit`](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) hooks to perform some formatting and linting before a commit is allowed.
That way, everyone uses the same style and some common issues can be caught early on.

Once installed, hooks will run when you commit. If the formatting isn't quite right or a linter catches something, the commit will be rejected.
You'll need to look at the output and fix the issue. Some hooks will format failing files, so all you need to do is `git add` those files again
and retry your commit.

## Service Widget Guidelines

To ensure cohesiveness of various widgets, the following should be used as a guide for developing new widgets:
Expand Down

0 comments on commit f48cf0d

Please sign in to comment.