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

import grouping/ordering consistency #602

Merged
merged 2 commits into from
Mar 20, 2017

Conversation

brendansudol
Copy link
Contributor

@jeremiak -- i want to propose a pattern/standard for our file imports:

  • 2 groupings: externals, relative
  • within each, we alphabetize according to the module name (as opposed to the function(s) names. i think this has a few benefits: 1) it keeps related things together (for example, d3-array, d3-scale, etc., regardless of what the specific functions we import from those libraries are) 2) it means that if we change the name of a function that we import (or if we update which functions we import), we don't have to move the line that it's on.
  • for relative imports, we group and alphabetize according to folder depth (i.e., first within same folder, then within ../foo, then ../foo2, then ../../bar...)
  • 2 lines after last import to better separate from main code

let me know what you think! if you like this, i'll update the remaining files :)

@jeremiak
Copy link
Contributor

I like it! Please keep updating :)

@brendansudol
Copy link
Contributor Author

awesome, thx!

@brendansudol brendansudol force-pushed the bjs-import-cleanup-proposal branch from 6fa1fe3 to 2894da5 Compare March 17, 2017 14:36
@brendansudol brendansudol force-pushed the bjs-import-cleanup-proposal branch from 2894da5 to 1e4fa67 Compare March 17, 2017 15:10
@brendansudol brendansudol merged commit 6bda2ea into master Mar 20, 2017
@brendansudol brendansudol deleted the bjs-import-cleanup-proposal branch March 20, 2017 14:42
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

Successfully merging this pull request may close these issues.

2 participants