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

Do not name modules "module" #178

Open
kettanaito opened this issue Aug 14, 2017 · 4 comments
Open

Do not name modules "module" #178

kettanaito opened this issue Aug 14, 2017 · 4 comments

Comments

@kettanaito
Copy link
Contributor

kettanaito commented Aug 14, 2017

What

We should not have a module/component named "module".

Why

module is a global variable inserted into code during the compilation. For instance, module is also responsible for HMR in webpack builds. We have just experienced this issue with @ronaldruzicka today morning:

import module from './components/module';
...
if (module.hot) {
  // Provide HMR logic
}

There are no hot updates accepted, since module is being overwritten with our custom component with the same name.

How

I would recommend to remove "module" example completely, since it doesn't add any value to the devstack (neither it shows some good practices, nor has an objective value, like being a useful snippet or reusable component).

@ronaldruzicka
Copy link
Contributor

I'm doing an update of our packages and for the js example I named the module suffix.js since it's adding a _js suffix to the title. But maybe we can create some better js example.

@kettanaito
Copy link
Contributor Author

kettanaito commented Aug 16, 2017

@ronaldruzicka nice!
But I really don't see the point of having something which doesn't contribute to the end-product's value. This is like setting up hidden bombs in the code, which may lead to code leftovers.
Good example is what @zoltan-kovac has discovered recently: there is a PlusOne example from our devstack being bundled for the production of one of our projects :/
I remember some discussion about providing Collapse as a default Javascript example.

@vbulant
Copy link
Contributor

vbulant commented Aug 16, 2017

@ronaldruzicka there also is a cookie law module as an example so I think we may delete the suffix.js (previously module.js) altogether…

Regarding @kettanaito’s concern – I find it difficult to address it. The same may happen with the bootstrap.less – you can include half of the bootstrap modules while using only a handful of them. So it’s more about the developer’s care I think. But in general I agree that it’s better to avoid having lots of examples in the devstack (if any) and try to create more complex boilerplates/examples separately maybe (?)

@vbulant
Copy link
Contributor

vbulant commented Aug 16, 2017

There is another discussion about JS examples: #82 The Collapse component mentioned by @kettanaito is mentioned there as well.

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

No branches or pull requests

3 participants