Skip to content

Commit

Permalink
chore: Upgrade to latest biome version
Browse files Browse the repository at this point in the history
  • Loading branch information
EvHaus committed Sep 13, 2024
1 parent d4287c6 commit 14aaf4e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 42 deletions.
61 changes: 32 additions & 29 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"css": {
"linter": {
"enabled": false
},
"formatter": {
"enabled": false,
"quoteStyle": "single"
},
"parser": {
"cssModules": true
}
},
"formatter": {
Expand All @@ -23,62 +22,66 @@
"rules": {
"recommended": true,
"a11y": {
"noAutofocus": "off"
"noAutofocus": "off",
"useSemanticElements": "off"
},
"complexity": {
"noForEach": "off",
"noUselessStringConcat": "error",
"noUselessUndefinedInitialization": "error",
"noVoid": "error",
"useArrowFunction": "off"
"useDateNow": "error"
},
"correctness": {
"noConstantMathMinMaxClamp": "error",
"noUndeclaredDependencies": "off",
"noUnusedFunctionParameters": "error",
"noUnusedImports": "error",
"noUnusedPrivateClassMembers": "error",
"noUnusedVariables": "error",
"useHookAtTopLevel": "error"
},
"nursery": {
"noDuplicateAtImportRules": "error",
"noDuplicateFontNames": "error",
"noDuplicateJsonKeys": "error",
"noDuplicateSelectorsKeyframeBlock": "error",
"noEmptyBlock": "error",
"noDuplicateCustomProperties": "error",
"noEnum": "error",
"noExportedImports": "error",
"noImportantInKeyframe": "error",
"noInvalidPositionAtImportRule": "error",
"noUnknownFunction": "error",
"noUnknownMediaFeatureName": "error",
"noUnknownProperty": "error",
"noUnknownSelectorPseudoElement": "error",
"noUnknownUnit": "error",
"noUnmatchableAnbSelector": "error",
"noUnusedFunctionParameters": "error",
"noYodaExpression": "error",
"noIrregularWhitespace": "error",
"noUnknownPseudoElement": "error",
"noUselessEscapeInRegex": "error",
"useDeprecatedReason": "error",
"useErrorMessage": "error",
"useNumberToFixedDigitsArgument": "error",
"useSortedClasses": "error",
"useThrowNewError": "error",
"useThrowOnlyError": "error"
"useSortedClasses": "error"
},
"performance": {
"noBarrelFile": "warn"
},
"style": {
"noDoneCallback": "error",
"noNamespaceImport": "error",
"noYodaExpression": "error",
"useCollapsedElseIf": "error",
"useConsistentArrayType": {
"level": "error",
"options": {
"syntax": "generic"
}
},
"useShorthandAssign": "error"
"useConsistentBuiltinInstantiation": "error",
"useShorthandAssign": "error",
"useThrowNewError": "error",
"useThrowOnlyError": "error"
},
"suspicious": {
"useAwait": "error",
"noConsoleLog": "error",
"noEmptyBlockStatements": "error"
"noConsole": {
"level": "error",
"options": {
"allow": ["error", "warn", "info", "debug"]
}
},
"useErrorMessage": "error",
"noEmptyBlockStatements": "error",
"noMisplacedAssertion": "error",
"useNumberToFixedDigitsArgument": "error"
}
}
},
Expand Down
25 changes: 12 additions & 13 deletions main.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// You can open new issues at:
// https://github.com/EvHaus/youtube-hide-watched/issues

(function (_undefined) {
((_undefined) => {
// Enable for debugging
const DEBUG = false;

Expand Down Expand Up @@ -62,13 +62,12 @@
localStorage.YTHWV_WATCHED = localStorage.YTHWV_WATCHED || 'false';

const logDebug = (...msgs) => {
// biome-ignore lint/suspicious/noConsoleLog: This is a debug log
if (DEBUG) console.log('[YT-HWV]', msgs);
if (DEBUG) console.debug('[YT-HWV]', msgs);
};

// GreaseMonkey no longer supports GM_addStyle. So we have to define
// our own polyfill here
const addStyle = function (aCss) {
const addStyle = (aCss) => {
const head = document.getElementsByTagName('head')[0];
if (head) {
const style = document.createElement('style');
Expand Down Expand Up @@ -183,7 +182,7 @@

// ===========================================================

const findWatchedElements = function () {
const findWatchedElements = () => {
const watched = document.querySelectorAll(
'.ytd-thumbnail-overlay-resume-playback-renderer',
);
Expand All @@ -206,7 +205,7 @@

// ===========================================================

const findShortsContainers = function () {
const findShortsContainers = () => {
const shortsContainers = [
// Subscriptions Page (List View)
document.querySelectorAll(
Expand Down Expand Up @@ -248,14 +247,14 @@

// ===========================================================

const findButtonAreaTarget = function () {
const findButtonAreaTarget = () => {
// Button will be injected into the main header menu
return document.querySelector('#container #end #buttons');
};

// ===========================================================

const determineYoutubeSection = function () {
const determineYoutubeSection = () => {
const { href } = window.location;

let youtubeSection = 'misc';
Expand All @@ -278,7 +277,7 @@

// ===========================================================

const updateClassOnWatchedItems = function () {
const updateClassOnWatchedItems = () => {
// Remove existing classes
document
.querySelectorAll('.YT-HWV-WATCHED-DIMMED')
Expand Down Expand Up @@ -369,7 +368,7 @@

// ===========================================================

const updateClassOnShortsItems = function () {
const updateClassOnShortsItems = () => {
const section = determineYoutubeSection();

document
Expand All @@ -395,7 +394,7 @@

// ===========================================================

const renderButtons = function () {
const renderButtons = () => {
// Find button area target
const target = findButtonAreaTarget();
if (!target) return;
Expand Down Expand Up @@ -512,12 +511,12 @@

// ===========================================================

const observeDOM = (function () {
const observeDOM = (() => {
const MutationObserver =
window.MutationObserver || window.WebKitMutationObserver;
const eventListenerSupported = window.addEventListener;

return function (obj, callback) {
return (obj, callback) => {
logDebug('Attaching DOM listener');

// Invalid `obj` given
Expand Down

0 comments on commit 14aaf4e

Please sign in to comment.