Fix eslint errors

This commit is contained in:
Paulo Gustavo Veiga 2021-12-19 09:07:01 -08:00
parent c97fa80925
commit 8a8e921c17
16 changed files with 42 additions and 45 deletions

View File

@ -9,7 +9,7 @@
"test:unit": "lerna run test:unit --stream",
"test:integration": "lerna run test:integration --stream"
},
"private": true,
"private": false,
"devDependencies": {
"cypress": "^8.4.1",
"husky": "4",

View File

@ -3,7 +3,6 @@
"version": "0.0.1",
"description": "WiseMapping - Mindplot Canvas Library",
"homepage": "http://www.wisemapping.org/",
"license": "ISC",
"main": "dist/main.js",
"directories": {
"lib": "src",

View File

@ -1,4 +1,4 @@
/* eslint-disable class-methods-use-this */
/* eslint-disable no-unused-vars */
/*
* Copyright [2015] [wisemapping]
*

View File

@ -117,13 +117,13 @@ class ControlPoint {
_mouseDown(event, point, me) {
if (!this._isBinded) {
this._isBinded = true;
this._mouseMoveFunction = function mouseMoveFunction(event) {
me._mouseMoveEvent(event, point, me);
this._mouseMoveFunction = (e) => {
me._mouseMoveEvent(e, point, me);
};
this._workspace.getScreenManager().addEvent('mousemove', this._mouseMoveFunction);
this._mouseUpFunction = function mouseUpFunction(event) {
me._mouseUp(event, point, me);
this._mouseUpFunction = (e) => {
me._mouseUp(e, point, me);
};
this._workspace.getScreenManager().addEvent('mouseup', this._mouseUpFunction);
}

View File

@ -244,14 +244,14 @@ class DesignerKeyboard extends Keyboard {
return;
}
// Sometimes Firefox doesn't contain keyCode value
if (event.key && event.keyCode == 0) {
if (event.key && event.keyCode === 0) {
keyCode = event.charCode;
} else {
keyCode = event.keyCode;
}
const specialKey = jQuery.hotkeys.specialKeys[keyCode];
if (['enter', 'capslock'].indexOf(specialKey) == -1 && !jQuery.hotkeys.shiftNums[keyCode]) {
const specialKey = $.hotkeys.specialKeys[keyCode];
if (['enter', 'capslock'].indexOf(specialKey) === -1 && !$.hotkeys.shiftNums[keyCode]) {
const nodes = designer.getModel().filterSelectedTopics();
if (nodes.length > 0) {
// If a modifier is press, the key selected must be ignored.

View File

@ -52,7 +52,7 @@ class LocalStorageManager extends PersistenceManager {
}
}
return jQuery.parseXML(xml);
return $.parseXML(xml);
}
unlockMap(mindmap) {

View File

@ -71,6 +71,7 @@ class MainTopic extends Topic {
}
/** */
// eslint-disable-next-line no-unused-vars
updateTopicShape(targetTopic, workspace) {
// Change figure based on the connected topic ...
const model = this.getModel();
@ -87,8 +88,6 @@ class MainTopic extends Topic {
/** */
disconnect(workspace) {
super.disconnect(workspace);
const size = this.getSize();
const model = this.getModel();
let shapeType = model.getShapeType();
if (!$defined(shapeType)) {

View File

@ -57,7 +57,7 @@ class MultilineTextEditor extends Events {
const textareaElem = this._getTextareaElem();
const me = this;
textareaElem.on('keydown', function keydown(event) {
switch (jQuery.hotkeys.specialKeys[event.keyCode]) {
switch ($.hotkeys.specialKeys[event.keyCode]) {
case 'esc':
me.close(false);
break;
@ -90,7 +90,7 @@ class MultilineTextEditor extends Events {
me.close(true);
}
break;
case 'tab':
case 'tab': {
event.preventDefault();
const start = $(this).get(0).selectionStart;
const end = $(this).get(0).selectionEnd;
@ -99,8 +99,10 @@ class MultilineTextEditor extends Events {
$(this).val(`${$(this).val().substring(0, start)}\t${$(this).val().substring(end)}`);
// put caret at right position again
$(this).get(0).selectionStart = $(this).get(0).selectionEnd = start + 1;
$(this).get(0).selectionEnd = start + 1;
$(this).get(0).selectionStart = $(this).get(0).selectionEnd;
break;
}
default:
// No actions...
break;

View File

@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
/*
* Copyright [2015] [wisemapping]
*
@ -34,7 +35,7 @@ class PersistenceManager {
try {
this.saveMapXml(mapId, mapXml, pref, saveHistory, events, sync);
} catch (e) {
console.log(e);
console.error(e);
events.onError(this._buildError());
}
}
@ -62,11 +63,11 @@ class PersistenceManager {
}
}
PersistenceManager.init = function (instance) {
PersistenceManager.init = function init(instance) {
PersistenceManager._instance = instance;
};
PersistenceManager.getInstance = function () {
PersistenceManager.getInstance = function getInstance() {
return PersistenceManager._instance;
};

View File

@ -22,6 +22,7 @@ import Mindmap from '../model/Mindmap';
import INodeModel from '../model/INodeModel';
import TopicFeature from '../TopicFeature';
// eslint-disable-next-line camelcase
class XMLSerializer_Beta {
toXML(mindmap) {
$assert(mindmap, 'Can not save a null mindmap');
@ -321,4 +322,5 @@ class XMLSerializer_Beta {
XMLSerializer_Beta.MAP_ROOT_NODE = 'map';
// eslint-disable-next-line camelcase
export default XMLSerializer_Beta;

View File

@ -507,4 +507,5 @@ class XMLSerializer_Pela {
*/
XMLSerializer_Pela.MAP_ROOT_NODE = 'map';
// eslint-disable-next-line camelcase
export default XMLSerializer_Pela;

View File

@ -15,15 +15,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import XMLSerializer_Pela from './XMLSerializer_Pela';
import XMLSerializer from './XMLSerializer_Pela';
/**
* This serializer works exactly the same way as for the former version Pela
* {@link mindplot.persistence.XMLSerializer_Pela}
* @class
* @extends mindplot.persistence.XMLSerializer_Pela
*/
class XMLSerializer_Tango extends XMLSerializer_Pela {
// eslint-disable-next-line camelcase
class XMLSerializer_Tango extends XMLSerializer {
}
// eslint-disable-next-line camelcase
export default XMLSerializer_Tango;

View File

@ -90,13 +90,12 @@ class LinkEditor extends BootstrapDialog {
this.form.append(section);
const me = this;
this.form.unbind('submit').submit(
function (event) {
this.form.unbind('submit').submit((event) => {
event.preventDefault();
if (me.checkURL(input.val())) {
me.cleanError();
const inputValue = input.val();
if (inputValue != null && $.trim(inputValue) != '') {
if (inputValue != null && $.trim(inputValue) !== '') {
model.setValue(inputValue);
}
me.close();
@ -105,8 +104,7 @@ class LinkEditor extends BootstrapDialog {
me.alertError($msg('URL_ERROR'));
event.stopPropagation();
}
},
);
});
result.append(this.form);
return result;

View File

@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
import Mindmap from './components/model/Mindmap';
import PersistenceManager from './components/PersistenceManager';
import Designer from './components/Designer';

View File

@ -1,17 +1,13 @@
{
"env": {
"browser": true,
"commonjs": true
"es6": true
},
"extends": [
"airbnb-base",
"plugin:cypress/recommended"
],
"globals":{
"Class": "readonly"
},
"rules": {
"no-underscore-dangle": "off",
"no-restricted-syntax": "off",
"no-underscore-dangle": "off",
"no-plusplus": "off",

View File

@ -11,6 +11,5 @@
}
]
],
"plugins": ["@babel/plugin-transform-modules-commonjs"],
"sourceType": "unambiguous"
}