Integration of tslint static analyser for cvat-canvas (#624)
parent
440b3de63c
commit
aab6a124ed
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
'env': {
|
||||
'node': true,
|
||||
'browser': true,
|
||||
'es6': true,
|
||||
},
|
||||
'parserOptions': {
|
||||
'parser': '@typescript-eslint/parser',
|
||||
'sourceType': 'module',
|
||||
'ecmaVersion': 6,
|
||||
},
|
||||
'plugins': [
|
||||
'security',
|
||||
'no-unsanitized',
|
||||
'no-unsafe-innerhtml',
|
||||
'@typescript-eslint',
|
||||
],
|
||||
'extends': [
|
||||
'eslint:recommended',
|
||||
'plugin:security/recommended',
|
||||
'plugin:no-unsanitized/DOM',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'airbnb',
|
||||
],
|
||||
'rules': {
|
||||
'no-new': [0],
|
||||
'class-methods-use-this': [0],
|
||||
'no-plusplus': [0],
|
||||
'no-restricted-syntax': [0, {'selector': 'ForOfStatement'}],
|
||||
'no-continue': [0],
|
||||
'security/detect-object-injection': 0,
|
||||
'indent': ['warn', 4],
|
||||
'no-useless-constructor': 0,
|
||||
'func-names': [0],
|
||||
'no-console': [0], // this rule deprecates console.log, console.warn etc. because 'it is not good in production code'
|
||||
'@typescript-eslint/no-explicit-any': [0],
|
||||
'lines-between-class-members': [0],
|
||||
},
|
||||
'settings': {
|
||||
'import/resolver': {
|
||||
'node': {
|
||||
'extensions': ['.ts', '.js', '.json'],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -1,16 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title> CVAT-CANVAS Dev Server </title>
|
||||
<script type="text/javascript" src="index.js"></script>
|
||||
<script type="text/javascript" src="cvat-core.js"></script>
|
||||
<script type="text/javascript" src="cvat-canvas.js"></script>
|
||||
<link rel = "stylesheet" type = "text/css" href = "canvas.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="htmlContainer" style="width: 1920px;height: 1080px;">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,28 +0,0 @@
|
||||
window.addEventListener('DOMContentLoaded', async () => {
|
||||
await window.cvat.server.login('admin', 'nimda760');
|
||||
const [job] = (await window.cvat.jobs.get({ jobID: 21 }));
|
||||
const canvas = new window.canvas.Canvas();
|
||||
const htmlContainer = window.document.getElementById('htmlContainer');
|
||||
|
||||
|
||||
htmlContainer.appendChild(canvas.html());
|
||||
|
||||
let frame = 0;
|
||||
const callback = async () => {
|
||||
canvas.fit();
|
||||
const frameData = await job.frames.get(frame);
|
||||
canvas.setup(frameData, []);
|
||||
frame += 1;
|
||||
|
||||
if (frame > 50) {
|
||||
frame = 0;
|
||||
}
|
||||
};
|
||||
|
||||
canvas.html().addEventListener('canvas.setup', async () => {
|
||||
setTimeout(callback, 30);
|
||||
});
|
||||
|
||||
const frameData = await job.frames.get(frame);
|
||||
canvas.setup(frameData, []);
|
||||
});
|
||||
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
module.exports = {
|
||||
defaultSeverity: 'error',
|
||||
extends: [
|
||||
'tslint:recommended',
|
||||
'tslint-config-airbnb'
|
||||
],
|
||||
jsRules: {},
|
||||
rulesDirectory: [],
|
||||
rules: {
|
||||
'ter-indent': ['warn', 4],
|
||||
// TypeScript guildline prevents interfaces names started with I
|
||||
// https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#names
|
||||
'interface-name': false,
|
||||
'no-console': false,
|
||||
// Arrow functions doesn't use closure context, but sometimes we need it
|
||||
// At the same time typescript non-arrow functions are forbidden in TS
|
||||
// So, we forced to disable this rule
|
||||
'no-this-assignment': false,
|
||||
// Just a strange rule
|
||||
'no-shadowed-variable': false,
|
||||
// Don't prevent ++ and -- operations (the same like in eslint)
|
||||
'no-increment-decrement': false,
|
||||
},
|
||||
linterOptions: {
|
||||
include: ['src/*.ts']
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue