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

Stage 1: Refactor codebase (re) (re) #689

Open
wants to merge 46 commits into
base: dev
Choose a base branch
from

Conversation

mist8kengas
Copy link
Contributor

@mist8kengas mist8kengas commented Nov 22, 2024

Re: #520 (comment)

Summary by CodeRabbit

  • Documentation

    • Updated contributor guidelines with detailed sections for onboarding and best practices.
  • New Features

    • Introduced a share shortener and volume boost functionality for an enhanced viewing experience.
  • Refactor

    • Streamlined control flows and error handling across various interactive features (theater mode, playback controls, custom styling, and video resume prompts) to improve responsiveness and reliability.

@VampireChicken12
Copy link
Member

@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.

Copy link

coderabbitai bot commented Dec 23, 2024

Tip

For best results, initiate chat on the files or code changes.

@VampireChicken12 Here are the requested stats in a table, followed by a pie chart of the language distribution:

Metric Value
Total Commits 1817
Number of Authors 10
Lines of Code (non-binary, approx) 37270

Below is a pie chart showing the language distribution according to GitHub’s size measurement:

pie
title Language Distribution
"TypeScript" : 97.41
"CSS" : 1.71
"JavaScript" : 0.66
"HTML" : 0.15
"Shell" : 0.07
Loading
🔗 Analysis chain
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Gather interesting stats about the repository.

# 1. Count the total commits on the current branch:
echo "Total Commits:"
git rev-list --count HEAD

# 2. Count the number of unique authors:
echo "Number of Authors:"
git shortlog -sn HEAD | wc -l

# 3. Count the total lines in the repository (excluding binary files):
echo "Lines of Code:"
rg --count-matches '^'

# 4. Fetch language distribution from GitHub:
echo "Language Distribution (JSON):"
gh repo view --json languages | jq .

Length of output: 8004


Script:

#!/bin/bash
# Let's sum up the line counts from the earlier rg command output
# so we can include it in our table.

rg --count-matches '^' | sed 's/.*://' | awk '{sum += $1} END {print "Total lines of code:", sum}'

Length of output: 127

@VampireChicken12
Copy link
Member

@coderabbitai full review

Copy link

coderabbitai bot commented Feb 8, 2025

✅ Actions performed

Full review triggered.

Copy link

coderabbitai bot commented Feb 8, 2025

Walkthrough

This pull request introduces significant documentation updates and extensive code refactorings across the codebase. The CONTRIBUTING.md file now features a new “Contributing” section with clearly defined subsections for guidelines and best practices. Numerous feature modules have been refactored to simplify control flows by consolidating conditionals, utilizing early returns, and adopting optional chaining. In addition, type safety improvements and minor formatting adjustments were applied. New helper functions (e.g. for share shortener and volume boost) were also introduced, enhancing consistency and maintainability across the project.

Changes

File(s) Change Summary
CONTRIBUTING.md Added new “Contributing” section with subsections (Glossary, Getting Started, Commits, Contributor Workflow, Internationalization, Code Quality) for standardized guidelines.
src/defaults.ts Reversed deep merge condition: the function now skips merging when the stored value is not an object or is null.
src/features/automaticTheaterMode/index.ts Added an early return for non-watch pages and simplified theater mode detection by directly accessing document.body.clientWidth.
src/features/buttonPlacement/utils.ts Streamlined icon handling logic and updated getFeatureButtonId to use a generic type parameter.
src/features/customCSS/(index.ts, utils.ts) Simplified control flow in enabling/disabling custom CSS by consolidating checks and using optional chaining.
src/features/deepDarkCSS/(index.ts, utils.ts) Streamlined enable/disable functions with consolidated returns and optional chaining for clear, concise logic.
src/features/featureMenu/(index.ts, utils.ts) Condensed MutationObserver configuration and refactored menu item creation; updated getFeatureIds signature to use generics.
src/features/hideLiveStreamChat/index.ts Inlined asynchronous live check and streamlined control flow using early returns.
src/features/hideShorts/(index.ts, utils.ts) Simplified observer disconnection using optional chaining and removed redundant block structures.
src/features/loopButton/(index.ts, utils.ts) Refactored loop button label creation and mutation handling, employing early returns to reduce nesting.
src/features/maximizePlayerButton/(index.ts, utils.ts) Removed unused imports and updated type annotations; streamlined event listener setup with concise syntax.
src/features/openTranscriptButton/utils.ts Replaced explicit null-check with optional chaining for safer transcript button handling.
src/features/pauseBackgroundPlayers/index.ts Introduced Nullable types for video elements and refined event listener attachment with optional chaining.
src/features/playbackSpeedButtons/index.ts Simplified tooltip string assignment by directly using a literal and adjusted formatting in display manager instantiation.
src/features/playerQuality/index.ts Inverted conditionals to exit early when quality setting is not applicable, reorganizing the quality update logic.
src/features/playerSpeed/index.ts Unified overloads into a single implementation accepting an optional parameter; streamlined playback speed change listener.
src/features/remainingTime/(index.ts, utils.ts) Consolidated conditionals for remaining time display removal and flattened nested time formatting logic.
src/features/rememberVolume/utils.ts Reorganized conditionals to reduce nesting and enable early exit when volume restoration conditions aren’t met.
src/features/removeRedirect/index.ts Inverted href checks and streamlined mutation callbacks for efficient link processing.
src/features/screenshotButton/index.ts Simplified setTimeout syntax and streamlined error handling with an inline arrow function using .catch.
src/features/scrollWheelSpeedControl/(index.ts, utils.ts) Converted setOptionsData to a single-line async arrow function and simplified conditional checks.
src/features/scrollWheelVolumeControl/(index.ts, utils.ts) Consolidated async operations and error handling; refined OnScreenDisplayManager instantiation.
src/features/shareShortener/index.ts Simplified URL cleaning logic, added logging and new enable/disable functions, and optimized conditional checks.
src/features/shortsAutoScroll/utils.ts Reversed auto scroll trigger condition and applied optional chaining to safely invoke the next button’s click.
src/features/videoHistory/index.ts Streamlined resume prompt logic, flattening conditionals and ensuring the callback is executed unconditionally.
src/features/volumeBoost/index.ts Inverted conditional checks for volume boost setup and introduced a new enableVolumeBoost function for clarity.
src/hooks/useNotifications/provider.ts Simplified notification creation and removal scheduling; streamlined cleanup logic in the useEffect hook.
src/pages/(background/index.ts, content/index.ts, embedded/index.ts) Consolidated event listener and message handling logic; restructured feature toggling and storage validations.
src/utils/EventManager.ts Enhanced addEventListener type safety by using generics and refined listener info typing for precise event handling.

Sequence Diagram(s)

sequenceDiagram
    participant UI as User Interaction
    participant F as Feature Function
    participant C as Condition Checker
    participant DOM as Document Element
    participant Log as Logger

    UI->>F: Trigger action (e.g., button click)
    F->>C: Check prerequisites (page type, element existence, etc.)
    alt Preconditions not met
       C-->>F: Early return (exit function)
    else Preconditions met
       F->>DOM: Update UI component (apply CSS, toggle button, etc.)
       F->>Log: Log operation or error (optional)
       DOM-->>F: Confirmation of update
    end
    F-->>UI: Complete action and notify user
Loading

Poem

I'm a rabbit with hoppin' delight,
Skippin' through refactors in code so bright.
Early returns and optional chains set the pace,
Making our logic elegant with style and grace.
With every line trimmed and every bug out of sight,
I nibble on changes—coding's pure delight!

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (21)
src/features/shortsAutoScroll/utils.ts (1)

12-16: Consider adding error handling for the next button.

While the optional chaining handles the null case safely, consider adding a warning log when the next button is not found to help with debugging.

-		nextButton?.click();
+		if (!nextButton) {
+			console.warn('YouTube Enhancer: Next button not found for auto-scroll');
+			return;
+		}
+		nextButton.click();
🧰 Tools
🪛 ESLint

[error] 12-12: Insert

(prettier/prettier)


[error] 13-13: Insert

(prettier/prettier)


[error] 14-14: Insert

(prettier/prettier)


[error] 15-15: Insert

(prettier/prettier)


[error] 16-16: Insert

(prettier/prettier)

src/features/customCSS/utils.ts (1)

8-8: Consider adding validation for successful CSS update.

While optional chaining handles the null case, there's no way to know if the CSS was successfully updated.

-	customCSSStyleElement?.replaceWith(createCustomCSSElement({ custom_css_code }));
+	if (!customCSSStyleElement) {
+		console.warn('YouTube Enhancer: Custom CSS element not found for update');
+		return false;
+	}
+	customCSSStyleElement.replaceWith(createCustomCSSElement({ custom_css_code }));
+	return true;
🧰 Tools
🪛 ESLint

[error] 8-8: Insert

(prettier/prettier)

src/features/remainingTime/utils.ts (1)

11-12: Consider further simplifying the reduce callback.

The current if-else logic could be made more concise using a ternary operator.

- if (acc.length > 0) acc.push(unit.toString().padStart(2, "0"));
- else if (unit > 0) acc.push(unit.toString());
+ acc.length > 0 ? acc.push(unit.toString().padStart(2, "0")) : unit > 0 && acc.push(unit.toString());
🧰 Tools
🪛 ESLint

[error] 11-11: Insert

(prettier/prettier)


[error] 12-12: Insert

(prettier/prettier)

src/features/removeRedirect/index.ts (1)

17-20: Consider moving regex compilation outside the loop.

While the early returns improve readability, the regex is recompiled for each link. Consider moving the regex compilation outside the loop for better performance.

 const regex = /https\:\/\/www\.youtube\.com\/redirect\?.+/gm;
+const compiledRegex = new RegExp(regex);
 links.forEach((link: HTMLElement) => {
   const href: Nullable<string> = link.getAttribute("href");
-  if (!href || !href.match(regex)) return;
+  if (!href || !compiledRegex.test(href)) return;
   const urlParams: URLSearchParams = new URLSearchParams(href);
   link.setAttribute("href", urlParams.get("q") || "");
 });
🧰 Tools
🪛 ESLint

[error] 17-17: Insert

(prettier/prettier)


[error] 18-18: Insert

(prettier/prettier)


[error] 19-19: Insert

(prettier/prettier)


[error] 20-20: Insert

(prettier/prettier)

src/features/hideLiveStreamChat/index.ts (1)

17-17: Consider extracting common player check logic.

Both functions share similar player check logic. Consider extracting this into a helper function to reduce duplication and improve maintainability.

+async function isLiveStream(player: YouTubePlayerDiv): Promise<boolean> {
+  return (await player.getVideoData()).isLive;
+}

 export async function enableHideLiveStreamChat() {
   // ... existing code ...
   const player = document.querySelector<YouTubePlayerDiv>("div#movie_player");
   if (!player) return;
-  if (!(await player.getVideoData()).isLive) return;
+  if (!(await isLiveStream(player))) return;
   // ... rest of the function ...
 }

 export async function disableHideLiveStreamChat() {
   const player = document.querySelector<YouTubePlayerDiv>("div#movie_player");
   if (!player) return;
-  if (!(await player.getVideoData()).isLive) return;
+  if (!(await isLiveStream(player))) return;
   // ... rest of the function ...
 }

Also applies to: 37-37

🧰 Tools
🪛 ESLint

[error] 17-17: Insert

(prettier/prettier)

src/features/shareShortener/index.ts (2)

5-7: Add return type annotation for better type safety.

The function's return type should be explicitly specified for better type safety and documentation.

-function cleanUrl(url: string) {
+function cleanUrl(url: string): string {
   return url.replace(regexp, "");
}
🧰 Tools
🪛 ESLint

[error] 5-5: Insert

(prettier/prettier)


[error] 6-6: Insert

(prettier/prettier)


[error] 7-7: Insert

(prettier/prettier)


16-19: Remove debug logging statement.

The console.log statement appears to be debug code that should be removed before merging.

   if (!input) return void (input = document.querySelector<HTMLInputElement>("#share-url"));
   if (!input.value.match(regexp)) return;
-  console.log("cleanAndUpdateUrl");
   input.value = cleanUrl(input.value);
🧰 Tools
🪛 ESLint

[error] 16-16: Insert

(prettier/prettier)


[error] 17-17: Insert

(prettier/prettier)


[error] 18-18: Insert

(prettier/prettier)


[error] 19-19: Insert

(prettier/prettier)

src/features/scrollWheelVolumeControl/utils.ts (1)

21-21: Consider breaking down the long condition for better readability.

The long condition line could be split for better readability.

-if (!playerContainer.getVolume || !playerContainer.setVolume || !playerContainer.isMuted || !playerContainer.unMute) return;
+const hasRequiredMethods = 
+  playerContainer.getVolume &&
+  playerContainer.setVolume &&
+  playerContainer.isMuted &&
+  playerContainer.unMute;
+if (!hasRequiredMethods) return;
🧰 Tools
🪛 ESLint

[error] 21-21: Insert

(prettier/prettier)

src/features/pauseBackgroundPlayers/index.ts (1)

38-39: Consider combining related conditions.

The consecutive conditions checking videoPlayerContainer could be combined.

-if (videoPlayerContainer) observer.observe(videoPlayerContainer, { childList: true, subtree: true });
-if (!videoPlayerContainer?.paused) PauseBackgroundPlayers();
+if (videoPlayerContainer) {
+  observer.observe(videoPlayerContainer, { childList: true, subtree: true });
+  if (!videoPlayerContainer.paused) PauseBackgroundPlayers();
+}
🧰 Tools
🪛 ESLint

[error] 38-38: Insert

(prettier/prettier)


[error] 39-39: Insert

(prettier/prettier)

src/features/playerQuality/index.ts (1)

37-44: Consider adding error logging for quality fallback.

While the logic is correct, it would be helpful to log when quality fallback occurs for debugging purposes.

 const closestQuality = chooseClosestQuality(player_quality, availableQualityLevels, player_quality_fallback_strategy);
 if (!closestQuality) return;
+// Log when quality fallback occurs
+if (closestQuality !== player_quality) {
+  browserColorLog(`Quality ${player_quality} not available, falling back to ${closestQuality}`, "FgYellow");
+}
 // Log the message indicating the player quality being set
 browserColorLog(`Setting player quality to ${closestQuality}`, "FgMagenta");
🧰 Tools
🪛 ESLint

[error] 37-37: Insert

(prettier/prettier)


[error] 38-38: Insert

(prettier/prettier)


[error] 39-39: Insert

(prettier/prettier)


[error] 40-40: Insert

(prettier/prettier)


[error] 41-41: Insert

(prettier/prettier)


[error] 42-42: Insert

(prettier/prettier)


[error] 43-43: Insert

(prettier/prettier)


[error] 44-44: Insert

(prettier/prettier)

src/features/rememberVolume/utils.ts (1)

32-35: Consider consolidating volume change messages.

The separate if-else blocks for watch page and shorts page volume could be simplified using an object literal.

-// Send a "setVolume" message to the content script
-if (IsWatchPage) sendContentOnlyMessage("setRememberedVolume", { watchPageVolume: newVolume });
-// Send a "setVolume" message to the content script
-else if (IsShortsPage) sendContentOnlyMessage("setRememberedVolume", { shortsPageVolume: newVolume });
+const volumeKey = IsWatchPage ? 'watchPageVolume' : IsShortsPage ? 'shortsPageVolume' : null;
+if (volumeKey) sendContentOnlyMessage("setRememberedVolume", { [volumeKey]: newVolume });
🧰 Tools
🪛 ESLint

[error] 32-32: Insert

(prettier/prettier)


[error] 33-33: Insert

(prettier/prettier)


[error] 34-34: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)

src/pages/background/index.ts (1)

53-71: Consider adding retry logic for script execution failures.

While the error handling is good, adding retry logic could improve reliability when pausing background media.

+const MAX_RETRIES = 3;
+const executeScriptWithRetry = (tabId: number, retryCount = 0) => {
 chrome.scripting.executeScript(
   {
     func: () => {
       const videos = document.querySelectorAll("video");
       videos.forEach((video) => {
         if (!video.paused) video.pause();
       });
       const audios = document.querySelectorAll("audio");
       audios.forEach((audio) => {
         if (!audio.paused) audio.pause();
       });
     },
     target: { tabId }
   },
   (results) => {
-    if (chrome.runtime.lastError) console.error(chrome.runtime.lastError.message);
+    if (chrome.runtime.lastError) {
+      console.error(chrome.runtime.lastError.message);
+      if (retryCount < MAX_RETRIES) {
+        setTimeout(() => executeScriptWithRetry(tabId, retryCount + 1), 1000);
+      }
+    }
     else if (results[0].result) console.log(results);
   }
 );
+};
+executeScriptWithRetry(tab.id);
🧰 Tools
🪛 ESLint

[error] 53-53: Insert

(prettier/prettier)


[error] 54-54: Insert

(prettier/prettier)


[error] 55-55: Insert

(prettier/prettier)


[error] 56-56: Insert

(prettier/prettier)


[error] 57-57: Insert

(prettier/prettier)


[error] 58-58: Insert

(prettier/prettier)


[error] 59-59: Insert

(prettier/prettier)


[error] 60-60: Insert

(prettier/prettier)


[error] 61-61: Insert

(prettier/prettier)


[error] 62-62: Insert

(prettier/prettier)


[error] 63-63: Insert

(prettier/prettier)


[error] 64-64: Insert

(prettier/prettier)


[error] 65-65: Insert

(prettier/prettier)


[error] 66-66: Insert

(prettier/prettier)


[error] 67-67: Insert

(prettier/prettier)


[error] 68-68: Insert

(prettier/prettier)


[error] 69-69: Insert

(prettier/prettier)


[error] 70-70: Insert

(prettier/prettier)


[error] 71-71: Insert

(prettier/prettier)

src/hooks/useNotifications/provider.tsx (1)

57-57: Consider using optional chaining for cleanup.

While the current check works, using optional chaining could make it more concise.

-if (animationFrameId) cancelAnimationFrame(animationFrameId);
+animationFrameId?.cancelAnimationFrame?.();
🧰 Tools
🪛 ESLint

[error] 57-57: Insert

(prettier/prettier)

src/features/loopButton/index.ts (1)

46-81: Consider reordering switch cases alphabetically.

The switch cases could be ordered alphabetically to improve maintainability. The static analysis tool suggests moving "below_player" before "feature_menu".

 switch (loopButtonPlacement) {
+  case "below_player":
+  case "player_controls_left":
+  case "player_controls_right": {
+    if (typeof loopSVG === "object" && "off" in loopSVG && "on" in loopSVG) {
+      button.firstChild?.replaceWith(loop ? loopSVG.on : loopSVG.off);
+    }
+    break;
+  }
   case "feature_menu": {
     if (loopSVG instanceof SVGSVGElement) {
       button.firstChild?.replaceWith(loopSVG);
     }
     break;
   }
-  case "below_player":
-  case "player_controls_left":
-  case "player_controls_right": {
-    if (typeof loopSVG === "object" && "off" in loopSVG && "on" in loopSVG) {
-      button.firstChild?.replaceWith(loop ? loopSVG.on : loopSVG.off);
-    }
-    break;
-  }
 }
🧰 Tools
🪛 ESLint

[error] 46-46: Insert

(prettier/prettier)


[error] 47-47: Insert

(prettier/prettier)


[error] 48-48: Insert

(prettier/prettier)


[error] 49-49: Insert

(prettier/prettier)


[error] 50-50: Insert

(prettier/prettier)


[error] 51-51: Insert

(prettier/prettier)


[error] 52-52: Insert

(prettier/prettier)


[error] 53-53: Insert

(prettier/prettier)


[error] 54-54: Insert

(prettier/prettier)


[error] 55-55: Insert

(prettier/prettier)


[error] 56-56: Insert

(prettier/prettier)


[error] 57-57: Insert

(prettier/prettier)


[error] 58-58: Insert

(prettier/prettier)


[error] 59-59: Insert

(prettier/prettier)


[error] 60-60: Insert

(prettier/prettier)


[error] 61-61: Insert

(prettier/prettier)


[error] 62-62: Insert

(prettier/prettier)


[error] 63-63: Insert

(prettier/prettier)


[error] 64-64: Insert

(prettier/prettier)


[error] 65-65: Insert

(prettier/prettier)


[error] 66-66: Insert

(prettier/prettier)


[error] 67-67: Insert

(prettier/prettier)


[error] 68-68: Insert

(prettier/prettier)


[error] 69-69: Insert

(prettier/prettier)


[error] 70-70: Insert

(prettier/prettier)


[error] 71-71: Insert

(prettier/prettier)


[error] 72-72: Expected "below_player" to come before "feature_menu".

(perfectionist/sort-switch-case)


[error] 72-72: Insert

(prettier/prettier)


[error] 73-73: Insert

(prettier/prettier)


[error] 74-74: Insert

(prettier/prettier)


[error] 75-75: Insert

(prettier/prettier)


[error] 76-76: Insert

(prettier/prettier)


[error] 77-77: Insert

(prettier/prettier)


[error] 78-78: Insert

(prettier/prettier)


[error] 79-79: Insert

(prettier/prettier)


[error] 80-80: Insert

(prettier/prettier)


[error] 81-81: Insert

(prettier/prettier)

src/features/hideShorts/utils.ts (1)

119-119: Consider keeping braces for consistency and maintainability.

While removing braces for single-line if statements is valid, keeping them can prevent future bugs when the block needs to be expanded and improves consistency with the rest of the codebase.

-if (containsShortsSelector) hideShorts();
+if (containsShortsSelector) {
+  hideShorts();
+}
🧰 Tools
🪛 ESLint

[error] 119-119: Insert

(prettier/prettier)

src/features/scrollWheelSpeedControl/utils.ts (1)

35-35: Enhanced Type Safety in Query Selection
Using document.querySelectorAll(selector) explicitly ensures that the queried elements are typed correctly as HTMLDivElements. This small refactor improves readability and reduces potential type issues downstream.
(Minor formatting note: ESLint hinted at a required carriage return on this line; ensure your editor’s CR/LF settings align with project configuration.)

🧰 Tools
🪛 ESLint

[error] 35-35: Insert

(prettier/prettier)

CONTRIBUTING.md (2)

1-11: Well-Structured Table of Contents
The new “Contributing” document introduces a clear table of contents that makes navigation easier. The section headings (Glossary, Getting Started, etc.) are logically ordered.
(Note: Markdown linters flag the use of emoji-based link fragments—e.g., “Glossary”—which may not render uniformly in all environments. Consider using simplified, plain-text link fragments if linter issues persist.)

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

5-5: Link fragments should be valid
null

(MD051, link-fragments)


6-6: Link fragments should be valid
null

(MD051, link-fragments)


7-7: Link fragments should be valid
null

(MD051, link-fragments)


8-8: Link fragments should be valid
null

(MD051, link-fragments)


9-9: Link fragments should be valid
null

(MD051, link-fragments)


10-10: Link fragments should be valid
null

(MD051, link-fragments)


25-33: Comprehensive Guidelines for Issues and PRs
The section covering commits, issue reporting, and PR creation is detailed and provides useful links for further guidance. Consider reviewing the phrasing on line 27 to reduce wordiness (“There are a few guidelines that we follow in order to maintain the quality of the codebase:” might be simplified).

🧰 Tools
🪛 LanguageTool

[style] ~27-~27: Consider a shorter alternative to avoid wordiness.
Context: ...ere are a few guidelines that we follow in order to maintain the quality of the codebase: ...

(IN_ORDER_TO_PREMIUM)

src/features/playbackSpeedButtons/index.ts (2)

44-44: Simplified Tooltip Feature Name Assignment
Replacing the variable reference with a direct string literal ("playbackSpeedButtons") in the createTooltip call simplifies the code and removes unnecessary indirection.

(Minor Prettier note: ESLint suggests an extra carriage return—ensure your file’s line endings meet your team’s conventions.)

🧰 Tools
🪛 ESLint

[error] 44-44: Insert

(prettier/prettier)


83-83: Use of Shorthand Object Property in OnScreenDisplayManager
Passing “playerContainer” using the ES6 shorthand in the configuration object is clean and concise. This change maintains the functionality while reducing verbosity.

(Again, check for any Prettier line break adjustments as flagged by ESLint.)

🧰 Tools
🪛 ESLint

[error] 83-83: Insert

(prettier/prettier)

src/features/featureMenu/index.ts (1)

230-230: Condensed MutationObserver Configuration
The refactored observer.observe call consolidates the configuration into a single line, which enhances clarity without affecting functionality.

(Static analysis recommends a carriage return insertion on this line—please verify your formatting settings.)

🧰 Tools
🪛 ESLint

[error] 230-230: Insert

(prettier/prettier)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f8296c and 83f80fd.

📒 Files selected for processing (40)
  • CONTRIBUTING.md (1 hunks)
  • src/defaults.ts (1 hunks)
  • src/features/automaticTheaterMode/index.ts (2 hunks)
  • src/features/buttonPlacement/utils.ts (4 hunks)
  • src/features/customCSS/index.ts (1 hunks)
  • src/features/customCSS/utils.ts (2 hunks)
  • src/features/deepDarkCSS/index.ts (2 hunks)
  • src/features/deepDarkCSS/utils.ts (2 hunks)
  • src/features/featureMenu/index.ts (1 hunks)
  • src/features/featureMenu/utils.ts (2 hunks)
  • src/features/hideLiveStreamChat/index.ts (2 hunks)
  • src/features/hideShorts/index.ts (1 hunks)
  • src/features/hideShorts/utils.ts (1 hunks)
  • src/features/loopButton/index.ts (1 hunks)
  • src/features/loopButton/utils.ts (1 hunks)
  • src/features/maximizePlayerButton/index.ts (6 hunks)
  • src/features/maximizePlayerButton/utils.ts (3 hunks)
  • src/features/openTranscriptButton/utils.ts (1 hunks)
  • src/features/pauseBackgroundPlayers/index.ts (2 hunks)
  • src/features/playbackSpeedButtons/index.ts (2 hunks)
  • src/features/playerQuality/index.ts (2 hunks)
  • src/features/playerSpeed/index.ts (3 hunks)
  • src/features/remainingTime/index.ts (1 hunks)
  • src/features/remainingTime/utils.ts (1 hunks)
  • src/features/rememberVolume/utils.ts (2 hunks)
  • src/features/removeRedirect/index.ts (1 hunks)
  • src/features/screenshotButton/index.ts (2 hunks)
  • src/features/scrollWheelSpeedControl/index.ts (1 hunks)
  • src/features/scrollWheelSpeedControl/utils.ts (1 hunks)
  • src/features/scrollWheelVolumeControl/index.ts (2 hunks)
  • src/features/scrollWheelVolumeControl/utils.ts (2 hunks)
  • src/features/shareShortener/index.ts (3 hunks)
  • src/features/shortsAutoScroll/utils.ts (1 hunks)
  • src/features/videoHistory/index.ts (4 hunks)
  • src/features/volumeBoost/index.ts (3 hunks)
  • src/hooks/useNotifications/provider.tsx (2 hunks)
  • src/pages/background/index.ts (1 hunks)
  • src/pages/content/index.ts (3 hunks)
  • src/pages/embedded/index.ts (13 hunks)
  • src/utils/EventManager.ts (2 hunks)
🧰 Additional context used
🪛 ESLint
src/features/hideShorts/index.ts

[error] 22-22: Insert

(prettier/prettier)


[error] 23-23: Insert

(prettier/prettier)

src/features/scrollWheelSpeedControl/utils.ts

[error] 35-35: Insert

(prettier/prettier)

src/features/loopButton/utils.ts

[error] 9-9: Insert

(prettier/prettier)


[error] 10-10: Insert

(prettier/prettier)


[error] 11-11: Insert

(prettier/prettier)


[error] 12-12: Insert

(prettier/prettier)

src/features/shortsAutoScroll/utils.ts

[error] 12-12: Insert

(prettier/prettier)


[error] 13-13: Insert

(prettier/prettier)


[error] 14-14: Insert

(prettier/prettier)


[error] 15-15: Insert

(prettier/prettier)


[error] 16-16: Insert

(prettier/prettier)

src/features/remainingTime/utils.ts

[error] 11-11: Insert

(prettier/prettier)


[error] 12-12: Insert

(prettier/prettier)

src/defaults.ts

[error] 31-31: Insert

(prettier/prettier)


[error] 32-32: Insert

(prettier/prettier)


[error] 33-33: Insert

(prettier/prettier)


[error] 34-34: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)


[error] 36-36: Insert

(prettier/prettier)


[error] 37-37: Insert

(prettier/prettier)

src/pages/background/index.ts

[error] 52-52: Insert

(prettier/prettier)


[error] 53-53: Insert

(prettier/prettier)


[error] 54-54: Insert

(prettier/prettier)


[error] 55-55: Insert

(prettier/prettier)


[error] 56-56: Insert

(prettier/prettier)


[error] 57-57: Insert

(prettier/prettier)


[error] 58-58: Insert

(prettier/prettier)


[error] 59-59: Insert

(prettier/prettier)


[error] 60-60: Insert

(prettier/prettier)


[error] 61-61: Insert

(prettier/prettier)


[error] 62-62: Insert

(prettier/prettier)


[error] 63-63: Insert

(prettier/prettier)


[error] 64-64: Insert

(prettier/prettier)


[error] 65-65: Insert

(prettier/prettier)


[error] 66-66: Insert

(prettier/prettier)


[error] 67-67: Insert

(prettier/prettier)


[error] 68-68: Insert

(prettier/prettier)


[error] 69-69: Insert

(prettier/prettier)


[error] 70-70: Insert

(prettier/prettier)


[error] 71-71: Insert

(prettier/prettier)

src/features/hideLiveStreamChat/index.ts

[error] 17-17: Insert

(prettier/prettier)


[error] 37-37: Insert

(prettier/prettier)

src/features/hideShorts/utils.ts

[error] 119-119: Insert

(prettier/prettier)

src/features/customCSS/index.ts

[error] 14-14: Insert

(prettier/prettier)


[error] 15-15: Insert

(prettier/prettier)


[error] 16-16: Insert

(prettier/prettier)


[error] 17-17: Insert

(prettier/prettier)


[error] 18-18: Insert

(prettier/prettier)


[error] 19-19: Insert

(prettier/prettier)


[error] 20-20: Insert

(prettier/prettier)


[error] 21-21: Insert

(prettier/prettier)


[error] 22-22: Insert

(prettier/prettier)


[error] 23-23: Insert

(prettier/prettier)


[error] 24-24: Insert

(prettier/prettier)

src/features/automaticTheaterMode/index.ts

[error] 6-6: Insert

(prettier/prettier)


[error] 20-20: Insert

(prettier/prettier)

src/features/playerQuality/index.ts

[error] 18-18: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)


[error] 36-36: Insert

(prettier/prettier)


[error] 37-37: Insert

(prettier/prettier)


[error] 38-38: Insert

(prettier/prettier)


[error] 39-39: Insert

(prettier/prettier)


[error] 40-40: Insert

(prettier/prettier)


[error] 41-41: Insert

(prettier/prettier)


[error] 42-42: Insert

(prettier/prettier)


[error] 43-43: Insert

(prettier/prettier)


[error] 44-44: Insert

(prettier/prettier)

src/features/deepDarkCSS/index.ts

[error] 16-16: Insert

(prettier/prettier)


[error] 17-17: Insert

(prettier/prettier)


[error] 18-18: Insert

(prettier/prettier)


[error] 32-32: Insert

(prettier/prettier)

src/hooks/useNotifications/provider.tsx

[error] 22-22: Insert

(prettier/prettier)


[error] 23-23: Insert

(prettier/prettier)


[error] 24-24: Insert

(prettier/prettier)


[error] 25-25: Insert

(prettier/prettier)


[error] 26-26: Insert

(prettier/prettier)


[error] 57-57: Insert

(prettier/prettier)

src/features/featureMenu/index.ts

[error] 230-230: Insert

(prettier/prettier)

src/features/scrollWheelVolumeControl/index.ts

[error] 34-34: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)


[error] 36-36: Insert

(prettier/prettier)


[error] 95-95: Insert

(prettier/prettier)

src/features/deepDarkCSS/utils.ts

[error] 9-9: Insert

(prettier/prettier)


[error] 22-22: Insert

(prettier/prettier)

src/features/scrollWheelSpeedControl/index.ts

[error] 34-34: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)


[error] 36-36: Insert

(prettier/prettier)

src/features/playbackSpeedButtons/index.ts

[error] 44-44: Insert

(prettier/prettier)


[error] 83-83: Insert

(prettier/prettier)

src/features/customCSS/utils.ts

[error] 8-8: Insert

(prettier/prettier)


[error] 21-21: Insert

(prettier/prettier)

src/features/maximizePlayerButton/index.ts

[error] 2-2: Insert

(prettier/prettier)


[error] 31-31: Insert

(prettier/prettier)


[error] 32-32: Insert

(prettier/prettier)


[error] 46-46: Insert

(prettier/prettier)


[error] 47-47: Insert

(prettier/prettier)


[error] 48-48: Insert

(prettier/prettier)


[error] 49-49: Insert

(prettier/prettier)


[error] 50-50: Insert

(prettier/prettier)


[error] 51-51: Insert

(prettier/prettier)


[error] 52-52: Insert

(prettier/prettier)


[error] 53-53: Insert

(prettier/prettier)


[error] 54-54: Insert

(prettier/prettier)


[error] 55-55: Insert

(prettier/prettier)


[error] 56-56: Insert

(prettier/prettier)


[error] 57-57: Insert

(prettier/prettier)


[error] 58-58: Insert

(prettier/prettier)


[error] 59-59: Insert

(prettier/prettier)


[error] 60-60: Insert

(prettier/prettier)


[error] 61-61: Insert

(prettier/prettier)


[error] 62-62: Insert

(prettier/prettier)


[error] 63-63: Insert

(prettier/prettier)


[error] 64-64: Insert

(prettier/prettier)


[error] 65-65: Insert

(prettier/prettier)


[error] 66-66: Insert

(prettier/prettier)


[error] 67-67: Insert

(prettier/prettier)


[error] 68-68: Insert

(prettier/prettier)


[error] 69-69: Insert

(prettier/prettier)


[error] 70-70: Insert

(prettier/prettier)


[error] 71-71: Insert

(prettier/prettier)


[error] 72-72: Insert

(prettier/prettier)


[error] 73-73: Insert

(prettier/prettier)


[error] 74-74: Insert

(prettier/prettier)


[error] 75-75: Insert

(prettier/prettier)


[error] 116-116: Insert

(prettier/prettier)


[error] 117-117: Insert

(prettier/prettier)


[error] 118-118: Insert

(prettier/prettier)


[error] 119-119: Insert

(prettier/prettier)


[error] 120-120: Insert

(prettier/prettier)


[error] 121-121: Insert

(prettier/prettier)


[error] 122-122: Insert

(prettier/prettier)


[error] 123-123: Insert

(prettier/prettier)


[error] 124-124: Insert

(prettier/prettier)


[error] 125-125: Insert

(prettier/prettier)


[error] 126-126: Insert

(prettier/prettier)


[error] 153-153: Insert

(prettier/prettier)


[error] 154-154: Insert

(prettier/prettier)


[error] 155-155: Insert

(prettier/prettier)


[error] 156-156: Insert

(prettier/prettier)


[error] 171-171: Insert

(prettier/prettier)


[error] 172-172: Insert

(prettier/prettier)

src/features/remainingTime/index.ts

[error] 56-56: Insert

(prettier/prettier)

src/pages/content/index.ts

[error] 149-149: Insert

(prettier/prettier)


[error] 150-150: Insert

(prettier/prettier)


[error] 151-151: Insert

(prettier/prettier)


[error] 152-152: Insert

(prettier/prettier)


[error] 153-153: Insert

(prettier/prettier)


[error] 154-154: Insert

(prettier/prettier)


[error] 155-155: Insert

(prettier/prettier)


[error] 236-236: Insert

(prettier/prettier)


[error] 478-478: Insert

(prettier/prettier)

src/features/screenshotButton/index.ts

[error] 44-44: Insert

(prettier/prettier)


[error] 78-78: Insert

(prettier/prettier)


[error] 79-79: Insert

(prettier/prettier)

src/features/scrollWheelVolumeControl/utils.ts

[error] 21-21: Insert

(prettier/prettier)


[error] 22-22: Insert

(prettier/prettier)


[error] 23-23: Insert

(prettier/prettier)


[error] 24-24: Insert

(prettier/prettier)


[error] 25-25: Insert

(prettier/prettier)


[error] 26-26: Insert

(prettier/prettier)


[error] 38-38: Insert

(prettier/prettier)

src/features/loopButton/index.ts

[error] 35-35: Insert

(prettier/prettier)


[error] 36-36: Insert

(prettier/prettier)


[error] 37-37: Insert

(prettier/prettier)


[error] 38-38: Insert

(prettier/prettier)


[error] 39-39: Insert

(prettier/prettier)


[error] 40-40: Insert

(prettier/prettier)


[error] 41-41: Insert

(prettier/prettier)


[error] 42-42: Insert

(prettier/prettier)


[error] 43-43: Insert

(prettier/prettier)


[error] 44-44: Insert

(prettier/prettier)


[error] 45-45: Insert

(prettier/prettier)


[error] 46-46: Insert

(prettier/prettier)


[error] 47-47: Insert

(prettier/prettier)


[error] 48-48: Insert

(prettier/prettier)


[error] 49-49: Insert

(prettier/prettier)


[error] 50-50: Insert

(prettier/prettier)


[error] 51-51: Insert

(prettier/prettier)


[error] 52-52: Insert

(prettier/prettier)


[error] 53-53: Insert

(prettier/prettier)


[error] 54-54: Insert

(prettier/prettier)


[error] 55-55: Insert

(prettier/prettier)


[error] 56-56: Insert

(prettier/prettier)


[error] 57-57: Insert

(prettier/prettier)


[error] 58-58: Insert

(prettier/prettier)


[error] 59-59: Insert

(prettier/prettier)


[error] 60-60: Insert

(prettier/prettier)


[error] 61-61: Insert

(prettier/prettier)


[error] 62-62: Insert

(prettier/prettier)


[error] 63-63: Insert

(prettier/prettier)


[error] 64-64: Insert

(prettier/prettier)


[error] 65-65: Insert

(prettier/prettier)


[error] 66-66: Insert

(prettier/prettier)


[error] 67-67: Insert

(prettier/prettier)


[error] 68-68: Insert

(prettier/prettier)


[error] 69-69: Insert

(prettier/prettier)


[error] 70-70: Insert

(prettier/prettier)


[error] 71-71: Insert

(prettier/prettier)


[error] 72-72: Expected "below_player" to come before "feature_menu".

(perfectionist/sort-switch-case)


[error] 72-72: Insert

(prettier/prettier)


[error] 73-73: Insert

(prettier/prettier)


[error] 74-74: Insert

(prettier/prettier)


[error] 75-75: Insert

(prettier/prettier)


[error] 76-76: Insert

(prettier/prettier)


[error] 77-77: Insert

(prettier/prettier)


[error] 78-78: Insert

(prettier/prettier)


[error] 79-79: Insert

(prettier/prettier)


[error] 80-80: Insert

(prettier/prettier)


[error] 81-81: Insert

(prettier/prettier)

src/features/rememberVolume/utils.ts

[error] 32-32: Insert

(prettier/prettier)


[error] 33-33: Insert

(prettier/prettier)


[error] 34-34: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)


[error] 55-55: Insert

(prettier/prettier)


[error] 56-56: Insert

(prettier/prettier)


[error] 57-57: Insert

(prettier/prettier)


[error] 58-58: Insert

(prettier/prettier)


[error] 59-59: Insert

(prettier/prettier)


[error] 60-60: Insert

(prettier/prettier)


[error] 61-61: Insert

(prettier/prettier)


[error] 62-62: Insert

(prettier/prettier)


[error] 63-63: Insert

(prettier/prettier)


[error] 64-64: Insert

(prettier/prettier)

src/features/pauseBackgroundPlayers/index.ts

[error] 1-1: Insert

(prettier/prettier)


[error] 2-2: Insert

(prettier/prettier)


[error] 21-21: Insert

(prettier/prettier)


[error] 22-22: Insert

(prettier/prettier)


[error] 23-23: Insert

(prettier/prettier)


[error] 24-24: Insert

(prettier/prettier)


[error] 25-25: Insert

(prettier/prettier)


[error] 26-26: Insert

(prettier/prettier)


[error] 27-27: Insert

(prettier/prettier)


[error] 28-28: Insert

(prettier/prettier)


[error] 29-29: Insert

(prettier/prettier)


[error] 30-30: Insert

(prettier/prettier)


[error] 31-31: Insert

(prettier/prettier)


[error] 32-32: Insert

(prettier/prettier)


[error] 33-33: Insert

(prettier/prettier)


[error] 34-34: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)


[error] 36-36: Insert

(prettier/prettier)


[error] 37-37: Insert

(prettier/prettier)


[error] 38-38: Insert

(prettier/prettier)


[error] 39-39: Insert

(prettier/prettier)


[error] 40-40: Insert

(prettier/prettier)


[error] 41-41: Insert

(prettier/prettier)


[error] 42-42: Insert

(prettier/prettier)


[error] 43-43: Insert

(prettier/prettier)


[error] 44-44: Insert

(prettier/prettier)


[error] 45-45: Insert

(prettier/prettier)

src/features/removeRedirect/index.ts

[error] 17-17: Insert

(prettier/prettier)


[error] 18-18: Insert

(prettier/prettier)


[error] 19-19: Insert

(prettier/prettier)


[error] 20-20: Insert

(prettier/prettier)


[error] 21-21: Insert

(prettier/prettier)


[error] 22-22: Insert

(prettier/prettier)


[error] 23-23: Insert

(prettier/prettier)


[error] 24-24: Insert

(prettier/prettier)


[error] 25-25: Insert

(prettier/prettier)


[error] 26-26: Insert

(prettier/prettier)


[error] 27-27: Insert

(prettier/prettier)


[error] 28-28: Insert

(prettier/prettier)


[error] 29-29: Insert

(prettier/prettier)


[error] 30-30: Insert

(prettier/prettier)


[error] 31-31: Insert

(prettier/prettier)

src/features/openTranscriptButton/utils.ts

[error] 19-19: Insert

(prettier/prettier)

src/features/maximizePlayerButton/utils.ts

[error] 14-14: Insert

(prettier/prettier)


[error] 28-28: Insert

(prettier/prettier)


[error] 63-63: Insert

(prettier/prettier)


[error] 64-64: Insert

(prettier/prettier)

src/features/featureMenu/utils.ts

[error] 84-84: Insert

(prettier/prettier)


[error] 85-85: Insert

(prettier/prettier)


[error] 86-86: Insert

(prettier/prettier)


[error] 87-87: Insert

(prettier/prettier)


[error] 88-88: Insert

(prettier/prettier)


[error] 89-89: Insert

(prettier/prettier)


[error] 90-90: Insert

(prettier/prettier)


[error] 91-91: Insert

(prettier/prettier)


[error] 92-92: Insert

(prettier/prettier)


[error] 163-163: Insert

(prettier/prettier)


[error] 164-164: Insert

(prettier/prettier)


[error] 165-165: Insert

(prettier/prettier)


[error] 166-166: Insert

(prettier/prettier)

src/pages/embedded/index.ts

[error] 270-270: Insert

(prettier/prettier)


[error] 271-271: Insert

(prettier/prettier)


[error] 337-337: Insert

(prettier/prettier)


[error] 338-338: Insert

(prettier/prettier)


[error] 339-339: Insert

(prettier/prettier)


[error] 340-340: Insert

(prettier/prettier)


[error] 341-341: Insert

(prettier/prettier)


[error] 342-342: Insert

(prettier/prettier)


[error] 343-343: Insert

(prettier/prettier)


[error] 344-344: Insert

(prettier/prettier)


[error] 353-353: Insert

(prettier/prettier)


[error] 401-401: Insert

(prettier/prettier)


[error] 402-402: Insert

(prettier/prettier)


[error] 441-441: Insert

(prettier/prettier)


[error] 442-442: Insert

(prettier/prettier)


[error] 443-443: Insert

(prettier/prettier)


[error] 444-444: Insert

(prettier/prettier)


[error] 445-445: Insert

(prettier/prettier)


[error] 446-446: Insert

(prettier/prettier)


[error] 447-447: Insert

(prettier/prettier)


[error] 448-448: Insert

(prettier/prettier)


[error] 449-449: Insert

(prettier/prettier)


[error] 450-450: Insert

(prettier/prettier)


[error] 451-451: Insert

(prettier/prettier)


[error] 452-452: Insert

(prettier/prettier)


[error] 453-453: Insert

(prettier/prettier)


[error] 454-454: Insert

(prettier/prettier)


[error] 455-455: Insert

(prettier/prettier)


[error] 456-456: Insert

(prettier/prettier)


[error] 457-457: Insert

(prettier/prettier)


[error] 458-458: Insert

(prettier/prettier)


[error] 459-459: Insert

(prettier/prettier)


[error] 460-460: Insert

(prettier/prettier)


[error] 461-461: Insert

(prettier/prettier)


[error] 462-462: Insert

(prettier/prettier)


[error] 463-463: Insert

(prettier/prettier)


[error] 464-464: Insert

(prettier/prettier)


[error] 465-472: Expected "remainingTimeChange" to come before "videoHistoryChange".

(perfectionist/sort-switch-case)


[error] 465-465: Insert

(prettier/prettier)


[error] 466-466: Insert

(prettier/prettier)


[error] 467-467: Insert

(prettier/prettier)


[error] 468-468: Insert

(prettier/prettier)


[error] 469-469: Insert

(prettier/prettier)


[error] 470-470: Insert

(prettier/prettier)


[error] 471-471: Insert

(prettier/prettier)


[error] 472-472: Insert

(prettier/prettier)


[error] 473-473: Insert

(prettier/prettier)


[error] 474-474: Insert

(prettier/prettier)


[error] 475-475: Insert

(prettier/prettier)


[error] 476-476: Insert

(prettier/prettier)


[error] 477-477: Insert

(prettier/prettier)


[error] 478-478: Insert

(prettier/prettier)


[error] 562-562: Insert

(prettier/prettier)


[error] 563-563: Insert

(prettier/prettier)


[error] 564-564: Insert

(prettier/prettier)


[error] 565-565: Insert

(prettier/prettier)


[error] 566-573: Expected "scrollWheelSpeedControlChange" to come before "scrollWheelVolumeControlChange".

(perfectionist/sort-switch-case)


[error] 566-566: Insert

(prettier/prettier)


[error] 567-567: Insert

(prettier/prettier)


[error] 568-568: Insert

(prettier/prettier)


[error] 569-569: Insert

(prettier/prettier)


[error] 570-570: Insert

(prettier/prettier)


[error] 571-571: Insert

(prettier/prettier)


[error] 572-572: Insert

(prettier/prettier)


[error] 573-573: Insert

(prettier/prettier)


[error] 574-574: Insert

(prettier/prettier)


[error] 575-575: Insert

(prettier/prettier)


[error] 576-576: Insert

(prettier/prettier)


[error] 577-577: Insert

(prettier/prettier)


[error] 578-578: Insert

(prettier/prettier)


[error] 579-579: Insert

(prettier/prettier)


[error] 595-595: Insert

(prettier/prettier)


[error] 596-596: Insert

(prettier/prettier)


[error] 597-597: Insert

(prettier/prettier)


[error] 598-598: Insert

(prettier/prettier)


[error] 599-599: Insert

(prettier/prettier)


[error] 600-600: Insert

(prettier/prettier)


[error] 601-601: Insert

(prettier/prettier)


[error] 602-602: Insert

(prettier/prettier)


[error] 603-603: Insert

(prettier/prettier)


[error] 604-604: Insert

(prettier/prettier)


[error] 630-630: Insert

(prettier/prettier)


[error] 631-631: Insert

(prettier/prettier)


[error] 654-654: Insert

(prettier/prettier)


[error] 655-655: Insert

(prettier/prettier)


[error] 656-656: Insert

(prettier/prettier)


[error] 685-685: Insert

(prettier/prettier)


[error] 686-686: Insert

(prettier/prettier)


[error] 687-687: Insert

(prettier/prettier)


[error] 688-688: Insert

(prettier/prettier)


[error] 689-689: Insert

(prettier/prettier)


[error] 690-690: Insert

(prettier/prettier)


[error] 691-691: Insert

(prettier/prettier)


[error] 692-692: Insert

(prettier/prettier)


[error] 693-693: Insert

(prettier/prettier)


[error] 694-694: Insert

(prettier/prettier)


[error] 695-695: Insert

(prettier/prettier)


[error] 696-696: Insert

(prettier/prettier)


[error] 697-697: Insert

(prettier/prettier)


[error] 698-698: Insert

(prettier/prettier)


[error] 699-699: Insert

(prettier/prettier)


[error] 700-700: Insert

(prettier/prettier)


[error] 701-701: Insert

(prettier/prettier)


[error] 702-702: Insert

(prettier/prettier)


[error] 703-703: Insert

(prettier/prettier)


[error] 704-704: Insert

(prettier/prettier)


[error] 705-705: Insert

(prettier/prettier)


[error] 706-706: Insert

(prettier/prettier)


[error] 707-707: Insert

(prettier/prettier)


[error] 708-708: Insert

(prettier/prettier)


[error] 709-709: Insert

(prettier/prettier)


[error] 710-710: Insert

(prettier/prettier)


[error] 711-711: Insert

(prettier/prettier)


[error] 712-712: Insert

(prettier/prettier)


[error] 713-713: Insert

(prettier/prettier)


[error] 714-714: Insert

(prettier/prettier)


[error] 715-715: Insert

(prettier/prettier)


[error] 716-716: Insert

(prettier/prettier)


[error] 750-750: Insert

(prettier/prettier)


[error] 751-751: Insert

(prettier/prettier)


[error] 752-752: Insert

(prettier/prettier)


[error] 753-753: Insert

(prettier/prettier)


[error] 754-754: Insert

(prettier/prettier)


[error] 755-755: Insert

(prettier/prettier)


[error] 756-756: Insert

(prettier/prettier)


[error] 757-757: Insert

(prettier/prettier)


[error] 758-758: Insert

(prettier/prettier)


[error] 759-759: Insert

(prettier/prettier)


[error] 760-760: Insert

(prettier/prettier)


[error] 761-761: Insert

(prettier/prettier)


[error] 762-762: Insert

(prettier/prettier)


[error] 763-763: Insert

(prettier/prettier)


[error] 764-764: Insert

(prettier/prettier)


[error] 765-765: Insert

(prettier/prettier)


[error] 766-766: Insert

(prettier/prettier)


[error] 767-767: Insert

(prettier/prettier)


[error] 768-768: Insert

(prettier/prettier)


[error] 769-776: Expected "pauseBackgroundPlayersChange" to come before "removeRedirectChange".

(perfectionist/sort-switch-case)


[error] 769-769: Insert

(prettier/prettier)


[error] 770-770: Insert

(prettier/prettier)


[error] 771-771: Insert

(prettier/prettier)


[error] 772-772: Insert

(prettier/prettier)


[error] 773-773: Insert

(prettier/prettier)


[error] 774-774: Insert

(prettier/prettier)


[error] 775-775: Insert

(prettier/prettier)


[error] 776-776: Insert

(prettier/prettier)


[error] 777-777: Insert

(prettier/prettier)


[error] 778-778: Insert

(prettier/prettier)


[error] 779-779: Insert

(prettier/prettier)


[error] 780-780: Insert

(prettier/prettier)


[error] 781-781: Insert

(prettier/prettier)


[error] 782-782: Insert

(prettier/prettier)


[error] 783-783: Insert

(prettier/prettier)


[error] 784-784: Insert

(prettier/prettier)


[error] 785-785: Insert

(prettier/prettier)


[error] 786-786: Insert

(prettier/prettier)


[error] 787-787: Insert

(prettier/prettier)


[error] 788-788: Insert

(prettier/prettier)


[error] 789-789: Insert

(prettier/prettier)


[error] 807-807: Insert

(prettier/prettier)


[error] 808-808: Insert

(prettier/prettier)


[error] 809-809: Insert

(prettier/prettier)


[error] 810-810: Insert

(prettier/prettier)


[error] 811-811: Insert

(prettier/prettier)


[error] 812-812: Insert

(prettier/prettier)


[error] 813-813: Insert

(prettier/prettier)


[error] 814-814: Insert

(prettier/prettier)


[error] 815-815: Insert

(prettier/prettier)


[error] 816-816: Insert

(prettier/prettier)


[error] 817-817: Insert

(prettier/prettier)


[error] 818-818: Insert

(prettier/prettier)


[error] 895-895: Insert

(prettier/prettier)


[error] 896-896: Insert

(prettier/prettier)

src/features/videoHistory/index.ts

[error] 75-75: Insert

(prettier/prettier)


[error] 76-76: Insert

(prettier/prettier)


[error] 77-77: Insert

(prettier/prettier)


[error] 78-78: Insert

(prettier/prettier)


[error] 79-79: Insert

(prettier/prettier)


[error] 80-80: Insert

(prettier/prettier)


[error] 81-81: Insert

(prettier/prettier)


[error] 82-82: Insert

(prettier/prettier)


[error] 83-83: Insert

(prettier/prettier)


[error] 84-84: Insert

(prettier/prettier)


[error] 172-172: Insert

(prettier/prettier)


[error] 173-173: Insert

(prettier/prettier)


[error] 188-188: Insert

(prettier/prettier)


[error] 189-189: Insert

(prettier/prettier)


[error] 190-190: Insert

(prettier/prettier)


[error] 191-191: Insert

(prettier/prettier)


[error] 201-201: Insert

(prettier/prettier)


[error] 202-202: Insert

(prettier/prettier)


[error] 203-203: Insert

(prettier/prettier)


[error] 204-204: Insert

(prettier/prettier)


[error] 205-205: Insert

(prettier/prettier)


[error] 206-206: Insert

(prettier/prettier)


[error] 207-207: Insert

(prettier/prettier)


[error] 208-208: Insert

(prettier/prettier)


[error] 209-209: Insert

(prettier/prettier)


[error] 210-210: Insert

(prettier/prettier)

src/features/buttonPlacement/utils.ts

[error] 35-35: Insert

(prettier/prettier)


[error] 75-75: Insert

(prettier/prettier)


[error] 76-76: Insert

(prettier/prettier)


[error] 77-77: Insert

(prettier/prettier)


[error] 78-78: Insert

(prettier/prettier)


[error] 79-79: Insert

(prettier/prettier)


[error] 80-80: Insert

(prettier/prettier)


[error] 95-95: Insert

(prettier/prettier)


[error] 161-161: Insert

(prettier/prettier)

src/features/playerSpeed/index.ts

[error] 32-32: Insert

(prettier/prettier)


[error] 33-33: Insert

(prettier/prettier)


[error] 94-94: Insert

(prettier/prettier)


[error] 124-124: Insert

(prettier/prettier)


[error] 125-125: Insert

(prettier/prettier)


[error] 126-126: Insert

(prettier/prettier)


[error] 127-127: Insert

(prettier/prettier)


[error] 128-128: Insert

(prettier/prettier)


[error] 129-129: Insert

(prettier/prettier)


[error] 130-130: Insert

(prettier/prettier)


[error] 131-131: Insert

(prettier/prettier)


[error] 132-132: Insert

(prettier/prettier)


[error] 133-133: Insert

(prettier/prettier)


[error] 134-134: Insert

(prettier/prettier)


[error] 135-135: Insert

(prettier/prettier)


[error] 136-136: Insert

(prettier/prettier)


[error] 137-137: Insert

(prettier/prettier)


[error] 138-138: Insert

(prettier/prettier)


[error] 139-139: Insert

(prettier/prettier)


[error] 140-140: Insert

(prettier/prettier)


[error] 141-141: Insert

(prettier/prettier)


[error] 142-142: Insert

(prettier/prettier)


[error] 143-143: Insert

(prettier/prettier)


[error] 144-144: Insert

(prettier/prettier)


[error] 145-145: Insert

(prettier/prettier)


[error] 146-146: Insert

(prettier/prettier)


[error] 147-147: Insert

(prettier/prettier)


[error] 148-148: Insert

(prettier/prettier)


[error] 149-149: Insert

(prettier/prettier)

src/utils/EventManager.ts

[error] 44-44: Insert

(prettier/prettier)


[error] 78-78: Insert

(prettier/prettier)


[error] 79-79: Insert

(prettier/prettier)


[error] 80-80: Insert

(prettier/prettier)


[error] 81-81: Insert

(prettier/prettier)


[error] 82-82: Insert

(prettier/prettier)


[error] 83-83: Insert

(prettier/prettier)


[error] 84-84: Insert

(prettier/prettier)


[error] 85-85: Insert

(prettier/prettier)


[error] 86-86: Insert

(prettier/prettier)


[error] 87-87: Insert

(prettier/prettier)


[error] 88-88: Insert

(prettier/prettier)


[error] 89-89: Insert

(prettier/prettier)


[error] 90-90: Insert

(prettier/prettier)


[error] 91-91: Insert

(prettier/prettier)


[error] 92-92: Insert

(prettier/prettier)


[error] 93-93: Insert

(prettier/prettier)


[error] 94-94: Insert

(prettier/prettier)


[error] 95-95: Insert

(prettier/prettier)

src/features/shareShortener/index.ts

[error] 5-5: Insert

(prettier/prettier)


[error] 16-16: Insert

(prettier/prettier)


[error] 17-17: Insert

(prettier/prettier)


[error] 18-18: Insert

(prettier/prettier)


[error] 19-19: Insert

(prettier/prettier)


[error] 20-20: Insert

(prettier/prettier)


[error] 21-21: Insert

(prettier/prettier)


[error] 22-22: Insert

(prettier/prettier)


[error] 23-23: Insert

(prettier/prettier)


[error] 24-24: Insert

(prettier/prettier)


[error] 25-25: Insert

(prettier/prettier)


[error] 26-26: Insert

(prettier/prettier)


[error] 27-27: Insert

(prettier/prettier)


[error] 28-28: Insert

(prettier/prettier)


[error] 29-29: Insert

(prettier/prettier)


[error] 30-30: Insert

(prettier/prettier)


[error] 31-31: Insert

(prettier/prettier)


[error] 32-32: Insert

(prettier/prettier)


[error] 33-33: Insert

(prettier/prettier)


[error] 34-34: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)


[error] 52-52: Insert

(prettier/prettier)


[error] 53-53: Insert

(prettier/prettier)


[error] 54-54: Insert

(prettier/prettier)

🪛 Biome (1.9.4)
src/features/volumeBoost/index.ts

[error] 21-22: Expected a statement but instead found '======='.

Expected a statement here.

(parse)

🪛 LanguageTool
CONTRIBUTING.md

[style] ~27-~27: Consider a shorter alternative to avoid wordiness.
Context: ...ere are a few guidelines that we follow in order to maintain the quality of the codebase: ...

(IN_ORDER_TO_PREMIUM)


[grammar] ~77-~77: Possible agreement error. The noun ‘source’ seems to be countable.
Context: ...hree_(computer_programming)>) - [Single source of truth](https://en.wikipedia.org/wiki...

(CD_NN)

🪛 markdownlint-cli2 (0.17.2)
CONTRIBUTING.md

5-5: Link fragments should be valid
null

(MD051, link-fragments)


6-6: Link fragments should be valid
null

(MD051, link-fragments)


7-7: Link fragments should be valid
null

(MD051, link-fragments)


8-8: Link fragments should be valid
null

(MD051, link-fragments)


9-9: Link fragments should be valid
null

(MD051, link-fragments)


10-10: Link fragments should be valid
null

(MD051, link-fragments)

🔇 Additional comments (59)
src/features/loopButton/utils.ts (1)

11-12: LGTM! Clean refactoring of the loop toggle logic.

The simplified conditional structure maintains the same functionality while improving readability.

🧰 Tools
🪛 ESLint

[error] 11-11: Insert

(prettier/prettier)


[error] 12-12: Insert

(prettier/prettier)

src/features/hideShorts/index.ts (1)

22-23: LGTM! Good use of optional chaining.

The optional chaining operator provides a cleaner way to handle the potential null state of shortsObserver.

🧰 Tools
🪛 ESLint

[error] 22-22: Insert

(prettier/prettier)


[error] 23-23: Insert

(prettier/prettier)

src/features/customCSS/utils.ts (1)

21-21: LGTM! Clean boolean expression.

The simplified return statement improves readability while maintaining the same functionality.

🧰 Tools
🪛 ESLint

[error] 21-21: Insert

(prettier/prettier)

src/features/customCSS/index.ts (2)

14-14: LGTM! Control flow simplification looks good.

The simplified conditional return improves code readability while maintaining the same functionality.

🧰 Tools
🪛 ESLint

[error] 14-14: Insert

(prettier/prettier)


24-24: LGTM! Proper use of optional chaining.

The use of optional chaining (?.) for element removal is a good TypeScript practice, eliminating the need for explicit null checks.

🧰 Tools
🪛 ESLint

[error] 24-24: Insert

(prettier/prettier)

src/features/automaticTheaterMode/index.ts (1)

20-20: LGTM! Simplified width comparison.

Direct access to document.body.clientWidth is cleaner than destructuring.

🧰 Tools
🪛 ESLint

[error] 20-20: Insert

(prettier/prettier)

src/features/openTranscriptButton/utils.ts (1)

18-19: Consider using a more specific selector.

The current selector might be too generic and could potentially match unintended elements as YouTube's UI evolves.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for usage of the ytd-video-description-transcript-section-renderer selector
rg "ytd-video-description-transcript-section-renderer" -A 2

Length of output: 930


Transcript Button Selector Specificity

The search confirmed that both in src/features/openTranscriptButton/utils.ts and src/features/openTranscriptButton/index.ts, the code uses the generic selector "ytd-video-description-transcript-section-renderer button". While this currently works as intended, it may become brittle if YouTube’s markup changes or if additional buttons are added under the same container.

• The generic selector is used consistently in both files.
• A more specific selector (e.g., one incorporating unique attributes or an ID) would better ensure that you’re targeting the correct element even as the UI evolves.

I recommend refining the selector to use additional attributes if available, to guard against future changes in the DOM structure.

🧰 Tools
🪛 ESLint

[error] 18-18: Insert

(prettier/prettier)


[error] 19-19: Insert

(prettier/prettier)

src/features/deepDarkCSS/index.ts (2)

16-18: LGTM! Clean refactoring of the return statement.

The direct return of updateDeepDarkCSS result improves code clarity by eliminating unnecessary variable assignment.

🧰 Tools
🪛 ESLint

[error] 16-16: Insert

(prettier/prettier)


[error] 17-17: Insert

(prettier/prettier)


[error] 18-18: Insert

(prettier/prettier)


32-32: LGTM! Good use of optional chaining.

The optional chaining operator ?. elegantly handles the null check for deepDarkThemeStyleElement.

🧰 Tools
🪛 ESLint

[error] 32-32: Insert

(prettier/prettier)

src/features/deepDarkCSS/utils.ts (2)

9-9: LGTM! Consistent use of optional chaining.

The optional chaining operator aligns with the pattern used in index.ts, maintaining consistency across the module.

🧰 Tools
🪛 ESLint

[error] 9-9: Insert

(prettier/prettier)


22-22: LGTM! Clean boolean expression.

Direct comparison with null simplifies the code by removing unnecessary conditional structure.

🧰 Tools
🪛 ESLint

[error] 22-22: Insert

(prettier/prettier)

src/features/removeRedirect/index.ts (1)

24-31: LGTM! Good use of early returns in mutation callback.

The early returns reduce nesting and improve code readability. The type checks and null checks are well-structured.

🧰 Tools
🪛 ESLint

[error] 24-24: Insert

(prettier/prettier)


[error] 25-25: Insert

(prettier/prettier)


[error] 26-26: Insert

(prettier/prettier)


[error] 27-27: Insert

(prettier/prettier)


[error] 28-28: Insert

(prettier/prettier)


[error] 29-29: Insert

(prettier/prettier)


[error] 30-30: Insert

(prettier/prettier)


[error] 31-31: Insert

(prettier/prettier)

src/features/shareShortener/index.ts (1)

27-29: LGTM! Good error handling.

The simplified error handling with early returns improves code readability.

🧰 Tools
🪛 ESLint

[error] 27-27: Insert

(prettier/prettier)


[error] 28-28: Insert

(prettier/prettier)


[error] 29-29: Insert

(prettier/prettier)

src/defaults.ts (1)

31-37: LGTM! Improved control flow.

The simplified control flow with early returns and reduced nesting makes the code more maintainable.

🧰 Tools
🪛 ESLint

[error] 31-31: Insert

(prettier/prettier)


[error] 32-32: Insert

(prettier/prettier)


[error] 33-33: Insert

(prettier/prettier)


[error] 34-34: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)


[error] 36-36: Insert

(prettier/prettier)


[error] 37-37: Insert

(prettier/prettier)

src/features/scrollWheelVolumeControl/utils.ts (1)

38-38: LGTM! Improved type safety.

The explicit type parameter in querySelectorAll improves type safety.

🧰 Tools
🪛 ESLint

[error] 38-38: Insert

(prettier/prettier)

src/features/pauseBackgroundPlayers/index.ts (1)

1-2: LGTM! Improved type safety with Nullable type.

Good use of the Nullable type and optional chaining for better type safety.

Also applies to: 22-24

🧰 Tools
🪛 ESLint

[error] 1-1: Insert

(prettier/prettier)


[error] 2-2: Insert

(prettier/prettier)

src/features/playerQuality/index.ts (1)

35-35: LGTM! Early return pattern improves readability.

The early return for auto quality or undefined player quality simplifies the control flow.

🧰 Tools
🪛 ESLint

[error] 35-35: Insert

(prettier/prettier)

src/features/rememberVolume/utils.ts (1)

55-64: LGTM! Early return pattern improves readability.

The early return for invalid conditions and the simplified volume restoration logic improves code clarity.

🧰 Tools
🪛 ESLint

[error] 55-55: Insert

(prettier/prettier)


[error] 56-56: Insert

(prettier/prettier)


[error] 57-57: Insert

(prettier/prettier)


[error] 58-58: Insert

(prettier/prettier)


[error] 59-59: Insert

(prettier/prettier)


[error] 60-60: Insert

(prettier/prettier)


[error] 61-61: Insert

(prettier/prettier)


[error] 62-62: Insert

(prettier/prettier)


[error] 63-63: Insert

(prettier/prettier)


[error] 64-64: Insert

(prettier/prettier)

src/pages/background/index.ts (1)

52-52: LGTM! Simplified tab ID validation.

The combined condition for tab ID validation improves readability.

🧰 Tools
🪛 ESLint

[error] 52-52: Insert

(prettier/prettier)

src/hooks/useNotifications/provider.tsx (2)

22-22: LGTM! Improved type safety with satisfies operator.

The use of satisfies operator ensures type safety while maintaining code readability.

🧰 Tools
🪛 ESLint

[error] 22-22: Insert

(prettier/prettier)


25-26: LGTM! Early return pattern improves readability.

The early return for invalid removeAfterMs simplifies the control flow.

🧰 Tools
🪛 ESLint

[error] 25-25: Insert

(prettier/prettier)


[error] 26-26: Insert

(prettier/prettier)

src/features/remainingTime/index.ts (1)

56-56: LGTM! Clean refactor.

The simplified conditional improves readability while maintaining the same functionality.

🧰 Tools
🪛 ESLint

[error] 56-56: Insert

(prettier/prettier)

src/features/loopButton/index.ts (1)

35-39: LGTM! Clean i18n refactor.

The simplified i18n string selection improves readability.

🧰 Tools
🪛 ESLint

[error] 35-35: Insert

(prettier/prettier)


[error] 36-36: Insert

(prettier/prettier)


[error] 37-37: Insert

(prettier/prettier)


[error] 38-38: Insert

(prettier/prettier)


[error] 39-39: Insert

(prettier/prettier)

src/features/screenshotButton/index.ts (2)

44-44: LGTM! Clean setTimeout refactor.

The simplified setTimeout callback improves readability.

🧰 Tools
🪛 ESLint

[error] 44-44: Insert

(prettier/prettier)


78-79: LGTM! Clean error handling refactor.

The simplified error handling using .catch is more concise while maintaining the same behavior.

🧰 Tools
🪛 ESLint

[error] 78-78: Insert

(prettier/prettier)


[error] 79-79: Insert

(prettier/prettier)

src/features/volumeBoost/index.ts (3)

37-50: LGTM! Clean error handling refactor.

The setupVolumeBoost function has been improved with better error handling and early returns.


53-55: LGTM! Clean null check.

Added early return for null gainNode improves error handling.


79-85: LGTM! Clean control flow refactor.

The button click handler has been simplified with better control flow using early returns.

src/features/scrollWheelSpeedControl/index.ts (1)

34-36: LGTM! Code simplification improves readability.

The refactoring of setOptionsData and the conditional return statement enhances code clarity while maintaining the same functionality.

🧰 Tools
🪛 ESLint

[error] 34-34: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)


[error] 36-36: Insert

(prettier/prettier)

src/features/scrollWheelVolumeControl/index.ts (2)

34-36: LGTM! Code simplification improves readability.

The refactoring of setOptionsData and the conditional return statement enhances code clarity while maintaining the same functionality.

🧰 Tools
🪛 ESLint

[error] 34-34: Insert

(prettier/prettier)


[error] 35-35: Insert

(prettier/prettier)


[error] 36-36: Insert

(prettier/prettier)


95-95: LGTM! Object literal consolidation improves readability.

The consolidation of the object literal into a single line enhances code clarity.

🧰 Tools
🪛 ESLint

[error] 95-95: Insert

(prettier/prettier)

src/features/maximizePlayerButton/utils.ts (3)

14-14: LGTM! Consolidated null checks improve readability.

The consolidation of multiple null checks into a single line enhances code clarity.

🧰 Tools
🪛 ESLint

[error] 14-14: Insert

(prettier/prettier)


28-28: LGTM! Simplified event listener improves readability.

The use of an arrow function for the event listener enhances code clarity.

🧰 Tools
🪛 ESLint

[error] 28-28: Insert

(prettier/prettier)


63-64: Address TODO comments in the code.

While the theater mode state logic simplification is good, there are several TODO comments in the file that need attention:

  1. Line 8: "get played progress bar to be accurate when maximized from default view"
  2. Line 9: "Add event listener that updates scrubber position when maximize button is clicked"
  3. Line 20: "get this working when video is playing"
  4. Line 22: "get all progress bar lists updated when video is playing"
  5. Line 65: "finish this code to make the maximize player button work properly"

Would you like me to help implement solutions for these TODO items or create issues to track them?

🧰 Tools
🪛 ESLint

[error] 63-63: Insert

(prettier/prettier)


[error] 64-64: Insert

(prettier/prettier)

src/features/buttonPlacement/utils.ts (2)

75-80: LGTM! Icon handling logic has been improved.

The changes streamline the icon handling by:

  1. Consolidating the icon type checks into a single isIconToggle check.
  2. Simplifying the control flow for appending icons.
🧰 Tools
🪛 ESLint

[error] 75-75: Insert

(prettier/prettier)


[error] 76-76: Insert

(prettier/prettier)


[error] 77-77: Insert

(prettier/prettier)


[error] 78-78: Insert

(prettier/prettier)


[error] 79-79: Insert

(prettier/prettier)


[error] 80-80: Insert

(prettier/prettier)


161-163: LGTM! Type safety has been improved.

The function signature now uses a generic type parameter ButtonName to enhance type safety while maintaining a simple implementation.

🧰 Tools
🪛 ESLint

[error] 161-161: Insert

(prettier/prettier)


[error] 162-162: Insert

(prettier/prettier)


[error] 163-163: Insert

(prettier/prettier)

src/features/playerSpeed/index.ts (2)

32-33: LGTM! Code has been simplified.

The player speed assignment has been simplified while maintaining the same functionality.

🧰 Tools
🪛 ESLint

[error] 32-32: Insert

(prettier/prettier)


[error] 33-33: Insert

(prettier/prettier)


124-150: LGTM! Code structure has been improved.

The changes enhance the code by:

  1. Using early returns for better control flow.
  2. Improving error handling with null checks.
  3. Making the code more maintainable.
🧰 Tools
🪛 ESLint

[error] 124-124: Insert

(prettier/prettier)


[error] 125-125: Insert

(prettier/prettier)


[error] 126-126: Insert

(prettier/prettier)


[error] 127-127: Insert

(prettier/prettier)


[error] 128-128: Insert

(prettier/prettier)


[error] 129-129: Insert

(prettier/prettier)


[error] 130-130: Insert

(prettier/prettier)


[error] 131-131: Insert

(prettier/prettier)


[error] 132-132: Insert

(prettier/prettier)


[error] 133-133: Insert

(prettier/prettier)


[error] 134-134: Insert

(prettier/prettier)


[error] 135-135: Insert

(prettier/prettier)


[error] 136-136: Insert

(prettier/prettier)


[error] 137-137: Insert

(prettier/prettier)


[error] 138-138: Insert

(prettier/prettier)


[error] 139-139: Insert

(prettier/prettier)


[error] 140-140: Insert

(prettier/prettier)


[error] 141-141: Insert

(prettier/prettier)


[error] 142-142: Insert

(prettier/prettier)


[error] 143-143: Insert

(prettier/prettier)


[error] 144-144: Insert

(prettier/prettier)


[error] 145-145: Insert

(prettier/prettier)


[error] 146-146: Insert

(prettier/prettier)


[error] 147-147: Insert

(prettier/prettier)


[error] 148-148: Insert

(prettier/prettier)


[error] 149-149: Insert

(prettier/prettier)


[error] 150-150: Insert

(prettier/prettier)

src/features/featureMenu/utils.ts (2)

84-92: LGTM! Menu item content creation has been simplified.

The changes improve the code by:

  1. Creating menu item content unconditionally.
  2. Maintaining conditional toggle element creation.
  3. Making the code more maintainable.
🧰 Tools
🪛 ESLint

[error] 84-84: Insert

(prettier/prettier)


[error] 85-85: Insert

(prettier/prettier)


[error] 86-86: Insert

(prettier/prettier)


[error] 87-87: Insert

(prettier/prettier)


[error] 88-88: Insert

(prettier/prettier)


[error] 89-89: Insert

(prettier/prettier)


[error] 90-90: Insert

(prettier/prettier)


[error] 91-91: Insert

(prettier/prettier)


[error] 92-92: Insert

(prettier/prettier)


163-167: LGTM! Type safety and inference have been improved.

The changes enhance the code by:

  1. Using a generic type parameter for better type safety.
  2. Inferring return values as constants for better type inference.
🧰 Tools
🪛 ESLint

[error] 163-163: Insert

(prettier/prettier)


[error] 164-164: Insert

(prettier/prettier)


[error] 165-165: Insert

(prettier/prettier)


[error] 166-166: Insert

(prettier/prettier)


[error] 167-167: Insert

(prettier/prettier)

src/features/videoHistory/index.ts (4)

75-76: LGTM! Good use of early return pattern.

The code is more readable with the early return pattern, and the callback is correctly invoked.

🧰 Tools
🪛 ESLint

[error] 75-75: Insert

(prettier/prettier)


[error] 76-76: Insert

(prettier/prettier)


81-84: LGTM! Good refactoring of the conditional logic.

The code is more maintainable with:

  1. Simplified conditional using negative condition
  2. Consistent callback invocation at the end
🧰 Tools
🪛 ESLint

[error] 81-81: Insert

(prettier/prettier)


[error] 82-82: Insert

(prettier/prettier)


[error] 83-83: Insert

(prettier/prettier)


[error] 84-84: Insert

(prettier/prettier)


172-173: LGTM! Good simplification of the animation frame logic.

The code is more concise and readable with the simplified conditional structure.

🧰 Tools
🪛 ESLint

[error] 172-172: Insert

(prettier/prettier)


[error] 173-173: Insert

(prettier/prettier)


189-191: LGTM! Good defensive programming.

The code is more robust with:

  1. Element existence checks before appending
  2. Early return to prevent duplicate prompt creation
  3. Proper sequencing of append operations

Also applies to: 208-210

🧰 Tools
🪛 ESLint

[error] 189-189: Insert

(prettier/prettier)


[error] 190-190: Insert

(prettier/prettier)


[error] 191-191: Insert

(prettier/prettier)

src/features/maximizePlayerButton/index.ts (3)

31-33: LGTM! Good simplification of constant values.

Using direct string literals improves readability for constant values.

🧰 Tools
🪛 ESLint

[error] 31-31: Insert

(prettier/prettier)


[error] 32-32: Insert

(prettier/prettier)


[error] 33-33: Insert

(prettier/prettier)


56-66: LGTM! Good error handling and control flow.

The code is more maintainable with:

  1. Early returns for validation
  2. Simplified control flow
  3. Proper null checks
🧰 Tools
🪛 ESLint

[error] 56-56: Insert

(prettier/prettier)


[error] 57-57: Insert

(prettier/prettier)


[error] 58-58: Insert

(prettier/prettier)


[error] 59-59: Insert

(prettier/prettier)


[error] 60-60: Insert

(prettier/prettier)


[error] 61-61: Insert

(prettier/prettier)


[error] 62-62: Insert

(prettier/prettier)


[error] 63-63: Insert

(prettier/prettier)


[error] 64-64: Insert

(prettier/prettier)


[error] 65-65: Insert

(prettier/prettier)


[error] 66-66: Insert

(prettier/prettier)


116-126: LGTM! Good organization of style updates.

The code is more maintainable with:

  1. Early return for validation
  2. Grouped style updates
  3. Proper sequencing
🧰 Tools
🪛 ESLint

[error] 116-116: Insert

(prettier/prettier)


[error] 117-117: Insert

(prettier/prettier)


[error] 118-118: Insert

(prettier/prettier)


[error] 119-119: Insert

(prettier/prettier)


[error] 120-120: Insert

(prettier/prettier)


[error] 121-121: Insert

(prettier/prettier)


[error] 122-122: Insert

(prettier/prettier)


[error] 123-123: Insert

(prettier/prettier)


[error] 124-124: Insert

(prettier/prettier)


[error] 125-125: Insert

(prettier/prettier)


[error] 126-126: Insert

(prettier/prettier)

src/pages/content/index.ts (3)

149-149: LGTM! Good use of arrow function.

The code is more concise with the arrow function syntax.

🧰 Tools
🪛 ESLint

[error] 149-149: Insert

(prettier/prettier)


153-155: LGTM! Good use of nested destructuring.

The code is more readable with explicit data flow through nested destructuring.

🧰 Tools
🪛 ESLint

[error] 153-153: Insert

(prettier/prettier)


[error] 154-154: Insert

(prettier/prettier)


[error] 155-155: Insert

(prettier/prettier)


478-478: LGTM! Good validation logic.

The code is more robust with combined null checks and early return.

🧰 Tools
🪛 ESLint

[error] 478-478: Insert

(prettier/prettier)

src/pages/embedded/index.ts (4)

270-271: LGTM! Good error handling for language data.

The code is more robust with proper destructuring and early return for missing language.

🧰 Tools
🪛 ESLint

[error] 270-270: Insert

(prettier/prettier)


[error] 271-271: Insert

(prettier/prettier)


337-344: LGTM! Good control flow for volume boost handling.

The code is more maintainable with:

  1. Reduced nesting through early returns
  2. Clear operation sequencing
  3. Separated mode-specific logic
🧰 Tools
🪛 ESLint

[error] 337-337: Insert

(prettier/prettier)


[error] 338-338: Insert

(prettier/prettier)


[error] 339-339: Insert

(prettier/prettier)


[error] 340-340: Insert

(prettier/prettier)


[error] 341-341: Insert

(prettier/prettier)


[error] 342-342: Insert

(prettier/prettier)


[error] 343-343: Insert

(prettier/prettier)


[error] 344-344: Insert

(prettier/prettier)


807-809: LGTM! Good control flow for theme handling.

The code is more maintainable with:

  1. Early returns for better flow control
  2. Proper existence checks
  3. Simplified update logic
🧰 Tools
🪛 ESLint

[error] 807-807: Insert

(prettier/prettier)


[error] 808-808: Insert

(prettier/prettier)


[error] 809-809: Insert

(prettier/prettier)


816-818: LGTM! Good control flow for CSS handling.

The code is more maintainable with:

  1. Early returns for better flow control
  2. Proper existence checks
  3. Simplified update logic
🧰 Tools
🪛 ESLint

[error] 816-816: Insert

(prettier/prettier)


[error] 817-817: Insert

(prettier/prettier)


[error] 818-818: Insert

(prettier/prettier)

CONTRIBUTING.md (5)

12-19: Clear Glossary Section
The Glossary section concisely defines key terms such as “Pull Request”, “Continuous Integration”, etc. This added clarity is beneficial for new contributors.


20-24: Effective Getting Started Guidelines
The “Getting Started” section outlines the commit message conventions and links to the conventional commits spec, which helps maintain a standardized workflow.


34-45: Clear Contributor Workflow Instructions
The Contributor Workflow section is straightforward and explains the fork–commit–PR process well. The instructions are easy to follow and support a collaborative process.


48-61: Solid Internationalization Guidelines
The “Internationalization (i18n)” section provides step-by-step guidance for contributors interested in translations and clearly references the Crowdin project.


62-72: Robust Code Quality Section
The Code Quality section effectively instructs contributors on running linters and fixing errors, reinforcing a culture of consistent code standards.

@@ -3,6 +3,7 @@ import type { YouTubePlayerDiv } from "@/src/types";
import { isLivePage, isWatchPage, waitForSpecificMessage } from "@/src/utils/utilities";

export async function enableAutomaticTheaterMode() {
if (!isWatchPage()) return;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove redundant isWatchPage() check.

The code checks isWatchPage() twice - once at the start and again in the player container query. Since we have an early return, the second check is unnecessary.

- const playerContainer = isWatchPage() || isLivePage() ? document.querySelector<YouTubePlayerDiv>("div#movie_player") : null;
+ const playerContainer = isLivePage() ? document.querySelector<YouTubePlayerDiv>("div#movie_player") : document.querySelector<YouTubePlayerDiv>("div#movie_player");

Also applies to: 16-16

🧰 Tools
🪛 ESLint

[error] 6-6: Insert

(prettier/prettier)

Comment on lines +20 to 26
export async function enableVolumeBoost() {
setupVolumeBoost();
=======

if (volume_boost_mode === "per_video") await addVolumeBoostButton();
else if (volume_boost_mode === "global") applyVolumeBoost(volume_boost_amount);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix merge conflict.

There are unresolved merge conflict markers in the code.

Please resolve the merge conflict and remove the ======= marker.

🧰 Tools
🪛 Biome (1.9.4)

[error] 21-22: Expected a statement but instead found '======='.

Expected a statement here.

(parse)

Comment on lines +83 to 85
// @ts-expect-error see: https://github.com/microsoft/TypeScript/issues/27808
// TODO: Add a better way to handle the subtype constraints
existingListeners.push(listenerInfo);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify and address the type errors.

The @ts-expect-error comments indicate known type issues that need to be addressed:

  1. Line 83: Subtype constraints need to be handled better.
  2. Line 91: The types are not aligning as expected.

Please investigate and fix these type errors to ensure type safety.

Run the following script to verify the type errors:

Also applies to: 91-93


🏁 Script executed:

#!/bin/bash
# Description: Verify type errors in EventManager.ts.

# Test: Search for similar type errors in the codebase.
ast-grep --pattern $'@ts-expect-error'

Length of output: 37


🏁 Script executed:

#!/bin/bash
# Using rg to search for "@ts-expect-error" along with context in the EventManager.ts file.
rg --context 2 "@ts-expect-error" src/utils/EventManager.ts

Length of output: 419


Attention: Type Error Workarounds Detected

Our search confirms that the use of @ts-expect-error is still present in the file, indicating unresolved type mismatches:

  • In src/utils/EventManager.ts around lines 83–85, the suppression for subtype constraint issues remains.
  • In src/utils/EventManager.ts around lines 91–93, the suppression for the callback type issue is still in place.

These issues indicate that the underlying type errors persist. Please review the subtype constraints and callback types to devise a solution that avoids suppressing these type errors.

🧰 Tools
🪛 ESLint

[error] 83-83: Insert

(prettier/prettier)


[error] 84-84: Insert

(prettier/prettier)


[error] 85-85: Insert

(prettier/prettier)

Comment on lines +441 to 454
if (maximizePlayerButtonEnabled) return await addMaximizePlayerButton();

await removeMaximizePlayerButton();
const maximizePlayerButton = document.querySelector<HTMLButtonElement>("video.html5-main-video");
if (!maximizePlayerButton) return;
// Get the video element
const videoElement = document.querySelector<HTMLVideoElement>("video.html5-main-video");
// If video element is not available, return
if (!videoElement) return;
const videoContainer = document.querySelector<YouTubePlayerDiv>("video.html5-main-video");
if (!videoContainer) return;
if (videoContainer.classList.contains("maximized_video_container") && videoElement.classList.contains("maximized_video")) {
maximizePlayer();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the video container selector.

The selector for videoContainer is incorrect. It's using video.html5-main-video instead of div#movie_player.

Apply this fix:

-const videoContainer = document.querySelector<YouTubePlayerDiv>("video.html5-main-video");
+const videoContainer = document.querySelector<YouTubePlayerDiv>("div#movie_player");
🧰 Tools
🪛 ESLint

[error] 441-441: Insert

(prettier/prettier)


[error] 442-442: Insert

(prettier/prettier)


[error] 443-443: Insert

(prettier/prettier)


[error] 444-444: Insert

(prettier/prettier)


[error] 445-445: Insert

(prettier/prettier)


[error] 446-446: Insert

(prettier/prettier)


[error] 447-447: Insert

(prettier/prettier)


[error] 448-448: Insert

(prettier/prettier)


[error] 449-449: Insert

(prettier/prettier)


[error] 450-450: Insert

(prettier/prettier)


[error] 451-451: Insert

(prettier/prettier)


[error] 452-452: Insert

(prettier/prettier)


[error] 453-453: Insert

(prettier/prettier)


[error] 454-454: Insert

(prettier/prettier)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants