prettier-plugin-hug-call-arguments 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +25 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -141,6 +141,31 @@ match one of a few narrow, specific shapes.
141
141
  - there's no blank line between arguments, no comments on the relevant
142
142
  nodes, and no TS type arguments
143
143
 
144
+ **Hugging an arrow function's concise body:**
145
+
146
+ ```js
147
+ // input
148
+ const f = (data) =>
149
+ pgBoss.then((boss) => {
150
+ return boss.send(jobName, data);
151
+ });
152
+
153
+ // with this plugin
154
+ const f = (data) => pgBoss.then((boss) => {
155
+ return boss.send(jobName, data);
156
+ });
157
+ ```
158
+
159
+ - the arrow has a concise (non-block) body, no type parameters, return type,
160
+ or predicate, and default `arrowParens`
161
+ - the body is a `CallExpression` that needs multi-line printing (Prettier
162
+ already hugs directly after `=>` for other body types — objects, arrays,
163
+ JSX, template literals — so there's no gap to fix there)
164
+ - the resulting line fits `printWidth`; otherwise this falls back to
165
+ Prettier's default (a hardline after `=>`, body indented on its own line).
166
+ The arrow's own parameter list can still break onto its own line first the
167
+ normal way — only the `=> body` boundary is affected
168
+
144
169
  **Flattening a method chain:**
145
170
 
146
171
  - every link is a plain, non-optional `.name(...)` or `[expr](...)` call down
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-hug-call-arguments",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "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",
5
5
  "author": "soso tsertsvadze",
6
6
  "license": "MIT",