silence (or fix) a bunch of eslint warnings

This commit is contained in:
Andrew Dolgov 2021-02-12 19:02:09 +03:00
parent ad7842c98a
commit 7f0800537e
14 changed files with 65 additions and 50 deletions

View File

@ -1,5 +1,6 @@
'use strict'; 'use strict';
/* eslint-disable new-cap */
/* global __, Article, Ajax, Headlines, Filters, fox */ /* global __, Article, Ajax, Headlines, Filters, fox */
/* global xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Feeds, Cookie */ /* global xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Feeds, Cookie */
/* global CommonDialogs, Plugins, Effect */ /* global CommonDialogs, Plugins, Effect */

View File

@ -1,5 +1,6 @@
'use strict' 'use strict'
/* eslint-disable no-new */
/* global __, ngettext, App, Headlines, xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Ajax, fox */ /* global __, ngettext, App, Headlines, xhrPost, xhrJson, dojo, dijit, PluginHost, Notify, $$, Ajax, fox */
const Article = { const Article = {
@ -250,12 +251,10 @@ const Article = {
return false; return false;
}, },
editTags: function (id) { editTags: function (id) {
xhrPost("backend.php", {op: "article", method: "editarticletags", param: id}, (transport) => {
const dialog = new fox.SingleUseDialog({ const dialog = new fox.SingleUseDialog({
id: "editTagsDlg", id: "editTagsDlg",
title: __("Edit article Tags"), title: __("Edit article Tags"),
content: transport.responseText, content: __("Loading, please wait..."),
execute: function () { execute: function () {
if (this.validate()) { if (this.validate()) {
Notify.progress("Saving article tags...", true); Notify.progress("Saving article tags...", true);
@ -287,15 +286,17 @@ const Article = {
const tmph = dojo.connect(dialog, 'onShow', function () { const tmph = dojo.connect(dialog, 'onShow', function () {
dojo.disconnect(tmph); dojo.disconnect(tmph);
xhrPost("backend.php", {op: "article", method: "editarticletags", param: id}, (transport) => {
dialog.attr('content', transport.responseText);
new Ajax.Autocompleter('tags_str', 'tags_choices', new Ajax.Autocompleter('tags_str', 'tags_choices',
"backend.php?op=article&method=completeTags", "backend.php?op=article&method=completeTags",
{tokens: ',', paramName: "search"}); {tokens: ',', paramName: "search"});
}); });
});
dialog.show(); dialog.show();
});
}, },
cdmMoveToId: function (id, params) { cdmMoveToId: function (id, params) {
params = params || {}; params = params || {};

View File

@ -8,8 +8,8 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
// reference: https://stackoverflow.com/a/27968996 // reference: https://stackoverflow.com/a/27968996
_saveExpandedNodes: function(){ _saveExpandedNodes: function(){
if (this.persist && this.cookieName){ if (this.persist && this.cookieName){
var ary = []; const ary = [];
for(var id in this._openedNodes){ for (const id in this._openedNodes){
ary.push(id); ary.push(id);
} }
// Was: // Was:
@ -24,7 +24,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dojo/_base/array", "dojo/co
if (this.persist && this.cookieName){ if (this.persist && this.cookieName){
// Was: // Was:
// var oreo = cookie(this.cookieName); // var oreo = cookie(this.cookieName);
var oreo = localStorage.getItem(this.cookieName); let oreo = localStorage.getItem(this.cookieName);
// migrate old data if nothing in localStorage // migrate old data if nothing in localStorage
if (oreo == null || oreo === '') { if (oreo == null || oreo === '') {
oreo = cookie(this.cookieName); oreo = cookie(this.cookieName);

View File

@ -199,6 +199,7 @@ const Headlines = {
} else if (event.ctrlKey) { } else if (event.ctrlKey) {
Headlines.select('invert', id); Headlines.select('invert', id);
} else { } else {
// eslint-disable-next-line no-lonely-if
if (App.isCombinedMode()) { if (App.isCombinedMode()) {
if (event.altKey && !in_body) { if (event.altKey && !in_body) {
@ -237,6 +238,7 @@ const Headlines = {
return in_body; return in_body;
} else { } else {
// eslint-disable-next-line no-lonely-if
if (event.altKey) { if (event.altKey) {
Article.openInNewWindow(id); Article.openInNewWindow(id);
Headlines.toggleUnread(id, 0); Headlines.toggleUnread(id, 0);

View File

@ -1,3 +1,4 @@
/* eslint-disable prefer-rest-params */
/* global __, lib, dijit, define, dojo, CommonDialogs, Notify, Tables, xhrPost, fox, App */ /* global __, lib, dijit, define, dojo, CommonDialogs, Notify, Tables, xhrPost, fox, App */
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) { define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) {

View File

@ -1,4 +1,5 @@
/* global __, $$, define, lib, dijit, dojo, xhrPost, Notify, Filters, Lists */ /* eslint-disable prefer-rest-params */
/* global __, define, lib, dijit, dojo, xhrPost, Notify */
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) { define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) {
@ -54,6 +55,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
return label; return label;
}, },
getIconClass: function (item, opened) { getIconClass: function (item, opened) {
// eslint-disable-next-line no-nested-ternary
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible"; return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
}, },
getRowClass: function (item, opened) { getRowClass: function (item, opened) {
@ -62,7 +64,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
return enabled ? "dijitTreeRow" : "dijitTreeRow filterDisabled"; return enabled ? "dijitTreeRow" : "dijitTreeRow filterDisabled";
}, },
checkItemAcceptance: function(target, source, position) { checkItemAcceptance: function(target, source, position) {
const item = dijit.getEnclosingWidget(target).item; //const item = dijit.getEnclosingWidget(target).item;
// disable copying items // disable copying items
source.copyState = function() { return false; }; source.copyState = function() { return false; };

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
/* global __, dijit, dojo, Tables, xhrPost, Notify, xhrJson, App, fox */ /* eslint-disable no-new */
/* global __, dijit, dojo, Tables, xhrPost, Notify, xhrJson, App, fox, Effect */
const Helpers = { const Helpers = {
AppPasswords: { AppPasswords: {

View File

@ -1,3 +1,4 @@
/* eslint-disable prefer-rest-params */
/* global __, define, lib, dijit, dojo, xhrPost, Notify, fox */ /* global __, define, lib, dijit, dojo, xhrPost, Notify, fox */
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/form/DropDownButton"], function (declare, domConstruct) { define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/form/DropDownButton"], function (declare, domConstruct) {
@ -39,6 +40,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree", "dijit/f
return tnode; return tnode;
}, },
getIconClass: function (item, opened) { getIconClass: function (item, opened) {
// eslint-disable-next-line no-nested-ternary
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible"; return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
}, },
getSelectedLabels: function() { getSelectedLabels: function() {

View File

@ -1,6 +1,7 @@
'use strict'; 'use strict';
/* global dijit, __, App, Ajax */ /* global dijit, __, App, Ajax */
/* eslint-disable no-new */
/* error reporting shim */ /* error reporting shim */
// TODO: deprecated; remove // TODO: deprecated; remove
@ -31,8 +32,8 @@ function xhrPost(url, params, complete) {
/* exported xhrJson */ /* exported xhrJson */
function xhrJson(url, params, complete) { function xhrJson(url, params, complete) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) =>
return xhrPost(url, params).then((reply) => { xhrPost(url, params).then((reply) => {
let obj = null; let obj = null;
try { try {
@ -44,8 +45,7 @@ function xhrJson(url, params, complete) {
if (complete != undefined) complete(obj); if (complete != undefined) complete(obj);
resolve(obj); resolve(obj);
}); }));
});
} }
/* add method to remove element from array */ /* add method to remove element from array */

View File

@ -1,4 +1,5 @@
/* global dijit */ /* eslint-disable prefer-rest-params */
/* global dijit, define */
define(["dojo/_base/declare", "dijit/form/ComboButton"], function (declare) { define(["dojo/_base/declare", "dijit/form/ComboButton"], function (declare) {
return declare("fox.form.ComboButton", dijit.form.ComboButton, { return declare("fox.form.ComboButton", dijit.form.ComboButton, {
startup: function() { startup: function() {

View File

@ -1,4 +1,5 @@
/* global dijit */ /* eslint-disable prefer-rest-params */
/* global dijit, define */
define(["dojo/_base/declare", "dijit/form/DropDownButton"], function (declare) { define(["dojo/_base/declare", "dijit/form/DropDownButton"], function (declare) {
return declare("fox.form.DropDownButton", dijit.form.DropDownButton, { return declare("fox.form.DropDownButton", dijit.form.DropDownButton, {
startup: function() { startup: function() {

View File

@ -1,4 +1,4 @@
/* global dijit */ /* global dijit, define */
define(["dojo/_base/declare", "dijit/form/Select"], function (declare) { define(["dojo/_base/declare", "dijit/form/Select"], function (declare) {
return declare("fox.form.Select", dijit.form.Select, { return declare("fox.form.Select", dijit.form.Select, {
focus: function() { focus: function() {

View File

@ -1,4 +1,6 @@
// https://stackoverflow.com/questions/19317258/how-to-use-dijit-textarea-validation-dojo-1-9 // https://stackoverflow.com/questions/19317258/how-to-use-dijit-textarea-validation-dojo-1-9
/* eslint-disable no-new */
/* global define */
define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/SimpleTextarea", "dijit/form/ValidationTextBox"], define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/SimpleTextarea", "dijit/form/ValidationTextBox"],
function(declare, lang, SimpleTextarea, ValidationTextBox) { function(declare, lang, SimpleTextarea, ValidationTextBox) {
@ -8,6 +10,7 @@ define(["dojo/_base/declare", "dojo/_base/lang", "dijit/form/SimpleTextarea", "d
this.constraints = {}; this.constraints = {};
this.baseClass += ' dijitValidationTextArea'; this.baseClass += ' dijitValidationTextArea';
}, },
// eslint-disable-next-line no-template-curly-in-string
templateString: "<textarea ${!nameAttrSetting} data-dojo-attach-point='focusNode,containerNode,textbox' autocomplete='off'></textarea>", templateString: "<textarea ${!nameAttrSetting} data-dojo-attach-point='focusNode,containerNode,textbox' autocomplete='off'></textarea>",
validator: function(value, constraints) { validator: function(value, constraints) {
//console.log(this, value, constraints); //console.log(this, value, constraints);

View File

@ -1,6 +1,6 @@
'use strict' 'use strict'
/* global require, App */ /* global require, App, $H */
/* exported Plugins */ /* exported Plugins */
const Plugins = {}; const Plugins = {};