-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 import-order
rule
#247
Conversation
Looks good to me, if it works for you. I don't have a lot of opinions about this, beyond just supporting the notion of the I did just push some README/CHANGELOG changes that caused the conflicts. Can you rebase and update CHANGELOG to reference this PR? Also, thank yourself? 😉 |
I think I'll apply the changes I proposed above tonight, if you don't mind waiting a bit before merging this.
What about |
As for merge timeline, totally up to you. Let me know when you're ready. 😄 |
I'd like some thoughts on what we should do if some types are omitted. Should we ignore those imports, lint an error if they are encountered (saying that they should cover it in the configuration), give a default to each rule, ...? |
i.e. spec is just I imagine there being an implicit So |
Hmm, so order: [
[ "external", "internal" ]
] would implicitly be order: [
[ "external", "internal" ],
[ "builtin-in", "sibling", "index", "..." ],
] I like it.
I think so yes. I think that I'll add |
Makes sense to me, I'd expect it to come after external packages and before relative imports.
That's right, I think any unresolved Resolved paths that aren't rooted in I think it probably makes sense to wait for the issue to be filed by the 1 person who is using Webpack, Bower, and |
Also, brain blast: should this rule be named ---
rules:
import/order: [ error, groups: [...] ] Seems more natural than I've also renamed the No worries either way, just dawned on me, and now is a better time than later. |
Previous and default behavior still work :) |
Sweet! If you're happy with it, I think it's probably all good, but I'll try to take a look in the next day or two! Out of town this weekend so it might be a bit, though. Just heads up. |
No rush here :) |
LGTM |
@jfmengels Is jfmengels/eslint-plugin-import-order#10 taken into account here? |
Ah no, didn't think of adding that. I could add it, though not sure whether to add it as an option (probably), and if so, enabled by default (probably not)? What do you think about |
Why would you want it as an option? This is about sorting them in separate steps. There's no good reason to mix them. |
That makes sense 👍 |
I just added an item to the checklist, just trying to remind myself so I don't prematurely merge. Seems like a good thing to get in before this incarnation is published. |
Separated Also, updated Let me know what you think. (I rebased, but only the two last commits are responsible for the changes this time) |
LGTM I'm super excited about this rule. Great work @jfmengels ✨ |
I'm happy with it whenever you guys are. 😎 I'd merge it now but I'm still AFK and I think merging the no-nodes-modules created the merge conflicts. @jfmengels, if you want to go ahead and merge directly to master that's fine with me, or if you want to just rebase I can push the button. |
@benmosher Rebased it (yes, it was my own |
Well, that was a longer process than expected, but it went well :) |
I think so too. And your package lives on here! 😄 |
And even better than before! |
🎉💃 can't wait for a release! |
Awesome job @jfmengels! I'm implementing that rule now and just noticed that if we have "import/order": ["error", {"groups": [
["builtin", "external"], //whatever order here
["internal", "index", "sibling", "parent"] //whatever order here
]}] |
@singles Thanks! And yes, you're right : #259 ;) |
This is a port from https://github.com/jfmengels/eslint-plugin-import-order.
Now that the
project
type is available inimportType
, we could add it in the order list. It should not have to be there by default though, so we have to loosen up the JSON schema.And while we're at it, I like the flexibility of the grouping described here #246 (comment), which can complement what already exists too (the old way would still be possible).
Let me know what you guys think of these, and if there's anything I forgot.
cc @singles @sindresorhus @duncanbeevers
task list:
order
require
independently as a second group(@jfmengels: just added this to aggregate ideas from thread and track, you can check off/edit/delete as you see fit --ben)
(@benmosher: All checked, thanks :D)