Skip to content

Commit

Permalink
chore: Added eslint to stitcher
Browse files Browse the repository at this point in the history
  • Loading branch information
matvp91 committed Oct 8, 2024
1 parent 93c5743 commit 16793c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 7 additions & 3 deletions packages/stitcher/src/parser/lexical-parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function parseLine(line: string): Tag | null {
}
throw new Error("EXT-X-PLAYLIST-TYPE: param must be EVENT or VOD");

case "EXTINF":
case "EXTINF": {
assert(param, "EXTINF: no param");
const chunks = param.split(",");
return [
Expand All @@ -98,6 +98,7 @@ function parseLine(line: string): Tag | null {
duration: parseFloat(chunks[0]),
},
];
}

case "EXT-X-STREAM-INF": {
assert(param, "EXT-X-STREAM-INF: no param");
Expand All @@ -110,13 +111,14 @@ function parseLine(line: string): Tag | null {
attrs.bandwidth = Number.parseFloat(value);
break;

case "RESOLUTION":
case "RESOLUTION": {
const chunks = value.split("x");
attrs.resolution = {
width: parseFloat(chunks[0]),
height: parseFloat(chunks[1]),
};
break;
}

case "AUDIO":
attrs.audio = value;
Expand Down Expand Up @@ -159,6 +161,7 @@ function parseLine(line: string): Tag | null {
} else {
throw new Error("EXT-X-MEDIA: invalid type param");
}
break;
case "GROUP-ID":
attrs.groupId = value;
break;
Expand Down Expand Up @@ -229,7 +232,7 @@ function parseLine(line: string): Tag | null {
case "START-DATE":
attrs.startDate = DateTime.fromISO(value);
break;
default:
default: {
if (!key.startsWith("X-")) {
break;
}
Expand All @@ -248,6 +251,7 @@ function parseLine(line: string): Tag | null {
}

break;
}
}
});

Expand Down
4 changes: 2 additions & 2 deletions packages/stitcher/src/parser/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function formatMediaPlaylist(tags: Tag[]): MediaPlaylist {
let mediaSequenceBase: number | undefined;
let discontinuitySequenceBase: number | undefined;
let map: MediaInitializationSection | undefined;
let dateRanges: DateRange[] = [];
const dateRanges: DateRange[] = [];

tags.forEach(([name, value]) => {
if (name === "EXT-X-TARGETDURATION") {
Expand Down Expand Up @@ -56,7 +56,7 @@ function formatMediaPlaylist(tags: Tag[]): MediaPlaylist {
}

let segmentStart = index;
let segmentEnd = index + 1;
const segmentEnd = index + 1;
for (let i = index; i > 0; i--) {
if (tags[i][0] === "LITERAL") {
segmentStart = i + 1;
Expand Down
4 changes: 3 additions & 1 deletion scripts/code-eslint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ echo "✅ eslint(player)"
eslint "packages/shared/src/**/*.ts"
echo "✅ eslint(shared)"
eslint "packages/dashboard/src/**/*.ts" "packages/dashboard/src/**/*.tsx"
echo "✅ eslint(dashboard)"
echo "✅ eslint(dashboard)"
eslint "packages/stitcher/src/**/*.ts"
echo "✅ eslint(stitcher)"

0 comments on commit 16793c4

Please sign in to comment.