Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FEC-13600): Synchronize between Lint & prettier #744

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c0d33c9
feat(FEC-13371): Refactor: Migrate to TypeScript (from Flow)
Oct 30, 2023
eb84b3f
push for reset
Nov 1, 2023
0fca9a5
work - everyone typed excluding engines/ track/ player/ playkit/ rem…
Nov 1, 2023
88436a9
integrated smoothly with kaltura-player includeing tracks
Nov 2, 2023
687a9e0
playkit complet - everything works
Nov 2, 2023
9dbf878
playkit complet - everything works includes playkit and player files
Nov 2, 2023
8c9dd1e
lint passed
Nov 5, 2023
3942ca5
add tests
Nov 5, 2023
949fd48
passes: 466 failures: 10
Nov 5, 2023
5405a21
fix tests - all passing
Nov 7, 2023
dda77c8
fix type
Nov 7, 2023
e631ecd
Merge remote-tracking branch 'origin/master' into FEC-13371
Nov 8, 2023
dd6c87f
configure newer node version for github action
Nov 8, 2023
085a53c
fix invalid conf
Nov 8, 2023
55adee8
fix lint
Nov 8, 2023
e5b9ac4
update types
Nov 13, 2023
1d06c34
github actiions and webpack conf file
Dec 11, 2023
2c9e89c
remove flow deps
Dec 11, 2023
3c2cf68
fix test + tree shaking
Dec 19, 2023
8681c8a
Merge branch 'master' into FEC-13371
Dec 19, 2023
cfd58e0
fix lint and types
Dec 20, 2023
437abb3
fix
Dec 20, 2023
a0e29e3
fix types
Dec 24, 2023
02207f4
fix types
Dec 24, 2023
5403ff8
fix brwserlist
Dec 24, 2023
48a82a8
fix lint and serhi commonts
Dec 25, 2023
d77fe58
fix lint
Dec 25, 2023
7289f77
Merge remote-tracking branch 'origin/master' into FEC-13371
Dec 28, 2023
44e4dbd
fix(FEC-13371): Update browser-list dep
Dec 28, 2023
ddf6bbc
fix
Dec 28, 2023
6c50ca9
Merge remote-tracking branch 'origin/master' into FEC-13600
Dec 31, 2023
14edfdb
fix(FEC-13600): Synchronize between Lint & prettier
Dec 31, 2023
66dbf1f
fix
Dec 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 19 additions & 23 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"plugins": ["@typescript-eslint"],
"extends": ["plugin:prettier/recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"plugins": ["prettier", "@typescript-eslint"],
"rules": {
"indent": ["error", 2],
"react/prefer-stateless-function": "off",
"max-len": ["warn", { "code": 500 }],
"max-len": [
"error",
{
"code": 150,
"ignoreComments": true,
"ignoreStrings": true,
"ignoreUrls": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}
],
"space-before-function-paren": "off",
"eol-last": "off",
"prettier/prettier": "error",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": "error",
// "@typescript-eslint/no-explicit-any": "warn",
// "@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-member-accessibility": [
"error",
Expand All @@ -27,34 +38,19 @@
}
],
"block-scoped-var": "error",
"arrow-parens": "error",
"eqeqeq": "error",
"no-var": "error",
"no-console": "error",
"prefer-const": "error",
"prefer-arrow-callback": "error",
"no-trailing-spaces": "error",
"quotes": ["warn", "single", { "avoidEscape": true }],
"no-restricted-properties": [
"error",
{
"object": "describe",
"property": "only"
},
{
"object": "it",
"property": "only"
}
]
"quotes": ["warn", "single", { "avoidEscape": true }]
},
"overrides": [],
"settings": {
"jest": {
"version": 26
}
},
"settings": {},
"env": {
"browser": true,
"commonjs": true,
"es6": true
}
}
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: kaltura/ovp-pipelines-pub/.github/workflows/player_tests.yaml@master
with:
node-version: '20.x'
yarn-run-to-execute: 'build'
yarn-run-to-execute: 'build:prod'
test:
uses: kaltura/ovp-pipelines-pub/.github/workflows/player_tests.yaml@master
with:
Expand Down
6 changes: 2 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"printWidth": 200,
"printWidth": 150,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"proseWrap": "preserve"
"arrowParens": "always"
}
4 changes: 2 additions & 2 deletions api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
},
"extractorMessageReporting": {
"default": {
"logLevel": "warning"
"logLevel": "none"
}
},
"tsdocMessageReporting": {
"default": {
"logLevel": "warning"
"logLevel": "none"
}
}
}
Expand Down
32 changes: 16 additions & 16 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
#player-placeholder {
width: 640px;
height: 360px;
background-color: black;
}
</style>
<script src="./playkit.js" type="text/javascript"></script>
</head>
<body>
<div id="player-placeholder"></div>
</body>
<head>
<meta charset="UTF-8" />
<title>Title</title>
<style>
#player-placeholder {
width: 640px;
height: 360px;
background-color: black;
}
</style>
<script src="./playkit.js" type="text/javascript"></script>
</head>
<body>
<div id="player-placeholder"></div>
</body>
</html>
8 changes: 5 additions & 3 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const webpackConfig = require('./webpack.config')( null, {mode: 'development'});
const webpackConfig = require('./webpack.config')(null, {
mode: 'development'
});
delete webpackConfig.entry;
delete webpackConfig.externals;
delete webpackConfig.output;
Expand All @@ -15,15 +17,15 @@ module.exports = function (config) {
{
pattern: 'tests/assets/**/*',
included: false
},
}
],
exclude: [],
preprocessors: {
'tests/index.js': ['webpack', 'sourcemap']
},
reporters: ['mocha'],
mochaReporter: {
showDiff: true,
showDiff: true
},

coverageIstanbulReporter: {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@
"copy-webpack-plugin": "^11.0.0",
"css-loader": "6.8.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-mocha": "^10.2.0",
"eslint-plugin-prettier": "^5.1.2",
"karma": "^6.4.0",
"karma-chrome-launcher": "^3.1.1",
"karma-firefox-launcher": "^1.3.0",
Expand Down
4 changes: 2 additions & 2 deletions src/ads/ad-error-code.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const AdErrorCode: {[code: string]: number} = {
const AdErrorCode: { [code: string]: number } = {
/**
* VAST supplied in adm is not a valid XML document.
* URL supplied in nurl does not resolve to a valid XML document.
Expand Down Expand Up @@ -172,4 +172,4 @@ const AdErrorCode: {[code: string]: number} = {
GENERAL_VPAID_ERROR: 8901
};

export {AdErrorCode};
export { AdErrorCode };
2 changes: 1 addition & 1 deletion src/ads/ad-event-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ const AdEventType = {
AD_AUTOPLAY_FAILED: 'adautoplayfailed'
} as const;

export {AdEventType};
export { AdEventType };
2 changes: 1 addition & 1 deletion src/ads/ad-tag-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const AdTagType = {
export const AdTagType = {
VAST: 'vast',
VMAP: 'vmap'
} as const;
14 changes: 7 additions & 7 deletions src/drm/fairplay.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {FairPlayDrmConfigType} from '../engines/html5/media-source/adapters/fairplay-drm-handler';
import {DrmScheme} from './drm-scheme';
import {PKDrmConfigObject, PKDrmDataObject} from '../types';
import {ILogger} from 'js-logger';
import { FairPlayDrmConfigType } from '../engines/html5/media-source/adapters/fairplay-drm-handler';
import { DrmScheme } from './drm-scheme';
import { PKDrmConfigObject, PKDrmDataObject } from '../types';
import { ILogger } from 'js-logger';
import getLogger from '../utils/logger';

const _logger: ILogger = getLogger('FairPlay');
Expand All @@ -14,7 +14,7 @@ class FairPlay {
* @return {boolean} - Whether FairPlay is the configure key system.
*/
public static isConfigured(drmData: Array<PKDrmDataObject>, drmConfig: PKDrmConfigObject): boolean {
return DrmScheme.FAIRPLAY === drmConfig.keySystem && !!drmData.find(drmEntry => drmEntry.scheme === drmConfig.keySystem);
return DrmScheme.FAIRPLAY === drmConfig.keySystem && !!drmData.find((drmEntry) => drmEntry.scheme === drmConfig.keySystem);
}

/**
Expand All @@ -27,7 +27,7 @@ class FairPlay {
public static canPlayDrm(drmData: Array<PKDrmDataObject>): boolean {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const result = drmData.some(drmEntry => drmEntry.scheme === DrmScheme.FAIRPLAY) && !!window.WebKitMediaKeys;
const result = drmData.some((drmEntry) => drmEntry.scheme === DrmScheme.FAIRPLAY) && !!window.WebKitMediaKeys;
_logger.debug(`Can play DRM scheme of: ${DrmScheme.FAIRPLAY} is ${result.toString()}`);
return result;
}
Expand All @@ -40,7 +40,7 @@ class FairPlay {
*/
public static setDrmPlayback(config: FairPlayDrmConfigType, drmData: Array<PKDrmDataObject>): void {
_logger.debug('Sets drm playback');
const drmEntry = drmData.find(drmEntry => drmEntry.scheme === DrmScheme.FAIRPLAY);
const drmEntry = drmData.find((drmEntry) => drmEntry.scheme === DrmScheme.FAIRPLAY);
if (drmEntry) {
config.licenseUrl = drmEntry.licenseUrl;
config.certificate = drmEntry.certificate;
Expand Down
8 changes: 4 additions & 4 deletions src/engines/dropped-frames-watcher.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FakeEventTarget } from '../event/fake-event-target';
import getLogger from '../utils/logger';
import {CustomEventType} from '../event/event-type';
import { CustomEventType } from '../event/event-type';
import { EventManager } from '../event/event-manager';
import { FakeEvent } from '../event/fake-event';
import {IMediaSourceAdapter} from '../types';
import {PKAbrConfigObject} from '../types';
import { IMediaSourceAdapter } from '../types';
import { PKAbrConfigObject } from '../types';

const NOT_SUPPORTED: number = -1;

Expand Down Expand Up @@ -108,4 +108,4 @@ class DroppedFramesWatcher extends FakeEventTarget {
}
}

export {DroppedFramesWatcher};
export { DroppedFramesWatcher };
10 changes: 5 additions & 5 deletions src/engines/engine-decorator-manager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow
import getLogger from '../utils/logger';
import {IEngine} from '../types/interfaces/engine';
import {IEngineDecorator} from '../types/interfaces/engine-decorator';
import {IEngineDecoratorProvider} from '../types';
import { IEngine } from '../types/interfaces/engine';
import { IEngineDecorator } from '../types/interfaces/engine-decorator';
import { IEngineDecoratorProvider } from '../types';
import { FakeEvent } from '../event/fake-event';

/**
Expand All @@ -23,7 +23,7 @@ class EngineDecoratorManager {

public createDecorators(engine: IEngine, dispatchEvent: (event: FakeEvent) => void): Array<IEngineDecorator> {
this._logger.debug(`decorators created for ${Array.from(this._decoratorProviders.keys()).toString()}`);
return Array.from(this._decoratorProviders.values(), engineDecoratorProvider =>
return Array.from(this._decoratorProviders.values(), (engineDecoratorProvider) =>
engineDecoratorProvider.getEngineDecorator(engine, dispatchEvent)
);
}
Expand All @@ -34,4 +34,4 @@ class EngineDecoratorManager {
}
}

export {EngineDecoratorManager};
export { EngineDecoratorManager };
8 changes: 4 additions & 4 deletions src/engines/engine-decorator-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* @param {IEngineDecoratorProvider} plugin - The plugin which have implemented decorator.
* @implements {IEngineDecorator}
*/
import {IEngineDecoratorProvider} from '../types';
import {IEngine} from '../types/interfaces/engine';
import {IEngineDecorator} from '../types/interfaces/engine-decorator';
import { IEngineDecoratorProvider } from '../types';
import { IEngine } from '../types/interfaces/engine';
import { IEngineDecorator } from '../types/interfaces/engine-decorator';
import { FakeEvent } from '../event/fake-event';

class EngineDecoratorProvider implements IEngineDecoratorProvider {
Expand All @@ -27,4 +27,4 @@ class EngineDecoratorProvider implements IEngineDecoratorProvider {
}
}

export {EngineDecoratorProvider};
export { EngineDecoratorProvider };
18 changes: 9 additions & 9 deletions src/engines/engine-decorator.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FakeEvent } from '../event/fake-event';
import {EventType} from '../event/event-type';
import { EventType } from '../event/event-type';
import { EventManager } from '../event/event-manager';
import { FakeEventTarget } from '../event/fake-event-target';
import {EngineDecoratorManager} from './engine-decorator-manager';
import {IEngineDecorator} from '../types/interfaces/engine-decorator';
import {IEngine} from '../types/interfaces/engine';
import { EngineDecoratorManager } from './engine-decorator-manager';
import { IEngineDecorator } from '../types/interfaces/engine-decorator';
import { IEngine } from '../types/interfaces/engine';

export type EngineDecoratorType = EngineDecorator & IEngine;

Expand All @@ -23,13 +23,13 @@ class EngineDecorator extends FakeEventTarget implements IEngineDecorator {
this._eventManager = new EventManager();
this._pluginDecorators = decoratorManager.createDecorators(engine, super.dispatchEvent.bind(this));
const events: Array<string> = Object.values(EventType);
events.forEach(event => this._eventManager.listen(engine, event, (e: FakeEvent) => this.dispatchEvent(e)));
events.forEach((event) => this._eventManager.listen(engine, event, (e: FakeEvent) => this.dispatchEvent(e)));
return new Proxy<IEngine>(engine, {
get: (obj, prop): IEngine => {
if (prop === 'destroy') {
this._destroy();
}
const activeDecorator = this._pluginDecorators.find(decorator => decorator.active);
const activeDecorator = this._pluginDecorators.find((decorator) => decorator.active);
let target;
//For events the proxy is the target - to avoid listening to engine itself
if (prop === 'addEventListener' || prop === 'removeEventListener') {
Expand All @@ -41,15 +41,15 @@ class EngineDecorator extends FakeEventTarget implements IEngineDecorator {
return target[prop] && typeof target[prop].bind === 'function' ? target[prop].bind(target) : target[prop];
},
set: (obj, prop, value): boolean => {
const activeDecorator = this._pluginDecorators.find(decorator => prop in decorator && decorator.active);
const activeDecorator = this._pluginDecorators.find((decorator) => prop in decorator && decorator.active);
activeDecorator && prop in activeDecorator ? (activeDecorator[prop] = value) : (obj[prop] = value);
return true;
}
}) as EngineDecoratorType;
}

public dispatchEvent(event: FakeEvent): boolean {
const activeDecorator = this._pluginDecorators.find(decorator => decorator.active);
const activeDecorator = this._pluginDecorators.find((decorator) => decorator.active);
return activeDecorator && activeDecorator.dispatchEvent ? activeDecorator.dispatchEvent(event) : super.dispatchEvent(event);
}

Expand All @@ -63,4 +63,4 @@ class EngineDecorator extends FakeEventTarget implements IEngineDecorator {
}
}

export {EngineDecorator};
export { EngineDecorator };
8 changes: 4 additions & 4 deletions src/engines/engine-provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import getLogger from '../utils/logger';
import Html5 from './html5/html5';
import {IEngineStatic} from '../types';
import { IEngineStatic } from '../types';

/**
* Engine Provider
Expand All @@ -21,7 +21,7 @@ class EngineProvider {
* @static
* @private
*/
private static _engineProviders: {[id: string]: IEngineStatic} = {};
private static _engineProviders: { [id: string]: IEngineStatic } = {};

/**
* Add an engine to the registry.
Expand Down Expand Up @@ -61,7 +61,7 @@ class EngineProvider {
* @static
*/
public static getEngines(): Array<IEngineStatic> {
return Object.keys(EngineProvider._engineProviders).map(key => EngineProvider._engineProviders[key]);
return Object.keys(EngineProvider._engineProviders).map((key) => EngineProvider._engineProviders[key]);
}

/**
Expand All @@ -80,4 +80,4 @@ if (Html5.isSupported()) {

const registerEngine = EngineProvider.register;
const unRegisterEngine = EngineProvider.unRegister;
export {registerEngine, unRegisterEngine, EngineProvider};
export { registerEngine, unRegisterEngine, EngineProvider };
Loading