protofire / solhint

Solhint is an open-source project to provide a linting utility for Solidity code.
https://protofire.github.io/solhint/
MIT License
1.04k stars 160 forks source link

Solhint not being picked up in CLI but in vscode it is. #341

Closed emretepedev closed 1 year ago

emretepedev commented 2 years ago

I have changed the compiler requirement but in the CLI it does not found the issue BUT the vscode is correctly highlighting the problem.

yarn run solhint contracts/FooToken.sol output

Done in 0.63s.

But vscode shows "Linter: Compiler version ^0.7.4 does not satisfy the ^0.8.4 semver requirement [compiler-version]" correctly.

.solhint.json

{
  "extends": "solhint:recommended",
  "rules": {
    "compiler-version": ["error", "^0.8.4"],
    "func-visibility": ["warn", { "ignoreConstructors": true }]
  }
}

package.json

{
  // ...
  "devDependencies": {
    "solhint": "^3.3.7",
  }
  // ...
}

contracts/FooToken.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.4;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract FooToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("Foo Token", "FOO") {
        _mint(_msgSender(), initialSupply);
    }
}
dbale-altoros commented 1 year ago

@emretepedev I will ask a few standard questions

1) Do you have a .solhint.json in the same dir you are executing solhint ? Try forcing it with -c option and test it 2) You are executing with yarn run solhint... do you have solhint globaly ? 3) Do you have the keyword solhint as a script defined in the package.json file ? Can you post it here the script section of that file ?

dbale-altoros commented 1 year ago

Closed due to lack of user feedback Check the new version release ! Feel free to comment if you have any issue