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:unit": "lerna run test:unit --stream",
"test:integration": "lerna run test:integration --stream" "test:integration": "lerna run test:integration --stream"
}, },
"private": true, "private": false,
"devDependencies": { "devDependencies": {
"cypress": "^8.4.1", "cypress": "^8.4.1",
"husky": "4", "husky": "4",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,15 +15,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * 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 * This serializer works exactly the same way as for the former version Pela
* {@link mindplot.persistence.XMLSerializer_Pela} * {@link mindplot.persistence.XMLSerializer_Pela}
* @class * @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; export default XMLSerializer_Tango;

View File

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

View File

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

View File

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

View File

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