Fix eslint errors

This commit is contained in:
Paulo Gustavo Veiga 2021-12-19 09:56:22 -08:00
parent 48642f2dcf
commit 5e8be48916
8 changed files with 63 additions and 22 deletions

View File

@ -27,12 +27,11 @@ class LayoutManager extends Events {
super();
$assert($defined(rootNodeId), 'rootNodeId can not be null');
$assert(rootSize, 'rootSize can not be null');
var position = position || { x: 0, y: 0 };
this._treeSet = new RootedTreeSet();
this._layout = new OriginalLayout(this._treeSet);
const rootNode = this._layout.createNode(rootNodeId, rootSize, position, 'root');
const rootNode = this._layout.createNode(rootNodeId, rootSize, { x: 0, y: 0 }, 'root');
this._treeSet.setRoot(rootNode);
this._events = [];
}

View File

@ -212,7 +212,9 @@ class OriginalLayout {
);
siblingsToShift.forEach(((sibling) => {
const overlappingOccurs = shiftedBranches.some(((shiftedBranch) => OriginalLayout._branchesOverlap(shiftedBranch, sibling, heightById)));
const overlappingOccurs = shiftedBranches
// eslint-disable-next-line max-len
.some(((shiftedBranch) => OriginalLayout._branchesOverlap(shiftedBranch, sibling, heightById)));
if (!sibling.isFree() || overlappingOccurs) {
const sAmount = node.getFreeDisplacement().y;

View File

@ -1,3 +1,21 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import $ from 'jquery';
import Options from '../../Options';
import { $msg } from '../../Messages';

View File

@ -1,4 +1,21 @@
import { $assert, $defined } from '@wisemapping/core-js';
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import $ from 'jquery';
import BootstrapDialog from './BootstrapDialog';
class BootstrapDialogRequest extends BootstrapDialog {
@ -7,7 +24,8 @@ class BootstrapDialogRequest extends BootstrapDialog {
this.requestOptions = {};
this.requestOptions.cache = false;
const me = this;
this.requestOptions.fail = function (xhr) {
this.requestOptions.fail = (xhr) => {
// Intercept form requests ...
console.log('Failure:');
console.log(xhr);
@ -32,7 +50,7 @@ class BootstrapDialogRequest extends BootstrapDialog {
me.acceptButton.unbind('click').click(() => {
submitDialogForm();
});
me._native.on('hidden.bs.modal', function () {
me._native.on('hidden.bs.modal', () => {
$(this).remove();
});
me.show();
@ -40,7 +58,7 @@ class BootstrapDialogRequest extends BootstrapDialog {
}
onDialogShown() {
if (typeof (onDialogShown) === 'function') {
if (onDialogShown instanceof Function) {
onDialogShown();
}
}

View File

@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
/* eslint-disable class-methods-use-this */
/*
* Copyright [2015] [wisemapping]
@ -134,7 +135,7 @@ class IMindmap {
result = '{ ';
const branches = this.getBranches();
result = `${result}version:${this.getVersion()}`;
result = `${result} , version:${this.getVersion()}`;
result = `${result} , [`;
for (let i = 0; i < branches.length; i++) {

View File

@ -250,6 +250,7 @@ class INodeModel {
}
/** @abstract */
// eslint-disable-next-line no-unused-vars
append(node) {
throw new Error('Unsupported operation');
}
@ -316,11 +317,13 @@ class INodeModel {
}
/** @abstract */
// eslint-disable-next-line no-unused-vars
putProperty(key, value) {
throw new Error('Unsupported operation');
}
/** @abstract */
// eslint-disable-next-line no-unused-vars
setParent(parent) {
throw new Error('Unsupported operation');
}
@ -363,6 +366,7 @@ class INodeModel {
}
/** @abstract */
// eslint-disable-next-line no-unused-vars
removeChild(child) {
throw new Error('Unsupported operation');
}

View File

@ -19,9 +19,9 @@ import { $defined } from '@wisemapping/core-js';
import ModelCodeName from './ModelCodeName';
import Beta2PelaMigrator from './Beta2PelaMigrator';
import Pela2TangoMigrator from './Pela2TangoMigrator';
import XMLSerializer_Beta from './XMLSerializer_Beta';
import XMLSerializer_Pela from './XMLSerializer_Pela';
import XMLSerializer_Tango from './XMLSerializer_Tango';
import XMLSerializerBeta from './XMLSerializer_Beta';
import XMLSerializerPela from './XMLSerializer_Pela';
import XMLSerializerTango from './XMLSerializer_Tango';
/**
* @class mindplot.persistence.XMLSerializerFactory
@ -33,7 +33,7 @@ const XMLSerializerFactory = {};
* @return {mindplot.persistence.XMLSerializer_Beta|mindplot.persistence.XMLSerializer_Pela|
* mindplot.persistence.XMLSerializer_Tango} serializer corresponding to the mindmap's version
*/
XMLSerializerFactory.getSerializerFromMindmap = function (mindmap) {
XMLSerializerFactory.getSerializerFromMindmap = function getSerializerFromMindmap(mindmap) {
return XMLSerializerFactory.getSerializer(mindmap.getVersion());
};
@ -41,7 +41,7 @@ XMLSerializerFactory.getSerializerFromMindmap = function (mindmap) {
* @param domDocument
* @return serializer corresponding to the mindmap's version
*/
XMLSerializerFactory.getSerializerFromDocument = function (domDocument) {
XMLSerializerFactory.getSerializerFromDocument = function getSerializerFromDocument(domDocument) {
const rootElem = domDocument.documentElement;
return XMLSerializerFactory.getSerializer(rootElem.getAttribute('version'));
};
@ -76,18 +76,18 @@ XMLSerializerFactory.getSerializer = function getSerializer(version) {
XMLSerializerFactory._codeNames = [
{
codeName: ModelCodeName.BETA,
serializer: XMLSerializer_Beta,
serializer: XMLSerializerBeta,
migrator() {
},
},
{
codeName: ModelCodeName.PELA,
serializer: XMLSerializer_Pela,
serializer: XMLSerializerPela,
migrator: Beta2PelaMigrator,
},
{
codeName: ModelCodeName.TANGO,
serializer: XMLSerializer_Tango,
serializer: XMLSerializerTango,
migrator: Pela2TangoMigrator,
},
];

View File

@ -68,13 +68,12 @@ class FloatingTip extends Events {
this.options = options;
if (this.addEvent) {
for (const option in options) {
if (typeof (options[option]) !== 'function' || !(/^on[A-Z]/).test(option)) {
continue;
}
Object.keys(options).forEach((option) => {
if (options[option] instanceof Function && (/^on[A-Z]/).test(option)) {
this.addEvent(option, options[option]);
delete options[option];
}
});
}
return this;
}