add noFallThrough, inplicitReturn, update packages

This commit is contained in:
Michael C
2022-10-20 22:13:51 -04:00
parent aec5845bce
commit 1fcfea9fd5
12 changed files with 1301 additions and 1733 deletions

2976
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,23 +8,23 @@
"react-dom": "^18.2.0" "react-dom": "^18.2.0"
}, },
"devDependencies": { "devDependencies": {
"@types/chrome": "^0.0.197", "@types/chrome": "^0.0.199",
"@types/firefox-webext-browser": "^94.0.1", "@types/firefox-webext-browser": "^94.0.1",
"@types/jest": "^29.1.2", "@types/jest": "^29.2.0",
"@types/react": "^18.0.21", "@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6", "@types/react-dom": "^18.0.6",
"@types/selenium-webdriver": "^4.1.5", "@types/selenium-webdriver": "^4.1.6",
"@types/wicg-mediasession": "^1.1.4", "@types/wicg-mediasession": "^1.1.4",
"@typescript-eslint/eslint-plugin": "^5.39.0", "@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.39.0", "@typescript-eslint/parser": "^5.40.1",
"chromedriver": "^106.0.1", "chromedriver": "^106.0.1",
"concurrently": "^7.4.0", "concurrently": "^7.4.0",
"copy-webpack-plugin": "^11.0.0", "copy-webpack-plugin": "^11.0.0",
"eslint": "^8.24.0", "eslint": "^8.25.0",
"eslint-plugin-react": "^7.31.8", "eslint-plugin-react": "^7.31.10",
"fork-ts-checker-webpack-plugin": "^7.2.13", "fork-ts-checker-webpack-plugin": "^7.2.13",
"jest": "^29.1.2", "jest": "^29.2.1",
"jest-environment-jsdom": "^29.1.2", "jest-environment-jsdom": "^29.2.1",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"schema-utils": "^4.0.0", "schema-utils": "^4.0.0",
"selenium-webdriver": "^4.5.0", "selenium-webdriver": "^4.5.0",
@@ -33,7 +33,7 @@
"ts-loader": "^9.4.1", "ts-loader": "^9.4.1",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "4.8", "typescript": "4.8",
"web-ext": "^7.2.0", "web-ext": "^7.3.1",
"webpack": "^5.74.0", "webpack": "^5.74.0",
"webpack-cli": "^4.10.0", "webpack-cli": "^4.10.0",
"webpack-merge": "^5.8.0" "webpack-merge": "^5.8.0"

View File

@@ -59,16 +59,16 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
switch(request.message) { switch(request.message) {
case "openConfig": case "openConfig":
chrome.tabs.create({url: chrome.runtime.getURL('options/options.html' + (request.hash ? '#' + request.hash : ''))}); chrome.tabs.create({url: chrome.runtime.getURL('options/options.html' + (request.hash ? '#' + request.hash : ''))});
return; return true;
case "openHelp": case "openHelp":
chrome.tabs.create({url: chrome.runtime.getURL('help/index.html')}); chrome.tabs.create({url: chrome.runtime.getURL('help/index.html')});
return; return true;
case "openUpsell": case "openUpsell":
chrome.tabs.create({url: chrome.runtime.getURL('upsell/index.html')}); chrome.tabs.create({url: chrome.runtime.getURL('upsell/index.html')});
return; return true;
case "openPage": case "openPage":
chrome.tabs.create({url: chrome.runtime.getURL(request.url)}); chrome.tabs.create({url: chrome.runtime.getURL(request.url)});
return; return true;
case "sendRequest": case "sendRequest":
sendRequestToCustomServer(request.type, request.url, request.data).then(async (response) => { sendRequestToCustomServer(request.type, request.url, request.data).then(async (response) => {
callback({ callback({
@@ -112,6 +112,8 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
popupPort[sender.tab.id]?.postMessage(request); popupPort[sender.tab.id]?.postMessage(request);
} }
return false; return false;
default:
return false;
} }
}); });

View File

@@ -373,6 +373,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
</span> </span>
); );
} }
return null;
} }
getSubmissionChooser(): JSX.Element[] { getSubmissionChooser(): JSX.Element[] {

View File

@@ -2093,7 +2093,7 @@ async function voteAsync(type: number, UUID: SegmentUUID, category?: Category):
const sponsorIndex = utils.getSponsorIndexFromUUID(sponsorTimes, UUID); const sponsorIndex = utils.getSponsorIndexFromUUID(sponsorTimes, UUID);
// Don't vote for preview sponsors // Don't vote for preview sponsors
if (sponsorIndex == -1 || sponsorTimes[sponsorIndex].source !== SponsorSourceType.Server) return; if (sponsorIndex == -1 || sponsorTimes[sponsorIndex].source !== SponsorSourceType.Server) Promise.resolve();
// See if the local time saved count and skip count should be saved // See if the local time saved count and skip count should be saved
if (type === 0 && sponsorSkipped[sponsorIndex] || type === 1 && !sponsorSkipped[sponsorIndex]) { if (type === 0 && sponsorSkipped[sponsorIndex] || type === 1 && !sponsorSkipped[sponsorIndex]) {

View File

@@ -744,7 +744,7 @@ class PreviewBar {
chaptersContainer.style.display = "none"; chaptersContainer.style.display = "none";
} }
return; return [];
} }
segments ??= []; segments ??= [];

View File

@@ -67,9 +67,13 @@ class MessageHandler {
// To prevent clickjacking // To prevent clickjacking
let allowPopup = window === window.top; let allowPopup = window === window.top;
window.addEventListener("message", async (e) => { window.addEventListener("message", async (e): Promise<void> => {
if (e.source !== window.parent) return; if (e.source !== window.parent) return;
if (e.origin.endsWith('.youtube.com')) return allowPopup = true; if (e.origin.endsWith('.youtube.com')) {
allowPopup = true;
return
}
else return;
}); });
//make this a function to allow this to run on the content page //make this a function to allow this to run on the content page

View File

@@ -319,6 +319,7 @@ export default class Utils {
return selection; return selection;
} }
} }
return { name: "None", option: 0} as CategorySelection;
} }
/** /**

View File

@@ -148,5 +148,13 @@ export function getGuidelineInfo(category: Category): TextBox[] {
icon: "icons/check-smaller.svg", icon: "icons/check-smaller.svg",
text: chrome.i18n.getMessage(`category_${category}_guideline3`) text: chrome.i18n.getMessage(`category_${category}_guideline3`)
}]; }];
default:
return [{
icon: "icons/segway.png",
text: chrome.i18n.getMessage(`generic_guideline1`)
}, {
icon: "icons/right-arrow.svg",
text: chrome.i18n.getMessage(`generic_guideline2`)
}];
} }
} }

View File

@@ -22,5 +22,7 @@ export function urlTimeToSeconds(time: string): number {
return hours * 3600 + minutes * 60 + seconds; return hours * 3600 + minutes * 60 + seconds;
} else if (/\d+/.test(time)) { } else if (/\d+/.test(time)) {
return parseInt(time, 10); return parseInt(time, 10);
} else {
return 0;
} }
} }

View File

@@ -3,6 +3,8 @@
"module": "commonjs", "module": "commonjs",
"target": "es6", "target": "es6",
"noImplicitAny": false, "noImplicitAny": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": false, "sourceMap": false,
"outDir": "dist/js", "outDir": "dist/js",
"noEmitOnError": false, "noEmitOnError": false,

View File

@@ -3,6 +3,8 @@
"module": "commonjs", "module": "commonjs",
"target": "es6", "target": "es6",
"noImplicitAny": false, "noImplicitAny": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true, "sourceMap": true,
"outDir": "dist/js", "outDir": "dist/js",
"noEmitOnError": false, "noEmitOnError": false,