Format your code contribution - electricitymaps/electricitymaps-contrib GitHub Wiki
The Electricity Maps 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.
Python code formatting
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 🪄
JS code formatting
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