Skip to content

Update OZ solhint custom rules [WIP] #5794

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

gonzaotc
Copy link
Contributor

@gonzaotc gonzaotc commented Jul 10, 2025

  1. Removes interface-names custom rule which is now covered by solhint's already included interface-starts-with-i
  2. Adds interface-only-external-functions rule.
  3. Prevents leading underscore in constants and immutables, which was previously only prevented in private constants
  4. Prevents leading underscore in public and external functions.
  5. Prevents external virtual functions.

Note that 2, 3, and 4 require breaking changes that can be potential candidates for 6.0

Ideally I would like to add another rule to verify that Interfaces can only import other interfaces

@gonzaotc gonzaotc requested a review from a team as a code owner July 10, 2025 20:03
Copy link

changeset-bot bot commented Jul 10, 2025

⚠️ No Changeset found

Latest commit: ba351f3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@gonzaotc gonzaotc marked this pull request as draft July 10, 2025 20:03
@Amxx
Copy link
Collaborator

Amxx commented Jul 10, 2025

For reference, there is already this PR that deals with linter rules: #5497

Copy link
Collaborator

@Amxx Amxx left a comment

Choose a reason for hiding this comment

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

Ideally I would like to add another rule to verify that Interfaces can only import other interfaces

AFAIK, this is already something solidity enforces. We don't need the linter to check taht if the compiler rejects it anyway.

Edit: that is true of "inheritance", importing is a different thing.

Copy link
Collaborator

@Amxx Amxx left a comment

Choose a reason for hiding this comment

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

How efficient/explicit is /^_/.test(node.name) compared to node.name.startsWith('_')

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.

2 participants