Welcome Solhint v2.0: Shareable Configs and Custom Plugins!

We are excited to announce the new version of our Solidity linter.

New to Solhint?

Solhint is an open-source project for linting solidity code, providing both security and style guide validations. It integrates seamlessly into most mainstream IDEs. Flexibly configurable and extendable, while staying unobtrusive, Solhint’s user experience is similar to any other languages linters. Earlier, our team wrote a comprehensive article about it.

Maintained and under continuous development by a thriving development team, Solhint is an active project that keeps getting updates and new features on a regular basis.

Solhint v2.0: new functionality

Indeed, we are proud and excited to announce the new version of our Solidity linter.

Solhint now ships with rules whitelisting instead of blacklisting, shareable configs, and plugins. In fact, Solhint has been re-architectured to allow developers to write their own configurations and even their very own plugins. From now on, every team can setup and share its own set of rules, and every developer can create and share a plugin to support any missing rules. Yes, it’s kind of awesome.

Shareable configs

Shareable configs are configurations that can be used and extended from. The big thing is that they allow you to use the same base configuration across all your projects or just extend a well-known one.

"extends": ["solhint:recommended", "protofire"]

Since these shareable configs are just regular npm packages, they can be shared with the community to ease others Solhint setups. Say hello to a new contribution-driven configurations ecosystem!

Plugins

Need a new rule? Know someone who does? Got an idea for a new/missing rule? Well, you can create your own Solhint plugin now. Yes, you can write your own plugins to add new rules to Solhint. Plugins are just npm packages that implement and export a set of rules. As you can imagine, rules have to follow some…well, rules. They also have a defined structure. But no worries, everything has been documented accordingly and solhint-plugin-prettier — the first Solhint plugin — is already out there, which should serve as reference.

class NoFoosAllowed {

constructor(reporter, config) {

this.ruleId = 'no-foos'



this.reporter = reporter

this.config = config

}



enterContractDefinition(ctx) {

const identifier = ctx.children[1]

const text = identifier.getText()



if (text === 'Foo') {

this.reporter.error(ctx, this.ruleId, 'Contracts cannot be named "Foo"')

}

}

}

Just like shareable configs, since plugins are regular npm packages, they can be shared, as well.

More details

So, what’s next? Well, we have many ideas, things we’d like to try out and, most important, willingness to hear back from users. Always trying to assist developers in their daily work and contribute to the whole community by just making it easier to write better and more secure code. We expect that the project will be extended with new features based on the early feedback we’ll get from the v2.0 release.

A couple of links for those who would like to learn more about the linter:

Bugs, features, and pull requests: https://github.com/protofire/solhint

Join the discussion at Gitter: https://gitter.im/solhint/Lobby

Or, follow this blog to get the latest new about this and other projects.