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

feat(Formatter): add space inside option #4605

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

sirreal
Copy link

@sirreal sirreal commented Nov 20, 2024

WIP

Summary

Add formatting option to include spacing inside parentheses, square brackets, curly braces, and angle brackets.

For example, this input:

function id<TypeArg>(x: TypeArg): TypeArg {
	return x;
}
const arr = [1, 2, 3];
if (id(true)) {
	// …
}

Would be formatted as follows with a "space inside" option enabled:

function id< TypeArg > ( x: TypeArg ): TypeArg {
	return x;
}
const arr = [ 1, 2, 3 ];
if ( id( true ) ) {
	// …
}

See #2360 (comment).
Closes #4607 (eventually).

Test Plan

@github-actions github-actions bot added A-CLI Area: CLI A-Project Area: project A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages labels Nov 20, 2024
@sirreal sirreal changed the title Add space inside option feat(formatter): Add space inside option Nov 20, 2024
@sirreal sirreal changed the title feat(formatter): Add space inside option feat(Formatter): Add space inside option Nov 20, 2024
@sirreal sirreal changed the title feat(Formatter): Add space inside option feat(Formatter): add space inside option Nov 20, 2024
@ematipico
Copy link
Member

@sirreal would you mind creating a task first? Or an umbrella issue?

This isn't something that we might be able to ship in one PR, there's a lot of stuff to take into account:

  • CLI
  • option names
  • comments
  • formatting strategies

@sirreal
Copy link
Author

sirreal commented Nov 20, 2024

Sure, thanks. I've created #4607.

This PR really a placeholder and I have a number of questions of my own after spending just a bit of time on this 🙂

Copy link

codspeed-hq bot commented Nov 20, 2024

CodSpeed Performance Report

Merging #4605 will not alter performance

Comparing sirreal:add/space-around-format-option (19de599) with main (610d09d)

Summary

✅ 97 untouched benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI A-Formatter Area: formatter A-Project Area: project L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

📎 Implement formatting option to include space inside parens, braces, brackets, etc.
2 participants