Skip to content

Conversation

@sderrow
Copy link
Contributor

@sderrow sderrow commented Aug 11, 2025

In #601, I missed a couple critical cases:

  • else and else if statements, where the syntax error is actually at the start of the line, not the end
  • Lines that have comments at the end (e.g., if (foo) // here, we're doing xyz), since adding an empty block at the end would mean it'd be commented out if it's a // comment

@Shinigami92 hope you don't mind that I went straight for a PR instead of opening an issue first.

@sderrow sderrow marked this pull request as ready for review August 11, 2025 22:17
@sderrow sderrow requested a review from Shinigami92 as a code owner August 11, 2025 22:17
@github-actions
Copy link
Contributor

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 94.26% (🎯 90%)
⬆️ +0.04%
2731 / 2897
🟢 Statements 94.26% (🎯 90%)
⬆️ +0.04%
2731 / 2897
🟢 Functions 96.46% (🎯 90%)
⬆️ +0.04%
109 / 113
🟢 Branches 92.88% (🎯 90%)
⬇️ -0.08%
653 / 703
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/printer.ts 93.59%
⬆️ +0.08%
94.01%
⬇️ -0.13%
100%
🟰 ±0%
93.59%
⬆️ +0.08%
337-338, 374-375, 524-526, 538-547, 552-565, 612-667, 704-705, 790-794, 1143-1144, 1237-1238, 1265, 1274-1275, 1566-1567, 1613-1614, 2022-2028, 2066-2071
Unchanged Files
src/doctype-shortcut-registry.ts 100% 100% 100% 100%
src/index.ts 93.18% 100% 71.42% 93.18% 79-81, 84-86
src/logger.ts 77.46% 90.9% 81.81% 77.46% 37-46, 93-94, 153-157
src/options/common.ts 100% 100% 100% 100%
src/options/constants.ts 100% 100% 100% 100%
src/options/converge.ts 100% 60% 100% 100%
src/options/index.ts 100% 100% 100% 100%
src/options/pug-attribute-separator.ts 89.74% 75% 100% 89.74% 52-55
src/options/pug-class-location.ts 100% 100% 100% 100%
src/options/pug-class-notation.ts 100% 100% 100% 100%
src/options/pug-closing-bracket-indent-depth.ts 100% 100% 100% 100%
src/options/pug-comment-preserve-spaces.ts 100% 100% 100% 100%
src/options/pug-explicit-div.ts 100% 100% 100% 100%
src/options/pug-framework.ts 100% 100% 100% 100%
src/options/pug-id-notation.ts 100% 100% 100% 100%
src/options/pug-preserve-attribute-brackets.ts 100% 100% 100% 100%
src/options/pug-preserve-whitespace.ts 100% 100% 100% 100%
src/options/pug-single-file-component-indentation.ts 100% 100% 100% 100%
src/options/pug-wrap-attributes.ts 100% 100% 100% 100%
src/options/types.ts 100% 100% 100% 100%
src/options/attribute-sorting/index.ts 100% 100% 100% 100%
src/options/attribute-sorting/utils.ts 95.69% 94.44% 100% 95.69% 82-83, 94-95
src/options/empty-attributes/index.ts 100% 100% 100% 100%
src/options/empty-attributes/types.ts 100% 100% 100% 100%
src/options/empty-attributes/utils.ts 100% 100% 100% 100%
src/utils/angular.ts 100% 100% 100% 100%
src/utils/common.ts 89.67% 86.11% 100% 89.67% 19-20, 27-28, 56-57, 258-259, 262-263, 269-272, 331-332
src/utils/script-mime-types.ts 87.5% 83.33% 100% 87.5% 42-43, 49-50
src/utils/svelte.ts 100% 100% 100% 100%
src/utils/vue.ts 100% 100% 100% 100%
Generated in workflow #855 for commit f4cd646 by the Vitest Coverage Report Action

@Shinigami92 Shinigami92 added the type: enhancement Functionality that enhances existing features label Aug 12, 2025
@Shinigami92 Shinigami92 merged commit 53d392f into prettier:main Aug 12, 2025
10 checks passed
@Shinigami92
Copy link
Member

As usual, release hopefully in the evening, because I wont like to release from my company laptop 😉

@sderrow sderrow deleted the handle-else-blocks-and-comments branch September 18, 2025 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement Functionality that enhances existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants