Skip to content

Commit

Permalink
Update dependencies, lint and run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
peaBerberian committed Sep 1, 2024
1 parent 6768f29 commit dfc58bf
Show file tree
Hide file tree
Showing 75 changed files with 2,920 additions and 2,190 deletions.
28 changes: 13 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ module.exports = {
objectLiteralTypeAssertions: "allow",
},
],
"@typescript-eslint/prefer-promise-reject-errors": "error",
"@typescript-eslint/only-throw-error": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/explicit-member-accessibility": [
Expand All @@ -42,6 +44,8 @@ module.exports = {
accessibility: "explicit",
},
],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/naming-convention": [
"error",
{
Expand Down Expand Up @@ -102,6 +106,8 @@ module.exports = {
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-this-alias": "error",
// Might be enabled in the future, for now this is too much work:
"@typescript-eslint/no-unsafe-enum-comparison": ["off"],
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "error",
Expand All @@ -117,12 +123,14 @@ module.exports = {
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "none",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/quotes": ["error", "double", { avoidEscape: true }],
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/strict-boolean-expressions": "error",
"@typescript-eslint/triple-slash-reference": [
Expand All @@ -137,20 +145,16 @@ module.exports = {
"@typescript-eslint/unified-signatures": "error",
"arrow-body-style": "off",
"arrow-parens": ["off", "always"],
// TODO?
// "class-methods-use-this": "error",
complexity: [
"off",
{
max: 20,
},
],
// TODO?
// "consistent-return": "error",
"constructor-super": "error",
curly: "error",
"default-case": "off",
eqeqeq: ["error", "smart"],
eqeqeq: "error",
"guard-for-in": "warn",
"id-blacklist": "off",
"id-match": "off",
Expand All @@ -159,7 +163,7 @@ module.exports = {
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: true,
devDependencies: ["**/*.test.ts", "**/__tests__/**", "demo/**/*"],
},
],
"import/no-internal-modules": "off",
Expand All @@ -175,26 +179,20 @@ module.exports = {
"jsdoc/check-alignment": "error",
"jsdoc/no-types": "off",
"max-classes-per-file": ["warn", 5],
"max-len": [
"warn",
{
code: 90,
},
],
"max-lines": ["off", 300],
"newline-per-chained-call": "off",
"no-bitwise": "off",
"no-caller": "error",
// "no-console": "error",
"no-console": "error",
"no-debugger": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": "error",
"no-eval": "error",
"no-fallthrough": "error",
"no-invalid-this": "error",
"no-magic-numbers": "off",
"no-new-wrappers": "error",
"no-nested-ternary": "error",
"no-param-reassign": "error",
"no-return-await": "error",
"no-sequences": "error",
Expand Down
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@

## 0.4.2 (2023-04-27)

- Better detect mimetype from segment's extension by stripping query and fragment components from its URL
- Relative Playlist URLs starting with a "/" now are relative from the Playlist's domain, not its path
- Fix issue in GOP (group of pictures) creation code in the mpeg-ts to fmp4 transmuxer. The real impact on playback in unclear (none was noticed).
- Better detect mimetype from segment's extension by stripping query and fragment components from its URL
- Relative Playlist URLs starting with a "/" now are relative from the Playlist's domain, not its path
- Fix issue in GOP (group of pictures) creation code in the mpeg-ts to fmp4 transmuxer. The real impact on playback in unclear (none was noticed).

## 0.4.1 (2023-04-22)

### Bug fixes

- Fix HTTP Range requests (by prepending the forgotten `bytes=` string)
- Fix HTTP Range requests (by prepending the forgotten `bytes=` string)

## 0.4.0 (2023-04-21)

(First public release)

### Features

- Add TypeScript declaration files for embedded wasm and worker files
- Add TypeScript declaration files for embedded wasm and worker files

## 0.3.0 (2023-04-21)

### Features

- Add embedded wasm and worker
- Add embedded wasm and worker

## 0.2.0 (2023-04-21)

### Features

- Emit TypeScript declaration files and add more types
- Emit TypeScript declaration files and add more types

## 0.1.1 (2023-04-21)

### Bug fixes

- Fix-up export paths in the package published on npm
- Fix-up export paths in the package published on npm

## 0.1.0 (2023-04-21)

Expand Down
8 changes: 8 additions & 0 deletions demo/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ module.exports = {
project: "./tsconfig.json",
sourceType: "module",
},
rules: {
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: true,
},
],
},
};
4 changes: 2 additions & 2 deletions demo/src/components/AudioTrackSetting.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { AudioTrackInfo } from "../../../src/ts-main";
import type { AudioTrackInfo } from "../../../src/ts-main";

/**
* @param {Object} props
Expand All @@ -24,7 +24,7 @@ function AudioTrackSetting({
const selected = audioTrackList[index];
updateAudioTrack(selected);
},
[audioTrackList]
[audioTrackList],
);

const selectedIndex =
Expand Down
6 changes: 3 additions & 3 deletions demo/src/components/BufferSizeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function BufferSizeChart({
innerData: Array<{
date: number;
value: number;
}>
}>,
) => {
if (canvasCtx.current === null) {
return;
Expand Down Expand Up @@ -146,7 +146,7 @@ function BufferSizeChart({
for (let i = 1; i < innerData.length; i++) {
canvasCtx.current.lineTo(
dateToX(innerData[i].date),
bufferValueToY(innerData[i].value)
bufferValueToY(innerData[i].value),
);
}
canvasCtx.current.stroke();
Expand All @@ -172,7 +172,7 @@ function BufferSizeChart({
return (date - minDate) * gridWidth;
}
},
[]
[],
);

React.useEffect((): void => {
Expand Down
8 changes: 4 additions & 4 deletions demo/src/components/ContentBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import WaspHlsPlayer from "../../../src";
import type WaspHlsPlayer from "../../../src";

/**
* @param {Object} props
Expand All @@ -18,7 +18,7 @@ export default React.memo(function ContentBar({
}): JSX.Element {
const nameEltId = React.useId();
const [url, setUrl] = React.useState<string>(
"https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8"
"https://storage.googleapis.com/shaka-demo-assets/angel-one-hls/hls.m3u8",
);
const [isContentListOpened, setIsContentListOpened] = React.useState(false);
const loadContent = React.useCallback(() => {
Expand All @@ -30,14 +30,14 @@ export default React.memo(function ContentBar({
loadContent();
}
},
[loadContent]
[loadContent],
);

const onUrlChange = React.useCallback(
(e: React.ChangeEvent<HTMLInputElement>) => {
setUrl(e.target.value ?? "");
},
[]
[],
);

const onNewUrlChoice = React.useCallback((newUrl: string) => {
Expand Down
24 changes: 13 additions & 11 deletions demo/src/components/ControlBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from "react";
import WaspHlsPlayer, { PlayerState } from "../../../src";
import type WaspHlsPlayer from "../../../src";
import { PlayerState } from "../../../src";
import FullScreenButton from "./FullScreenButton";
import PlayButton from "./PlayButton";
import PositionIndicator from "./PositionIndicator";
Expand Down Expand Up @@ -66,7 +67,7 @@ export default React.memo(function ControlBar({
// Clear Timeout on unmount
React.useEffect(
() => clearHideControlBarTimeout,
[clearHideControlBarTimeout]
[clearHideControlBarTimeout],
);
const startControlBarHideTimeout = React.useCallback(() => {
clearHideControlBarTimeout();
Expand Down Expand Up @@ -94,7 +95,7 @@ export default React.memo(function ControlBar({
startControlBarHideTimeout();
}
},
[clearHideControlBarTimeout, startControlBarHideTimeout]
[clearHideControlBarTimeout, startControlBarHideTimeout],
);

React.useEffect(() => {
Expand All @@ -117,17 +118,17 @@ export default React.memo(function ControlBar({
player.removeEventListener("playing", onPlaying);
player.videoElement.removeEventListener(
"volumechange",
onVideoVolumeChange
onVideoVolumeChange,
);
clearPositionUpdateInterval();
if (playerContainerRef.current !== null) {
playerContainerRef.current.removeEventListener(
"mouseover",
onMouseOver
onMouseOver,
);
playerContainerRef.current.removeEventListener(
"mousemove",
onMouseMove
onMouseMove,
);
playerContainerRef.current.removeEventListener("mouseout", onMouseOut);
}
Expand All @@ -149,7 +150,7 @@ export default React.memo(function ControlBar({
clearPositionUpdateInterval();
positionRefreshIntervalId = setInterval(
onPositionUpdateInterval,
TIME_CHECK_INTERVAL
TIME_CHECK_INTERVAL,
);
break;
case PlayerState.Stopped:
Expand Down Expand Up @@ -192,6 +193,7 @@ export default React.memo(function ControlBar({
setBufferGap(player.getCurrentBufferGap());
if (!player.isPaused()) {
if (minPos !== undefined && minPos > pos + 2) {
// eslint-disable-next-line no-console
console.warn("Behind minimum position, seeking...");
player.seek(minPos + 2);
}
Expand Down Expand Up @@ -264,7 +266,7 @@ export default React.memo(function ControlBar({
(newVolume: number) => {
player.videoElement.volume = newVolume;
},
[player]
[player],
);

const onStopButtonClick = React.useCallback(() => {
Expand All @@ -275,7 +277,7 @@ export default React.memo(function ControlBar({
(pos: number) => {
player.seek(pos);
},
[player]
[player],
);

// Handle controls on keypresses
Expand Down Expand Up @@ -306,7 +308,7 @@ export default React.memo(function ControlBar({
evt.preventDefault();
const newPosition = Math.min(
player.getPosition() + 10,
maxPosition
maxPosition,
);
displayControlBar(false);
player.seek(newPosition);
Expand All @@ -320,7 +322,7 @@ export default React.memo(function ControlBar({
evt.preventDefault();
const newPosition = Math.max(
player.getPosition() - 10,
minPosition
minPosition,
);
displayControlBar(false);
player.seek(newPosition);
Expand Down
Loading

0 comments on commit dfc58bf

Please sign in to comment.