prettier-plugin-hug-call-arguments weekly downloads statistics
By Generalsimus · npm · Prettier plugins
Prettier plugin: hug the last call argument even when it's wrapped in another call, e.g. app.delete("/x", catchAsync(async (req, res) => { ... })). Fixes https://github.com/prettier/prettier/issues/11080
prettier-plugin-hug-call-arguments has 120 recorded weekly downloads on npm, a decrease of 77.6% over the past 30 days, ranking #1759 of 2,391 tracked listings.
About prettier-plugin-hug-call-arguments
prettier-plugin-hug-call-arguments
Fixes prettier/prettier#11080.
Usage
Requires Prettier 3.x as a peer dependency.
npm install --save-dev prettier-plugin-hug-call-arguments
yarn add --dev prettier-plugin-hug-call-arguments
pnpm add --save-dev prettier-plugin-hug-call-arguments
Add it to your Prettier config (.prettierrc, .prettierrc.json,
prettier.config.js, or the "prettier" key in package.json):
{
"plugins": ["prettier-plugin-hug-call-arguments"]
}
No other options — it works automatically wherever Prettier already formats
JS/JSX/TS/TSX with the estree printer (the babel, babel-ts, and
typescript parsers). Nothing to configure, and every case it doesn't
recognize is left to Prettier's own formatting untouched.
Examples
Prettier hugs the last argument of a call when it's a function/object/array literal:
app.get("/x", (req, res) => {
res.send("ok");
});
...but not when that literal is wrapped in another call, which is a very
common pattern for middleware wrappers (Express catchAsync, error
boundaries, decorators-as-functions, etc.):
// input
app.delete('/campgrounds/:id', catchAsync(async (req, res) => {
const { id } = req.params;
await Campground.findByIdAndDelete(id);
res.redirect('/campgrounds');
}));
// vanilla Prettier output
app.delete(
"/campgrounds/:id",
catchAsync(async (req, res) => {
const { id } = req.params;
await Campground.findByIdAndDelete(id);
res.redirect("/campgrounds");
}),
);
// with this plugin
app.delete("/campgrounds/:id", catchAsync(async (req, res) => {
const { id } = req.params;
await Campground.findByIdAndDelete(id);
res.redirect("/campgrounds");
}));
It also flattens method chains instead of breaking every .method() onto its
own line — a common look with query builders:
// input
db.updateTable('User').set({
isDeleted: true,
profilePicture: null,
username: null,
}).where('id', '=', user.id).execute();
// vanilla Prettier output
db
.updateTable("User")
.set({
isDeleted: true,
profilePicture: null,
username: null,
})
.where("id", "=", user.id)
.execute();
// with this plugin
db.updateTable("User").set({
isDeleted: true,
profilePicture: null,
username: null,
}).where("id", "=", user.id).execute();
How it works
This plugin wraps Prettier's built-in estree printer and only overrides the
print step for CallExpression, ArrayExpression, ObjectExpression,
ConditionalExpression, and ArrowFunctionExpression nodes that match one of a few narrow, specific
shapes.
Preserving a layout you already chose:
// input
foo(
1,
2,
);
// with this plugin — kept exactly as written
foo(
1,
2,
);
// bar(1, 2, 3) stays on one line — nothing to preserve, so it's printed
// the normal, printWidth-aware way
Prettier already does this for object literals by default (objectWrap: "preserve"): write { with a newline before the first property and it
stays multi-line, even if it would fit on one line. This plugin extends that
same "respect how the author wrote it" behavior to call arguments, array
elements, and arrow function parameter lists, which Prettier doesn't
normally preserve — those always auto-collapse to fit printWidth
regardless of the original formatting.
-
a list is split one item per line when there's a newline anywhere between its own items — right after the opening
(/[/{, between two items, or right before the closing bracket — and at least two items. Objects get the same rule, extending Prettier's own "newline before the first key" check -
newlines inside an item never count: every list decides for itself. A list written on one line stays on that line even when one of its items splits, and only that item breaks:
// input foo([1, 2, [ 3, 4]], d); // output — the outer array and the call stay inline foo([1, 2, [ 3, 4, ]], d);The same applies to a ternary written on one line (
a ? foo([\n...\n]) : null). Either one falls back to Prettier's own layout when even its opening line wouldn't fitprintWidth -
takes priority over every other feature below: a layout you explicitly chose is never fought by this plugin's own hugging heuristics
-
bails on comments anywhere in the list, a sparse array, TS type arguments/parameters, or (for parameters) anything but a plain arrow function — a
functionexpression/declaration has a name and block body to reproduce too, which is more than this narrow check takes on
Hugging a call-wrapped callback:…
Description from the npm listing.
- prettier
- prettier-plugin
- formatter
- code-style
- call-arguments
- callback
- typescript
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (122)Similar npm Prettier plugins plugins
All 20 prettier-plugin-hug-call-arguments alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/prettier-plugin-hug-call-arguments. First seen Oct 16, 2026; last successful collection Oct 21, 2026. See the methodology.