Skip to content

Commit 53ccaaf

Browse files
lint: add prettier to pre-commit hook
1 parent 4cee95f commit 53ccaaf

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

.pre-commit-config.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,12 @@ repos:
1818
- repo: https://github.com/psf/black
1919
rev: 23.9.1
2020
hooks:
21-
- id: black
21+
- id: black
22+
- repo: local
23+
hooks:
24+
- id: prettier-eslint
25+
name: Prettier and ESLint
26+
entry: prettier-eslint --write --list-different
27+
language: node
28+
types_or: [javascript, css, html, markdown, yaml]
29+
additional_dependencies: ["[email protected]"]

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"tabWidth": 2,
3+
"semi": false,
4+
"singleQuote": false
5+
}

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ Test the code with `python manage.py test myhpi.tests`.
3434

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

37-
- run `autoflake` with a couple of flags to remove unused imports,
38-
- run `isort .` to sort imports,
39-
- run `black .` to format the code. You can also check out the [IDE integration](https://github.com/psf/black#editor-integration)
37+
- run `autoflake` with a couple of flags to remove unused imports,
38+
- run `isort .` to sort imports,
39+
- run `black .` to format the python code. You can also check out the [IDE integration](https://github.com/psf/black#editor-integration)
40+
- 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)
4041

4142
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.
4243

0 commit comments

Comments
 (0)