fix(linting)

This commit is contained in:
Rushabh Mehta 2019-05-23 13:06:20 +05:30
parent 81fa64d4bc
commit 9f5a632baf
5 changed files with 20 additions and 27 deletions

View file

@ -58,8 +58,6 @@
"frappe": true,
"Vue": true,
"__": true,
"_p": true,
"_f": true,
"repl": true,
"Class": true,
"locals": true,

View file

@ -500,7 +500,7 @@ frappe.ui.form.Form = class FrappeForm {
}).then(() => {
me.show_success_action();
}).catch((e) => {
console.error(e);
console.error(e); // eslint-disable-line
});
}
@ -929,10 +929,6 @@ frappe.ui.form.Form = class FrappeForm {
}
}
set_print_heading(txt) {
this.pformat[this.docname] = txt;
}
show_success_action() {
const route = frappe.get_route();
if (route[0] !== 'Form') return;
@ -1027,7 +1023,7 @@ frappe.ui.form.Form = class FrappeForm {
toggle_enable(fnames, enable) {
this.field_map(fnames, function(field) {
field.read_only = enable ? 0 : 1;
})
});
}
toggle_reqd(fnames, mandatory) {
@ -1346,11 +1342,11 @@ frappe.validated = 0;
// Proxy for frappe.validated
Object.defineProperty(window, 'validated', {
get: function() {
console.warn('Please use `frappe.validated` instead of `validated`. It will be deprecated soon.');
console.warn('Please use `frappe.validated` instead of `validated`. It will be deprecated soon.'); // eslint-disable-line
return frappe.validated;
},
set: function(value) {
console.warn('Please use `frappe.validated` instead of `validated`. It will be deprecated soon.');
console.warn('Please use `frappe.validated` instead of `validated`. It will be deprecated soon.'); // eslint-disable-line
frappe.validated = value;
return frappe.validated;
}

View file

@ -4,20 +4,19 @@
// create options
for(var i=0, j=options_list.length; i<j; i++) {
var v = options_list[i];
if (is_null(v)) {
var value = null;
var label = null;
} else {
var value = null;
var label = null;
if (!is_null(v)) {
var is_value_null = is_null(v.value);
var is_label_null = is_null(v.label);
var is_disabled = Boolean(v.disabled);
if (is_value_null && is_label_null) {
var value = v;
var label = __(v);
value = v;
label = __(v);
} else {
var value = is_value_null ? "" : v.value;
var label = is_label_null ? __(value) : __(v.label);
value = is_value_null ? "" : v.value;
label = is_label_null ? __(value) : __(v.label);
}
}
$('<option>').html(cstr(label))
@ -28,12 +27,12 @@
// select the first option
this.selectedIndex = 0;
return $(this);
}
};
$.fn.set_working = function() {
this.prop('disabled', true);
}
};
$.fn.done_working = function() {
this.prop('disabled', false);
}
};
})(jQuery);

View file

@ -56,7 +56,7 @@ frappe.markdown = function(txt) {
var txt1 = [];
$.each(txt.split("\n"), function(i, t) {
txt1.push(t.substr(whitespace_len));
})
});
txt = txt1.join("\n");
}

View file

@ -1,7 +1,7 @@
frappe.urllib = {
// get argument from url
get_arg: function(name) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
name = name.replace(/[[]/, "\\[").replace(/[\]]/,"\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
@ -13,7 +13,7 @@ frappe.urllib = {
// returns url dictionary
get_dict: function() {
var d = {}
var d = {};
var t = window.location.href.split('?')[1];
if(!t) return d;
@ -31,9 +31,9 @@ frappe.urllib = {
// returns the base url with http + domain + path (-index.cgi or # or ?)
get_base_url: function() {
// var url= (frappe.base_url || window.location.href).split('#')[0].split('?')[0].split('desk')[0];
var url = (frappe.base_url || window.location.origin)
if(url.substr(url.length-1, 1)=='/') url = url.substr(0, url.length-1)
return url
var url = (frappe.base_url || window.location.origin);
if(url.substr(url.length-1, 1)=='/') url = url.substr(0, url.length-1);
return url;
},
// returns absolute url