solhint
solhint copied to clipboard
Running solhint gives an error
When I run solhint directly, I get this error:
node:internal/fs/utils:344
throw err;
^
Error: EISDIR: illegal operation on a directory, read
at Object.readSync (node:fs:723:3)
at tryReadSync (node:fs:433:20)
at Object.readFileSync (node:fs:479:19)
at processFile (/opt/homebrew/lib/node_modules/solhint/lib/index.js:55:32)
at /opt/homebrew/lib/node_modules/solhint/lib/index.js:67:31
at Array.map (<anonymous>)
at Object.processPath (/opt/homebrew/lib/node_modules/solhint/lib/index.js:67:16)
at processPath (/opt/homebrew/lib/node_modules/solhint/solhint.js:183:17)
at Array.map (<anonymous>)
at Command.execMainAction (/opt/homebrew/lib/node_modules/solhint/solhint.js:68:55) {
errno: -21,
syscall: 'read',
code: 'EISDIR'
}
When I use it like a npm command, I get:
> [email protected] solhint
> solhint --fix "contracts/**/*.sol"
/opt/homebrew/lib/node_modules/solhint/lib/index.js:40
throw e
^
RangeError: index parameter must be between >= 0 and <= number of children.
at SimpleStatementContext.getChild (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:9347:15)
at ASTBuilder.visitSimpleStatement (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:35449:27)
at SimpleStatementContext.accept (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:33590:22)
at ASTBuilder.visit (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:17669:19)
at ASTBuilder.visitStatement (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:35446:17)
at /opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:35482:51
at Array.map (<anonymous>)
at ASTBuilder.visitBlock (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:35482:35)
at ASTBuilder.visitFunctionDefinition (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:35521:20)
at FunctionDefinitionContext.accept (/opt/homebrew/lib/node_modules/solhint/node_modules/@solidity-parser/parser/dist/index.cjs.js:32561:22)
The code triggering this error as of right now: https://github.com/QEDK/opensignal/commit/eeef402b75f7663f6eae9bb8bce56cd586624966
OS: MacOS 11.5.2 Node version: v16.8.0 npm version: v7.21.0 Solhint version: v3.3.6
Hey @QEDK I was running into the same issue today.
Not sure if it's still a problem on your end but what fixed the issue for me is adding the artifacts directory to my .solhintignore (I'm using Hardhat). Exploring the directory structure of artifacts shows that there's a directory called contracts/<contract-name>.sol which confuses Solhint (as it's a directory, not a file).
For completeness, here's my .solhintignore
artifacts
node_modules
Do you remember if that was the issue and it is solved @QEDK ?