solhint icon indicating copy to clipboard operation
solhint copied to clipboard

no-unused-import does not recognize @inheritdoc reference

Open jmendiola222 opened this issue 8 months ago • 1 comments

Description

If a contract is only referenced by @inheritdoc documentation tag, you need to import it, but then the no-unused-import fails.

Example

A.sol

contract A {
   /** 
   * @notice my cool foo funtion 
   */
   function foo() virtual view { ... }
}

B.sol

import { A } from A;

contract B is A {
}

C.sol

import { A } from A; // ----------------------------------------> THIS FAILS WITH no-unused-import
import { B } from B;

contract C is B {
    /**
     * @inheritdoc A -------------------------------------------> THIS REQUIRES "A" to be imported
     */
    function foo() override view { ... }
}

Version: 5.0.5

jmendiola222 avatar Mar 28 '25 11:03 jmendiola222