Skip to content

Commit

Permalink
lint: add prettier to pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
SilvanVerhoeven committed Jul 29, 2024
1 parent 4cee95f commit 53ccaaf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ repos:
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- id: black
- repo: local
hooks:
- id: prettier-eslint
name: Prettier and ESLint
entry: prettier-eslint --write --list-different
language: node
types_or: [javascript, css, html, markdown, yaml]
additional_dependencies: ["[email protected]"]
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tabWidth": 2,
"semi": false,
"singleQuote": false
}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ Test the code with `python manage.py test myhpi.tests`.

We recommend installing a pre-commit hook with `pre-commit install`. That will (look at `.pre-commit-config.yaml`) before every commit

- run `autoflake` with a couple of flags to remove unused imports,
- run `isort .` to sort imports,
- run `black .` to format the code. You can also check out the [IDE integration](https://github.com/psf/black#editor-integration)
- run `autoflake` with a couple of flags to remove unused imports,
- run `isort .` to sort imports,
- run `black .` to format the python code. You can also check out the [IDE integration](https://github.com/psf/black#editor-integration)
- run `prettier-eslint --write --list-different` to format the JavaScript code and Markdown files. You can also check out the [Prettier IDE integration](https://prettier.io/docs/en/editors.html)

If you want to do that manually, run `pre-commit run --all-files`. Next to that, we also run `pylint myhpi` to check for semantic issues in the code.

Expand Down

0 comments on commit 53ccaaf

Please sign in to comment.