From 8271e84f93aaba195e4f96bdf30ce86ad3b8fde2 Mon Sep 17 00:00:00 2001 From: Oliver Wright Date: Sat, 28 Dec 2024 21:52:42 +0000 Subject: [PATCH] MAINT: Fix lint issues --- src/mixins/filterVideos.js | 10 +++++----- src/plugins/vuetify.js | 19 +++++++++---------- src/store/settings.module.js | 2 +- src/utils/consts.js | 2 +- src/utils/time.js | 2 +- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/mixins/filterVideos.js b/src/mixins/filterVideos.js index 14340ddad..610ba64be 100644 --- a/src/mixins/filterVideos.js +++ b/src/mixins/filterVideos.js @@ -14,8 +14,8 @@ export default { const favoriteChannels = this.$store.getters["favorites/favoriteChannelIDs"]; // eslint-disable-next-line no-param-reassign forOrg ||= this.$store.state.currentOrg.name; - let hiddenGroups = this.$store.state.settings.hiddenGroups; - const validOrgs = Object.keys(hiddenGroups) + const { hiddenGroups } = this.$store.state.settings; + const validOrgs = Object.keys(hiddenGroups); const orgGroupsHidden = validOrgs.includes(v.channel.org); let keep = true; @@ -32,8 +32,8 @@ export default { // TODO: Update to suport hideViaGroup: mentions needs suborg field on API if (!isFavoritedOrInOrg) { keep &&= !hideCollabs && !v.mentions?.every( - ({ id, org, suborg }) => (blockedChannels.has(id) || - (hideGroups && validOrgs.includes(org) && hiddenGroups[org].includes((`${suborg}`).slice(2) || "Other")) + ({ id, org, suborg }) => (blockedChannels.has(id) + || (hideGroups && validOrgs.includes(org) && hiddenGroups[org].includes((`${suborg}`).slice(2) || "Other")) || (org !== forOrg && !favoriteChannels.has(id))), ); } @@ -49,7 +49,7 @@ export default { if (hideMissing) { keep &&= v.status !== "missing"; } - + if (hideGroups) { if (orgGroupsHidden) { keep &&= !hideViaGroup; diff --git a/src/plugins/vuetify.js b/src/plugins/vuetify.js index 8a298242c..31804bceb 100644 --- a/src/plugins/vuetify.js +++ b/src/plugins/vuetify.js @@ -37,27 +37,26 @@ export const langs = [ { val: "th", display: "ไทย", credit: "SnowNeko#0282" }, ]; -const possibleChars = [768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 794, 795, 829, 830, 831, 832, 833, 834, 835, 836, 838, 842, 843, 844, 848, 849, 850, 855, 856, 859, 861, 862, 864, 865, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 820, 821, 822, 823, 824, 790, 791, 792, 793, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 825, 826, 827, 828, 837, 839, 840, 841, 845, 846, 851, 852, 853, 854, 857, 858, 860, 863, 866,]; -const randInt = upperBound => Math.floor(Math.random() * upperBound); +const possibleChars = [768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 794, 795, 829, 830, 831, 832, 833, 834, 835, 836, 838, 842, 843, 844, 848, 849, 850, 855, 856, 859, 861, 862, 864, 865, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 820, 821, 822, 823, 824, 790, 791, 792, 793, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 825, 826, 827, 828, 837, 839, 840, 841, 845, 846, 851, 852, 853, 854, 857, 858, 860, 863, 866]; +const randInt = (upperBound) => Math.floor(Math.random() * upperBound); function combiningChars() { return () => String.fromCharCode(possibleChars[randInt(possibleChars.length)]); } const repeat = (fn, count) => { - const result = [] - for (let i = 0; i < count; i++) { - result.push(fn()) + const result = []; + for (let i = 0; i < count; i += 1) { + result.push(fn()); } - return result -} - + return result; +}; export const zalgo = (str) => { - let mstr = str; + const mstr = str; const n = 0.5; const randomCombiningChar = combiningChars(); - return mstr.split('').map((char, i) => `${char}${repeat(randomCombiningChar, n).join('')}`).join('');; + return mstr.split("").map((char) => `${char}${repeat(randomCombiningChar, n).join("")}`).join(""); }; export const asyncLang = { diff --git a/src/store/settings.module.js b/src/store/settings.module.js index 451bce3b8..6000d0a05 100644 --- a/src/store/settings.module.js +++ b/src/store/settings.module.js @@ -146,7 +146,7 @@ const mutations = { const groupName = `${group.title}`.toLowerCase(); const orgName = `${group.org}`; if (!state.hiddenGroups) Vue.set(state, "hiddenGroups", {}); - if (!state.hiddenGroups[orgName]) Vue.set(state.hiddenGroups, `${orgName}`, []) + if (!state.hiddenGroups[orgName]) Vue.set(state.hiddenGroups, `${orgName}`, []); // determine to add or subtract: if (state.hiddenGroups[orgName].includes(groupName)) { diff --git a/src/utils/consts.js b/src/utils/consts.js index ba980d613..744c5f95b 100644 --- a/src/utils/consts.js +++ b/src/utils/consts.js @@ -142,7 +142,7 @@ export const TL_LANGS = Object.freeze([ export const langConversion = Object.freeze({ "lol-PEKO": "en", "lol-UWU": "en", - "zh": "zh-Hant", + zh: "zh-Hant", "zh-CN": "zh-Hans", }); diff --git a/src/utils/time.js b/src/utils/time.js index e888bd73e..07f3db676 100644 --- a/src/utils/time.js +++ b/src/utils/time.js @@ -55,7 +55,7 @@ export function localizedDayjs(time, lang) { return dayjs(time); } -export function titleTimeString(available_at, lang ) { +export function titleTimeString(available_at, lang) { const ts = localizedDayjs(available_at, lang); const ts1 = ts.format(`${ts.isTomorrow() ? "ddd " : ""}LT zzz`); const ts2 = ts