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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default (plugin registration)
✓ Add to Prettier config plugins array
✗ Direct import and use as a module
The plugin is not a JS module to import directly; it's loaded by Prettier's plugin mechanism via config file (.prettierrc) or CLI.
plugins
✓ "plugins": ["prettier-plugin-groovy"] in .prettierrc
✗ require('prettier-plugin-groovy') in config
Prettier plugins are strings in config, not required modules. The plugin must be installed as a package.
CLI usage
✓ prettier --write --plugin=prettier-plugin-groovy path/to/file.groovy
✗ Running prettier on non-Groovy files with plugin
The plugin automatically detects Groovy files; no special CLI flag needed if plugin is in config.
Installation and usage of prettier-plugin-groovy to format Groovy files (e.g., Jenkinsfile) via Prettier.
// Install the plugin as a dev dependency
npm install prettier-plugin-groovy --save-dev
// Add to .prettierrc (JSON format)
{
"plugins": ["prettier-plugin-groovy"]
}
// Or use CLI with plugin flag
prettier --write --plugin=prettier-plugin-groovy Jenkinsfile
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-groovy'
Plugin is not installed or not in node_modules.
fixRun 'npm install prettier-plugin-groovy --save-dev' to install the plugin.
prettier-plugin-groovy requires prettier@>=3.3.3. Please upgrade.
Installed Prettier version is too old.
fixUpdate Prettier to version 3.3.3 or later: 'npm install prettier@latest --save-dev'.
Plugin 'prettier-plugin-groovy' is not found when parsing config.
Plugin name in Prettier config is incorrect or not installed.
fixEnsure the plugin is installed and listed as 'prettier-plugin-groovy' in the plugins array.
Audit
Dependencies
prettierrequiredPeer dependency; plugin requires Prettier to function