hubble-contracts
hubble-contracts copied to clipboard
Add eslint with mocha rules
What's Wrong
Per https://github.com/thehubbleproject/hubble-contracts/pull/552#discussion_r616244448 , there are a number of gotcha's such as describe/it.only
s being committed unknowingly. There are likely other code issues we could scan for as well.
How to fix it
- Implement
eslint
for typescript https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md - Add default mocha rules and also enable https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/no-exclusive-tests.md
- (optional) Consider integrating prettier and
solhint
intoeslint
- Make sure
eslint
checks do not add too much overhead to the local development experience.
Consider: Add check to ensure all equality checks are strict equality. See https://stackoverflow.com/questions/359494/which-equals-operator-vs-should-be-used-in-javascript-comparisons/359509#359509 for a good opinion on why strict equality is preferable.
tl;dr use ===
, !==
, enforce via linting