{"id":20560,"library":"solhint-plugin-prettier","title":"solhint-plugin-prettier","description":"Solhint plugin that integrates Prettier formatting checks for Solidity files. Version 0.1.0 released as a stable package. It requires solhint-community, prettier >=3.0.0, and prettier-plugin-solidity >=1.0.0 as peer dependencies. The plugin reports each formatting difference as an individual lint issue, enabling consistent code style enforcement in Solidity projects. Unlike using Prettier directly in CI, this plugin runs formatting checks as part of the Solhint linting workflow, making it easy to integrate with existing lint configurations and reporting tools.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","solhint","prettier","plugin","solidity"],"install":[{"cmd":"npm install solhint-plugin-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add solhint-plugin-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add solhint-plugin-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: required for formatting comparison","package":"prettier","optional":false},{"reason":"Peer dependency: required to format Solidity files with Prettier","package":"prettier-plugin-solidity","optional":false}],"imports":[{"note":"Configure in .solhint.json under 'plugins' array. No programmatic import typically used.","symbol":"default","correct":"plugin is loaded via Solhint config (JSON) not JS import"},{"note":"The rule is accessed through Solhint's plugin system, not by importing the package directly.","wrong":"Requiring the module directly in JS","symbol":"Rule","correct":"Set rule in .solhint.json: 'prettier/prettier': 'error'"},{"note":"Ensure the plugin is listed in the 'plugins' array before defining rules.","wrong":"Setting rule without registering plugin","symbol":"Configuration","correct":"Add 'plugins': ['prettier'] to .solhint.json"}],"quickstart":{"code":"// Install dependencies\nnpm install --save-dev solhint-community solhint-plugin-prettier prettier prettier-plugin-solidity\n\n// Create .solhint.json\n{\n  \"plugins\": [\"prettier\"],\n  \"rules\": {\n    \"prettier/prettier\": \"error\"\n  }\n}\n\n// Create .prettierrc (optional but recommended)\n{\n  \"plugins\": [\"prettier-plugin-solidity\"],\n  \"tabWidth\": 4,\n  \"overrides\": [\n    {\n      \"files\": \"*.sol\",\n      \"options\": {\n        \"parser\": \"solidity-parse\"\n      }\n    }\n  ]\n}\n\n// Run solhint\nnpx solhint 'contracts/**/*.sol'","lang":"javascript","description":"Installs dependencies, configures Solhint to use the prettier plugin, and runs Solhint to check formatting against Prettier."},"warnings":[{"fix":"Use 'solhint-community' instead of 'solhint' in your npm install and config.","message":"Plugin only works with solhint-community (not the original Solhint package).","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Ensure prettier@^3.0.0 and prettier-plugin-solidity@^1.0.0 are installed.","message":"Requires Prettier v3 and prettier-plugin-solidity v1. Older versions are incompatible.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use 'severity: error' only; 'warning' will be treated as error by Solhint.","message":"The rule always reports formatting differences as errors; 'warning' is not supported.","severity":"deprecated","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure solhint-plugin-prettier is installed and add 'plugins': ['prettier'] to .solhint.json.","cause":"Plugin not registered in .solhint.json or not installed.","error":"Error: Plugin prettier not found"},{"fix":"npm install --save-dev prettier-plugin-solidity","cause":"Missing peer dependency.","error":"Error: Cannot find module 'prettier-plugin-solidity'"},{"fix":"Add 'prettier/prettier': 'error' to rules in .solhint.json.","cause":"Rule name mismatch or missing from rules object.","error":"Rule prettier/prettier is not configured"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}