Keep iife function comments in parentheses (#18538)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-12-29 18:46:45 +08:00
1 parent 88ffc016db
commit e2806a30b2
9 files changed
+241 -9

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
#### Keep iife function comments in parentheses (#18538 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
const a = (
/**
* @param {number} foo
* @return {number}
*/
function (foo) {
return foo + 1;
}
)(1);
// Prettier stable
const a = /**
* @param {number} foo
* @return {number}
*/
(function (foo) {
return foo + 1;
})(1);
// Prettier main
const a = (
/**
* @param {number} foo
* @return {number}
*/
function (foo) {
return foo + 1;
}
)(1);
```