
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
hardhat-ignore-warnings
Advanced tools
This plugin adds ways to ignore Solidity warnings, and a way to turn remaining warnings into errors.
Actual compilation errors will not be silenced by the plugin.
You can turn off all Solidity warnings by installing the plugin and configuring it as follows.
// hardhat.config.js
+require('hardhat-ignore-warnings');
module.exports = {
+ warnings: 'off',
};
You can be more selective about the warnings that should be ignored and those that shouldn't.
If you want to ignore a warning in a particular line without setting rules for the entire project, you can use inline comments.
// solc-ignore-next-line unused-param
function bar(uint x) public {
In order to ignore warnings or promote to errors across the entire project or in entire files, the plugin accepts more detailed configuration.
The config is an object that maps glob patterns to warning rules. These rules will be applied to files matched by the glob pattern. More specific patterns override the rules of less specific ones.
A warning can be set to 'off'
, 'error'
(promote to error), or 'warn'
(the default), as well as false
(meaning 'off'
) and true
(meaning the local default, or 'warn'
if none is set).
The special id default
can be used to apply a setting to all warnings at once.
warnings: {
// make every warning an error:
'*': 'error',
// equivalently:
'*': {
default: 'error',
},
// add an exception for a particular warning id:
'*': {
'code-size': 'warn',
default: 'error',
},
// turn off all warnings under a directory:
'contracts/test/**/*': {
default: 'off',
},
}
Both inline comments and detailed configuration use the following set of names to identify warnings.
unreachable
: "Unreachable code."unused-param
: "Unused function parameter. Remove or comment out the variable name to silence this warning."unused-var
: "Unused local variable."code-size
: "Contract code size is N bytes and exceeds 24576 bytes (a limit introduced in Spurious Dragon). This contract may not be deployable on Mainnet. Consider enabling the optimizer (with a low "runs" value!), turning off revert strings, or using libraries."shadowing
: "This declaration shadows an existing declaration."shadowing-builtin
: "This declaration shadows a builtin symbol."shadowing-opcode
: "Variable is shadowed in inline assembly by an instruction of the same name."func-mutability
: "Function state mutability can be restricted to pure/view."license
: "SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: " to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information."pragma-solidity
: "Source file does not specify required compiler version!"missing-receive
: "This contract has a payable fallback function, but no receive ether function. Consider adding a receive ether function." -- To ignore this warning with a comment, it must be placed before the contract definition.FAQs
Hardhat plugin to ignore Solidity warnings
The npm package hardhat-ignore-warnings receives a total of 11,696 weekly downloads. As such, hardhat-ignore-warnings popularity was classified as popular.
We found that hardhat-ignore-warnings demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.