Skip to content
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

Use explicit imports #4399

Merged
merged 12 commits into from
Jun 29, 2023
Merged

Use explicit imports #4399

merged 12 commits into from
Jun 29, 2023

Conversation

frangio
Copy link
Contributor

@frangio frangio commented Jun 28, 2023

Note that because of Solidity override resolution (override(A, B)) sometimes it's necessary to import an identifier even if it's only used for that.

When both an interface and implementation are required, I've reused the same file for the import statement, as in:

import {IGovernor, Governor} from "../../governance/Governor.sol";

@changeset-bot
Copy link

changeset-bot bot commented Jun 28, 2023

🦋 Changeset detected

Latest commit: eeecdd1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openzeppelin-solidity Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@frangio
Copy link
Contributor Author

frangio commented Jun 28, 2023

Do we want a changeset for this?

@ernestognw
Copy link
Member

Do we want a changeset for this?

I think it may unexpectedly remove imported values that users might rely on. I'd say yes just for making sure it's mentioned somewhere.

@socket-security
Copy link

undefined. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: hardhat-exposed@0.3.6

@frangio frangio marked this pull request as ready for review June 29, 2023 03:37
Amxx
Amxx previously approved these changes Jun 29, 2023
@frangio frangio requested a review from a team June 29, 2023 16:27
ernestognw
ernestognw previously approved these changes Jun 29, 2023
Copy link
Member

@ernestognw ernestognw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for tackling this @frangio!

I just updated the docs references to also use explicit imports and added a linter rule to avoid global imports

@@ -200,11 +200,12 @@ The Governor will automatically detect the clock mode used by the token and adap
// SPDX-License-Identifier: MIT
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: We have to move this example code to a separate file like the others in this article.

@frangio frangio enabled auto-merge (squash) June 29, 2023 20:07
@frangio frangio merged commit 874c2d3 into OpenZeppelin:master Jun 29, 2023
@frangio frangio deleted the explicit-imports branch June 29, 2023 20:12
This was referenced Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants