Skip to content

Commit

Permalink
periodic dependency update with many lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
peaBerberian committed Aug 25, 2023
1 parent 33df454 commit 7e311ee
Show file tree
Hide file tree
Showing 25 changed files with 2,878 additions and 2,177 deletions.
4,883 changes: 2,791 additions & 2,092 deletions package-lock.json

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,37 +80,37 @@
"next-tick": "1.1.0"
},
"devDependencies": {
"@babel/core": "7.22.5",
"@babel/plugin-transform-runtime": "7.22.5",
"@babel/preset-env": "7.22.5",
"@babel/core": "7.22.11",
"@babel/plugin-transform-runtime": "7.22.10",
"@babel/preset-env": "7.22.10",
"@babel/preset-react": "7.22.5",
"@types/chai": "4.3.5",
"@types/jest": "29.5.2",
"@types/jest": "29.5.4",
"@types/mocha": "10.0.1",
"@types/node": "20.3.1",
"@types/react": "18.2.12",
"@types/react-dom": "18.2.5",
"@types/sinon": "10.0.15",
"@typescript-eslint/eslint-plugin": "5.59.11",
"@typescript-eslint/eslint-plugin-tslint": "5.59.11",
"@typescript-eslint/parser": "5.59.11",
"@types/node": "20.5.4",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7",
"@types/sinon": "10.0.16",
"@typescript-eslint/eslint-plugin": "6.4.1",
"@typescript-eslint/eslint-plugin-tslint": "6.4.1",
"@typescript-eslint/parser": "6.4.1",
"arraybuffer-loader": "1.0.8",
"babel-loader": "9.1.2",
"chai": "4.3.7",
"core-js": "3.31.0",
"babel-loader": "9.1.3",
"chai": "4.3.8",
"core-js": "3.32.1",
"docgen.ico": "^0.2.3",
"esbuild": "0.18.2",
"eslint": "8.42.0",
"esbuild": "0.19.2",
"eslint": "8.47.0",
"eslint-plugin-ban": "1.6.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsdoc": "46.2.6",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-jsdoc": "46.5.0",
"eslint-plugin-react": "7.33.2",
"esm": "3.2.25",
"express": "4.18.2",
"github-buttons": "2.27.0",
"html-entities": "2.3.6",
"jest": "29.5.0",
"jest-environment-jsdom": "29.5.0",
"html-entities": "2.4.0",
"jest": "29.6.4",
"jest-environment-jsdom": "29.6.4",
"karma": "6.4.2",
"karma-chrome-launcher": "3.2.0",
"karma-firefox-launcher": "2.1.2",
Expand All @@ -121,16 +121,16 @@
"raw-loader": "4.0.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"regenerator-runtime": "0.13.11",
"regenerator-runtime": "0.14.0",
"rimraf": "5.0.1",
"semver": "7.5.1",
"sinon": "15.1.2",
"semver": "7.5.4",
"sinon": "15.2.0",
"terser-webpack-plugin": "5.3.9",
"ts-jest": "29.1.0",
"ts-loader": "9.4.3",
"ts-jest": "29.1.1",
"ts-loader": "9.4.4",
"tslint": "6.1.3",
"typescript": "5.1.3",
"webpack": "5.86.0",
"typescript": "5.1.6",
"webpack": "5.88.2",
"webpack-bundle-analyzer": "4.9.0",
"webpack-cli": "5.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion src/compat/eme/custom_media_keys/webkit_media_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function isFairplayKeyType(keyType: string): boolean {
*/
function setWebKitMediaKeys(
videoElement: HTMLMediaElement,
mediaKeys: IWebKitMediaKeys|null
mediaKeys: unknown
): Promise<unknown> {
const elt : ICompatHTMLMediaElement = videoElement;
return wrapInPromise(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/compat/event_listeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function createCompatibleEventListener(
}
});
} else {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
log.warn(`compat: element ${element.tagName}` +
" does not support any of these events: " +
prefixedEvents.join(", "));
Expand Down
4 changes: 2 additions & 2 deletions src/core/adaptive/utils/pending_requests_store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class PendingRequestsStore {
public addProgress(progress : IPendingRequestStoreProgress) : void {
const request = this._currentRequests[progress.id];
if (request == null) {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
throw new Error("ABR: progress for a request not added");
}
log.warn("ABR: progress for a request not added");
Expand All @@ -69,7 +69,7 @@ export default class PendingRequestsStore {
*/
public remove(id : string) : void {
if (this._currentRequests[id] == null) {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
throw new Error("ABR: can't remove unknown request");
}
log.warn("ABR: can't remove unknown request");
Expand Down
2 changes: 1 addition & 1 deletion src/core/decrypt/__tests__/__global__/get_license.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe("core - decrypt - global tests - getLicense", () => {
getTimeout: () => undefined,
nbRetries: 6,
ignoreLicenseRequests: false });
}, 15000);
}, 25000);

it("should fail after 7 failures when getLicenseConfig.retry is set to `6`", async () => {
await checkGetLicense({ isGetLicensePromiseBased: true,
Expand Down
1 change: 1 addition & 0 deletions src/core/decrypt/session_events_listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export interface ISessionEventListenerCallbacks {
*/
onKeyUpdate : (val : IKeyUpdateValue) => void;
onWarning : (val : IPlayerError) => void;
/* eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents */
onError : (val : unknown | BlacklistedSessionError) => void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ export default class AudioVideoSegmentBuffer extends SegmentBuffer {
function assertPushedDataIsBufferSource(
pushedData : IPushChunkInfos<unknown>
) : asserts pushedData is IPushChunkInfos<BufferSource> {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.PRODUCTION as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.PRODUCTION as number) {
return;
}
const { chunk, initSegment } = pushedData.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ export interface INativeTextTracksBufferSegmentData {
function assertChunkIsTextTrackSegmentData(
chunk : unknown
) : asserts chunk is INativeTextTracksBufferSegmentData {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.PRODUCTION as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.PRODUCTION as number) {
return;
}
if (
Expand Down Expand Up @@ -494,7 +494,7 @@ function assertChunkIsTextTrackSegmentData(
* It doesn't correspond at all to real code that will be called. This is just
* a hack to tell TypeScript to perform that check.
*/
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default class TextTrackCuesStore {
* @param {Number} to
*/
remove(from : number, _to : number) : void {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
assert(from >= 0);
assert(_to >= 0);
assert(_to > from);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export interface INativeTextTracksBufferSegmentData {
function assertChunkIsTextTrackSegmentData(
chunk : unknown
) : asserts chunk is INativeTextTracksBufferSegmentData {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.PRODUCTION as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.PRODUCTION as number) {
return;
}
if (
Expand Down Expand Up @@ -307,7 +307,7 @@ function assertChunkIsTextTrackSegmentData(
* It doesn't correspond at all to real code that will be called. This is just
* a hack to tell TypeScript to perform that check.
*/
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class ManualTimeRanges implements TimeRanges {
}

insert(start : number, end : number) : void {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
assert(start >= 0, "invalid start time");
assert(end - start > 0, "invalid end time");
}
Expand All @@ -48,7 +48,7 @@ export default class ManualTimeRanges implements TimeRanges {
}

remove(start : number, end : number) : void {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
assert(start >= 0, "invalid start time");
assert(end - start > 0, "invalid end time");
}
Expand Down
50 changes: 24 additions & 26 deletions src/features/initialize_features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,102 +22,100 @@ import features from "./features_object";

/**
* Selects the features to include based on environment variables.
*
* @param {Object} features
*/
export default function initializeFeaturesObject() : void {
if (__FEATURES__.EME === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.EME as number === __FEATURES__.IS_ENABLED as number) {
features.decrypt = require("../core/decrypt/index.ts").default;
}

if (__FEATURES__.BIF_PARSER === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.BIF_PARSER as number === __FEATURES__.IS_ENABLED as number) {
features.imageBuffer =
require("../core/segment_buffers/implementations/image/index.ts").default;
features.imageParser = require("../parsers/images/bif.ts").default;
}

// Feature switching the Native TextTrack implementation
const HAS_NATIVE_MODE =
__FEATURES__.NATIVE_VTT === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.NATIVE_SAMI === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.NATIVE_TTML === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.NATIVE_SRT === __FEATURES__.IS_ENABLED as number;
__FEATURES__.NATIVE_VTT as number === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.NATIVE_SAMI as number === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.NATIVE_TTML as number === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.NATIVE_SRT as number === __FEATURES__.IS_ENABLED as number;

if (__FEATURES__.SMOOTH === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.SMOOTH as number === __FEATURES__.IS_ENABLED as number) {
features.transports.smooth = require("../transports/smooth/index.ts").default;
}
if (__FEATURES__.DASH === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.DASH as number === __FEATURES__.IS_ENABLED as number) {
features.transports.dash = require("../transports/dash/index.ts").default;
features.dashParsers.js =
require("../parsers/manifest/dash/js-parser/index.ts").default;
}
if (__FEATURES__.LOCAL_MANIFEST === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.LOCAL_MANIFEST as number === __FEATURES__.IS_ENABLED as number) {
features.transports.local = require("../transports/local/index.ts").default;
}
if (__FEATURES__.METAPLAYLIST === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.METAPLAYLIST as number === __FEATURES__.IS_ENABLED as number) {
features.transports.metaplaylist =
require("../transports/metaplaylist/index.ts").default;
}
if (__FEATURES__.DEBUG_ELEMENT === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.DEBUG_ELEMENT as number === __FEATURES__.IS_ENABLED as number) {
features.createDebugElement = require("../core/api/debug/index.ts").default;
}

if (HAS_NATIVE_MODE) {
features.nativeTextTracksBuffer =
require("../core/segment_buffers/implementations/text/native/index.ts").default;
if (__FEATURES__.NATIVE_VTT === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.NATIVE_VTT as number === __FEATURES__.IS_ENABLED as number) {
features.nativeTextTracksParsers.vtt =
require("../parsers/texttracks/webvtt/native/index.ts").default;
}

if (__FEATURES__.NATIVE_TTML === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.NATIVE_TTML as number === __FEATURES__.IS_ENABLED as number) {
features.nativeTextTracksParsers.ttml =
require("../parsers/texttracks/ttml/native/index.ts").default;
}

if (__FEATURES__.NATIVE_SAMI === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.NATIVE_SAMI as number === __FEATURES__.IS_ENABLED as number) {
features.nativeTextTracksParsers.sami =
require("../parsers/texttracks/sami/native.ts").default;
}

if (__FEATURES__.NATIVE_SRT === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.NATIVE_SRT as number === __FEATURES__.IS_ENABLED as number) {
features.nativeTextTracksParsers.srt =
require("../parsers/texttracks/srt/native.ts").default;
}
}

// Feature switching the HTML TextTrack implementation
const HAS_HTML_MODE =
__FEATURES__.HTML_VTT === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.HTML_SAMI === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.HTML_TTML === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.HTML_SRT === __FEATURES__.IS_ENABLED as number;
__FEATURES__.HTML_VTT as number === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.HTML_SAMI as number === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.HTML_TTML as number === __FEATURES__.IS_ENABLED as number ||
__FEATURES__.HTML_SRT as number === __FEATURES__.IS_ENABLED as number;

if (HAS_HTML_MODE) {
features.htmlTextTracksBuffer =
require("../core/segment_buffers/implementations/text/html/index.ts").default;
if (__FEATURES__.HTML_SAMI === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.HTML_SAMI as number === __FEATURES__.IS_ENABLED as number) {
features.htmlTextTracksParsers.sami =
require("../parsers/texttracks/sami/html.ts").default;
}

if (__FEATURES__.HTML_TTML === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.HTML_TTML as number === __FEATURES__.IS_ENABLED as number) {
features.htmlTextTracksParsers.ttml =
require("../parsers/texttracks/ttml/html/index.ts").default;
}

if (__FEATURES__.HTML_SRT === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.HTML_SRT as number === __FEATURES__.IS_ENABLED as number) {
features.htmlTextTracksParsers.srt =
require("../parsers/texttracks/srt/html.ts").default;
}

if (__FEATURES__.HTML_VTT === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.HTML_VTT as number === __FEATURES__.IS_ENABLED as number) {
features.htmlTextTracksParsers.vtt =
require("../parsers/texttracks/webvtt/html/index.ts").default;
}
}

if (__FEATURES__.DIRECTFILE === __FEATURES__.IS_ENABLED as number) {
if (__FEATURES__.DIRECTFILE as number === __FEATURES__.IS_ENABLED as number) {
const initDirectFile =
require("../core/init/directfile_content_initializer.ts").default;
const mediaElementTrackChoiceManager =
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ initializeFeatures();

if (typeof __RX_PLAYER_DEBUG_MODE__ === "boolean" && __RX_PLAYER_DEBUG_MODE__) {
logger.setLevel("DEBUG");
} else if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
} else if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
logger.setLevel(__LOGGER_LEVEL__.CURRENT_LEVEL);
}

Expand Down
2 changes: 1 addition & 1 deletion src/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import logger from "./log";

if (typeof __RX_PLAYER_DEBUG_MODE__ === "boolean" && __RX_PLAYER_DEBUG_MODE__) {
logger.setLevel("DEBUG");
} else if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
} else if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
logger.setLevel(__LOGGER_LEVEL__.CURRENT_LEVEL);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function generateBaseUrlAttrParser(
linearMemory : WebAssembly.Memory
) : IAttributeParser {
const textDecoder = new TextDecoder();
return function onMPDAttribute(attr : number, ptr : number, len : number) {
return function onMPDAttribute(attr : AttributeName, ptr : number, len : number) {
if (attr === AttributeName.Text) {
baseUrlAttrs.value = parseString(textDecoder, linearMemory.buffer, ptr, len);
}
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/manifest/smooth/create_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ function createSmoothStreamingParser(
const UrlAttr = root.getAttribute("Url");
const UrlPathWithTokens = UrlAttr === null ? "" :
UrlAttr;
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
assert(UrlPathWithTokens !== "");
}

Expand Down
4 changes: 2 additions & 2 deletions src/transports/dash/manifest_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export default function generateManifestParser(
function assertLoadedResourcesFormatString(
loadedResources : Array<ILoadedResource<string | ArrayBuffer>>
) : asserts loadedResources is Array<ILoadedResource<string>> {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.PRODUCTION as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.PRODUCTION as number) {
return;
}
loadedResources.forEach((loadedResource) => {
Expand All @@ -244,7 +244,7 @@ function assertLoadedResourcesFormatString(
function assertLoadedResourcesFormatArrayBuffer(
loadedResources : Array<ILoadedResource<string | ArrayBuffer>>
) : asserts loadedResources is Array<ILoadedResource<ArrayBuffer>> {
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.PRODUCTION as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.PRODUCTION as number) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/transports/smooth/segment_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const generateSegmentLoader = ({
break;
}
default:
if (__ENVIRONMENT__.CURRENT_ENV === __ENVIRONMENT__.DEV as number) {
if (__ENVIRONMENT__.CURRENT_ENV as number === __ENVIRONMENT__.DEV as number) {
assert(false, "responseData should have been set");
}
responseData = new Uint8Array(0);
Expand Down
Loading

0 comments on commit 7e311ee

Please sign in to comment.