Skip to content

Lint for package-prefixed library names (Style Guide) #57166

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

Closed
pq opened this issue Feb 10, 2015 · 1 comment
Closed

Lint for package-prefixed library names (Style Guide) #57166

pq opened this issue Feb 10, 2015 · 1 comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-lint-request type-enhancement A request for a change that isn't a bug

Comments

@pq
Copy link
Member

pq commented Feb 10, 2015

DO prefix library names with the package name and a dot-separated path.

This guideline helps avoid the warnings you get when two libraries have the same name. Here are the rules we recommend:

  • Prefix all library names with the package name.
  • Make the entry library have the same name as the package.
  • For all other libraries in a package, after the package name add the dot-separated path to the library’s Dart file.
  • For libraries under lib, omit the top directory name.

For example, say the package name is my_package. Here are the library names for various files in the package:

GOOD:

// In lib/my_package.dart
library my_package;

// In lib/other.dart
library my_package.other;

// In lib/foo/bar.dart
library my_package.foo.bar;

// In example/foo/bar.dart
library my_package.example.foo.bar;

// In lib/src/private.dart
library my_package.src.private;
@pq pq added the type-enhancement A request for a change that isn't a bug label Feb 10, 2015
@pq pq changed the title Lint for package-prefixed library names(Style Guide) Lint for package-prefixed library names (Style Guide) Feb 10, 2015
@pq
Copy link
Member Author

pq commented Feb 14, 2015

Accidentally closed

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-lint-request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants