UNPKG

@layerzerolabs/solhint-config

Version:

LayerZero Solhint Config

51 lines (34 loc) 1.39 kB
<h1 align="center">@layerzerolabs/solhint-config</h1> Shared solhint configuration that defines Solidity rules and their severity for [LayerZero](https://layerzero.network/) codebase. It should be used in all LayerZero repositories containing Solidity contracts to ensure the uniform conventions. The full list of `solhint` rules can be found in [`solhint` repository](https://github.com/protofire/solhint/blob/develop/docs/rules.md). ## Installation 1. Install version of `solhint` package specified in `peerDependencies` section of `package.config` 2. Install `@layerzerolabs/solhint-config` ```bash yarn add --dev @layerzerolabs/solhint-config ``` ## Configuration Create `solhint.config.js` file to configure `solhint`. If you want to use only the default rules put the following line in `solhint.config.js` ```javascript module.exports = require("@layerzerolabs/solhint-config"); ``` If you want to override the default rules use the following format for `solhint.config.js` ```javascript const defaults = require("@layerzerolabs/solhint-config"); module.exports = { ...defaults, rules: { ...defaults.rules, "compiler-version": ["error", "0.8.20"], // override }, }; ``` ## Usage To lint all files inside `contracts` directory run ```bash yarn solhint contracts/**/*.sol ``` To lint a single file run ```bash yarn solhint contracts/MyContract.sol ```