Slippy is a linter for Solidity that's simple, powerful, and thoughtfully built.
Install it:
npm install --save-dev @slippy-lint/slippy
Initialize a config file:
npx slippy --init
Run it:
npx slippy "contracts/**/*.sol"
You can read a more detailed comparison between Slippy and Solhint, but here's a summary:
- A single, flexible configuration that lets you easily enable or disable rules for specific parts of your codebase
- A unified
naming-convention
rule - A more accurate
no-unused-vars
rule - Unused comment directives like
// slippy-disable-line
are reported - No formatting rules
- Semantic versioning
Slippy's configuration lives in a slippy.config.js
file, which exports the configuration that Slippy will use to lint your code. Here’s a minimal example:
module.exports = {
rules: {
"no-console": "warn",
"no-unused-vars": ["error", { ignorePattern: "^_" }],
},
};
For more details on configuring Slippy, including advanced features like cascading configurations, file ignores, and comment directives, see the configuration documentation.
curly
: enforces the use of curly braces for all control structures.explicit-types
: enforces or forbids the use of aliases likeuint
instead ofuint256
.id-denylist
: allows you to specify a list of forbidden identifiers.imports-on-top
: enforces that all import statements are at the top of the file.max-state-vars
: limits the number of state variables in a contract.named-return-params
: enforces that functions with multiple return parameters use named return parameters.naming-convention
: enforces a naming convention across the codebase.no-console
: forbids the use ofconsole.log
and the import ofconsole.sol
.no-default-visibility
: forbids the use of default visibility for state variables.no-duplicate-imports
: forbids importing the same file multiple times.no-empty-blocks
: forbids blocks without statements.no-global-imports
: forbids global imports likeimport "./foo.sol"
.no-restricted-syntax
: disallow certain syntax patterns using Slang queries.no-send
: forbids the use ofsend
andtransfer
for sending value, in favor of usingcall
with value.no-tx-origin
: forbids the use oftx.origin
.no-unchecked-calls
: disallows low-level calls likecall
,staticcall
, anddelegatecall
that don't use their return values.no-uninitialized-immutable-references
: forbids using immutable references before they are initialized.no-unused-vars
: detects unused variables, imports and functions.private-vars
: enforces that all state variables are private.require-revert-reason
: enforces that all reverts have a reason.sort-imports
: enforces a specific order for import statements.sort-modifiers
: enforces a specific order for modifiers.
Don't see a rule you need? Open an issue.
What’s next for Slippy:
- More rules
- Support for plugins
- Browser build
- Autofix