chore: remove eslint-disable*

This commit is contained in:
Ankush Menat 2023-07-14 15:35:52 +05:30
parent 58cf770760
commit b5409f6f07
41 changed files with 34 additions and 84 deletions

View file

@ -1,4 +1,3 @@
/* eslint-disable no-console */
const path = require("path"); const path = require("path");
const fs = require("fs"); const fs = require("fs");
const glob = require("fast-glob"); const glob = require("fast-glob");

View file

@ -1,4 +1,3 @@
/* eslint-disable no-console */
const path = require("path"); const path = require("path");
const fs = require("fs"); const fs = require("fs");
const glob = require("fast-glob"); const glob = require("fast-glob");

View file

@ -94,16 +94,16 @@ function get_cli_arg(name) {
function log_error(message, badge = "ERROR") { function log_error(message, badge = "ERROR") {
badge = chalk.white.bgRed(` ${badge} `); badge = chalk.white.bgRed(` ${badge} `);
console.error(`${badge} ${message}`); // eslint-disable-line no-console console.error(`${badge} ${message}`);
} }
function log_warn(message, badge = "WARN") { function log_warn(message, badge = "WARN") {
badge = chalk.black.bgYellowBright(` ${badge} `); badge = chalk.black.bgYellowBright(` ${badge} `);
console.warn(`${badge} ${message}`); // eslint-disable-line no-console console.warn(`${badge} ${message}`);
} }
function log(...args) { function log(...args) {
console.log(...args); // eslint-disable-line no-console console.log(...args);
} }
function get_redis_subscriber(kind) { function get_redis_subscriber(kind) {

View file

@ -1,6 +1,5 @@
// Copyright (c) {year}, {app_publisher} and contributors // Copyright (c) {year}, {app_publisher} and contributors
// For license information, please see license.txt // For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["{name}"] = {{ frappe.query_reports["{name}"] = {{
"filters": [ "filters": [

View file

@ -1,6 +1,5 @@
// Copyright (c) 2022, Frappe Technologies and contributors // Copyright (c) 2022, Frappe Technologies and contributors
// For license information, please see license.txt // For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["Database Storage Usage By Tables"] = { frappe.query_reports["Database Storage Usage By Tables"] = {
filters: [], filters: [],

View file

@ -1,6 +1,5 @@
// Copyright (c) 2019, Frappe Technologies and contributors // Copyright (c) 2019, Frappe Technologies and contributors
// For license information, please see license.txt // For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["Transaction Log Report"] = { frappe.query_reports["Transaction Log Report"] = {
onload: function (query_report) { onload: function (query_report) {

View file

@ -1,6 +1,5 @@
// Copyright (c) 2023, Frappe Technologies and contributors // Copyright (c) 2023, Frappe Technologies and contributors
// For license information, please see license.txt // For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["Audit System Hooks"] = { frappe.query_reports["Audit System Hooks"] = {
filters: [], filters: [],

View file

@ -145,7 +145,6 @@ class UserProfile {
}); });
} }
// eslint-disable-next-line no-unused-vars
render_percentage_chart(field, title) { render_percentage_chart(field, title) {
frappe frappe
.xcall( .xcall(

View file

@ -1,6 +1,5 @@
// Copyright (c) 2016, Frappe Technologies and contributors // Copyright (c) 2016, Frappe Technologies and contributors
// For license information, please see license.txt // For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["ToDo"] = { frappe.query_reports["ToDo"] = {
filters: [], filters: [],

View file

@ -122,7 +122,6 @@ class Picker {
} }
setup_hue_event() { setup_hue_event() {
// eslint-disable-next-line no-unused-vars
let on_drag = (x, y) => { let on_drag = (x, y) => {
this.hue_selector_position.x = x; this.hue_selector_position.x = x;
this.hue = Math.round((x * 360) / this.hue_map.offsetWidth); this.hue = Math.round((x * 360) / this.hue_map.offsetWidth);
@ -152,9 +151,7 @@ class Picker {
} }
get_pointer_coords() { get_pointer_coords() {
// eslint-disable-next-line no-unused-vars
let h, s, v; let h, s, v;
// eslint-disable-next-line no-unused-vars
[h, s, v] = utils.get_hsv(this.get_color()); [h, s, v] = utils.get_hsv(this.get_color());
let width = this.color_map.offsetWidth; let width = this.color_map.offsetWidth;
let height = this.color_map.offsetHeight; let height = this.color_map.offsetHeight;

View file

@ -62,25 +62,22 @@ frappe.ui.form.Control = class BaseControl {
// like in case of a dialog box // like in case of a dialog box
if (cint(this.df.hidden)) { if (cint(this.df.hidden)) {
// eslint-disable-next-line if (explain) console.log("By Hidden: None");
if (explain) console.log("By Hidden: None"); // eslint-disable-line no-console
return "None"; return "None";
} else if (cint(this.df.hidden_due_to_dependency)) { } else if (cint(this.df.hidden_due_to_dependency)) {
// eslint-disable-next-line if (explain) console.log("By Hidden Dependency: None");
if (explain) console.log("By Hidden Dependency: None"); // eslint-disable-line no-console
return "None"; return "None";
} else if ( } else if (
cint(this.df.read_only || this.df.is_virtual || this.df.fieldtype === "Read Only") cint(this.df.read_only || this.df.is_virtual || this.df.fieldtype === "Read Only")
) { ) {
// eslint-disable-next-line if (explain) console.log("By Read Only: Read");
if (explain) console.log("By Read Only: Read"); // eslint-disable-line no-console
status = "Read"; status = "Read";
} else if ( } else if (
(this.grid && this.grid.display_status == "Read") || (this.grid && this.grid.display_status == "Read") ||
(this.layout && this.layout.grid && this.layout.grid.display_status == "Read") (this.layout && this.layout.grid && this.layout.grid.display_status == "Read")
) { ) {
// parent grid is read // parent grid is read
if (explain) console.log("By Parent Grid Read-only: Read"); // eslint-disable-line no-console if (explain) console.log("By Parent Grid Read-only: Read");
status = "Read"; status = "Read";
} }
@ -112,7 +109,7 @@ frappe.ui.form.Control = class BaseControl {
var grid = this.grid || this.layout.grid; var grid = this.grid || this.layout.grid;
if (grid.display_status == "Read") { if (grid.display_status == "Read") {
status = "Read"; status = "Read";
if (explain) console.log("By Parent Grid Read-only: Read"); // eslint-disable-line no-console if (explain) console.log("By Parent Grid Read-only: Read");
} }
} }
@ -132,8 +129,7 @@ frappe.ui.form.Control = class BaseControl {
is_null(value) && is_null(value) &&
!in_list(["HTML", "Image", "Button", "Geolocation"], this.df.fieldtype) !in_list(["HTML", "Image", "Button", "Geolocation"], this.df.fieldtype)
) { ) {
// eslint-disable-next-line if (explain) console.log("By Hide Read-only, null fields: None");
if (explain) console.log("By Hide Read-only, null fields: None"); // eslint-disable-line no-console
status = "None"; status = "None";
} }

View file

@ -165,7 +165,6 @@ frappe.ui.form.ControlCode = class ControlCode extends frappe.ui.form.ControlTex
const valid_languages = Object.keys(language_map); const valid_languages = Object.keys(language_map);
if (language && !valid_languages.includes(language)) { if (language && !valid_languages.includes(language)) {
// eslint-disable-next-line
console.warn( console.warn(
`Invalid language option provided for field "${ `Invalid language option provided for field "${
this.df.label this.df.label

View file

@ -47,7 +47,6 @@ frappe.ui.form.make_control = function (opts) {
if (frappe.ui.form[control_class_name]) { if (frappe.ui.form[control_class_name]) {
return new frappe.ui.form[control_class_name](opts); return new frappe.ui.form[control_class_name](opts);
} else { } else {
// eslint-disable-next-line
console.log("Invalid Control Name: " + opts.df.fieldtype); console.log("Invalid Control Name: " + opts.df.fieldtype);
} }
}; };

View file

@ -1,4 +1,3 @@
/* eslint-disable */
import Quill from "quill"; import Quill from "quill";
const Embed = Quill.import("blots/embed"); const Embed = Quill.import("blots/embed");

View file

@ -1,4 +1,3 @@
/* eslint-disable */
const Keys = { const Keys = {
TAB: "Tab", TAB: "Tab",
ENTER: "Enter", ENTER: "Enter",

View file

@ -1,4 +1,3 @@
/* eslint-disable */
import Quill from "quill"; import Quill from "quill";
import Keys from "./constants/keys"; import Keys from "./constants/keys";
import "./blots/mention"; import "./blots/mention";

View file

@ -747,7 +747,7 @@ frappe.ui.form.Form = class FrappeForm {
me.show_success_action(); me.show_success_action();
}) })
.catch((e) => { .catch((e) => {
console.error(e); // eslint-disable-line console.error(e);
}); });
} }

View file

@ -123,7 +123,7 @@ export default class GridRow {
]) ])
.catch((e) => { .catch((e) => {
// aborted // aborted
console.trace(e); // eslint-disable-line console.trace(e);
}); });
} else { } else {
let data = null; let data = null;

View file

@ -240,7 +240,6 @@ frappe.ui.form.Layout = class Layout {
} }
make_page(df) { make_page(df) {
// eslint-disable-line no-unused-vars
let me = this; let me = this;
let head = $(` let head = $(`
<div class="form-clickable-section text-center"> <div class="form-clickable-section text-center">

View file

@ -602,7 +602,6 @@ frappe.ui.form.MultiSelectDialog = class MultiSelectDialog {
async get_filtered_parents_for_child_search() { async get_filtered_parents_for_child_search() {
const parent_search_args = this.get_args_for_search(); const parent_search_args = this.get_args_for_search();
parent_search_args.filter_fields = ["name"]; parent_search_args.filter_fields = ["name"];
// eslint-disable-next-line no-unused-vars
const [response, _] = await this.perform_search(parent_search_args); const [response, _] = await this.perform_search(parent_search_args);
let parent_names = []; let parent_names = [];

View file

@ -1,6 +1,5 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt // MIT License. See license.txt
/* eslint-disable no-console */
window.refresh_many = function (flist, dn, table_field) { window.refresh_many = function (flist, dn, table_field) {
for (var i in flist) { for (var i in flist) {

View file

@ -668,7 +668,6 @@ class FilterArea {
const fields_dict = this.list_view.page.fields_dict; const fields_dict = this.list_view.page.fields_dict;
let out = filters.reduce((out, filter) => { let out = filters.reduce((out, filter) => {
// eslint-disable-next-line
const [dt, fieldname, condition, value] = filter; const [dt, fieldname, condition, value] = filter;
out.promise = out.promise || Promise.resolve(); out.promise = out.promise || Promise.resolve();
out.non_standard_filters = out.non_standard_filters || []; out.non_standard_filters = out.non_standard_filters || [];

View file

@ -173,7 +173,6 @@ $.extend(frappe.meta, {
}); });
if (!out) { if (!out) {
// eslint-disable-next-line
console.log( console.log(
__("Warning: Unable to find {0} in any table related to {1}", [ __("Warning: Unable to find {0} in any table related to {1}", [
key, key,

View file

@ -294,8 +294,8 @@ frappe.request.call = function (opts) {
status_code_handler(data, xhr); status_code_handler(data, xhr);
} }
} catch (e) { } catch (e) {
console.log("Unable to handle success response", data); // eslint-disable-line console.log("Unable to handle success response", data);
console.error(e); // eslint-disable-line console.error(e);
} }
}) })
.always(function (data, textStatus, xhr) { .always(function (data, textStatus, xhr) {
@ -348,8 +348,8 @@ frappe.request.call = function (opts) {
// if not handled by error handler! // if not handled by error handler!
opts.error_callback && opts.error_callback(xhr); opts.error_callback && opts.error_callback(xhr);
} catch (e) { } catch (e) {
console.log("Unable to handle failed response"); // eslint-disable-line console.log("Unable to handle failed response");
console.error(e); // eslint-disable-line console.error(e);
} }
}); });
}; };
@ -366,7 +366,6 @@ frappe.request.is_fresh = function (args, threshold) {
new Date() - past_request.timestamp < threshold && new Date() - past_request.timestamp < threshold &&
frappe.utils.deep_equal(args, past_request.args) frappe.utils.deep_equal(args, past_request.args)
) { ) {
// eslint-disable-next-line no-console
console.log("throttled"); console.log("throttled");
return true; return true;
} }

View file

@ -37,7 +37,7 @@ frappe.ui.Scanner = class Scanner {
try { try {
this.options.on_scan(decodedResult); this.options.on_scan(decodedResult);
} catch (error) { } catch (error) {
console.error(error); // eslint-disable-line console.error(error);
} }
} }
if (!this.options.multiple) { if (!this.options.multiple) {
@ -46,14 +46,13 @@ frappe.ui.Scanner = class Scanner {
} }
}, },
(errorMessage) => { (errorMessage) => {
// eslint-disable-line
// parse error, ignore it. // parse error, ignore it.
} }
) )
.catch((err) => { .catch((err) => {
this.is_alive = false; this.is_alive = false;
this.hide_dialog(); this.hide_dialog();
console.error(err); // eslint-disable-line console.error(err);
}); });
this.is_alive = true; this.is_alive = true;
} }

View file

@ -14,7 +14,6 @@ frappe.ui.color = {
if (color_names.includes(color_name)) { if (color_names.includes(color_name)) {
return frappe.ui.color_map[color_name]; return frappe.ui.color_map[color_name];
} else { } else {
// eslint-disable-next-line
console.warn(`'color_name' can be one of ${color_names} and not ${color_name}`); console.warn(`'color_name' can be one of ${color_names} and not ${color_name}`);
} }
}, },
@ -52,7 +51,6 @@ frappe.ui.color = {
const color = this.get_color(color_name); const color = this.get_color(color_name);
return color ? color[shades[shade]] : color_name; return color ? color[shades[shade]] : color_name;
} else { } else {
// eslint-disable-next-line
console.warn(`'shade' can be one of ${Object.keys(shades)} and not ${shade}`); console.warn(`'shade' can be one of ${Object.keys(shades)} and not ${shade}`);
} }
}, },

View file

@ -303,7 +303,6 @@ frappe.ui.FilterGroup = class {
} }
get_filter_area_template() { get_filter_area_template() {
/* eslint-disable indent */
return $(` return $(`
<div class="filter-area"> <div class="filter-area">
<div class="filter-edit-area"> <div class="filter-edit-area">
@ -330,7 +329,6 @@ frappe.ui.FilterGroup = class {
</div> </div>
</div> </div>
</div>`); </div>`);
/* eslint-disable indent */
} }
get_filters_as_object() { get_filters_as_object() {

View file

@ -432,7 +432,6 @@ frappe.ui.Slides = class Slides {
this.slide_dict[id] = null; this.slide_dict[id] = null;
} }
// eslint-disable-next-line no-unused-vars
on_update(completed, total) {} on_update(completed, total) {}
show_hide_prev_next(id) { show_hide_prev_next(id) {

View file

@ -59,7 +59,6 @@ frappe.search.SearchDialog = class {
callback(results, keywords); callback(results, keywords);
}, },
(err) => { (err) => {
// eslint-disable-next-line no-console
console.error(err); console.error(err);
} }
); );
@ -78,7 +77,6 @@ frappe.search.SearchDialog = class {
callback(results, keywords); callback(results, keywords);
}, },
(err) => { (err) => {
// eslint-disable-next-line no-console
console.error(err); console.error(err);
} }
); );
@ -177,7 +175,6 @@ frappe.search.SearchDialog = class {
doctype_results.length && this.add_more_results(doctype_results); doctype_results.length && this.add_more_results(doctype_results);
}, },
(err) => { (err) => {
// eslint-disable-next-line no-console
console.error(err); console.error(err);
} }
); );

View file

@ -84,7 +84,6 @@ frappe.search.utils = {
out.label = match[0].bold(); out.label = match[0].bold();
out.value = match[0]; out.value = match[0];
} else { } else {
// eslint-disable-next-line
console.log("Illegal match", match); console.log("Illegal match", match);
} }
out.index = 80; out.index = 80;

View file

@ -11,13 +11,13 @@ frappe.ui.Tree = class {
icon_set, icon_set,
toolbar, toolbar,
expandable, expandable,
with_skeleton = 1, // eslint-disable-line with_skeleton = 1,
args, args,
method, method,
get_label, get_label,
on_render, on_render,
on_click, // eslint-disable-line on_click,
}) { }) {
$.extend(this, arguments[0]); $.extend(this, arguments[0]);
if (root_value == null) { if (root_value == null) {
@ -79,14 +79,7 @@ frappe.ui.Tree = class {
setup_treenode_class() { setup_treenode_class() {
let tree = this; let tree = this;
this.TreeNode = class { this.TreeNode = class {
constructor({ constructor({ parent, label, parent_label, expandable, is_root, data }) {
parent,
label,
parent_label,
expandable,
is_root,
data, // eslint-disable-line
}) {
$.extend(this, arguments[0]); $.extend(this, arguments[0]);
this.loaded = 0; this.loaded = 0;
this.expanded = 0; this.expanded = 0;

View file

@ -1084,8 +1084,8 @@ Object.assign(frappe.utils, {
let expression_function = new Function(...variable_names, code); let expression_function = new Function(...variable_names, code);
return expression_function(...variables); return expression_function(...variables);
} catch (error) { } catch (error) {
console.log("Error evaluating the following expression:"); // eslint-disable-line no-console console.log("Error evaluating the following expression:");
console.error(code); // eslint-disable-line no-console console.error(code);
throw error; throw error;
} }
}, },
@ -1557,8 +1557,8 @@ Object.assign(frappe.utils, {
return title; return title;
}); });
} catch (error) { } catch (error) {
console.log("Error while fetching link title."); // eslint-disable-line console.log("Error while fetching link title.");
console.log(error); // eslint-disable-line console.log(error);
return Promise.resolve(name); return Promise.resolve(name);
} }
}, },

View file

@ -609,7 +609,7 @@ frappe.views.CommunicationComposer = class {
localforage.setItem(this.frm.doctype + this.frm.docname, message).catch((e) => { localforage.setItem(this.frm.doctype + this.frm.docname, message).catch((e) => {
if (e) { if (e) {
// silently fail // silently fail
console.log(e); // eslint-disable-line console.log(e);
console.warn( console.warn(
"[Communication] IndexedDB is full. Cannot save message as draft" "[Communication] IndexedDB is full. Cannot save message as draft"
); // eslint-disable-line ); // eslint-disable-line
@ -628,10 +628,10 @@ frappe.views.CommunicationComposer = class {
localforage.removeItem(this.frm.doctype + this.frm.docname).catch((e) => { localforage.removeItem(this.frm.doctype + this.frm.docname).catch((e) => {
if (e) { if (e) {
// silently fail // silently fail
console.log(e); // eslint-disable-line console.log(e);
console.warn( console.warn(
"[Communication] IndexedDB is full. Cannot save message as draft" "[Communication] IndexedDB is full. Cannot save message as draft"
); // eslint-disable-line );
} }
}); });
} }
@ -701,7 +701,7 @@ frappe.views.CommunicationComposer = class {
try { try {
me.success(r); me.success(r);
} catch (e) { } catch (e) {
console.log(e); // eslint-disable-line console.log(e);
} }
} }
} else { } else {
@ -714,7 +714,7 @@ frappe.views.CommunicationComposer = class {
try { try {
me.error(r); me.error(r);
} catch (e) { } catch (e) {
console.log(e); // eslint-disable-line console.log(e);
} }
} }
} }

View file

@ -96,7 +96,7 @@ frappe.provide("frappe.views");
}); });
}, },
function (err) { function (err) {
console.error(err); // eslint-disable-line console.error(err);
} }
); );
}, },

View file

@ -460,7 +460,6 @@ export default class ChartWidget extends Widget {
} }
set_chart_actions(actions) { set_chart_actions(actions) {
/* eslint-disable indent */
this.chart_actions = $(`<div class="chart-actions dropdown pull-right"> this.chart_actions = $(`<div class="chart-actions dropdown pull-right">
<button data-toggle="dropdown" <button data-toggle="dropdown"
aria-haspopup="true"aria-expanded="false" aria-haspopup="true"aria-expanded="false"

View file

@ -314,7 +314,6 @@ export default class NumberCardWidget extends Widget {
} }
set_card_actions(actions) { set_card_actions(actions) {
/* eslint-disable indent */
this.card_actions = $(`<div class="card-actions dropdown pull-right"> this.card_actions = $(`<div class="card-actions dropdown pull-right">
<a data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
... ...
@ -330,7 +329,6 @@ export default class NumberCardWidget extends Widget {
.join("")} .join("")}
</ul> </ul>
</div>`); </div>`);
/* eslint-disable indent */
this.card_actions.find("a[data-action]").each((i, o) => { this.card_actions.find("a[data-action]").each((i, o) => {
const action = o.dataset.action; const action = o.dataset.action;

View file

@ -26,7 +26,6 @@ frappe.widget.make_widget = (opts) => {
if (widget_class) { if (widget_class) {
return new widget_class(opts); return new widget_class(opts);
} else { } else {
// eslint-disable-next-line
console.warn("Invalid Widget Name: " + opts.widget_type); console.warn("Invalid Widget Name: " + opts.widget_type);
} }
}; };

View file

@ -1,7 +1,5 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors // Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt // MIT License. See license.txt
/* eslint-disable no-console */
import hljs from "./syntax_highlight"; import hljs from "./syntax_highlight";
frappe.provide("website"); frappe.provide("website");

View file

@ -1,6 +1,5 @@
// Copyright (c) 2016, Frappe Technologies and contributors // Copyright (c) 2016, Frappe Technologies and contributors
// For license information, please see license.txt // For license information, please see license.txt
/* eslint-disable */
frappe.query_reports["Website Analytics"] = { frappe.query_reports["Website Analytics"] = {
filters: [ filters: [

View file

@ -13,15 +13,15 @@ sass.render(
}, },
function (err, result) { function (err, result) {
if (err) { if (err) {
console.error(err.formatted); // eslint-disable-line console.error(err.formatted);
return; return;
} }
fs.writeFile(output_path, result.css, function (err) { fs.writeFile(output_path, result.css, function (err) {
if (!err) { if (!err) {
console.log(output_path); // eslint-disable-line console.log(output_path);
} else { } else {
console.error(err); // eslint-disable-line console.error(err);
} }
}); });
} }

View file

@ -1,6 +1,6 @@
const request = require("superagent"); const request = require("superagent");
const { get_url } = require("../utils"); const { get_url } = require("../utils");
const log = console.log; // eslint-disable-line const log = console.log;
const WEBSITE_ROOM = "website"; const WEBSITE_ROOM = "website";
const SITE_ROOM = "all"; const SITE_ROOM = "all";