Hi, having seen many Ionic-related starter apps, Git repos, sample apps and so on, I noticed that (almost) nobody is using ES5 “use strict”.
Just for this reason I’m also not using it, but does anyone know why this doesn’t seem to be common practice with Ionic apps? Maybe just coincidental but if anyone has experiences (good or bad) with “use strict” then I’d love to know.
"use strict" is used just to make sure you write what is considered more ‘secure’ JavaScript code. It basically just means you can’t use undeclared variables as well as a few other features.
Thanks, yes I know … I just noticed that in all of the code of Ionic apps nobody seems to use it, that’s all. But probably it’s just to reduce some clutter in demo code.
Yeah I think it’s usually just because people don’t tend to stick to writing that strict and don’t often include it because the code can run the same with or without it. I guess it probably is best to use it as a means of best practice though.
Big advantage --> everyone in the company is writing the same code-style without defining long lists of coding guidelines for such things. … and the best case would be --> everybody understands the code of the others
i have a requirejs environment, where all files are wrapped in define / require blocks and you code is defined as a callback - so i have already wrapped everything in a function
Nice blog, only the post titled “style guide” isn’t really a Style Guide. But since an Ionic app is an Angular app I think we can utilize one of the angular style guides (e.g. John Papa’s) ? And for the rest the various “starter apps” help a lot.
I think the Ionic team can still do things here e.g. in the form of providing some more advanced starter apps (with a better gulp file, require.js and so on) and a set of “best practices”.
Ionic’s misson is to make stuff easy and indeed it is easy (for a simple app) but there’s still room for improvement.