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

New option for order rule to allow spaces inside import groups. #627

Closed
giodamelio opened this issue Oct 15, 2016 · 7 comments · Fixed by renovatebot/renovate#217
Closed

Comments

@giodamelio
Copy link
Contributor

giodamelio commented Oct 15, 2016

I currently use the order rule with the newlines-between option set to always, the problem is, I would like to be able to have newlines inside my import groups(to allow sorting by related categories).

The always rule states(emphasis mine)

If set to always, at least one new line between each group will be enforced, and new lines inside a group will be forbidden. To prevent multiple lines between imports, core no-multiple-empty-lines rule can be used.

It would be nice to be able to control whether newlines are allowed within import groups. I was thinking maybe adding a boolean option newlines-inside that would allow you to make the choice. If the default is false, it should be backwards compatible.

I want to make a pull, but I was wondering what you think of this @benmosher, before I get started.

@jfmengels
Copy link
Collaborator

I'm fine with having this kind of option.

I'm thinking this should instead be a new possible value for newlines-between. It would be odd to be able configure newlines-between to never, and the new one to allow them. That would mean that you could only have empty lines inside groups, which is odd and counter to the idea of this rule.

@giodamelio
Copy link
Contributor Author

giodamelio commented Oct 16, 2016

Right, that wouldn't make much sense. So a new value it is. Not quite sure what to call it without being super verbose. always-with-newlines? always-extra-newlines? always-newlines?

@jfmengels
Copy link
Collaborator

ignore-everywhere? It's more or less the same idea as the current ignore

@giodamelio
Copy link
Contributor Author

I was talking about still forcing newlines between groups, but also allowing them within them.

@jfmengels
Copy link
Collaborator

Ah. That means that there are a few different new values to add...

  • Option to enforce always but allow inside groups
  • Option to enforce no newlines but allow inside groups (which we said was odd, so will not be added)
  • Option to not enforce it and not report inside groups (which I'll have to check whether that's not already the behavior of ignore).

So you'd probably need two new options... What do you think?

@giodamelio
Copy link
Contributor Author

Sounds good, #628 covers option 1, option 2 is ignored. If I understand you correctly option 3 is already covered by ignore.

giodamelio added a commit to giodamelio/eslint-plugin-import that referenced this issue Oct 16, 2016
giodamelio added a commit to giodamelio/eslint-plugin-import that referenced this issue Nov 15, 2016
giodamelio added a commit to giodamelio/eslint-plugin-import that referenced this issue Jan 21, 2017
@tiagocpontesp
Copy link

tag and pub? :)
btw #628 still open.

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

Successfully merging a pull request may close this issue.

3 participants