Latrasis/linter-solidity

File not found Error when importing from truffle

buck-ross opened this issue · 1 comments

When using the Truffle Framework to import a solidity contract, a "File not found" error is produced in the editor.

Apparent Cause:

This appears to be due to the fact that the root directory for the import statement in truffle is "/node_modules" (relative to the "contracts" folder, the path becomes "../node_modules"). However, the problem does not go away when "../node_modules/" is appended to the front of the path.

Specific Example:

In this truffle tutorial, importing Open Zeppelin. In "contracts/TutorialToken.sol":

pragma solidity 0.4.21;
import "zeppelin-solidity/contracts/token/ERC20/StandardToken.sol";

The error appears on the second line, and reads:

Source "zeppelin-solidity/contracts/token/ERC20/StandardToken.sol" not found: File not found.

Possible solution:

Enable the linter to check the "node_modules" directory in the project root for imported files.

@Latrasis This should be closed.