npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@chainlink/solhint-plugin-chainlink-solidity

v1.0.1

Published

A set of Solhint rules for Chainlink's Solidity Style Guide.

Downloads

437

Readme

Chainlink Solhint Rules

A set of Solhint rules for Chainlink's Solidity Style Guide.

You can find a working Foundry example here.

Install to a new project

npm init && npm install solhint solhint-plugin-chainlink-solidity@npm:@chainlink/solhint-plugin-chainlink-solidity --save

Create a .solhint.json in your root project directory:

{
  "extends": "solhint:recommended",
  "plugins": ["chainlink-solidity"],
  "rules": {
    "compiler-version": ["off", "^0.7.0"],
    "const-name-snakecase": "off",
    "constructor-syntax": "error",
    "var-name-mixedcase": "off",
    "func-visibility": [
      "error",
      {
        "ignoreConstructors": true
      }
    ],
    "max-line-length": ["error", 160],
    "not-rely-on-time": "off",
    "no-empty-blocks": "off",
    "quotes": ["error", "single"],
    "reason-string": [
      "warn",
      {
        "maxLength": 64
      }
    ],
    "chainlink-solidity/prefix-internal-functions-with-underscore": "warn",
    "chainlink-solidity/prefix-private-functions-with-underscore": "warn",
    "chainlink-solidity/prefix-storage-variables-with-s-underscore": "warn",
    "chainlink-solidity/prefix-immutable-variables-with-i": "warn",
    "chainlink-solidity/all-caps-constant-storage-variables": "warn",
    "chainlink-solidity/no-hardhat-imports": "warn",
    "chainlink-solidity/inherited-constructor-args-not-in-contract-definition": "warn",
    "chainlink-solidity/explicit-imports": "warn",
    "chainlink-solidity/no-require-statements": "warn",
    "chainlink-solidity/no-block-single-if-reverts": "warn"
  }
}

Add the following to your package.json:

  "scripts": {
    "solhint": "solhint --config .solhint.json \"src/*.sol\""
  },

Then, run:

npm solhint

src/Counter.sol
  4:1  warning  Internal function increment is not prefixed with underscore (_)  chainlink-solidity/prefix-internal-functions-with-underscore
  4:1  warning  Private / internal variable number is not prefixed with s_       chainlink-solidity/prefix-storage-variables-with-s-underscore
  8:9  warning  Use custom errors instead of revert statements                   chainlink-solidity/no-require-statements
  8:9  warning  Provide an error message for require                             reason-string

Rules

| Rule Id | Description | |---------------------------------------------------------|---------------------------------------------------------------------------------------| | prefix-internal-functions-with-underscore | Naming convention | | prefix-private-functions-with-underscore | Naming convention | | prefix-storage-variables-with-s-underscore | Naming convention | | prefix-immutable-variables-with-i | Naming convention | | all-caps-constant-storage-variables | Naming convention | | no-hardhat-imports | Leftover hardhat/*.sol imports not allowed | | inherited-constructor-args-not-in-contract-definition | Inherited contract constructor arguments should be specified in the constructor block | | explicit-imports | import {Foo} from 'Foo.sol' | | no-require-statements | Use custom errors instead | | no-block-single-if-reverts | Omit curly braces for single-line guard clauses |