PDA

View Full Version : [UNKNOWN][3.x] Has anybody run lint against ext-all-debug.js?



meroy
15 Dec 2009, 7:58 PM
http://www.javascriptlint.com/download.htm

Update: This work was done against SVN 5789. End of post #7 shows missing comma.

-- Line 505, missing semicolon, core/core/EventManager.js:



//Initialize doc classes
(function(){

var initExtCss = function(){
...
}; // <-- here

if(!initExtCss()){
Ext.onReady(initExtCss);
}
})();


-- Line 356, missing semicolon, util/UpdateManager.js:



formUpdate : function(form, url, reset, callback){
var me = this;
if(me.fireEvent(BEFOREUPDATE, me.el, form, url) !== false){
if(Ext.isFunction(url)){
url = url.call(me);
}
form = Ext.getDom(form); // <-- here
me.transaction = Ext.Ajax.request({
form: form,
url:url (https://www.extjs.com/forum/url),
success: processSuccess,
failure: processFailure,
scope: me,
timeout: (me.timeout*1000),
argument: {
"url": url,
"form": form,
"callback": callback,
"reset": reset
}
});
me.showLoading.defer(1, me);
}
},


There are a total of 57 "missing semicolon" lint warnings.

Unfortunately, I don't have the time now to go through the lint output and review each of the 517 warnings. I'm happy to report that there were 0 error(s) reported. Most of the warnings are ok though. The ones above are not. I will review the "missing semicolon(s)" though and report them here.

meroy
15 Dec 2009, 8:11 PM
-- Line 156, missing semicolon, util/Date.js



// private
Date.formatCodeToRegex = function(character, currentGroup) {
// Note: currentGroup - position in regex result array (see notes for Date.parseCodes below)
var p = Date.parseCodes[character];
if (p) {
p = typeof p == 'function'? p() : p;
Date.parseCodes[character] = p; // reassign function result to prevent repeated execution
}

return p? Ext.applyIf({
c: p.c? xf(p.c, currentGroup || "{0}") : p.c
}, p) : {
g:0,
c:null,
s:Ext.escapeRe(character) // treat unrecognised characters as literals
}
}; // <-- here

// private shorthand for Date.formatCodeToRegex since we'll be using it fairly often
var $f = Date.formatCodeToRegex;



-- Line 46, missing semicolon, core/Error.js



Ext.Error = function(message) {
// Try to read the message from Ext.Error.lang
this.message = (this.lang[message]) ? this.lang[message] : message;
}; // <-- here
Ext.Error.prototype = new Error();

meroy
15 Dec 2009, 8:13 PM
-- Line 257, missing semicolon, widgets/layout/BoxLayout.js:



// Apply heights
for (i = 0 ; i < csLen; i++) {
c = cs[i];
cm = c.margins;
t += cm.top;
aw = availableWidth;
cl = l + cm.left; // default left pos // <-- here
// Adjust left pos for centering
if(this.align == 'center'){
if((diff = availableWidth - (c.getWidth() + cm.left + cm.right)) > 0){
cl += (diff/2);
aw -= diff;
}
}
c.setPosition(cl, t);
if(isStart && c.flex){
ch = Math.max(0, heights[idx++] + (leftOver-- > 0 ? 1 : 0));
c.setSize(aw, ch);
}else{
ch = c.getHeight();
}
t += ch + cm.bottom;
}

meroy
15 Dec 2009, 8:20 PM
-- Line 14, missing semicolon, data/JsonWriter.js:



Ext.data.JsonWriter = function(config) {
Ext.data.JsonWriter.superclass.constructor.call(this, config);
// careful to respect "returnJson", renamed to "encode"
// TODO: remove after Ext-3.0.1 release
if (this.returnJson != undefined) {
this.encode = this.returnJson;
}
}; // <-- here
Ext.extend(Ext.data.JsonWriter, Ext.data.DataWriter, {
...
});


-- Line 181, missing semicolon, data/XmlReader.js:



buildExtractors : function() {
...
this.getRoot = function(res) {
return (!Ext.isEmpty(res[this.meta.record])) ? res[this.meta.record] : res[this.meta.root];
}; // <-- here
if (s.idPath || s.idProperty) {
...
}
...
},

meroy
15 Dec 2009, 8:26 PM
-- Lines 214, 221, 226; missing semicolons, data/XmlReader.js:



createAccessor : function(){
var q = Ext.DomQuery;
return function(key) {
switch(key) {
case this.meta.totalProperty:
return function(root, def){
return q.selectNumber(key, root, def);
}; // <-- here
break;
case this.meta.successProperty:
return function(root, def) {
var sv = q.selectValue(key, root, true);
var success = sv !== false && sv !== 'false';
return success;
}; // <-- here
break;
default:
return function(root, def) {
return q.selectValue(key, root, def);
}; // <-- here
break;
}
};
}(),


-- Line 3, missing semicolon, direct/Event.js:



Ext.Direct.Event = function(config){
Ext.apply(this, config);
}; // <-- here
Ext.Direct.Event.prototype = {
status: true,
getData: function(){
return this.data;
}
};

meroy
15 Dec 2009, 8:31 PM
-- Line 26, missing semicolon, direct/JsonProvider.js:



getEvents: function(xhr){
var data = null;
try{
data = this.parseResponse(xhr);
}catch(e){
var event = new Ext.Direct.ExceptionEvent({
data: e,
xhr: xhr,
code: Ext.Direct.exceptions.PARSE,
message: 'Error parsing json response: \n\n ' + data
}); // <-- here
return [event];
}
...
}


-- Line 74, missing semicolon, widgets/PanelDD.js:



/**
* Shows the proxy
*/
show : function(){
if(!this.ghost){
this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());
this.ghost.setXY(this.panel.el.getXY()); // <-- here
if(this.insertProxy){
this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});
this.proxy.setSize(this.panel.getSize());
}
this.panel.el.dom.style.display = 'none';
}
},

meroy
15 Dec 2009, 8:38 PM
-- Line 318, missing semicolon, widgets/list/ListView.js:



// private
onResize : function(w, h){
var bd = this.innerBody.dom;
var hd = this.innerHd.dom; // <-- here
if(!bd){
return;
}
...
},


-- Line 194, missing comma, widgets/tips/ToolTip.js:



// private
getTargetXY : function(){
if(this.delegate){
this.anchorTarget = this.triggerElement;
}
if(this.anchor){
this.targetCounter++;
var offsets = this.getOffsets(),
xy = (this.anchorToTarget && !this.trackMouse) ? this.el.getAlignToXY(this.anchorTarget, this.getAnchorAlign()) : this.targetXY,
dw = Ext.lib.Dom.getViewWidth() - 5,
dh = Ext.lib.Dom.getViewHeight() - 5,
de = document.documentElement,
bd = document.body,
scrollX = (de.scrollLeft || bd.scrollLeft || 0) + 5,
scrollY = (de.scrollTop || bd.scrollTop || 0) + 5,
axy = [xy[0] + offsets[0], xy[1] + offsets[1]], // <-- here (comma)
sz = this.getSize();

this.anchorEl.removeClass(this.anchorCls);
...

meroy
15 Dec 2009, 8:49 PM
-- Line 4, missing semicolon, widgets/tree/TreeEventModel.js:



Ext.tree.TreePanel.nodeTypes = {};

Ext.reg('treepanel', Ext.tree.TreePanel);Ext.tree.TreeEventModel = function(tree){
this.tree = tree;
this.tree.on('render', this.initEvents, this);
}; // <-- here

Ext.tree.TreeEventModel.prototype = {
...
};


-- Line 457, missing semicolon, data/Tree.js:



// private
clear : function(destroy){
// clear any references from the node
this.setOwnerTree(null, destroy);
this.parentNode = this.previousSibling = this.nextSibling = null; // <-- here
if(destroy){
this.firstChild = this.lastChild = null;
}
},

meroy
15 Dec 2009, 8:54 PM
Line 14, missing semicolon, widgets/chart/EventProxy.js:



Ext.FlashEventProxy = {
onEvent : function(id, e){
var fp = Ext.getCmp(id);
if(fp){
fp.onFlashEvent(e);
}else{
arguments.callee.defer(10, this, [id, e]);
}
}
}; // <-- here


Line 272, missing semicolon, widgets/form/Form.js:



// private
processRemove : function(c){
// If a single form Field, remove it
if(this.isField(c)){
this.form.remove(c);
// If a Container, its already destroyed by the time it gets here. Remove any references to destroyed fields.
}else if(c.findBy){
var isDestroyed = function(o) {
return !!o.isDestroyed;
}; // <-- here
this.form.items.filterBy(isDestroyed, this.form).each(this.form.remove, this.form);
}
},

meroy
15 Dec 2009, 9:09 PM
Of the 57 "missing semicolons" lint errors, 38 of them appeared to be ok. I'm not sure on how IE 6, an old browser, handles those mentioned above (19 in count). Is IE 6 forgiving here?

I understand the space savings by ommitting the comma right before the closing } if that was the intention -- 38 of the 57 were these.

evant
15 Dec 2009, 9:10 PM
Yeah, I was going through the individual files at some point, it's just an ongoing thing.

meroy
15 Dec 2009, 10:36 PM
I've gone back and entered the actual Ext src file and line number.

Animal
16 Dec 2009, 12:03 AM
Another thing is turning on Firebug's Javascript warnings. That turns up quite a lot of stuff, some of which is OK (Like functions not returning values), but some of which should be fixed.