Fix eslint issues.

This commit is contained in:
Paulo Gustavo Veiga 2022-02-09 19:26:44 -08:00
parent be727e3c4b
commit 1a8ffee801
12 changed files with 38 additions and 26 deletions

View File

@ -35,7 +35,6 @@ class CentralTopic extends Topic {
}); });
} }
workoutIncomingConnectionPoint(): Point { workoutIncomingConnectionPoint(): Point {
return this.getPosition(); return this.getPosition();
} }

View File

@ -22,7 +22,8 @@ import { Designer } from '..';
import Topic from './Topic'; import Topic from './Topic';
class DesignerKeyboard extends Keyboard { class DesignerKeyboard extends Keyboard {
static _instance: any; // eslint-disable-next-line no-use-before-define
static _instance: DesignerKeyboard;
constructor(designer: Designer) { constructor(designer: Designer) {
super(); super();
@ -79,14 +80,14 @@ class DesignerKeyboard extends Keyboard {
this.addShortcut( this.addShortcut(
['tab'], (eventevent: Event) => { ['tab'], (eventevent: Event) => {
designer.createChildForSelectedNode(); designer.createChildForSelectedNode();
event.preventDefault(); eventevent.preventDefault();
event.stopPropagation(); eventevent.stopPropagation();
}, },
); );
this.addShortcut( this.addShortcut(
['meta+enter'], (eventevent: Event) => { ['meta+enter'], (eventevent: Event) => {
event.preventDefault(); eventevent.preventDefault();
event.stopPropagation(); eventevent.stopPropagation();
designer.createChildForSelectedNode(); designer.createChildForSelectedNode();
}, },
); );
@ -244,7 +245,7 @@ class DesignerKeyboard extends Keyboard {
const excludes = ['esc', 'escape', 'f1', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12']; const excludes = ['esc', 'escape', 'f1', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12'];
$(document).on('keypress', (event) => { $(document).on('keypress', (event) => {
let keyCode; let keyCode: number;
// Firefox doesn't skip special keys for keypress event... // Firefox doesn't skip special keys for keypress event...
if (event.key && excludes.includes(event.key.toLowerCase())) { if (event.key && excludes.includes(event.key.toLowerCase())) {
return; return;
@ -256,6 +257,7 @@ class DesignerKeyboard extends Keyboard {
keyCode = event.keyCode; keyCode = event.keyCode;
} }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const jq: any = $; const jq: any = $;
const specialKey = jq.hotkeys.specialKeys[keyCode]; const specialKey = jq.hotkeys.specialKeys[keyCode];
if (['enter', 'capslock'].indexOf(specialKey) === -1 && !jq.hotkeys.shiftNums[keyCode]) { if (['enter', 'capslock'].indexOf(specialKey) === -1 && !jq.hotkeys.shiftNums[keyCode]) {

View File

@ -27,6 +27,7 @@ import SizeType from './SizeType';
class MainTopic extends Topic { class MainTopic extends Topic {
private INNER_RECT_ATTRIBUTES: { stroke: string; }; private INNER_RECT_ATTRIBUTES: { stroke: string; };
/** /**
* @extends mindplot.Topic * @extends mindplot.Topic
* @constructs * @constructs
@ -74,7 +75,6 @@ class MainTopic extends Topic {
return group; return group;
} }
updateTopicShape(targetTopic: Topic) { updateTopicShape(targetTopic: Topic) {
// Change figure based on the connected topic ... // Change figure based on the connected topic ...
const model = this.getModel(); const model = this.getModel();

View File

@ -20,11 +20,12 @@ import { Elipse } from '@wisemapping/web2d';
import TopicConfig from './TopicConfig'; import TopicConfig from './TopicConfig';
import ActionDispatcher from './ActionDispatcher'; import ActionDispatcher from './ActionDispatcher';
import Topic from './Topic'; import Topic from './Topic';
import IconGroup from './IconGroup';
class ShirinkConnector { class ShirinkConnector {
private _isShrink: boolean; private _isShrink: boolean;
private _ellipse: any;
private _ellipse: Elipse;
constructor(topic: Topic) { constructor(topic: Topic) {
this._isShrink = false; this._isShrink = false;
const ellipse = new Elipse(TopicConfig.INNER_RECT_ATTRIBUTES); const ellipse = new Elipse(TopicConfig.INNER_RECT_ATTRIBUTES);
@ -33,7 +34,7 @@ class ShirinkConnector {
ellipse.setFill('rgb(62,118,179)'); ellipse.setFill('rgb(62,118,179)');
ellipse.setSize(TopicConfig.CONNECTOR_WIDTH, TopicConfig.CONNECTOR_WIDTH); ellipse.setSize(TopicConfig.CONNECTOR_WIDTH, TopicConfig.CONNECTOR_WIDTH);
ellipse.addEvent('click', (event) => { ellipse.addEvent('click', (event: Event) => {
const model = topic.getModel(); const model = topic.getModel();
const collapse = !model.areChildrenShrunken(); const collapse = !model.areChildrenShrunken();

View File

@ -19,7 +19,7 @@ import $ from 'jquery';
import { $assert, $defined } from '@wisemapping/core-js'; import { $assert, $defined } from '@wisemapping/core-js';
import { import {
Rect, Image, Line, Text, Group, ElementClass, Point Rect, Image, Line, Text, Group, ElementClass, Point,
} from '@wisemapping/web2d'; } from '@wisemapping/web2d';
import NodeGraph from './NodeGraph'; import NodeGraph from './NodeGraph';
@ -35,7 +35,6 @@ import NoteEditor from './widget/NoteEditor';
import ActionDispatcher from './ActionDispatcher'; import ActionDispatcher from './ActionDispatcher';
import LinkEditor from './widget/LinkEditor'; import LinkEditor from './widget/LinkEditor';
import TopicEventDispatcher, { TopicEvent } from './TopicEventDispatcher'; import TopicEventDispatcher, { TopicEvent } from './TopicEventDispatcher';
import { TopicShape } from './model/INodeModel'; import { TopicShape } from './model/INodeModel';
import NodeModel from './model/NodeModel'; import NodeModel from './model/NodeModel';
@ -50,14 +49,25 @@ const ICON_SCALING_FACTOR = 1.3;
abstract class Topic extends NodeGraph { abstract class Topic extends NodeGraph {
private _innerShape: ElementClass; private _innerShape: ElementClass;
private _relationships: Relationship[]; private _relationships: Relationship[];
private _isInWorkspace: boolean; private _isInWorkspace: boolean;
// eslint-disable-next-line no-use-before-define
private _children: Topic[]; private _children: Topic[];
// eslint-disable-next-line no-use-before-define
private _parent: Topic | null; private _parent: Topic | null;
private _outerShape: ElementClass; private _outerShape: ElementClass;
private _text: Text | null; private _text: Text | null;
private _iconsGroup: IconGroup; private _iconsGroup: IconGroup;
private _connector: any;
private _connector: ShirinkConnector;
private _outgoingLine: Line; private _outgoingLine: Line;
constructor(model: NodeModel, options) { constructor(model: NodeModel, options) {
@ -241,7 +251,7 @@ abstract class Topic extends NodeGraph {
result.setStroke(1, 'solid', stokeColor); result.setStroke(1, 'solid', stokeColor);
}; };
result.getSize = function getSize() { this.size }; result.getSize = function getSize() { return this.size; };
result.setPosition = () => { result.setPosition = () => {
// Overwrite behaviour ... // Overwrite behaviour ...
@ -1324,7 +1334,6 @@ abstract class Topic extends NodeGraph {
return result; return result;
} }
isChildTopic(childTopic: Topic): boolean { isChildTopic(childTopic: Topic): boolean {
let result = this.getId() === childTopic.getId(); let result = this.getId() === childTopic.getId();
if (!result) { if (!result) {

View File

@ -18,6 +18,7 @@
import { $assert, $defined } from '@wisemapping/core-js'; import { $assert, $defined } from '@wisemapping/core-js';
import Command from '../Command'; import Command from '../Command';
import CommandContext from '../CommandContext'; import CommandContext from '../CommandContext';
import FeatureModel from '../model/FeatureModel';
import FeatureType from '../model/FeatureType'; import FeatureType from '../model/FeatureType';
class AddFeatureToTopicCommand extends Command { class AddFeatureToTopicCommand extends Command {
@ -27,7 +28,7 @@ class AddFeatureToTopicCommand extends Command {
private _attributes: object; private _attributes: object;
private _featureModel: any; private _featureModel: FeatureModel;
/* /*
* @classdesc This command class handles do/undo of adding features to topics, e.g. an * @classdesc This command class handles do/undo of adding features to topics, e.g. an

View File

@ -24,9 +24,9 @@ class ChangeFeatureToTopicCommand extends Command {
private _topicId: number; private _topicId: number;
private _attributes: any; private _attributes;
constructor(topicId: number, featureId: number, attributes: any) { constructor(topicId: number, featureId: number, attributes) {
$assert($defined(topicId), 'topicId can not be null'); $assert($defined(topicId), 'topicId can not be null');
$assert($defined(featureId), 'featureId can not be null'); $assert($defined(featureId), 'featureId can not be null');
$assert($defined(attributes), 'attributes can not be null'); $assert($defined(attributes), 'attributes can not be null');
@ -53,7 +53,7 @@ class ChangeFeatureToTopicCommand extends Command {
* Overrides abstract parent method * Overrides abstract parent method
* @see {@link mindplot.Command.undoExecute} * @see {@link mindplot.Command.undoExecute}
*/ */
undoExecute(commandContext: any) { undoExecute(commandContext: CommandContext) {
this.execute(commandContext); this.execute(commandContext);
} }
} }

View File

@ -16,13 +16,14 @@
* limitations under the License. * limitations under the License.
*/ */
import { $assert, $defined } from '@wisemapping/core-js'; import { $assert, $defined } from '@wisemapping/core-js';
import { Line } from '@wisemapping/web2d';
import Command from '../Command'; import Command from '../Command';
import ControlPoint from '../ControlPoint'; import ControlPoint from '../ControlPoint';
class MoveControlPointCommand extends Command { class MoveControlPointCommand extends Command {
private _ctrlPointControler: ControlPoint; private _ctrlPointControler: ControlPoint;
private _line: any; private _line: Line;
private _controlPoint: any; private _controlPoint: any;

View File

@ -112,7 +112,7 @@ class BootstrapDialog extends Options {
return header; return header;
} }
onAcceptClick(event) { onAcceptClick() {
throw new Error('Unsupported operation'); throw new Error('Unsupported operation');
} }
@ -120,7 +120,7 @@ class BootstrapDialog extends Options {
// Overwrite default behaviour ... // Overwrite default behaviour ...
} }
onRemoveClick(event) { onRemoveClick() {
throw new Error('Unsupported operation'); throw new Error('Unsupported operation');
} }

View File

@ -11,7 +11,7 @@ import Client, {
ImportMapInfo, ImportMapInfo,
Permission, Permission,
} from '..'; } from '..';
import { LocaleCode, localeFromStr, Locales } from '../../app-i18n'; import { LocaleCode, localeFromStr } from '../../app-i18n';
export default class RestClient implements Client { export default class RestClient implements Client {
private baseUrl: string; private baseUrl: string;

View File

@ -1,5 +1,4 @@
import TextField from '@mui/material/TextField'; import TextField from '@mui/material/TextField';
import { row } from '@wisemapping/mindplot/src/components/widget/ColorPaletteHtml';
import React, { ChangeEvent } from 'react'; import React, { ChangeEvent } from 'react';
import { ErrorInfo } from '../../../classes/client'; import { ErrorInfo } from '../../../classes/client';

View File

@ -3,7 +3,7 @@ import React from 'react';
import { useMutation, useQueryClient } from 'react-query'; import { useMutation, useQueryClient } from 'react-query';
import Client from '../../../classes/client'; import Client from '../../../classes/client';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { activeInstance, fetchAccount } from '../../../redux/clientSlice'; import { activeInstance } from '../../../redux/clientSlice';
import { FormattedMessage, useIntl } from 'react-intl'; import { FormattedMessage, useIntl } from 'react-intl';
import AppI18n, { LocaleCode, Locales } from '../../../classes/app-i18n'; import AppI18n, { LocaleCode, Locales } from '../../../classes/app-i18n';
import Tooltip from '@mui/material/Tooltip'; import Tooltip from '@mui/material/Tooltip';