Open ivan-korshun opened 9 years ago
Could you elaborate on that? What rules would you add on naming convention?
UploadMedia dialog has the "UploadMediaDialog.js" page code file. So we should use PascalCase when naming JS page code files.
If duplicated code had been extracted from serveral page codes into a separate JS file, then this file should also use PascalCase naming.
However SPEAK components use internal JS modules that use camelCase naming. For example, "userProfile.js".
Shouldn't we use the same casing for ALL the JavaScript files?
Yes, we should. But some of third party JS files use lowercase naming (bootstrap.js, fusioncharts.js). The others use "-" or "." as a separator (jquery.ui.js, jquery-ui.js). SPEAK core JS uses camelCase naming (sitecore-1.0.2.js).
I don't think we need to worry about 3rd party JS files (they are out of our control).
I'm not hearing a definite decision about this. What are the implications if we decide that all Sitecore provided file names follow the same casing rules, and this means that we need to change the name of some existing files?
URL are case insensitive so renaming should not be a problem (but for sure, their could be exception with some handlers). but anyway we should not start to rename all the files that we have.
We should just make sure that from now on, all new files follow the same rule.
Requirejs is case sensitive when requiring.
OK, so perhaps we could add a bullet saying:
I like the lower.case.with.point.separator.js
naming.
Do not think it is a good idea. You end up with people arguing about where to put the ".". Moreover a "." suffix generally expresses the file type or sub type.
Also, it could break some code (I hope not but let's be defensive) with people doing something like:
name.split(".")[1]
to get the file type.
I am voting for camelCase, then.
Thanks for that discussion, shall I add the following bullet then?
Yes, please. Pierre agrees with it.
Done.
Damn I missed this discussion, but I am still not sure why this approach has been chosen.
The normal approach in the .NET world is to create files in PascalCasing. And since this is for PageCode only, then I think it is a wrong choice to go camelCasing, since it will mainly be "SPEAK customers" who will use this guideline.
Now if we also apply this to our components, then I also think it is wrong, since all the other files in the SPEAK project (.cshtml, .cs, .less etc.) are also in PascalCasing.
So I still think it is hard to understand why we should use camelCasing, since Sitecore general usually using PascalCasing.
Everything else that we have in the project is currently in PascalCasing, I see no reason to change that.
The following is written in JavaScript.md:
Maybe we should add a rule for names of JavaScript files.