@slippy-lint/slippy
v0.2.2
Published
A simple but powerful linter for Solidity
Maintainers
Readme
Slippy
⚠️ Slippy is now published under the
slippypackage.Please see the new documentation site for up-to-date usage and the v0.3.0 release notes for migration instructions.
Slippy is a linter for Solidity that's simple, powerful, and thoughtfully built.
Installation
Install it:
npm install --save-dev @slippy-lint/slippyInitialize a config file:
npx slippy --initRun it:
npx slippy "contracts/**/*.sol"Why Slippy?
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-conventionrule - A more accurate
no-unused-varsrule - Unused comment directives like
// slippy-disable-lineare reported - No formatting rules
- Semantic versioning
Configuration
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.
Rules
Rules that have a 🔧 next to them can be automatically fixed by running Slippy with the --fix flag.
compatible-pragma: checks that the minimum supported pragma version is compatible with the features used in the file.curly: enforces the use of curly braces for all control structures.explicit-types: enforces or forbids the use of aliases likeuintinstead 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.logand 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: disallows syntax patterns specified with Slang queries.no-send: forbids the use ofsendandtransferfor sending value, in favor of usingcallwith value.no-tx-origin: forbids the use oftx.origin.no-unchecked-calls: disallows low-level calls likecall,staticcall, anddelegatecallthat 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.one-contract-per-file: enforces that a file contains at most one contract/interface/library definition.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-members: enforces a specific order for top-level elements and contract/interface/library members.sort-modifiers: enforces a specific order for modifiers.yul-prefer-iszero: recommends usingiszeroinstead ofeqwhen comparing to the0literal in Yul code.
Don't see a rule you need? Open an issue.
