Registry / devops / prettier-plugin-groovy

prettier-plugin-groovy

JSON →
library0.2.1jsnpmunverified

A Prettier plugin to format Groovy files, including Jenkinsfiles. Version 0.2.1 requires Node >=20.0.0 || ^18.12.0 and Prettier ^3.3.3. It internally uses groovy-beautify for formatting. Key differentiator: integrates Groovy formatting into the Prettier ecosystem, enabling consistent code style with other languages.

npm install prettier-plugin-groovy
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-GR
P
prettier-plugin-groovy
devopsjavascriptv0.2.1
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 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
Debug
Known issues
breakingRequires Node >=20.0.0 or >=18.12.0. Older Node versions are not supported.
fix
Upgrade Node to version 18.12.0 LTS or higher.
affects: <18.12.0
breakingRequires Prettier ^3.3.3. Incompatible with Prettier v2.
fix
Update Prettier to version 3.3.3 or later.
affects: <3.3.3
gotchaPlugin uses groovy-beautify internally; formatting behavior may differ from standard Groovy linters.
fix
Review formatting output and adjust Prettier options as needed.
affects: *
gotchaThe plugin is designed for Groovy and Jenkinsfiles; testing on other Groovy dialects is limited.
fix
Test plugin with your specific Groovy file types.
affects: *
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-groovy'
Plugin is not installed or not in node_modules.
fix
Run '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.
fix
Update 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.
fix
Ensure the plugin is installed and listed as 'prettier-plugin-groovy' in the plugins array.
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies
prettierrequiredPeer dependency; plugin requires Prettier to function
Agent activity
4 hits · last 30 days
node
4
Resources
prettier-plugin-groovy — npm install prettier-plugin-groovy · libregistry