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

So how do you remove blank lines between groups? #134

Closed
Mitsunee opened this issue May 26, 2023 · 4 comments
Closed

So how do you remove blank lines between groups? #134

Mitsunee opened this issue May 26, 2023 · 4 comments

Comments

@Mitsunee
Copy link

The README mentions "Remove blank lines between groups." as a thing you can do with custom grouping, but never mentions how to actually do it. I do not like these empty lines and would like to disable them (i.e. join on only one newline character)

@lydell
Copy link
Owner

lydell commented May 26, 2023

It does mention it, it’s just very subtle:

The inner arrays are joined with one newline; the outer arrays are joined with two (creating a blank line).

A bit further down, there’s also a link to examples, which contains:

{
files: ["groups.no-blank-lines.js"],
rules: {
imports: [
"error",
{
// The default grouping, but with no blank lines.
groups: [["^\\u0000", "^node:", "^@?\\w", "^", "^\\."]],
},
],
},
},
{
files: ["groups.default-reverse.js"],
rules: {
imports: [
"error",
{
// The default grouping, but in reverse.
groups: [["^\\."], ["^"], ["^@?\\w"], ["^node:"], ["^\\u0000"]],
},
],
},
},

@Mitsunee
Copy link
Author

I understood "Remove blank lines between groups." to mean that there is a way to configure whether groups are joined on one or two newlines. Is there no way to do that other than having all patterns in the same group? If so the sentence I quoted is a bit missleading since it implies the use of multiple groups.

@lydell
Copy link
Owner

lydell commented May 26, 2023

Is there no way to do that other than having all patterns in the same group?

Correct.

If so the sentence I quoted is a bit missleading since it implies the use of multiple groups.

What could a less misleading sentence look like?

@Mitsunee
Copy link
Author

What could a less misleading sentence look like?

How about "Avoid blank lines between imports by using a single group."?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants