Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Specify preferred order of imports in Style Guide #860

Closed
nicolasgarnier opened this issue Aug 26, 2014 · 9 comments
Closed

Specify preferred order of imports in Style Guide #860

nicolasgarnier opened this issue Aug 26, 2014 · 9 comments

Comments

@nicolasgarnier
Copy link
Contributor

From [email protected] on April 29, 2014 18:50:07

General convention is:

"dart:" libraries should come before "package:" imports, and the two should be separated by a space.

This is a SHOULD, not a MUST.

Original issue: http://code.google.com/p/dart/issues/detail?id=18527

@nicolasgarnier
Copy link
Contributor Author

From [email protected] on April 29, 2014 10:17:59

Labels: -Docs-Articles Docs-StyleGuide

@nicolasgarnier
Copy link
Contributor Author

From [email protected] on April 29, 2014 12:21:47

I believe some guidelines are intentionally kept out of the style guide so that it's easily readable by users who just want an overview of the general style. I think there's been some talk of creating a more complete style reference, but I don't know if anything's happened with that.

Also, while we're talking about import style, relative imports should be in yet a third block, and all blocks should be ordered alphabetically.

Cc: [email protected]

@nicolasgarnier
Copy link
Contributor Author

From [email protected] on April 29, 2014 12:52:25

Thanks for the feedback, Nathan. Until we have a "complete style guide", I'm worried about tribal knowledge not being recorded. I'd like the tech writers to decide if we have critical mass for a "complete style guide", or if we can extend an existing style guide. One concern with two styles guides: keeping them in sync, having to go to two places, and how to decide if something is specific or general.

@nicolasgarnier
Copy link
Contributor Author

From [email protected] on May 14, 2014 13:39:04

personally, I think it should all be part of the same guide.

  • agree that blocks should be ordered alphabetically
  • we should make exports a fourth group, followed finally by parts.

I wonder if we should also split other packages from the self-package imports. For example, as follows:

  • import dart:*
  • import package:* // other packages
  • import package:* // this package
  • import relative
  • export package:*
  • export relative
  • part package:*
  • part relative

@nicolasgarnier
Copy link
Contributor Author

From [email protected] on May 14, 2014 18:54:43

Labels: -Area-Documentation Area-Site

@nicolasgarnier
Copy link
Contributor Author

From [email protected] on May 22, 2014 15:44:45

Cc: [email protected]

@munificent
Copy link
Contributor

Subset of #635.

@kwalrath
Copy link
Contributor

@kwalrath
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants