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
Removing some magic to make naming conventions more sane #218
Removing some magic to make naming conventions more sane #218
Conversation
So does this mean no hyphens in filenames going forward? |
@dustinfarris yes, that is the idea. The reasoning is, less ambiguity === a good thing. I would be interested in hearing others thoughts on this, as I know I tend to prefer to avoid ambiguity + unneeded complexity. |
really can't see a case where allowing both would lead to ambiguity; the only "complicated" part of this is within the resolver, not anything that gets customized |
I have been bitten many times trying to figure out where ember wants under_score, lowerCamelCase or dash-er-ized strings ... I'd love to see it only work one way here. Normalizing isn't always a feature. |
@thomasboyt I would prefer we make this strict for now, we can always loosen the constraints later. |
This seems user-friendly and not confusing to me. If we had a solid technical reason for changing this, I'd be okay with it, but I'm not seeing it. Here's the situation after this change:
If we do this, we need to make it clear that view helpers are using module names (i.e. file names) and that components have different file name rooms (or autoconvert snake case component names to dasherized) |
The current implementation utilizes a hack I added to almond to inspect the "registry" to make the choice. The only other option I see is wrapping require is a try/catch and attempting the other variation. Additionally, I see little win for supporting both. |
|
||
if (parsedName.fullName === 'router:main') { | ||
// for now, lets keep the router at app/router.js | ||
return require(prefix + '/router'); | ||
} | ||
|
||
if (requirejs._eak_seen[normalizedModuleName]) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice if require supported has
We should use either camelCase, snake_case or dashes. The javascript world generally aggrees on using dashes for filenames. And with ember this seems to be a good idea, too. |
@MajorBreakfast we aim to only use dashes. 0 ambiguity is very important.
|
@mikegrassotti have any time to continue working on this one? |
@stefanpenner The WIP commit that started this discussion seemed to converting dasherized-filenames to underscored_file_names ... |
@@ -74,31 +58,33 @@ define("resolver", | |||
|
|||
// allow treat all dashed and all underscored as the same thing | |||
// supports components with dashes and other stuff with underscores. | |||
var normalizedModuleName = chooseModuleName(requirejs._eak_seen, moduleName); | |||
var normalizedModuleName = Ember.String.underscore(moduleName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line also seems to indicate that you are moving to underscored names instead of dasherized names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on disk underscored, in ember dasherized.
Is that it? |
on disk: snake_cased everything |
Great.. Thanks for the clarificaiton On Fri, Oct 18, 2013 at 2:56 PM, Stefan Penner notifications@github.comwrote:
|
Snake case module names might be a bad idea, because node modules are always dasherized. I think npm even enforces that. |
@MajorBreakfast interesting... then maybe we must dasherize |
Despite the commit message I am not against dashes. Just as long as we are consistent. — On Fri, Oct 18, 2013 at 5:14 PM, Stefan Penner notifications@github.com
|
File names often end up in urls and most sites prefer dashes there, too. So, modules AND file/folder names dasherized? |
I agree with @MajorBreakfast here. Why do we want file names to be underscored when module names have to be dasherized? If we want one convention to rule them all, we should be switching completely to dashes instead. Also, components (both Ember and web component spec) enforce dashes, so dashes should be the convention going forward. |
I'm for 1 convention to rule them all, dasherized in all the places would be fine with me. (i believe) |
this work has been pushed to https://github.com/stefanpenner/ember-jj-abrams-resolver |
Related: #184
Still a wip, this is where steph and i left off when pairing earlier.