@layerzerolabs/solhint-config 1.5.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/index.js +14 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<h1 align="center">@layerzerolabs/solhint-config</h1>
|
|
2
|
+
|
|
3
|
+
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).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
1. Install version of `solhint` package specified in `peerDependencies` section of `package.config`
|
|
8
|
+
2. Install `@layerzerolabs/solhint-config`
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
yarn add --dev @layerzerolabs/solhint-config
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Configuration
|
|
15
|
+
|
|
16
|
+
Create `solhint.config.js` file to configure `solhint`.
|
|
17
|
+
|
|
18
|
+
If you want to use only the default rules put the following line in `solhint.config.js`
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
module.exports = require("@layerzerolabs/solhint-config");
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If you want to override the default rules use the following format for `solhint.config.js`
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
const defaults = require("@layerzerolabs/solhint-config");
|
|
28
|
+
|
|
29
|
+
module.exports = {
|
|
30
|
+
...defaults,
|
|
31
|
+
rules: {
|
|
32
|
+
...defaults.rules,
|
|
33
|
+
"compiler-version": ["error", "0.8.20"], // override
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
To lint all files inside `contracts` directory run
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
yarn solhint contracts/**/*.sol
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
To lint a single file run
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
yarn solhint contracts/MyContract.sol
|
|
50
|
+
```
|
package/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: 'solhint:recommended',
|
|
3
|
+
rules: {
|
|
4
|
+
'no-global-import': 'error',
|
|
5
|
+
'compiler-version': 'off',
|
|
6
|
+
'no-unused-import': 'error',
|
|
7
|
+
'explicit-types': 'error',
|
|
8
|
+
'func-name-mixedcase': 'off',
|
|
9
|
+
'func-visibility': ['warn', { ignoreConstructors: true }],
|
|
10
|
+
'immutable-vars-naming': 'off',
|
|
11
|
+
'no-inline-assembly': 'off',
|
|
12
|
+
'const-name-snakecase': 'error',
|
|
13
|
+
},
|
|
14
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@layerzerolabs/solhint-config",
|
|
3
|
+
"version": "1.5.58",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "LayerZero Solhint Config",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"config",
|
|
8
|
+
"solhint"
|
|
9
|
+
],
|
|
10
|
+
"main": "index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"index.js"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"format": "$npm_execpath prettier --ignore-path $(git rev-parse --show-toplevel)/.prettierignore --write .",
|
|
16
|
+
"lint": "$npm_execpath eslint --no-error-on-unmatched-pattern . --ext .js,.ts --fix"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"eslint": "^8.33.0",
|
|
20
|
+
"prettier": "^2.8.4",
|
|
21
|
+
"prettier-plugin-packagejson": "^2.4.3"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"solhint": "^4.0.0"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
}
|
|
29
|
+
}
|