-
Notifications
You must be signed in to change notification settings - Fork 45
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: allows users to enter { newlinesBetween }
in groups
#435
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0cfa6ab
to
b720a00
Compare
newlinesBetween
in groups
newlinesBetween
in groups
{ newlinesBetween }
in groups
d561f91
to
b2a7ddd
Compare
…ways' | 'never' }` in `groups`
a45b955
to
99e6a29
Compare
99e6a29
to
2ae6c4c
Compare
azat-io
approved these changes
Jan 3, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #401
Continuation of #428.
customGroup.newlinesInside
option. We will take the opportunity to create agetNewlinesBetweenOption
method that will help us later to precisely customize newline behavior between two specific groups.Description
Allows users to enter
{ newlinesBetween: 'always' | 'never' | 'ignore' }
between elements of thegroups
option. This enables precisely setting/overriding the newline behavior between two groups.Example:
{ newlinesBetween: 'ignore' }
is only useful if anewlinesBetween
option different fromignore
is set.{ newlinesBetween }
objects in a group configuration will raise an error:Consecutive 'newlinesBetween' objects are not allowed
.Impacted rules
sort-imports
sort-intersection-types
sort-union-types
sort-classes
sort-modules
sort-object-types
sort-interfaces
Additional notes
❓ Is this better than proposal 1 ?
Proposal 1:
You can see a proof of concept PR here.
I believe the current implementation is superior:
newlinesAbove
incompatible with thenewlinesUnder
of the above group.groups
.❓ Why not use string tokens instead of an object, such as
"newlinesBetween:always"
?I believe that an object gives us more flexibility in the future if we want to allow users to pass additional options.
It's also easy to distinguish those objects from the group names.
What is the purpose of this pull request?