Minor code refactoring

main
Boris Sekachev 5 years ago
parent dabb153039
commit 5ccc18948a

@ -4,14 +4,13 @@
module.exports = { module.exports = {
env: { env: {
node: false, node: true,
browser: true, browser: true,
es6: true, es6: true,
jquery: true,
qunit: true,
}, },
parserOptions: { parserOptions: {
sourceType: 'script', sourceType: 'module',
ecmaVersion: 2018,
}, },
plugins: ['eslint-plugin-header'], plugins: ['eslint-plugin-header'],
extends: ['eslint:recommended', 'prettier'], extends: ['eslint:recommended', 'prettier'],

@ -1,27 +1,22 @@
{ {
"python.pythonPath": ".env/bin/python", "python.pythonPath": ".env/bin/python",
"eslint.enable": true, "eslint.enable": true,
"eslint.validate": [ "eslint.probe": [
"javascript", "javascript",
"typescript", "typescript",
"typescriptreact", "typescriptreact"
], ],
"eslint.onIgnoredFiles": "warn",
"eslint.workingDirectories": [ "eslint.workingDirectories": [
{ {
"directory": "./cvat-core", "directory": "${cwd}",
"changeProcessCWD": true
}, },
{ {
"directory": "./cvat-canvas", "pattern": "cvat-*"
"changeProcessCWD": true
}, },
{ {
"directory": "./cvat-ui", "directory": "tests",
"changeProcessCWD": true "!cwd": true
},
{
"directory": ".",
"changeProcessCWD": true
} }
], ],
"python.linting.pylintEnabled": true, "python.linting.pylintEnabled": true,

@ -4,12 +4,9 @@
module.exports = { module.exports = {
env: { env: {
amd: true, node: true,
node: false,
browser: true, browser: true,
es6: true, es6: true,
jquery: true,
qunit: true,
'jest/globals': true, 'jest/globals': true,
}, },
parserOptions: { parserOptions: {
@ -17,7 +14,7 @@ module.exports = {
sourceType: 'module', sourceType: 'module',
ecmaVersion: 2018, ecmaVersion: 2018,
}, },
plugins: ['security', 'jest', 'no-unsanitized', 'no-unsafe-innerhtml'], plugins: ['security', 'jest', 'no-unsafe-innerhtml'],
extends: ['eslint:recommended', 'plugin:security/recommended', 'plugin:no-unsanitized/DOM', 'airbnb-base'], extends: ['eslint:recommended', 'plugin:security/recommended', 'plugin:no-unsanitized/DOM', 'airbnb-base'],
rules: { rules: {
'no-await-in-loop': [0], 'no-await-in-loop': [0],

@ -2822,6 +2822,10 @@
}, },
"cvat-data": { "cvat-data": {
"version": "file:../cvat-data", "version": "file:../cvat-data",
"requires": {
"async-mutex": "^0.2.4",
"jszip": "3.5.0"
},
"dependencies": { "dependencies": {
"@babel/cli": { "@babel/cli": {
"version": "7.6.4", "version": "7.6.4",
@ -3932,9 +3936,19 @@
"integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==" "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ=="
}, },
"async-mutex": { "async-mutex": {
"version": "0.1.4", "version": "0.2.4",
"resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.1.4.tgz", "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.2.4.tgz",
"integrity": "sha512-zVWTmAnxxHaeB2B1te84oecI8zTDJ/8G49aVBblRX6be0oq6pAybNcUSxwfgVOmOjSCvN4aYZAqwtyNI8e1YGw==" "integrity": "sha512-fcQKOXUKMQc57JlmjBCHtkKNrfGpHyR7vu18RfuLfeTAf4hK9PgOadPR5cDrBQ682zasrLUhJFe7EKAHJOduDg==",
"requires": {
"tslib": "^2.0.0"
},
"dependencies": {
"tslib": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz",
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
}
}
}, },
"atob": { "atob": {
"version": "2.1.2", "version": "2.1.2",
@ -5068,11 +5082,6 @@
"event-emitter": "~0.3.5" "event-emitter": "~0.3.5"
} }
}, },
"es6-promise": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz",
"integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y="
},
"es6-set": { "es6-set": {
"version": "0.1.5", "version": "0.1.5",
"resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz",
@ -6781,22 +6790,14 @@
"integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=" "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk="
}, },
"jszip": { "jszip": {
"version": "3.1.5", "version": "3.5.0",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.1.5.tgz", "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.5.0.tgz",
"integrity": "sha512-5W8NUaFRFRqTOL7ZDDrx5qWHJyBXy6velVudIzQUSoqAAYqzSh2Z7/m0Rf1QbmQJccegD0r+YZxBjzqoBiEeJQ==", "integrity": "sha512-WRtu7TPCmYePR1nazfrtuF216cIVon/3GWOvHS9QR5bIwSbnxtdpma6un3jyGGNhHsKCSzn5Ypk+EkDRvTGiFA==",
"requires": { "requires": {
"core-js": "~2.3.0", "lie": "~3.3.0",
"es6-promise": "~3.0.2",
"lie": "~3.1.0",
"pako": "~1.0.2", "pako": "~1.0.2",
"readable-stream": "~2.0.6" "readable-stream": "~2.3.6",
}, "set-immediate-shim": "~1.0.1"
"dependencies": {
"core-js": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz",
"integrity": "sha1-+rg/uwstjchfpjbEudNMdUIMbWU="
}
} }
}, },
"kind-of": { "kind-of": {
@ -6822,9 +6823,9 @@
} }
}, },
"lie": { "lie": {
"version": "3.1.1", "version": "3.3.0",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
"integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=", "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
"requires": { "requires": {
"immediate": "~3.0.5" "immediate": "~3.0.5"
} }
@ -7699,9 +7700,9 @@
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI="
}, },
"process-nextick-args": { "process-nextick-args": {
"version": "1.0.7", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
}, },
"progress": { "progress": {
"version": "2.0.3", "version": "2.0.3",
@ -7891,15 +7892,16 @@
} }
}, },
"readable-stream": { "readable-stream": {
"version": "2.0.6", "version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"requires": { "requires": {
"core-util-is": "~1.0.0", "core-util-is": "~1.0.0",
"inherits": "~2.0.1", "inherits": "~2.0.3",
"isarray": "~1.0.0", "isarray": "~1.0.0",
"process-nextick-args": "~1.0.6", "process-nextick-args": "~2.0.0",
"string_decoder": "~0.10.x", "safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1" "util-deprecate": "~1.0.1"
} }
}, },
@ -8243,6 +8245,11 @@
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
}, },
"set-immediate-shim": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz",
"integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E="
},
"set-value": { "set-value": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
@ -8620,9 +8627,12 @@
} }
}, },
"string_decoder": { "string_decoder": {
"version": "0.10.31", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
}, },
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",

@ -1,12 +1,10 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />
import { taskName, labelName } from '../../support/const'; import { taskName } from '../../support/const';
context('Actions on polygon', () => { context('Actions on polygon', () => {
const caseId = '10'; const caseId = '10';

@ -1,13 +1,10 @@
/* eslint-disable no-undef */ // Copyright (C) 2020 Intel Corporation
/* //
* Copyright (C) 2020 Intel Corporation // SPDX-License-Identifier: MIT
*
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />
import { taskName, labelName } from '../../support/const'; import { taskName } from '../../support/const';
context('Actions on polylines', () => { context('Actions on polylines', () => {
const caseId = '11'; const caseId = '11';

@ -1,12 +1,10 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />
import { taskName, labelName } from '../../support/const'; import { taskName } from '../../support/const';
context('Actions on points', () => { context('Actions on points', () => {
const caseId = '12'; const caseId = '12';

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,12 +1,10 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />
import { taskName, labelName } from '../../support/const'; import { taskName } from '../../support/const';
context('Actions on rectangle', () => { context('Actions on rectangle', () => {
const caseId = '8'; const caseId = '8';

@ -1,12 +1,10 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />
import { taskName, labelName } from '../../support/const'; import { taskName } from '../../support/const';
context('Actions on Cuboid', () => { context('Actions on Cuboid', () => {
const caseId = '9'; const caseId = '9';

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
exports.imageGenerator = imageGenerator; exports.imageGenerator = imageGenerator;
@ -22,7 +20,7 @@ function imageGenerator(args) {
const count = args.count; const count = args.count;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
for (let i = 1; i <= count; i++) { for (let i = 1; i <= count; i++) {
const image = new jimp(width, height, color, function (err, image) { new jimp(width, height, color, function (err, image) {
if (err) reject(err); if (err) reject(err);
jimp.loadFont(jimp.FONT_SANS_64_BLACK, function (err, font) { jimp.loadFont(jimp.FONT_SANS_64_BLACK, function (err, font) {
if (err) reject(err); if (err) reject(err);

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
Cypress.Commands.add('imageGenerator', (directory, fileName, width, height, color, posX, posY, message, count) => { Cypress.Commands.add('imageGenerator', (directory, fileName, width, height, color, posX, posY, message, count) => {
return cy.task('imageGenerator', { return cy.task('imageGenerator', {

@ -1,8 +1,6 @@
/* // Copyright (C) 2020 Intel Corporation
* Copyright (C) 2020 Intel Corporation //
* // SPDX-License-Identifier: MIT
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" /> /// <reference types="cypress" />

Loading…
Cancel
Save