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

chore(imports): Direct internal imports #610

Merged
merged 1 commit into from
Oct 4, 2016

Conversation

jeffcarbs
Copy link
Member

@jeffcarbs jeffcarbs commented Oct 3, 2016

As per discussions https://github.com/TechnologyAdvice/stardust/pull/570#discussion_r81445116 and https://github.com/TechnologyAdvice/stardust/issues/524#issuecomment-250935483:

  • updates all internal imports to be directly to the file instead of using the index.js in each "type" folder
  • remove the index files in "type" folders.

Open questions:

  • Should each top-level component (e.g. Button get its own index file? Would make it possible to do import Button from 'stardust/elements/Button instead of needing the double /Button/Button. Sub-components would still be referenced at the nested path, which I think makes sense stardust/elements/Button/ButtonContent. Thoughts?

@jeffcarbs jeffcarbs changed the title Feature/direct imports chore(imports): Direct internal imports Oct 3, 2016
@besh
Copy link

besh commented Oct 3, 2016

I'm for the index files. If you didn't want to bring in index files, you could toss a package.json file in each dir and set the main key to Button.js. Not saying this is the best thing to do but it is another option.

@levithomason
Copy link
Member

Agree on not duplicating the component name in import paths. My first thought is an index.js file as well.

@levithomason
Copy link
Member

levithomason commented Oct 3, 2016

Heads up, regarding conformance tests (near the top of the common tests):

https://github.com/TechnologyAdvice/stardust/issues/524#issuecomment-250935483 Lastly, the common tests for exported components needs updated. The failure message instructs users to export their components in those index files. Once we remove them, that message is no longer valid. It should instead instruct users to export their components in the main index file.

@codecov-io
Copy link

codecov-io commented Oct 4, 2016

Current coverage is 100% (diff: 100%)

Merging #610 into master will not change coverage

@@           master   #610   diff @@
====================================
  Files         119    119          
  Lines        1915   1915          
  Methods         0      0          
  Messages        0      0          
  Branches        0      0          
====================================
  Hits         1915   1915          
  Misses          0      0          
  Partials        0      0          

Powered by Codecov. Last update ecbf72a...9429517

* Change imports from type index to direct
* Remove index files in type folders
* Add index.js to each component folder
* Update internal cross-component usage to use component index
@jeffcarbs
Copy link
Member Author

Just force-pushed a small change. I was going to update the tests to use the index-based imports but decided against it. I kinda like having the test import directly from the file they're testing.

Otherwise this is g2g I think 👍

@levithomason
Copy link
Member

👍 Great work, will review and merge soon as I can.

@levithomason levithomason merged commit 50b3241 into master Oct 4, 2016
@levithomason levithomason deleted the feature/direct-imports branch October 4, 2016 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants