gothinkster / aurelia-realworld-example-app

Exemplary real world application built with Aurelia
https://realworld.io
MIT License
183 stars 32 forks source link

Follow Aurelia naming conventions #1

Closed ajile-in closed 6 years ago

ajile-in commented 6 years ago

See: https://github.com/jadhavajay/aurelia-realworld-example-app/issues/6

loaded02 commented 6 years ago

Is there an Aurelia filename naming convention??? Cause when I use aurelia-cli with au generate element MyTestElement it generates mytestelement.js. And I know that in the official docs my-test-element.js is used. So what should I think of this? I used aurelia-cli for this project. That's why it ended up like this.

3cp commented 6 years ago

Sorry for late reply, I forgot to subscribe this issue.

@loaded02 you can use au generate my-test-element, probably cli should be smarter to normalise file name to kebab case foo-bar. It is not an enforced rule, that's why I use term "convention" as all official Aurelia repos follow the kebab case.

Obviously Aurelia is permissive enough to accept both mytestelement.js and my-test-element.js. Aurelia component did not use default export, so you need to match that file name with export class MyTestElement. If you write export class Foo inside, that would not work with <require from="./my-test-element"></require>.

note: if the component is loaded by router, current aurelia-router doesn't require you to match the file name with class name. It will just use the first exported class.

loaded02 commented 6 years ago

@huochunpeng thanks for the facts! If you like feel free to submit a pr. it would be just refactoring work. i'll be happy to merge it.