Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set indent depth of closing brackets #502

Merged
merged 5 commits into from
Sep 6, 2024
Merged

Add option to set indent depth of closing brackets #502

merged 5 commits into from
Sep 6, 2024

Conversation

MrHaila
Copy link
Contributor

@MrHaila MrHaila commented Sep 4, 2024

Closes #501

Adds a new option to modify how deep the closing brackets are indented when bracketSameLine is not used. Defaults (= null) to the current behavior and allows the choices of 0 (current default) or 1 (indent by +1).

I chose to add the feature as a numeric depth parameter instead of a true/false flag because it's a good way to communicate the feature, and there seem to be issues with passing booleans into Prettier plugins. Added tests to verify the new option.

Feedback is very much welcome if this approach makes sense!

@MrHaila MrHaila requested a review from Shinigami92 as a code owner September 4, 2024 11:41
@MrHaila
Copy link
Contributor Author

MrHaila commented Sep 4, 2024

Test names fixed 🙏

@MrHaila
Copy link
Contributor Author

MrHaila commented Sep 4, 2024

Looks like I mistakenly didn't commit in an unformatted input file for the tests, thus failing them for CI. Fixed. 🤦‍♂️

@Shinigami92
Copy link
Member

I'll have a last in-depth look tomorrow

@Shinigami92 Shinigami92 added the type: feature request Functionality that introduces a new feature label Sep 6, 2024
Add an option to set the indent depth of closing brackets
@MrHaila
Copy link
Contributor Author

MrHaila commented Sep 6, 2024

Thanks for the cleanup commit. It makes sense. Unfortunately I literally can't see the UI for enabling upstream commits as per Github's documentation.

Maybe our org has some global setting to disable it. Should have forked on my personal account instead. Sorry about that 😅

@Shinigami92
Copy link
Member

Thanks for the cleanup commit. It makes sense. Unfortunately I literally can't see the UI for enabling upstream commits as per Github's documentation.

Maybe our org has some global setting to disable it. Should have forked on my personal account instead. Sorry about that 😅

Yeah that's it, it needs to be from a non-org account 👌

@Shinigami92
Copy link
Member

Merging this now, but I need to cleanup some more things before the next release. So potentially a release could come around weekend, depending on how much time I can spend.

@Shinigami92 Shinigami92 changed the title Add an option to set the indent depth of closing brackets Add option to set indent depth of closing brackets Sep 6, 2024
@Shinigami92 Shinigami92 merged commit b09da87 into prettier:main Sep 6, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request Functionality that introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to indent the closing bracket of a multiline element by +1
2 participants