Skip to content

Commit

Permalink
add linter, prettier and husky
Browse files Browse the repository at this point in the history
  • Loading branch information
3xHarry committed Aug 29, 2022
1 parent 2ad5677 commit e82ee91
Show file tree
Hide file tree
Showing 13 changed files with 1,795 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ cache/
node_modules
.vscode
.env
out
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run prettier && npm run lint && forge build
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"overrides": [
{
"files": "*.sol",
"options": {
"compiler": "0.8.15"
}
}
]
}
54 changes: 54 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"extends": "solhint:recommended",
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error",
"code-complexity": ["error", 6],
"function-max-lines": ["error", 65],
"max-line-length": ["error", 250],
"no-empty-blocks": "error",
"no-unused-vars": "error",
"payable-fallback": "off",
"reason-string": [
"off",
{
"maxLength": 32
}
],
"constructor-syntax": "off",
"comprehensive-interface": "off",
"quotes": ["error", "double"],
"const-name-snakecase": "error",
"contract-name-camelcase": "error",
"event-name-camelcase": "warn",
"func-name-mixedcase": "warn",
"func-param-name-mixedcase": "error",
"modifier-name-mixedcase": "error",
"var-name-mixedcase": "error",
"imports-on-top": "error",
"ordering": "error",
"visibility-modifier-order": "error",
"avoid-call-value": "off",
"avoid-low-level-calls": "off",
"avoid-sha3": "error",
"avoid-suicide": "error",
"avoid-throw": "error",
"avoid-tx-origin": "off",
"check-send-result": "error",
"compiler-version": ["error", "0.8.15"],
"mark-callable-contracts": "off",
"func-visibility": [
"error",
{
"ignoreConstructors": true
}
],
"multiple-sends": "error",
"no-complex-fallback": "error",
"no-inline-assembly": "off",
"not-rely-on-block-hash": "error",
"not-rely-on-time": "error",
"reentrancy": "error",
"state-visibility": "error"
}
}
2 changes: 2 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
contracts/test
Loading

0 comments on commit e82ee91

Please sign in to comment.