From 0a5b71123d84e3d42076fbe261cd3e4a6ef46c75 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 7 Nov 2022 11:45:57 +0300 Subject: [PATCH] Fix ESLint errors in `cvat-data.ts` (#5247) By converting it into an ES6 module. Also, fix `tsconfig.json` so that ESLint knows that the file is actually in the project. --- cvat-data/src/ts/cvat-data.ts | 20 +++++++------------- cvat-data/tsconfig.json | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/cvat-data/src/ts/cvat-data.ts b/cvat-data/src/ts/cvat-data.ts index a7246b91..1484fff0 100644 --- a/cvat-data/src/ts/cvat-data.ts +++ b/cvat-data/src/ts/cvat-data.ts @@ -2,23 +2,23 @@ // // SPDX-License-Identifier: MIT -const { Mutex } = require('async-mutex'); +import { Mutex } from 'async-mutex'; // eslint-disable-next-line max-classes-per-file -const { MP4Reader, Bytestream } = require('./3rdparty/mp4'); -const ZipDecoder = require('./unzip_imgs.worker'); -const H264Decoder = require('./3rdparty/Decoder.worker'); +import { MP4Reader, Bytestream } from './3rdparty/mp4'; +import ZipDecoder from './unzip_imgs.worker'; +import H264Decoder from './3rdparty/Decoder.worker'; -const BlockType = Object.freeze({ +export const BlockType = Object.freeze({ MP4VIDEO: 'mp4video', ARCHIVE: 'archive', }); -const DimensionType = Object.freeze({ +export const DimensionType = Object.freeze({ DIM_3D: '3d', DIM_2D: '2d', }); -class FrameProvider { +export class FrameProvider { constructor( blockType, blockSize, @@ -373,9 +373,3 @@ class FrameProvider { return [...this._blocksRanges].sort((a, b) => a.split(':')[0] - b.split(':')[0]); } } - -module.exports = { - FrameProvider, - BlockType, - DimensionType, -}; diff --git a/cvat-data/tsconfig.json b/cvat-data/tsconfig.json index 036d7e73..0091ff8d 100644 --- a/cvat-data/tsconfig.json +++ b/cvat-data/tsconfig.json @@ -9,5 +9,5 @@ "noEmit": true, "baseUrl": "src", }, - "include": ["src/*.ts"] + "include": ["src/ts/*.ts"] }