manual lint --fix

This commit is contained in:
Henry Jameson 2025-02-04 15:23:21 +02:00
commit d1ea589531
76 changed files with 187 additions and 184 deletions

View file

@ -29,7 +29,7 @@ export const closeDesktopNotification = (rootState, { id }) => {
}
}
export const closeAllDesktopNotifications = (rootState) => {
export const closeAllDesktopNotifications = () => {
if (!('Notification' in window && window.Notification.permission === 'granted')) return
if (isSWSupported()) {

View file

@ -48,7 +48,7 @@ export class RegistrationError extends Error {
} else {
this.message = error
}
} catch (e) {
} catch {
// can't parse it, so just treat it like a string
this.message = error
}

View file

@ -42,7 +42,7 @@ export const newImporter = ({
filePicker.addEventListener('change', event => {
if (event.target.files[0]) {
const filename = event.target.files[0].name
const reader = new FileReader()
reader.onload = ({ target }) => {
try {

View file

@ -16,7 +16,7 @@ const fetchRelationship = (attempt, userId, store) => new Promise((resolve, reje
}
})
export const requestFollow = (userId, store) => new Promise((resolve, reject) => {
export const requestFollow = (userId, store) => new Promise((resolve) => {
store.state.api.backendInteractor.followUser({ id: userId })
.then((updated) => {
store.commit('updateUserRelationship', [updated])
@ -41,7 +41,7 @@ export const requestFollow = (userId, store) => new Promise((resolve, reject) =>
})
})
export const requestUnfollow = (userId, store) => new Promise((resolve, reject) => {
export const requestUnfollow = (userId, store) => new Promise((resolve) => {
store.state.api.backendInteractor.unfollowUser({ id: userId })
.then((updated) => {
store.commit('updateUserRelationship', [updated])

View file

@ -184,7 +184,7 @@ class SwipeAndClickGesture {
}
}
click (event) {
click () {
if (!this._preventNextClick) {
this.swipelessClickCallback()
}

View file

@ -23,7 +23,7 @@ export const getAttrs = (tag, filter) => {
.replace(/\/?$/, '')
.trim()
const attrs = Array.from(innertag.matchAll(/([a-z]+[a-z0-9-]*)(?:=("[^"]+?"|'[^']+?'))?/gi))
.map(([trash, key, value]) => [key, value])
.map(([, key, value]) => [key, value])
.map(([k, v]) => {
if (!v) return [k, true]
return [k, v.substring(1, v.length - 1)]

View file

@ -2,7 +2,7 @@ import { useListsStore } from 'src/stores/lists.js'
import apiService from '../api/api.service.js'
import { promiseInterval } from '../promise_interval/promise_interval.js'
const fetchAndUpdate = ({ store, credentials }) => {
const fetchAndUpdate = ({ credentials }) => {
return apiService.fetchLists({ credentials })
.then(lists => {
useListsStore().setLists(lists)

View file

@ -48,7 +48,7 @@ const adoptStyleSheets = (styles) => {
export const generateTheme = (inputRuleset, callbacks, debug) => {
const {
onNewRule = (rule, isLazy) => {},
onNewRule = () => {},
onLazyFinished = () => {},
onEagerFinished = () => {}
} = callbacks
@ -123,8 +123,8 @@ export const tryLoadCache = async () => {
export const applyTheme = (
input,
onEagerFinish = data => {},
onFinish = data => {},
onEagerFinish = () => {},
onFinish = () => {},
debug
) => {
const eagerStyles = createStyleSheet(EAGER_STYLE_ID)
@ -217,7 +217,7 @@ const extractStyleConfig = ({
console.log(defaultState)
const defaultStyleConfig = extractStyleConfig(defaultState)
export const applyConfig = (input, i18n) => {
export const applyConfig = (input) => {
const config = extractStyleConfig(input)
if (config === defaultStyleConfig) {
@ -228,7 +228,7 @@ export const applyConfig = (input, i18n) => {
const rules = Object
.entries(config)
.filter(([k, v]) => v)
.filter(([, v]) => v)
.map(([k, v]) => `--${k}: ${v}`).join(';')
document.getElementById('style-config')?.remove()
@ -283,7 +283,7 @@ export const getResourcesIndex = async (url, parser = JSON.parse) => {
const builtinData = await window.fetch(url, { cache })
const builtinResources = await builtinData.json()
builtin = resourceTransform(builtinResources)
} catch (e) {
} catch {
builtin = []
console.warn(`Builtin resources at ${url} unavailable`)
}
@ -292,7 +292,7 @@ export const getResourcesIndex = async (url, parser = JSON.parse) => {
const customData = await window.fetch(customUrl, { cache })
const customResources = await customData.json()
custom = resourceTransform(customResources)
} catch (e) {
} catch {
custom = []
console.warn(`Custom resources at ${customUrl} unavailable`)
}

View file

@ -138,7 +138,7 @@ export function unregisterPushNotifications (token) {
.then((registration) => {
return unsubscribePush(registration).then((result) => [registration, result])
})
.then(([registration, unsubResult]) => {
.then(([, unsubResult]) => {
if (!unsubResult) {
console.warn('Push subscription cancellation wasn\'t successful')
}

View file

@ -45,7 +45,7 @@ export const deserializeShadow = string => {
} else {
return [mode, result[i]]
}
}).filter(([k, v]) => v !== false).slice(1))
}).filter(([, v]) => v !== false).slice(1))
return { x, y, blur, spread, color, alpha, inset, name }
}

View file

@ -1,7 +1,7 @@
import { unroll } from './iss_utils.js'
import { deserializeShadow } from './iss_deserializer.js'
export const serializeShadow = (s, throwOnInvalid) => {
export const serializeShadow = (s) => {
if (typeof s === 'object') {
const inset = s.inset ? 'inset ' : ''
const name = s.name ? ` #${s.name} ` : ''

View file

@ -100,7 +100,7 @@ export const genericRuleToSelector = components => (rule, ignoreOutOfTreeSelecto
let arraySelector = Array.isArray(selector) ? selector : [selector]
if (ignoreOutOfTreeSelector || liteMode) arraySelector = [arraySelector[0]]
arraySelector
.sort((a, b) => {
.sort((a) => {
if (a.startsWith(':')) return 1
if (/^[a-z]/.exec(a)) return -1
else return 0

View file

@ -131,7 +131,7 @@ export const shadowFunctions = {
'[alpha]: (Optional) border opacity, defaults to 1 (fully opaque)',
'[inset]: (Optional) whether border should be on the inside or outside, defaults to inside'
],
exec: (args, { findColor }) => {
exec: (args) => {
const [color, side, alpha = '1', widthArg = '1', inset = 'inset'] = args
const width = Number(widthArg)

View file

@ -218,7 +218,7 @@ export const getLayerSlot = (
*/
export const SLOT_ORDERED = topoSort(
Object.entries(SLOT_INHERITANCE)
.sort(([aK, aV], [bK, bV]) => ((aV && aV.priority) || 0) - ((bV && bV.priority) || 0))
.sort(([, aV], [, bV]) => ((aV && aV.priority) || 0) - ((bV && bV.priority) || 0))
.reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})
)
@ -226,7 +226,7 @@ export const SLOT_ORDERED = topoSort(
* All opacity slots used in color slots, their default values and affected
* color slots.
*/
export const OPACITIES = Object.entries(SLOT_INHERITANCE).reduce((acc, [k, v]) => {
export const OPACITIES = Object.entries(SLOT_INHERITANCE).reduce((acc, [k]) => {
const opacity = getOpacitySlot(k, SLOT_INHERITANCE, getDependencies)
if (opacity) {
return {
@ -489,7 +489,7 @@ export const generateColors = (themeData) => {
return {
rules: {
colors: Object.entries(htmlColors.complete)
.filter(([k, v]) => v)
.filter(([, v]) => v)
.map(([k, v]) => `--${k}: ${v}`)
.join(';')
},
@ -506,10 +506,10 @@ export const generateRadii = (input) => {
if (typeof input.btnRadius !== 'undefined') {
inputRadii = Object
.entries(input)
.filter(([k, v]) => k.endsWith('Radius'))
.filter(([k]) => k.endsWith('Radius'))
.reduce((acc, e) => { acc[e[0].split('Radius')[0]] = e[1]; return acc }, {})
}
const radii = Object.entries(inputRadii).filter(([k, v]) => v).reduce((acc, [k, v]) => {
const radii = Object.entries(inputRadii).filter(([, v]) => v).reduce((acc, [k, v]) => {
acc[k] = v
return acc
}, {
@ -526,7 +526,7 @@ export const generateRadii = (input) => {
return {
rules: {
radii: Object.entries(radii).filter(([k, v]) => v).map(([k, v]) => `--${k}Radius: ${v}px`).join(';')
radii: Object.entries(radii).filter(([, v]) => v).map(([k, v]) => `--${k}Radius: ${v}px`).join(';')
},
theme: {
radii
@ -535,8 +535,8 @@ export const generateRadii = (input) => {
}
export const generateFonts = (input) => {
const fonts = Object.entries(input.fonts || {}).filter(([k, v]) => v).reduce((acc, [k, v]) => {
acc[k] = Object.entries(v).filter(([k, v]) => v).reduce((acc, [k, v]) => {
const fonts = Object.entries(input.fonts || {}).filter(([, v]) => v).reduce((acc, [k, v]) => {
acc[k] = Object.entries(v).filter(([, v]) => v).reduce((acc, [k, v]) => {
acc[k] = v
return acc
}, acc[k])
@ -560,7 +560,7 @@ export const generateFonts = (input) => {
rules: {
fonts: Object
.entries(fonts)
.filter(([k, v]) => v)
.filter(([, v]) => v)
.map(([k, v]) => `--${k}Font: ${v.family}`).join(';')
},
theme: {

View file

@ -117,7 +117,7 @@ export const findColor = (color, { dynamicVars, staticVars }) => {
Static:
${JSON.stringify(staticVars, null, 2)}
Dynamic:
${JSON.stringify(dynamicVars, null, 2)}`)
${JSON.stringify(dynamicVars, null, 2)}`, e)
}
}
@ -417,7 +417,7 @@ export const init = ({
dynamicVars.stacked = stacked[selector]
dynamicVars.background = computed[selector].background
const dynamicSlots = Object.entries(computedDirectives).filter(([k, v]) => k.startsWith('--'))
const dynamicSlots = Object.entries(computedDirectives).filter(([k]) => k.startsWith('--'))
dynamicSlots.forEach(([k, v]) => {
const [type, value] = v.split('|').map(x => x.trim()) // woah, Extreme!