Latrasis / linter-solidity

Atom Linter support for Solidity
Other
27 stars 10 forks source link

File not found Error when importing from truffle #22

Closed buck-ross closed 6 years ago

buck-ross commented 6 years ago

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.

mpetrunic commented 6 years ago

@Latrasis This should be closed.