--closurized_namespaces="goog,myrootnamespace" \
Wow never knew about closurized_namespaces property. I must admit I got a bit excited but after testing this I got a lot of errors; fixjsstyle added tons of invalid requires to global/static fields/functions/members. And it cleaned up unused requires that are actually used. A few example of the errors are:
Error 1: Say I have a static / globals file like:
goog.provide('ns.defaultformats');
ns.defaultformats.dateFormat = new goog.i18n.DateTimeFormat(datepattern);
... // Other defaults / globals here
If I use this somewhere else, I expect to:
goog.require('ns.defaultformats');
...
var dateformat = ns.defaultformats.dateFormat;
However, the closurized_namespaces addedd a require to ns.defaultformats.dateFormat which gjslint correctly identifies as not having been provided.
Error 2: Removing namespace imports.
I like the java style of importing namespace.*; To do this in closure I sometimes use what I call namespace files. An example may be this:
goog.provide('ns.dal');
goog.require('ns.dal.User');
goog.require('ns.dal.Account');
goog.require('ns.dal.UserSettings');
goog.require('ns.dal.AccountSettings');
...
And then in any file that needs to use my model (data access layer) I just import ns.dal goog.require('ns.dal') this is a nice workaround for missing wildcard imports but again not compatible with closurized_namespaces.
After this I reverted my changes so not sure if any other conflicts with my codebase exist.
Anyways, would love to see closurized_namespaces be a bit smarter.
Thanks for the heads up tho James, it is an interesting feature
Guido