Skip to content

Commit

Permalink
feat: lint and format solidity files
Browse files Browse the repository at this point in the history
  • Loading branch information
phenix3443 committed Mar 20, 2024
1 parent 9472068 commit c79be47
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
16 changes: 16 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "solhint:recommended",
"rules": {
"code-complexity": ["warn", 7],
"function-max-lines": ["warn", 50],
"max-line-length": ["error", 120],
"func-param-name-mixedcase": "warn",
"modifier-name-mixedcase": "warn",
"ordering": "warn",
"compiler-version": ["error", "^0.8.20"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"immutable-vars-naming": "off",
"one-contract-per-file": "off",
"no-console": "off"
}
}
2 changes: 2 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib
node_modules/
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@
"@commitlint/config-conventional": "^19.1.0",
"commitlint": "^19.2.1",
"hardhat": "^2.12.4",
"husky": "^9.0.11"
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"solhint": "^4.5.2"
},
"scripts": {
"prepare": "husky"
},
"lint-staged": {
"*.sol": [
"solhint",
"prettier --write --plugin=prettier-plugin-solidity"
]
}
}

0 comments on commit c79be47

Please sign in to comment.