{"id":20094,"library":"hardhat-prettier","title":"hardhat-prettier","description":"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.","status":"active","version":"0.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/fvictorio/hardhat-prettier","tags":["javascript","ethereum","smart-contracts","hardhat","hardhat-plugin","typescript"],"install":[{"cmd":"npm install hardhat-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add hardhat-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add hardhat-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency — Hardhat plugin architecture requires it","package":"hardhat","optional":false},{"reason":"peer dependency — core formatting engine","package":"prettier","optional":false},{"reason":"peer dependency — Solidity language support for Prettier","package":"prettier-plugin-solidity","optional":false}],"imports":[{"note":"Plugin is imported for side effects — no named exports. Must be required/imported in hardhat.config","wrong":"import { hardhatPrettier } from 'hardhat-prettier'","symbol":"hardhat-prettier (plugin)","correct":"import 'hardhat-prettier'"},{"note":"The plugin adds a 'format' task, not a 'prettier' task. Run via Hardhat CLI","wrong":"npx hardhat prettier","symbol":"format task","correct":"npx hardhat format"},{"note":"The plugin overrides the built-in 'check' task to include formatting verification","wrong":"npx hardhat check:format","symbol":"check task (overridden)","correct":"npx hardhat check"}],"quickstart":{"code":"// Install dependencies\n// npm install hardhat-prettier prettier prettier-plugin-solidity\n\n// hardhat.config.js\nrequire('hardhat-prettier');\n\n// hardhat.config.ts (TypeScript)\nimport 'hardhat-prettier';\n\n// .prettierrc (optional, use default settings)\n{\n  \"plugins\": [\"prettier-plugin-solidity\"],\n  \"singleQuote\": true,\n  \"printWidth\": 120\n}\n\n// Format your Solidity files\n// npx hardhat format\n\n// Check formatting without overwriting (via check task)\n// npx hardhat check","lang":"typescript","description":"Shows how to install, configure, and use hardhat-prettier for formatting Solidity files in a Hardhat project."},"warnings":[{"fix":"Monitor the package for updates; consider using a more recent version of prettier-plugin-solidity if compatible","message":"prettier-plugin-solidity version pinned to 1.0.0-beta.1 — not semver-stable and may have breaking changes","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Be aware that 'npx hardhat check' will now also check Solidity formatting; use 'npx hardhat format' to fix issues","message":"Plugin overrides the 'check' task globally — affects all Hardhat check behavior","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Create a .prettierrc file for any customization; cannot pass options via hardhat.config","message":"No custom task configuration — uses .prettierrc defaults only","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Upgrade Hardhat to v2 or later","message":"Requires Hardhat ^2.0.0 — incompatible with Hardhat v1","severity":"breaking","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install hardhat-prettier","cause":"Plugin not installed or missing from dependencies","error":"Error: Cannot find module 'hardhat-prettier'"},{"fix":"Add require('hardhat-prettier') or import 'hardhat-prettier' to your hardhat.config.js/ts","cause":"Plugin not imported in hardhat config","error":"Error HH12: Trying to use a non-existent hardhat task: format"},{"fix":"Install peer: npm install prettier-plugin-solidity","cause":"Missing peer dependency","error":"Cannot find module 'prettier-plugin-solidity'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}