Writing better code with the help of a linter
It is very important to follow best practices while writing code. This is more important when it comes to smart contracts, specifically solidity, because of the security issues that can arise. It is easy for a new smart contract developer to miss minor details. To avoid this, it is recommended to use a linter, which verifies your code against best practices.
This recipe will introduce you to the popular linters used in solidity to help you write better code. This can improve the overall readability and security of your smart contracts.
Getting ready
These linters are built using JavaScript and are distributed through npm
. You need to have NodeJS
(any recent version) installed on your machine to step through this recipe.
How to do it...
- Solium is a popular linter used by many to validate their code against best practices. Solium is distributed through
npm
and you can install it using the following command:
npm install -g solium
- Run the following command...