Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
2f97f1f
Update E2E.yml
Daulox92 Jul 29, 2025
0e56566
Update TESTS.yml
Daulox92 Jul 29, 2025
a441911
Merge pull request #698 from Daulox92/develop
dbale-altoros Aug 5, 2025
b4c69e7
fix: ignore working as .gitignore
dbale-altoros Aug 5, 2025
b0a316c
Merge branch 'develop' into feat/ignore-enhancement
dbale-altoros Aug 5, 2025
9e98a0f
fix: ci failing on windows
dbale-altoros Aug 6, 2025
cc20081
fix: ci failing on windows
dbale-altoros Aug 6, 2025
6d3cefa
fix: ci failing on windows
dbale-altoros Aug 6, 2025
d8881f3
fix: ci failing on windows
dbale-altoros Aug 6, 2025
17b1e47
fix: ci failing on windows
dbale-altoros Aug 6, 2025
b50f55f
fix: ci failing on windows
dbale-altoros Aug 6, 2025
7bf8407
fix: ci failing on windows
dbale-altoros Aug 6, 2025
e34274b
Merge pull request #700 from protofire/feat/ignore-enhancement
dbale-altoros Aug 6, 2025
62063fb
fix: minor issues
dbale-altoros Aug 6, 2025
65e07a7
Merge pull request #702 from protofire/fix/minor-issues
dbale-altoros Aug 6, 2025
c319b9a
update: prerelease 6.0.1
dbale-altoros Aug 8, 2025
b12b707
fix: exception for snake case in interface
dbale-altoros Aug 8, 2025
72bd5b8
fix: remove `strip-ansi`
v1rtl Aug 8, 2025
dd6bde6
fix: remove `fs-extra`
v1rtl Aug 8, 2025
89c1770
Update DOCKER.yml
Daulox92 Aug 11, 2025
da481bc
Update E2E.yml
Daulox92 Aug 11, 2025
1ecbfc2
Update PRE-COMMIT-HOOK-TEST.yml
Daulox92 Aug 11, 2025
eb1938f
Update TESTS.yml
Daulox92 Aug 11, 2025
0952d8c
Merge pull request #708 from Daulox92/develop
dbale-altoros Aug 12, 2025
c255d08
Merge branch 'develop' into remove-fs-extra
dbale-altoros Aug 12, 2025
510cb66
Merge branch 'develop' into remove-strip-ansi
dbale-altoros Aug 12, 2025
25a28d1
Merge branch 'develop' into fix-func-name-mixcase-for-constants
dbale-altoros Aug 12, 2025
8445f78
fix: exception for snake case in interface
dbale-altoros Aug 12, 2025
8547ad8
Merge pull request #705 from protofire/fix-func-name-mixcase-for-cons…
dbale-altoros Aug 12, 2025
69d2b2f
fix: remaining usage of `fs-extra` and e2e
v1rtl Aug 13, 2025
12ad3a5
Merge branch 'develop' into remove-fs-extra
v1rtl Aug 13, 2025
2b76857
test: add test to verify strip-ansi vs `stripVTControlCharacters` compat
v1rtl Aug 13, 2025
37f5476
Merge branch 'develop' into remove-strip-ansi
v1rtl Aug 13, 2025
79bec8a
Merge pull request #707 from talentlessguy/remove-fs-extra
dbale-altoros Aug 15, 2025
f9dd5e1
Merge branch 'develop' into 601-pre-release
dbale-altoros Aug 15, 2025
5117fb0
add: exec lint beforep pushing
dbale-altoros Aug 15, 2025
e3a9af6
Merge branch 'develop' of https://github.com/protofire/solhint into r…
v1rtl Aug 16, 2025
7cc5ae1
chore: move the test file to actual test dir
v1rtl Aug 16, 2025
3b28355
chore: add `strip-ansi` back but to dev deps so lint doesn't fail
v1rtl Aug 16, 2025
296be61
chore: install `strip-ansi` v6 which still has cjs
v1rtl Aug 16, 2025
39c8a61
Merge pull request #706 from talentlessguy/remove-strip-ansi
dbale-altoros Aug 18, 2025
ac3f620
fix no unused imports for multiline inheritdoc
dbale-altoros Aug 18, 2025
0487fd4
fix no unused imports for multiline inheritdoc
dbale-altoros Aug 18, 2025
d439651
Merge pull request #709 from protofire/fix-no-unused-imports
dbale-altoros Aug 18, 2025
8fc3a64
improve-ajv-schema errors
dbale-altoros Aug 18, 2025
075256e
Merge pull request #710 from protofire/improve-ajv-schema-validation
dbale-altoros Aug 18, 2025
987f79b
enhance: no unused vars
dbale-altoros Aug 20, 2025
6306222
fix on function and modifier parameters
dbale-altoros Aug 21, 2025
d73ebed
fix on function and modifier parameters
dbale-altoros Aug 21, 2025
0e8c482
fix on function and modifier parameters
dbale-altoros Aug 21, 2025
def76a7
fix on function and modifier parameters
dbale-altoros Aug 21, 2025
8d7f39c
Merge pull request #712 from protofire/enhance-no-unused-vars
dbale-altoros Aug 21, 2025
f18789c
Merge branch 'develop' into 601-pre-release
dbale-altoros Aug 22, 2025
5346986
pre release 6.0.1
dbale-altoros Aug 22, 2025
53b7239
Merge pull request #704 from protofire/601-pre-release
dbale-altoros Aug 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
parserOptions: {
ecmaVersion: 2020,
ecmaVersion: 2022,
},
env: {
browser: false,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/DOCKER.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Login to Docker Hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_ACCESS_TOKEN }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/E2E.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
node: [16, 18, 20]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
Expand Down Expand Up @@ -52,8 +52,8 @@ jobs:
- name: Enable Debugging
run: |
echo "::debug::Debugging enabled"
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
Expand Down Expand Up @@ -90,8 +90,8 @@ jobs:
name: Test on MacOS

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/PRE-COMMIT-HOOK-TEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
name: Test Hook
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: 20
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/TESTS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
node-version: [16, 18, 20]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand All @@ -38,8 +38,8 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
Expand All @@ -57,8 +57,8 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/checkout@v5
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
Expand Down
46 changes: 45 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
## [6.0.1] - 2025-08-22

🛠️ `Fix`: `no-unused-vars` for modifiers

🛠️ `Fix`: `no-unused-imports` handled for multiline @inheritdoc. Eliminates missed detections with multiline inheritance docs

🛠️ `Fix`: `func-name-mixedcase` improvement, added snake case exception in interface (naming). Aligns interface naming edge cases

🛠️ `Fix`: misc minor issues; docs link and typos. General polish and stability
<br><br>

🧰 `Infra`: Update GitHub Actions in CI workflows. Keeps CI up to date and consistent across jobs

🧰 `Infra`: Ignore enhancement to mimic as regular linters
<br><br>

🧹 `Chore`: Remove fs-extra dependency. Simplifies deps

🧹 `Chore`: Remove strip-ansi. Cleans unused/legacy deps

🧹 `Chore`: Changed changelog format
<br><br>

🧱 `Enhancement`: added config for no-unused-vars to validate parameters or not
<br><br>

🧱 `Validation`: Improve AJV schema validation and related caching approach. More robust/faster config validation
<br><br>

✨🛡️ Kudos to our contributors! 🛡️✨
- [@smol-ninja](https://github.com/smol-ninja) 🏅
- [@talentlessguy](https://github.com/talentlessguy) 🏅
- [@loki-sama](https://github.com/loki-sama)
- [@gonzaotc](https://github.com/gonzaotc)
- [@kilavvy](https://github.com/kilavvy)
- [@jmendiola222](https://github.com/jmendiola222)
- [@Daulox92](https://github.com/Daulox92)
- [@RidaMichofi](https://github.com/RidaMichofi)
- [@ddnexus](https://github.com/ddnexus)
- [@zeevick10](https://github.com/zeevick10)
- [@RyanRHall](https://github.com/RyanRHall)
- [@fulldecent](https://github.com/fulldecent)
- [@ncjones](https://github.com/ncjones)

## [6.0.0] - 2025-07-04

### BREAKING CHANGE
Expand Down Expand Up @@ -27,7 +71,7 @@ Rules revision - [#692](https://github.com/protofire/solhint/pull/692)
### Fixed
- `gas-struct-packing` false positives - [#690](https://github.com/protofire/solhint/pull/690)
- `gas-increment-by-one` backward expression - [#691](https://github.com/protofire/solhint/pull/691)
- Typo (thanks to @[MarkFizz77](https://github.com/MarkFizz77))
- Typo (thanks to [@MarkFizz77](https://github.com/MarkFizz77))

### Added
- `use-natspec`: Promote the use of natspec and make several checks to enforce it - [#689](https://github.com/protofire/solhint/pull/689)
Expand Down
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
[![](https://img.shields.io/badge/Join%20Our%20Discord-magenta)](https://discord.gg/4TYGq3zpjs)
[![Donate with Ethereum](https://img.shields.io/badge/Donate-ETH-blue)](https://etherscan.io/address/0xA81705c8C247C413a19A244938ae7f4A0393944e)
[![NPM version](https://badge.fury.io/js/solhint.svg)](https://npmjs.org/package/solhint)
[![Coverage Status](https://coveralls.io/repos/github/protofire/solhint/badge.svg?branch=master)](
https://coveralls.io/github/protofire/solhint?branch=master)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/protofire/solhint/master/LICENSE)

This is an open source project for linting [Solidity](http://solidity.readthedocs.io/en/develop/) code. This project
Expand Down Expand Up @@ -80,7 +78,7 @@ Commands:
stdin [options] linting of source code data provided to STDIN
list-rules display covered rules of current .solhint.json
```
### Notes
### New Versions
- Solhint checks if there are newer versions. The `--disc` option avoids that check.
- `--save` option will create a file named as `YYYYMMDDHHMMSS_solhintReport.txt` on current folder with default or specified format

Expand All @@ -95,10 +93,9 @@ This option currently works on:
- quotes
- contract-name-capwords
- avoid-suicide

<br><br>
## Configuration

## Configuration
You can use a `.solhint.json` file to configure Solhint for the whole project.

To generate a new sample `.solhint.json` file in current folder you can do:
Expand All @@ -114,12 +111,12 @@ This file has the following format:
"extends": "solhint:recommended"
}
```
### Note 1

The `solhint:default` configuration contains only two rules: max-line-length & no-console
It is now deprecated since version 5.1.0
<br>

### Note 2
### Multiple Configs
Multiple configs files can be used at once. All config files should be named `.solhint.json`.
If not done like this, multiple hierarchy configuration will not work.
Solhint will go though all config files automatically.
Expand Down Expand Up @@ -148,7 +145,7 @@ Project ROOT =>
<br><br>


### Sample
### Sample of simple config with recommended rules
```json
{
"extends": "solhint:recommended",
Expand All @@ -160,15 +157,28 @@ Project ROOT =>
}
```
A full list of all supported rules can be found [here](docs/rules.md).
<br><br>

### Ignore Configuration
You can exclude files from linting using a `.solhintignore` file (name by default) or `--ignore-path` followed by a custom name.
It uses the same syntax as `.gitignore`, including support for negation with !.

To ignore files that do not require validation you can use a `.solhintignore` file. It supports rules in
the `.gitignore` format.
Example:

```
node_modules/
additional-tests.sol
contracts/**
!contracts/utils/
!contracts/utils/SafeMath.sol
```

This will:
- Ignore everything inside contracts/
- Except the folder contracts/utils/
- And the file SafeMath.sol inside it

Tip: To unignore a file, you must also unignore its parent folders.
<br><br>

### Cache
Solhint supports a caching mechanism using the `--cache` flag to avoid re-linting files that haven't changed.
When enabled, Solhint stores a hash of each file's content and effective configuration, skipping analysis if neither has changed.
Expand All @@ -185,8 +195,7 @@ Example:
solhint contracts/**/*.sol --cache
solhint Foo.sol --cache --cache-location tmp/my-cache.json
```


<br><br>

### Extendable rulesets

Expand Down
8 changes: 0 additions & 8 deletions _config.yml

This file was deleted.

7 changes: 6 additions & 1 deletion conf/rulesets/solhint-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ module.exports = Object.freeze({
'no-empty-blocks': 'warn',
'no-global-import': 'warn',
'no-unused-import': 'warn',
'no-unused-vars': 'warn',
'no-unused-vars': [
'warn',
{
validateParameters: true,
},
],
'one-contract-per-file': 'warn',
'payable-fallback': 'warn',
'reason-string': [
Expand Down
7 changes: 6 additions & 1 deletion conf/rulesets/solhint-recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ module.exports = Object.freeze({
'no-empty-blocks': 'warn',
'no-global-import': 'warn',
'no-unused-import': 'warn',
'no-unused-vars': 'warn',
'no-unused-vars': [
'warn',
{
validateParameters: true,
},
],
'one-contract-per-file': 'warn',
'reason-string': [
'warn',
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:20-alpine
LABEL maintainer="diego.bale@protofire.io"
ENV VERSION=6.0.0
ENV VERSION=6.0.1

RUN npm install -g solhint@"$VERSION"
10 changes: 0 additions & 10 deletions docs/_config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ title: "Rule Index of Solhint"
| [use-forbidden-name](./rules/naming/use-forbidden-name.md) | Avoid to use letters 'I', 'l', 'O' as identifiers. | $~~~~~~~~$✔️ | |
| [var-name-mixedcase](./rules/naming/var-name-mixedcase.md) | Variable names must be in mixedCase. (Does not check IMMUTABLES nor CONSTANTS (use inherent rules for that) | $~~~~~~~~$✔️ | |
| [imports-on-top](./rules/order/imports-on-top.md) | Import statements must be on top. | $~~~~~~~~$✔️ | |
| [imports-order](./rules/naming/imports-order.md) | Order the imports of the contract to follow a certain hierarchy (read "Notes section") | | |
| [imports-order](./rules/order/imports-order.md) | Order the imports of the contract to follow a certain hierarchy (read "Notes section") | | |
| [ordering](./rules/order/ordering.md) | Check order of elements in file and inside each contract, according to the style guide | | |
| [visibility-modifier-order](./rules/order/visibility-modifier-order.md) | Visibility modifier must be first in list of modifiers. | $~~~~~~~~$✔️ | |

Expand Down
15 changes: 13 additions & 2 deletions docs/rules/best-practices/no-unused-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,24 @@ title: "no-unused-vars | Solhint"
Variable "name" is unused.

## Options
This rule accepts a string option for rule severity. Must be one of "error", "warn", "off". Defaults to warn.
This rule accepts an array of options:

| Index | Description | Default Value |
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
| 0 | Rule severity. Must be one of "error", "warn", "off". | warn |
| 1 | A JSON object with a single property "validateParameters" as boolean specifying whether to report unused parameters from functions and modifiers. | {"validateParameters":true} |


### Example Config
```json
{
"rules": {
"no-unused-vars": "warn"
"no-unused-vars": [
"warn",
{
"validateParameters": true
}
]
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/best-practices/use-natspec.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ This rule accepts an array of options:
```

## Version
This rule was introduced in the latest version.
This rule was introduced in [Solhint 6.0.0](https://github.com/protofire/solhint/blob/v6.0.0)

## Resources
- [Rule source](https://github.com/protofire/solhint/blob/master/lib/rules/best-practices/use-natspec.js)
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/miscellaneous/quotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This rule accepts an array of options:
```

### Notes
- This rule allows to put a double quote inside single quote string and viceversa
- This rule allows to put a double quote inside single quote string and vice versa

## Examples
### 👍 Examples of **correct** code for this rule
Expand Down
3 changes: 3 additions & 0 deletions docs/rules/naming/func-name-mixedcase.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ This rule accepts a string option for rule severity. Must be one of "error", "wa
}
```

### Notes
- SNAKE_CASE allowed only in interfaces when matching constant/immutable getter signatures.
- Return must be elementary, enum, UDVT, or contract/interface.

## Examples
This rule does not have examples.
Expand Down
File renamed without changes.
Loading
Loading