Hardhat plugin integrating Prettier Solidity for automatic code formatting and style checking. Current stable version 0.0.1 (pre-release) with no regular release cadence — it's experimental. Key differentiators: adds a format task and overrides the check task for Solidity files, leveraging prettier-plugin-solidity's Solidity-specific formatting rules. Minimal configuration via .prettierrc. Requires Hardhat ^2.0.0, Prettier ^2.1.0, and prettier-plugin-solidity 1.0.0-beta.1. Alternatives like solhint focus on linting; this plugin focuses solely on formatting. Active development on GitHub by a single maintainer.
npm install hardhat-prettierVerified import paths — ran on the pinned version, not inferred.
Shows how to install, configure, and use hardhat-prettier for formatting Solidity files in a Hardhat project.
Monitor the package for updates; consider using a more recent version of prettier-plugin-solidity if compatible
Be aware that 'npx hardhat check' will now also check Solidity formatting; use 'npx hardhat format' to fix issues
Create a .prettierrc file for any customization; cannot pass options via hardhat.config
Upgrade Hardhat to v2 or later
Run: npm install hardhat-prettier
Add require('hardhat-prettier') or import 'hardhat-prettier' to your hardhat.config.js/tsInstall peer: npm install prettier-plugin-solidity