Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keep-network/solhint-config-keep
Standard configuration for linting Solidity code using Solhint.
https://github.com/keep-network/solhint-config-keep
Last synced: 18 days ago
JSON representation
Standard configuration for linting Solidity code using Solhint.
- Host: GitHub
- URL: https://github.com/keep-network/solhint-config-keep
- Owner: keep-network
- Created: 2021-04-15T08:29:16.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-10-26T19:04:26.000Z (about 1 year ago)
- Last Synced: 2024-04-13T00:15:17.303Z (9 months ago)
- Language: JavaScript
- Size: 48.8 KB
- Stars: 0
- Watchers: 6
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# solhint-config-keep
Standard configuration for linting Solidity code using
[Solhint](https://github.com/protofire/solhint).
`Solhint` is an alternative to [Solium(ethlint)](https://github.com/duaraghav8/Ethlint)
which is no longer maintained.Uses the `solhint:recommended` ruleset, which itself is taken from the
[Solidity Style Guide](https://solidity.readthedocs.io/en/v0.5.9/style-guide.html).## Installation
`npm i https://github.com/keep-network/solhint-config-keep.git`
## Usage
### Setting up a project
1. Install the linter and config - `npm i -D solhint https://github.com/keep-network/solhint-config-keep.git`
2. Create your `.solhint.json` (you can add additional rules or plugins):
```json
{
"extends": "keep",
"plugins": [],
"rules": {
}
}
```
3. Add commands for linting to your `package.json`:
```json
{
"scripts": {
"lint:sol": "solhint 'contracts/**/*.sol'",
"lint:fix:sol": "solhint 'contracts/**/*.sol' --fix"
}
}
```### Disabling the linter
#### Directory
Edit the `.solhint.json`.#### File
`/* solhint-disable */`#### Code block
`/* solhint-disable */`
`/* solhint-enable */`#### Line
Prefer `/*` over `//`, as it looks different to a comment on the rationale of code.
`/* solhint-disable-next-line */`### Adding a pre-commit hook
```yaml
- repo: local
hooks:
- id: solhint
name: Solidity linter
language: node
entry: solhint
files: '\.sol$'
args:
- ./contracts/**/*.sol
- --config=./.solhint.json
additional_dependencies:
- [email protected]
```