-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: no-duplicated-import #588
Comments
@fedgiac thanks a lot for posting... Is that still good for you ? |
Yes! This is the more complicated variation of this rule that I was talking about (which happens when I merge files together and make imports work by copy-pasting). File contract Imported {} File import {Imported} from "./Imported1.sol"; File import {Imported} from "./Imported1.sol";
// The following line should trigger the suggested linting rule.
import {Imported} from "./Imported2.sol";
contract Contract is Imported {} The code above compiles with Solidity 0.8.26. Overall I don't think cross-file knowledge matters much: it's true that the two Another note: import renaming syntax like the following in import {Imported} from "./Imported1.sol";
// Does not trigger the rule. The import is renamed and used.
import {Imported as Imported2} from "./Imported2.sol";
contract Contract is Imported, Imported2 {} |
I'd like to suggest a new rule to catch when something is imported twice in a Solidity file, example below.
File
./Imported.sol
:File
./Contract.sol
:A repeating import like the one above compiles successfully.
A repetition can also happen in different import lines and from different files, as long as the import resolves to the same object.
The text was updated successfully, but these errors were encountered: