protofire/solhint

Feature Request: enable overrides in `.solhint.json`

amusingaxl opened this issue · 2 comments

Most linters out there support overrides for specific file patterns.

For instance, eslint has supported this for a long time.

One use case that I currently have is that I want slightly different ruleset for Solidity test files.

It would be awesome if we could have something like:

{
  "extends": "solhint:recommended",
  "plugins": [
    "prettier"
  ],
  "rules": {
    "prettier/prettier": "warn"
  },
  "overrides": [
    {
      "files": "**/*.t.sol",
      "rules": {
        "max-state-count": "off",
        "state-visibility": "off"
      }
    }
  ]
}

With the configs above we can reduce the error/warning clutter and also improve the signal-to-noise ratio in test files, so we can write:

    RwaUrn urn;
    RwaOutputConduit outC;
    RwaInputConduit inC;

instead of:

    RwaUrn internal urn;
    RwaOutputConduit internal outC;
    RwaInputConduit internal inC;

without being bothered with errors.

Right now the workaround is to have 2 separate .solhint*.json files and run the 2 tasks separately. It can be a bit tedious to add the required boilerplate every time though.

@amusingaxl
Sorry the late response and thanks a lot for your feedback
We are going to keep solhint updated on regular basis and this could be a good addition
Not sure when can we add this because it is not a simple addition, but I see the point of it.

Thanks a lot!

feature request seconded!

This feature is particularly useful when someone is using forge and solhint as the same time and trying to follow forge's somewhat arbitrary snake_camelCases for contract/function name.