Skip to content

Commit

Permalink
Chore: Code Linting & Formatting (#412)
Browse files Browse the repository at this point in the history
* (WIP) update+configure prettier, eslint, and plugins/configs
* code linting changes
* remove webextension-toolbox.config file
  • Loading branch information
rthaut committed May 28, 2024
1 parent c472f5d commit 9b37d39
Show file tree
Hide file tree
Showing 20 changed files with 191 additions and 199 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"@babel/preset-react"
]
}
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ insert_final_newline = false

[*.{pem,pub}]
insert_final_newline = false

[*.css]
tab_width = 4
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"root": true,
"extends": [
"prettier"
],
"plugins": [],
"rules": {}
}
8 changes: 4 additions & 4 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
OnBeforeSendHeaders,
OnSendHeaders,
} from "./background/webRequest";
import { IsVideoURL } from "./helpers/youtube";
import Options from "./helpers/options";
import { IsVideoURL } from "./helpers/youtube";

browser.browserAction.onClicked.addListener(() => {
if (browser.runtime.openOptionsPage) {
Expand All @@ -18,7 +18,7 @@ browser.browserAction.onClicked.addListener(() => {
browser.management
.getSelf()
.then(({ optionsUrl: url }) =>
browser.windows.create({ url, type: "popup" })
browser.windows.create({ url, type: "popup" }),
);
}
});
Expand All @@ -32,13 +32,13 @@ browser.runtime.onMessage.addListener(OnRuntimeMessage);
browser.webRequest.onBeforeSendHeaders.addListener(
OnBeforeSendHeaders,
GetFilter("onBeforeSendHeaders"),
GetExtraInfoSpec("onBeforeSendHeaders")
GetExtraInfoSpec("onBeforeSendHeaders"),
);

browser.webRequest.onSendHeaders.addListener(
OnSendHeaders,
GetFilter("onSendHeaders"),
GetExtraInfoSpec("onSendHeaders")
GetExtraInfoSpec("onSendHeaders"),
);

browser.tabs.onUpdated.addListener(async (tabId, changeInfo) => {
Expand Down
8 changes: 4 additions & 4 deletions app/scripts/background/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const OnCommandEventHandler = async (command) => {

case "open-popout-force-close-command":
console.log(
"[Background] Instructing active tab to open popout player and close original tab"
"[Background] Instructing active tab to open popout player and close original tab",
);
SendMessageToActiveTab({
action: "open-popout-via-command",
Expand All @@ -35,7 +35,7 @@ export const OnCommandEventHandler = async (command) => {

case "open-popout-no-close-command":
console.log(
"[Background] Instructing active tab to open popout player without closing original tab"
"[Background] Instructing active tab to open popout player without closing original tab",
);
SendMessageToActiveTab({
action: "open-popout-via-command",
Expand All @@ -48,7 +48,7 @@ export const OnCommandEventHandler = async (command) => {

case "rotate-video-left":
console.log(
"[Background] Instructing active tab to rotate video to the left (by -90 degrees)"
"[Background] Instructing active tab to rotate video to the left (by -90 degrees)",
);
SendMessageToActiveTab({
action: "rotate-video-player",
Expand All @@ -60,7 +60,7 @@ export const OnCommandEventHandler = async (command) => {

case "rotate-video-right":
console.log(
"[Background] Instructing active tab to rotate video to the right (by +90 degrees)"
"[Background] Instructing active tab to rotate video to the right (by +90 degrees)",
);
SendMessageToActiveTab({
action: "rotate-video-player",
Expand Down
12 changes: 5 additions & 7 deletions app/scripts/background/menus.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { OpenPopoutBackgroundHelper } from "./popout";

import {
YOUTUBE_VIDEO_URL_PATTERNS,
YOUTUBE_PLAYLIST_URL_PATTERNS,
YOUTUBE_VIDEO_URL_PATTERNS,
} from "../helpers/constants";

import Options from "../helpers/options";
import { OpenPopoutBackgroundHelper } from "./popout";

export const GetMenus = async () => {
const menus = [
Expand All @@ -27,12 +25,12 @@ export const GetMenus = async () => {

const showRotationMenus = await Options.GetLocalOption(
"behavior",
"showRotationMenus"
"showRotationMenus",
);
if (showRotationMenus !== false) {
menus.push({
title: browser.i18n.getMessage(
"LinkContextMenuEntry_OpenVideoRotateLeft_Text"
"LinkContextMenuEntry_OpenVideoRotateLeft_Text",
),
contexts: ["link"],
targetUrlPatterns: YOUTUBE_VIDEO_URL_PATTERNS,
Expand All @@ -41,7 +39,7 @@ export const GetMenus = async () => {
});
menus.push({
title: browser.i18n.getMessage(
"LinkContextMenuEntry_OpenVideoRotateRight_Text"
"LinkContextMenuEntry_OpenVideoRotateRight_Text",
),
contexts: ["link"],
targetUrlPatterns: YOUTUBE_VIDEO_URL_PATTERNS,
Expand Down
Loading

0 comments on commit 9b37d39

Please sign in to comment.