diff --git a/.husky/commit-msg.sh b/.husky/commit-msg.sh index 93396fde..deb033cf 100644 --- a/.husky/commit-msg.sh +++ b/.husky/commit-msg.sh @@ -1,4 +1 @@ -#!/bin/sh -. "${dirname "$0"}/_/husky/husky.sh" - -npx commitlint --edit $1 \ No newline at end of file +bunx --bun commitlint --edit $1 \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index b1018fa2..a5a10803 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - bun run lint diff --git a/src/features/background/Background.jsx b/src/features/background/Background.jsx index 5d6b2bc8..11b43d86 100644 --- a/src/features/background/Background.jsx +++ b/src/features/background/Background.jsx @@ -1,4 +1,4 @@ -/* eslint-disable no-unused-expressions */ + // todo: rewrite this mess import variables from 'config/variables'; import { PureComponent } from 'react'; @@ -42,7 +42,7 @@ export default class Background extends PureComponent { const backgroundImage = document.getElementById('backgroundImage'); if (this.state.url !== '') { - let url = this.state.url; + const url = this.state.url; const photoInformation = document.querySelector('.photoInformation'); // just set the background @@ -194,7 +194,7 @@ export default class Background extends PureComponent { } // API background - let data = JSON.parse(localStorage.getItem('nextImage')) || (await this.getAPIImageData()); + const data = JSON.parse(localStorage.getItem('nextImage')) || (await this.getAPIImageData()); localStorage.setItem('nextImage', null); if (data) { this.setState(data); diff --git a/src/features/background/components/PhotoInformation.jsx b/src/features/background/components/PhotoInformation.jsx index c06a7c57..76360b7e 100644 --- a/src/features/background/components/PhotoInformation.jsx +++ b/src/features/background/components/PhotoInformation.jsx @@ -240,7 +240,7 @@ function PhotoInformation({ info, url, api }) { {info.downloads.toLocaleString()} - {!!info.likes ? ( + {info.likes ? (
{info.likes.toLocaleString()} diff --git a/src/features/background/options/Custom.jsx b/src/features/background/options/Custom.jsx index bd906e3f..f0c66266 100644 --- a/src/features/background/options/Custom.jsx +++ b/src/features/background/options/Custom.jsx @@ -123,7 +123,7 @@ export default class CustomSettings extends PureComponent { addCustomURL(e) { // regex: https://ihateregex.io/expr/url/ - // eslint-disable-next-line no-useless-escape + const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._~#=]{1,256}\.[a-zA-Z0-9()]{1,63}\b([-a-zA-Z0-9()!@:%_.~#?&=]*)/; if (urlRegex.test(e) === false) { diff --git a/src/features/marketplace/views/Added.jsx b/src/features/marketplace/views/Added.jsx index bd34c4b7..c22b8ff4 100644 --- a/src/features/marketplace/views/Added.jsx +++ b/src/features/marketplace/views/Added.jsx @@ -131,7 +131,7 @@ export default class Added extends PureComponent { } sortAddons(value, sendEvent) { - let installed = JSON.parse(localStorage.getItem('installed')); + const installed = JSON.parse(localStorage.getItem('installed')); switch (value) { case 'newest': installed.reverse(); diff --git a/src/features/marketplace/views/Browse.jsx b/src/features/marketplace/views/Browse.jsx index e74d01bb..bbd62be8 100644 --- a/src/features/marketplace/views/Browse.jsx +++ b/src/features/marketplace/views/Browse.jsx @@ -197,7 +197,7 @@ class Marketplace extends PureComponent { const installed = JSON.parse(localStorage.getItem('installed')); for (const item of this.state.items) { if (installed.some((i) => i.name === item.display_name)) continue; // don't install if already installed - let { data } = await ( + const { data } = await ( await fetch(`${variables.constants.API_URL}/marketplace/item/${item.type}/${item.name}`, { signal: this.controller.signal, }) diff --git a/src/features/marketplace/views/Create.jsx b/src/features/marketplace/views/Create.jsx index 57c8b389..a68f774c 100644 --- a/src/features/marketplace/views/Create.jsx +++ b/src/features/marketplace/views/Create.jsx @@ -1,4 +1,4 @@ -/* eslint-disable no-unused-vars */ + import variables from 'config/variables'; import { PureComponent } from 'react'; import { MdOutlineExtensionOff } from 'react-icons/md'; diff --git a/src/features/marketplace/views/ItemPage.jsx b/src/features/marketplace/views/ItemPage.jsx index fda27d37..1b236f24 100644 --- a/src/features/marketplace/views/ItemPage.jsx +++ b/src/features/marketplace/views/ItemPage.jsx @@ -83,7 +83,7 @@ class ItemPage extends PureComponent { render() { const locale = localStorage.getItem('language'); const shortLocale = locale.includes('_') ? locale.split('_')[0] : locale; - let languageNames = new Intl.DisplayNames([shortLocale], { type: 'language' }); + const languageNames = new Intl.DisplayNames([shortLocale], { type: 'language' }); const convertedType = (() => { const map = { photos: 'photo_packs', diff --git a/src/features/misc/sections/About.jsx b/src/features/misc/sections/About.jsx index 491ce661..92223790 100644 --- a/src/features/misc/sections/About.jsx +++ b/src/features/misc/sections/About.jsx @@ -352,7 +352,7 @@ class About extends PureComponent { {variables.getMessage('modals.main.settings.sections.about.photographers')} - {!!this.state.loading ?

{this.state.loading}

: <>} + {this.state.loading ?

{this.state.loading}

: <>}
    {this.state.photographers.map(({ name, count }) => (
  • @@ -374,7 +374,7 @@ class About extends PureComponent { {variables.getMessage('modals.main.settings.sections.about.curators')} - {!!this.state.loading ?

    {this.state.loading}

    : <>} + {this.state.loading ?

    {this.state.loading}

    : <>}
      {this.state.curators.map((name) => (
    • diff --git a/src/features/navbar/components/Todo.jsx b/src/features/navbar/components/Todo.jsx index 8120183e..7e377528 100644 --- a/src/features/navbar/components/Todo.jsx +++ b/src/features/navbar/components/Todo.jsx @@ -155,7 +155,7 @@ class Todo extends PureComponent { * @param {Object} data The data to use for the action. */ updateTodo(action, index, data) { - let todo = this.state.todo; + const todo = this.state.todo; switch (action) { case 'add': todo.push({ diff --git a/src/features/quote/Quote.jsx b/src/features/quote/Quote.jsx index 06d14146..f8412f49 100644 --- a/src/features/quote/Quote.jsx +++ b/src/features/quote/Quote.jsx @@ -196,7 +196,7 @@ class Quote extends PureComponent { const favouriteQuote = localStorage.getItem('favouriteQuote'); if (favouriteQuote) { - let author = favouriteQuote.split(' - ')[1]; + const author = favouriteQuote.split(' - ')[1]; const authorimgdata = await this.getAuthorImg(author); return this.setState({ quote: favouriteQuote.split(' - ')[0], @@ -298,7 +298,7 @@ class Quote extends PureComponent { // First we try and get a quote from the API... try { - let data = JSON.parse(localStorage.getItem('nextQuote')) || (await getAPIQuoteData()); + const data = JSON.parse(localStorage.getItem('nextQuote')) || (await getAPIQuoteData()); localStorage.setItem('nextQuote', null); if (data) { this.setState(data); diff --git a/src/features/search/Search.jsx b/src/features/search/Search.jsx index 57d5cd48..980dec7e 100644 --- a/src/features/search/Search.jsx +++ b/src/features/search/Search.jsx @@ -43,7 +43,7 @@ function Search() { }; }, []); - let micIcon = createRef(); + const micIcon = createRef(); const customText = variables .getMessage('modals.main.settings.sections.search.custom') diff --git a/src/features/stats/options/StatsOptions.jsx b/src/features/stats/options/StatsOptions.jsx index 732df405..6a8a6395 100644 --- a/src/features/stats/options/StatsOptions.jsx +++ b/src/features/stats/options/StatsOptions.jsx @@ -1,4 +1,4 @@ -/* eslint-disable array-callback-return */ + import { useState, useEffect, useCallback, useMemo } from 'react'; import { MdShowChart, MdRestartAlt, MdDownload, MdAccessTime, MdLock } from 'react-icons/md'; import { FaTrophy } from 'react-icons/fa'; diff --git a/src/features/welcome/Welcome.jsx b/src/features/welcome/Welcome.jsx index 2d0f107a..6f4308ea 100644 --- a/src/features/welcome/Welcome.jsx +++ b/src/features/welcome/Welcome.jsx @@ -136,7 +136,7 @@ function WelcomeModal({ modalClose, modalSkip }) { }; // Current tab component - let CurrentTab = tabComponents[currentTab] || ; + const CurrentTab = tabComponents[currentTab] || ; // Render the WelcomeModal component return ( diff --git a/src/utils/links/isValidUrl.js b/src/utils/links/isValidUrl.js index f8fab6e6..243e737a 100644 --- a/src/utils/links/isValidUrl.js +++ b/src/utils/links/isValidUrl.js @@ -1,6 +1,6 @@ export function isValidUrl(url) { // regex: https://ihateregex.io/expr/url/ - // eslint-disable-next-line no-useless-escape + const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._~#=]{1,256}\.[a-zA-Z0-9()]{1,63}\b([-a-zA-Z0-9()!@:%_.~#?&=]*)/; diff --git a/src/utils/marketplace/install.js b/src/utils/marketplace/install.js index fc74b66d..11d50a02 100644 --- a/src/utils/marketplace/install.js +++ b/src/utils/marketplace/install.js @@ -15,7 +15,7 @@ export function install(type, input, sideload, collection) { case 'settings': localStorage.removeItem('backup_settings'); - let oldSettings = []; + const oldSettings = []; Object.keys(localStorage).forEach((key) => { oldSettings.push({ name: key, diff --git a/src/utils/marketplace/uninstall.js b/src/utils/marketplace/uninstall.js index e85e1223..8fc9b904 100644 --- a/src/utils/marketplace/uninstall.js +++ b/src/utils/marketplace/uninstall.js @@ -66,7 +66,7 @@ export function uninstall(type, name) { break; } - let installed = JSON.parse(localStorage.getItem('installed')); + const installed = JSON.parse(localStorage.getItem('installed')); for (let i = 0; i < installed.length; i++) { if (installed[i].name === name) { installed.splice(i, 1); diff --git a/src/utils/settings/export.js b/src/utils/settings/export.js index a1dcd61b..87cd800f 100644 --- a/src/utils/settings/export.js +++ b/src/utils/settings/export.js @@ -11,10 +11,10 @@ export function exportSettings() { settings[key] = localStorage.getItem(key); }); - let date = new Date(); + const date = new Date(); // Format the date as YYYY-MM-DD_HH-MM-SS - let formattedDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}_${date.getHours().toString().padStart(2, '0')}-${date.getMinutes().toString().padStart(2, '0')}-${date.getSeconds().toString().padStart(2, '0')}`; - let filename = `mue_settings_backup_${formattedDate}.json`; + const formattedDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}_${date.getHours().toString().padStart(2, '0')}-${date.getMinutes().toString().padStart(2, '0')}-${date.getSeconds().toString().padStart(2, '0')}`; + const filename = `mue_settings_backup_${formattedDate}.json`; saveFile(settings, filename); variables.stats.postEvent('tab', 'Settings exported'); }