Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@sidestream/solhint-plugin-makerdao

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sidestream/solhint-plugin-makerdao

This repository contains [linting](https://en.wikipedia.org/wiki/Lint_(software)) rules and opinionated configuration for the code style enforced by [MakerDAO](https://github.com/makerdao) protocol engineers. Technically, it's a set of [solhint](https://g

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
3
Created
Source

MakerDAO solidity linter

This repository contains linting rules and opinionated configuration for the code style enforced by MakerDAO protocol engineers. Technically, it's a set of solhint plugins and a configuration file that can be globally installed in your system and executed on demand of as a pre-commit hook.

Getting started

Use this package as a standalone cli tool

  • Install solhint globaly via npm i -g solhint
  • Install this repository via npm i -g solhint-plugin-makerdao@npm:@sidestream/solhint-plugin-makerdao
  • Lint all solidity files in the current folder via npx solhint-plugin-makerdao ./**/*.sol

Add this linter to existing project

  • Install solhint via npm i --save-dev solhint
  • Install this repository via npm i --save-dev solhint-plugin-makerdao@npm:@sidestream/solhint-plugin-makerdao
  • Create a new .solhint.json according to the documentation or use the one provided in this repository.
  • Add lint script to the package.json with solhint ./**/*.sol
  • Run npm run lint manually, in CI or before every commit

Rules

RuleDescription
vertically-aligned-commentsEnforce comments in the same block that start with // to start on the same column
vertically-aligned-declarationsEnforce contract scope declarations to have variable names start on the same column
vertically-aligned-state-var-visibilityEnforce visibility modifiers such as public to start on the same column in the declarations
no-newlines-between-function-signaturesForbid newlines in interface defenitions
capitalized-snake-only-for-constForbid CAPITALIZED_SNAKE_CASE for variables that are not constants
newlines-between-custom-and-native-declarationsEnforce newlines between variable declarations of custom and native types (e.g. IExampleContract and uint256 )
constructor-arguments-unserscoredEnforce underscores for constructor argument names
prefer-type-provided-maxenforce using type provided max values over conversions. I.e. type(uint256).max over uint256(-1)

Publishing to npm

  • Login to npm (if not yet) via npm login
  • Update version field inside package.json according to the semver
    • Run npm install to propagate changes to the package-lock.json
  • Open a PR with the changes
  • Publish the new version via npm publish --access public

Keywords

solhint

FAQs

Package last updated on 19 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts