Skip to content

Feature Request: enable overrides in .solhint.json #359

@amusingaxl

Description

@amusingaxl

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions