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, "frappe": true,
"Vue": true, "Vue": true,
"__": true, "__": true,
"_p": true,
"_f": true,
"repl": true, "repl": true,
"Class": true, "Class": true,
"locals": true, "locals": true,

View file

@ -500,7 +500,7 @@ frappe.ui.form.Form = class FrappeForm {
}).then(() => { }).then(() => {
me.show_success_action(); me.show_success_action();
}).catch((e) => { }).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() { show_success_action() {
const route = frappe.get_route(); const route = frappe.get_route();
if (route[0] !== 'Form') return; if (route[0] !== 'Form') return;
@ -1027,7 +1023,7 @@ frappe.ui.form.Form = class FrappeForm {
toggle_enable(fnames, enable) { toggle_enable(fnames, enable) {
this.field_map(fnames, function(field) { this.field_map(fnames, function(field) {
field.read_only = enable ? 0 : 1; field.read_only = enable ? 0 : 1;
}) });
} }
toggle_reqd(fnames, mandatory) { toggle_reqd(fnames, mandatory) {
@ -1346,11 +1342,11 @@ frappe.validated = 0;
// Proxy for frappe.validated // Proxy for frappe.validated
Object.defineProperty(window, 'validated', { Object.defineProperty(window, 'validated', {
get: function() { 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; return frappe.validated;
}, },
set: function(value) { 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; frappe.validated = value;
return frappe.validated; return frappe.validated;
} }

View file

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

View file

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

View file

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