Remove empty line in for statement without "update" (#18300)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-11-23 16:23:23 +08:00
1 parent a3d27e96c6
commit 1d0c666f0d
7 files changed
+41 -7

No files matched your search

+1 -1
View File
@@ -70,7 +70,7 @@ Prettier is an opinionated formatter and is not accepting pull requests that add
The project uses ESLint for linting and Prettier for formatting. If your editor isn't set up to work with them, you can lint and format all files from the command line using `yarn fix`.
After opening a PR, describe your changes in a file in the `changelog_unreleased` directory following the template [`changelog_unreleased/TEMPLATE.md`](changelog_unreleased/TEMPLATE.md) and commit this file to your PR. You can use `yarn gen:changelog` to generate a changelog file. Please see comments of the script file for usage.
After opening a PR, describe your changes in a file in the `changelog_unreleased` directory following the template [`changelog_unreleased/TEMPLATE.md`](changelog_unreleased/TEMPLATE.md) and commit this file to your PR. You can use `yarn generate-changelog` to generate a changelog file. Please see comments of the script file for usage.
## Other
+20
View File
@@ -0,0 +1,20 @@
#### Remove empty line in for statement without "update" (#18300 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
for ( let i = 0, j = 0, len = allMatches.length, lenJ = selections.length;i < len;) {}
// Prettier stable
for (
let i = 0, j = 0, len = allMatches.length, lenJ = selections.length;
i < len;
) {}
// Prettier main
for (
let i = 0, j = 0, len = allMatches.length, lenJ = selections.length;
i < len;
) {}
```
+1 -1
View File
@@ -207,7 +207,7 @@
"build": "node ./scripts/build/build.js",
"build:website": "node ./scripts/build-website.js",
"build:website:pr": "cross-env PULL_REQUEST=true yarn build:website",
"gen:changelog": "node ./scripts/generate-changelog.js",
"generate-changelog": "node ./scripts/generate-changelog.js",
"debug": "node bin/prettier.js --ignore-path=.prettierignore --plugin=./packages/plugin-oxc/index.js --plugin=./packages/plugin-hermes/index.js",
"debug:watch": "node --watch bin/prettier.js --ignore-path=.prettierignore --plugin=./packages/plugin-oxc/index.js --plugin=./packages/plugin-hermes/index.js",
"debug:inspect": "node --inspect-brk bin/prettier.js --ignore-path=.prettierignore --plugin=./packages/plugin-oxc/index.js --plugin=./packages/plugin-hermes/index.js"
+1 -2
View File
@@ -430,8 +430,7 @@ function printEstree(path, options, print, args) {
line,
print("test"),
";",
line,
print("update"),
node.update ? [line, print("update")] : ifBreak("", line),
]),
softline,
]),
@@ -651,7 +651,6 @@ async function f() {
/*0*/ for (
/*1*/ /*2*/ await using /*3*/ /*4*/ b /*5*/ = /*6*/ x /*7*/ /*8*/ /*9*/;
;
) /*10*/ ;
}
{
@@ -1048,6 +1048,23 @@ for (a in b) 0;
================================================================================
`;
exports[`no-update.js format 1`] = `
====================================options=====================================
parsers: ["babel", "flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
for ( let i = 0, j = 0, len = allMatches.length, lenJ = selections.length;i < len;) {}
=====================================output=====================================
for (
let i = 0, j = 0, len = allMatches.length, lenJ = selections.length;
i < len;
) {}
================================================================================
`;
exports[`parentheses.js [flow] format 1`] = `
"Unexpected token \`=>\`, expected the token \`;\` (11:27)
9 | for (var a = [b in c];;);
@@ -1128,7 +1145,6 @@ for (
(b in c);
};
;
);
for (var a = [(b in c)]; ; );
for (var a = { b: (b in c) }; ; );
@@ -1160,7 +1176,6 @@ for (
(a = () => {
b in c;
});
);
for (; (a = [b in c]); );
for (; (a = { b: b in c }); );
+1
View File
@@ -0,0 +1 @@
for ( let i = 0, j = 0, len = allMatches.length, lenJ = selections.length;i < len;) {}