Fix inspections

This commit is contained in:
Paulo Gustavo Veiga 2021-12-19 00:44:08 -08:00
parent 40d5924e25
commit 6cb88b9303
13 changed files with 18 additions and 20 deletions

View File

@ -12,6 +12,7 @@
"rules": { "rules": {
"no-underscore-dangle": "off", "no-underscore-dangle": "off",
"no-plusplus": "off", "no-plusplus": "off",
"no-param-reassign": "off",
"class-methods-use-this": "off", "class-methods-use-this": "off",
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["!cypress/**/*.js"]}] "import/no-extraneous-dependencies": ["error", {"devDependencies": ["!cypress/**/*.js"]}]
}, },

View File

@ -33,7 +33,7 @@
"@wisemapping/core-js": "^0.4.0", "@wisemapping/core-js": "^0.4.0",
"@wisemapping/web2d": "^0.4.0", "@wisemapping/web2d": "^0.4.0",
"jest": "^27.4.3", "jest": "^27.4.3",
"jquery": "^3.6.0", "jquery": "3.6.0",
"lodash": "^4.17.21" "lodash": "^4.17.21"
}, },
"devDependencies": { "devDependencies": {

View File

@ -16,6 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
import * as web2d from '@wisemapping/web2d'; import * as web2d from '@wisemapping/web2d';
import { $assert } from '@wisemapping/core-js';
import Topic from './Topic'; import Topic from './Topic';
import Shape from './util/Shape'; import Shape from './util/Shape';

View File

@ -30,7 +30,7 @@ class Command {
* @abstract * @abstract
*/ */
execute(commandContext) { execute(commandContext) {
throw 'execute must be implemented.'; throw new Error('execute must be implemented.');
} }
/** /**
@ -38,7 +38,7 @@ class Command {
* @abstract * @abstract
*/ */
undoExecute(commandContext) { undoExecute(commandContext) {
throw 'undo must be implemented.'; throw new Error('undo must be implemented.');
} }
/** /**
@ -50,7 +50,7 @@ class Command {
} }
} }
Command._nextUUID = function () { Command._nextUUID = function _nextUUID() {
if (!$defined(Command._uuid)) { if (!$defined(Command._uuid)) {
Command._uuid = 1; Command._uuid = 1;
} }

View File

@ -15,8 +15,9 @@
* 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 { $assert, $defined } from "@wisemapping/core-js"; import { $assert, $defined } from '@wisemapping/core-js';
import EventBus from "./layout/EventBus"; import EventBus from './layout/EventBus';
import NodeModel from './model/NodeModel';
class CommandContext { class CommandContext {
constructor(designer) { constructor(designer) {

View File

@ -16,7 +16,7 @@
* 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 { $assert } from "@wisemapping/core-js"; import { $assert } from '@wisemapping/core-js';
class IMindmap { class IMindmap {
getCentralTopic() { getCentralTopic() {

View File

@ -44,7 +44,7 @@ class Pela2TangoMigrator {
const children = centralNode.getChildren(); const children = centralNode.getChildren();
const leftNodes = []; const leftNodes = [];
const rightNodes = []; const rightNodes = [];
for (var i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
const child = children[i]; const child = children[i];
const position = child.getPosition(); const position = child.getPosition();
if (position.x < 0) { if (position.x < 0) {
@ -56,11 +56,11 @@ class Pela2TangoMigrator {
rightNodes.sort((a, b) => a.getOrder() > b.getOrder()); rightNodes.sort((a, b) => a.getOrder() > b.getOrder());
leftNodes.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); 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); leftNodes[i].setOrder(i * 2 + 1);
} }
} }
@ -75,6 +75,7 @@ class Pela2TangoMigrator {
this._fixNodePosition(child, position); this._fixNodePosition(child, position);
} }
} }
_fixNodePosition(node, parentPosition) { _fixNodePosition(node, parentPosition) {
// Position was not required in previous versions. Try to synthesize one . // Position was not required in previous versions. Try to synthesize one .
let position = node.getPosition(); let position = node.getPosition();

View File

@ -18,7 +18,7 @@
import $ from 'jquery'; import $ from 'jquery';
import { $defined } from '@wisemapping/core-js'; import { $defined } from '@wisemapping/core-js';
import { $msg } from '../Messages'; import { $msg } from '../Messages';
import BootstrapDialogRequest from "../libraries/bootstrap/BootstrapDialogRequest"; import BootstrapDialogRequest from '../libraries/bootstrap/BootstrapDialogRequest';
import IMenu from './IMenu'; import IMenu from './IMenu';
import FontFamilyPanel from './FontFamilyPanel'; import FontFamilyPanel from './FontFamilyPanel';
import FontSizePanel from './FontSizePanel'; import FontSizePanel from './FontSizePanel';

View File

@ -1,7 +1,6 @@
const path = require('path'); const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
/** @type {import('webpack').Configuration} */
module.exports = { module.exports = {
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
@ -22,7 +21,6 @@ module.exports = {
}, },
], ],
}, },
target: 'web',
resolve: { resolve: {
alias: { alias: {
'@libraries': path.resolve(__dirname, '../../libraries/'), '@libraries': path.resolve(__dirname, '../../libraries/'),

View File

@ -2,7 +2,6 @@ const { HotModuleReplacementPlugin } = require('webpack');
const { merge } = require('webpack-merge'); const { merge } = require('webpack-merge');
const common = require('./webpack.common'); const common = require('./webpack.common');
/** @type {import('webpack').Configuration} */
const devConfig = { const devConfig = {
mode: 'development', mode: 'development',
devServer: { devServer: {

View File

@ -3,7 +3,6 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin');
/** @type {import('webpack').Configuration} */
module.exports = { module.exports = {
entry: { entry: {
layout: path.resolve(__dirname, './test/playground/layout/context-loader'), layout: path.resolve(__dirname, './test/playground/layout/context-loader'),

View File

@ -45,12 +45,12 @@
"webpack": "^5.44.0", "webpack": "^5.44.0",
"webpack-cli": "^4.7.2", "webpack-cli": "^4.7.2",
"webpack-dev-server": "^3.11.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", "html-webpack-plugin": "^5.3.2",
"webpack-merge": "^5.8.0" "webpack-merge": "^5.8.0"
}, },
"dependencies": { "dependencies": {
"@wisemapping/core-js": "^0.4.0", "@wisemapping/core-js": "^0.4.0",
"jquery": "^3.6.0" "jquery": "3.6.0"
} }
} }

View File

@ -1,7 +1,6 @@
const path = require('path'); const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
/** @type {import('webpack').Configuration} */
module.exports = { module.exports = {
output: { output: {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
@ -22,6 +21,5 @@ module.exports = {
}, },
], ],
}, },
target: 'web',
plugins: [new CleanWebpackPlugin()], plugins: [new CleanWebpackPlugin()],
}; };