Registry / testing / solhint-plugin-prettier

solhint-plugin-prettier

JSON →
library0.1.0jsnpmunverified

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.

npm install solhint-plugin-prettier
INSTALL
IMPORT
SIG · SOLHINT-PLUGIN-PRE
S
solhint-plugin-prettier
testingjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
plugin is loaded via Solhint config (JSON) not JS import
Configure in .solhint.json under 'plugins' array. No programmatic import typically used.
Rule
Set rule in .solhint.json: 'prettier/prettier': 'error'
Requiring the module directly in JS
The rule is accessed through Solhint's plugin system, not by importing the package directly.
Configuration
Add 'plugins': ['prettier'] to .solhint.json
Setting rule without registering plugin
Ensure the plugin is listed in the 'plugins' array before defining rules.

Installs dependencies, configures Solhint to use the prettier plugin, and runs Solhint to check formatting against Prettier.

// Install dependencies npm install --save-dev solhint-community solhint-plugin-prettier prettier prettier-plugin-solidity // Create .solhint.json { "plugins": ["prettier"], "rules": { "prettier/prettier": "error" } } // Create .prettierrc (optional but recommended) { "plugins": ["prettier-plugin-solidity"], "tabWidth": 4, "overrides": [ { "files": "*.sol", "options": { "parser": "solidity-parse" } } ] } // Run solhint npx solhint 'contracts/**/*.sol'
Debug
Known issues
gotchaPlugin only works with solhint-community (not the original Solhint package).
fix
Use 'solhint-community' instead of 'solhint' in your npm install and config.
affects: >=0.1.0
gotchaRequires Prettier v3 and prettier-plugin-solidity v1. Older versions are incompatible.
fix
Ensure prettier@^3.0.0 and prettier-plugin-solidity@^1.0.0 are installed.
affects: >=0.1.0
deprecatedThe rule always reports formatting differences as errors; 'warning' is not supported.
fix
Use 'severity: error' only; 'warning' will be treated as error by Solhint.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Plugin prettier not found
Plugin not registered in .solhint.json or not installed.
fix
Ensure solhint-plugin-prettier is installed and add 'plugins': ['prettier'] to .solhint.json.
Error: Cannot find module 'prettier-plugin-solidity'
Missing peer dependency.
fix
npm install --save-dev prettier-plugin-solidity
Rule prettier/prettier is not configured
Rule name mismatch or missing from rules object.
fix
Add 'prettier/prettier': 'error' to rules in .solhint.json.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
prettierrequiredPeer dependency: required for formatting comparison
prettier-plugin-solidityrequiredPeer dependency: required to format Solidity files with Prettier
Agent activity
11 hits · last 30 days
node
9
Resources
solhint-plugin-prettier — npm install solhint-plugin-prettier · libregistry