-
Notifications
You must be signed in to change notification settings - Fork 952
Format your code contribution
The electricityMap contrib repository enforces some code formatting. These rules are here to improve code quality, readability, and make it easier for us to review your amazing contributions.
Automatic checks verify that the code you submit respect the defined format, and that code cannot be accepted as long as it does not respect it.
We have nevertheless automated the formatting commands so that you can make your code compliant by simply running a single CLI command. See below for details.
To check whether the python code inside contrib respects the formatting, run:
poetry run lint
if it's not the case, fix it up by running:
poetry run format
And voila 🪄
To manually format and lint things, use
yarn lint --fix
Or add the following setting if using VSCode:
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
If prettier fails on the automatic test, it is often resolved by running yarn lint --fix
Do you have a question or an idea for improvements? Open a new discussion here