Standard configuration for linting Solidity code using ethlint/Solium. Uses the solium:recommended
ruleset, which itself is taken from the Solidity Style Guide.
npm i https://github.com/keep-network/solium-config-keep.git
- Install the linter and config -
npm i -D ethlint https://github.com/keep-network/solium-config-keep.git
- Create your
.soliumrc.json
:
{
"extends": "keep",
"plugins": [
"security"
]
}
- Add commands for linting to your
package.json
:
{
"scripts": {
"sol:lint": "solium -d contracts/",
"sol:lint:fix": "solium -d contracts/ --fix"
}
}
Edit the .soliumrc.json
.
/* solium-disable */
/* solium-disable */
/* solium-enable */
Prefer /*
over //
, as it looks different to a comment on the rationale of code.
/* solium-disable-next-line <rules> */
/* solium-disable-previous-line <rules> */
- repo: local
hooks:
- id: solium
name: Solidity linter
language: node
entry: solium
files: '\.sol$'
args:
- --dir=./contracts/
- --config=./.soliumrc.json
additional_dependencies:
- ethlint@1.2.3