solhint-config-thesis

0.1.0 • Public • Published

solhint-config-thesis

Standard configuration for linting Solidity code using Solhint.
Solhint is an alternative to Solium(ethlint) which is no longer maintained.

Uses the solhint:recommended ruleset, which itself is taken from the Solidity Style Guide.

Usage

Setting up a project

  1. Install the linter and config - yarn add -D solhint https://github.com/thesis/solhint-config.git
  2. Create your .solhint.json (you can add additional rules or plugins):
{
  "extends": "thesis",
  "plugins": [],
  "rules": {
  }
}
  1. Add commands for linting to your package.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 <rules> */

Adding a pre-commit hook

- repo: local
   hooks:
    - id: solhint
      name: Solidity linter
      language: node
      entry: solhint
      files: '\.sol$'
      args:
      - ./contracts/**/*.sol
      - --config=./.solhint.json
      additional_dependencies:
      - solhint@3.3.4

Readme

Keywords

none

Package Sidebar

Install

npm i solhint-config-thesis

Weekly Downloads

19

Version

0.1.0

License

none

Unpacked Size

3.83 kB

Total Files

3

Last publish

Collaborators

  • nkuba8