diff --git a/packages/mindplot/.eslintrc.json b/packages/mindplot/.eslintrc.json index 7260f934..c0cf2251 100644 --- a/packages/mindplot/.eslintrc.json +++ b/packages/mindplot/.eslintrc.json @@ -12,6 +12,7 @@ "rules": { "no-underscore-dangle": "off", "no-plusplus": "off", + "no-param-reassign": "off", "class-methods-use-this": "off", "import/no-extraneous-dependencies": ["error", {"devDependencies": ["!cypress/**/*.js"]}] }, diff --git a/packages/mindplot/package.json b/packages/mindplot/package.json index 2c3f9444..36648cd6 100644 --- a/packages/mindplot/package.json +++ b/packages/mindplot/package.json @@ -33,7 +33,7 @@ "@wisemapping/core-js": "^0.4.0", "@wisemapping/web2d": "^0.4.0", "jest": "^27.4.3", - "jquery": "^3.6.0", + "jquery": "3.6.0", "lodash": "^4.17.21" }, "devDependencies": { diff --git a/packages/mindplot/src/components/CentralTopic.js b/packages/mindplot/src/components/CentralTopic.js index 962b0b96..1d37dbb3 100644 --- a/packages/mindplot/src/components/CentralTopic.js +++ b/packages/mindplot/src/components/CentralTopic.js @@ -16,6 +16,7 @@ * limitations under the License. */ import * as web2d from '@wisemapping/web2d'; +import { $assert } from '@wisemapping/core-js'; import Topic from './Topic'; import Shape from './util/Shape'; diff --git a/packages/mindplot/src/components/Command.js b/packages/mindplot/src/components/Command.js index 8fa423e6..29895eb6 100644 --- a/packages/mindplot/src/components/Command.js +++ b/packages/mindplot/src/components/Command.js @@ -30,7 +30,7 @@ class Command { * @abstract */ execute(commandContext) { - throw 'execute must be implemented.'; + throw new Error('execute must be implemented.'); } /** @@ -38,7 +38,7 @@ class Command { * @abstract */ undoExecute(commandContext) { - throw 'undo must be implemented.'; + throw new Error('undo must be implemented.'); } /** @@ -50,10 +50,10 @@ class Command { } } -Command._nextUUID = function () { +Command._nextUUID = function _nextUUID() { if (!$defined(Command._uuid)) { Command._uuid = 1; -} + } Command._uuid += 1; return Command._uuid; diff --git a/packages/mindplot/src/components/CommandContext.js b/packages/mindplot/src/components/CommandContext.js index 6bc4ba7b..1376e962 100644 --- a/packages/mindplot/src/components/CommandContext.js +++ b/packages/mindplot/src/components/CommandContext.js @@ -15,8 +15,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { $assert, $defined } from "@wisemapping/core-js"; -import EventBus from "./layout/EventBus"; +import { $assert, $defined } from '@wisemapping/core-js'; +import EventBus from './layout/EventBus'; +import NodeModel from './model/NodeModel'; class CommandContext { constructor(designer) { diff --git a/packages/mindplot/src/components/model/IMindmap.js b/packages/mindplot/src/components/model/IMindmap.js index 5d9e80d6..0cf0c578 100644 --- a/packages/mindplot/src/components/model/IMindmap.js +++ b/packages/mindplot/src/components/model/IMindmap.js @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { $assert } from "@wisemapping/core-js"; +import { $assert } from '@wisemapping/core-js'; class IMindmap { getCentralTopic() { diff --git a/packages/mindplot/src/components/persistence/Pela2TangoMigrator.js b/packages/mindplot/src/components/persistence/Pela2TangoMigrator.js index 064b2374..9b17944b 100644 --- a/packages/mindplot/src/components/persistence/Pela2TangoMigrator.js +++ b/packages/mindplot/src/components/persistence/Pela2TangoMigrator.js @@ -44,7 +44,7 @@ class Pela2TangoMigrator { const children = centralNode.getChildren(); const leftNodes = []; const rightNodes = []; - for (var i = 0; i < children.length; i++) { + for (let i = 0; i < children.length; i++) { const child = children[i]; const position = child.getPosition(); if (position.x < 0) { @@ -56,11 +56,11 @@ class Pela2TangoMigrator { rightNodes.sort((a, b) => a.getOrder() > b.getOrder()); leftNodes.sort((a, b) => a.getOrder() > b.getOrder()); - for (i = 0; i < rightNodes.length; i++) { + for (let i = 0; i < rightNodes.length; i++) { rightNodes[i].setOrder(i * 2); } - for (i = 0; i < leftNodes.length; i++) { + for (let i = 0; i < leftNodes.length; i++) { leftNodes[i].setOrder(i * 2 + 1); } } @@ -75,6 +75,7 @@ class Pela2TangoMigrator { this._fixNodePosition(child, position); } } + _fixNodePosition(node, parentPosition) { // Position was not required in previous versions. Try to synthesize one . let position = node.getPosition(); diff --git a/packages/mindplot/src/components/widget/Menu.js b/packages/mindplot/src/components/widget/Menu.js index 134e90a9..96947732 100644 --- a/packages/mindplot/src/components/widget/Menu.js +++ b/packages/mindplot/src/components/widget/Menu.js @@ -18,7 +18,7 @@ import $ from 'jquery'; import { $defined } from '@wisemapping/core-js'; import { $msg } from '../Messages'; -import BootstrapDialogRequest from "../libraries/bootstrap/BootstrapDialogRequest"; +import BootstrapDialogRequest from '../libraries/bootstrap/BootstrapDialogRequest'; import IMenu from './IMenu'; import FontFamilyPanel from './FontFamilyPanel'; import FontSizePanel from './FontSizePanel'; diff --git a/packages/mindplot/webpack.common.js b/packages/mindplot/webpack.common.js index 514b88a8..74f13674 100644 --- a/packages/mindplot/webpack.common.js +++ b/packages/mindplot/webpack.common.js @@ -1,7 +1,6 @@ const path = require('path'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); -/** @type {import('webpack').Configuration} */ module.exports = { output: { path: path.resolve(__dirname, 'dist'), @@ -22,7 +21,6 @@ module.exports = { }, ], }, - target: 'web', resolve: { alias: { '@libraries': path.resolve(__dirname, '../../libraries/'), diff --git a/packages/mindplot/webpack.dev.js b/packages/mindplot/webpack.dev.js index 6ae8c22f..58be844d 100644 --- a/packages/mindplot/webpack.dev.js +++ b/packages/mindplot/webpack.dev.js @@ -2,7 +2,6 @@ const { HotModuleReplacementPlugin } = require('webpack'); const { merge } = require('webpack-merge'); const common = require('./webpack.common'); -/** @type {import('webpack').Configuration} */ const devConfig = { mode: 'development', devServer: { diff --git a/packages/mindplot/webpack.playground.js b/packages/mindplot/webpack.playground.js index dcbb09b8..58e1eb4c 100644 --- a/packages/mindplot/webpack.playground.js +++ b/packages/mindplot/webpack.playground.js @@ -3,7 +3,6 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin'); -/** @type {import('webpack').Configuration} */ module.exports = { entry: { layout: path.resolve(__dirname, './test/playground/layout/context-loader'), diff --git a/packages/web2d/package.json b/packages/web2d/package.json index d168d6d4..073bcf98 100644 --- a/packages/web2d/package.json +++ b/packages/web2d/package.json @@ -45,12 +45,12 @@ "webpack": "^5.44.0", "webpack-cli": "^4.7.2", "webpack-dev-server": "^3.11.2", - "clean-webpack-plugin": "^4.0.0-alpha.0", + "clean-webpack-plugin": "^4.0.0", "html-webpack-plugin": "^5.3.2", "webpack-merge": "^5.8.0" }, "dependencies": { "@wisemapping/core-js": "^0.4.0", - "jquery": "^3.6.0" + "jquery": "3.6.0" } } \ No newline at end of file diff --git a/packages/web2d/webpack.common.js b/packages/web2d/webpack.common.js index e10f2869..14aca07d 100644 --- a/packages/web2d/webpack.common.js +++ b/packages/web2d/webpack.common.js @@ -1,7 +1,6 @@ const path = require('path'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); -/** @type {import('webpack').Configuration} */ module.exports = { output: { path: path.resolve(__dirname, 'dist'), @@ -22,6 +21,5 @@ module.exports = { }, ], }, - target: 'web', plugins: [new CleanWebpackPlugin()], };