threshold-network / staking-subgraphs

Threshold Network staking subgraphs
https://threshold.network
1 stars 1 forks source link

Add linting tools and pre-commit Git hooks #14

Closed manumonti closed 2 years ago

manumonti commented 2 years ago

To standardize the code format and increase the code robustness, it's necessary to incorporate subgraph repo standard development guidelines.

The proposed tools are Prettier and ESLint:

This is not a final decision about linting. Feel free to suggest prettier/linting rules. 😄

theref commented 2 years ago

All looks good, we might want to look at adding a github workflow for some of the linting as well, just to make sure that's it's being enforced. Not a blocker for now though.

manumonti commented 2 years ago

Looks good! 👍 Left a few comments to look at.

Let's add .git-blame-ignore-revs file to ignore bulk changes. Please see https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame. Unfortunately, it requires adding bulk change commits manually to the .git-blame-ignore-revs file but I believe ignoring bulk changes it's a good practice.

@r-czajkowski

Sure! I'm planning to make a new PR formatting the code with the new style once this PR is merged. There we can add .git-blame-ignore-revs file.

Thank you for the link! I have no idea about that was possible. 👍

I pushed some new commits with these changes:

manumonti commented 2 years ago

I've added lint-staged and modified package scripts. @r-czajkowski can you check if you agree with this strategy?