diff --git a/biome.json b/biome.json index 420656037..9b4ee2663 100644 --- a/biome.json +++ b/biome.json @@ -6,7 +6,7 @@ "useIgnoreFile": true }, "files": { - "includes": ["**", "!!**/dist"] + "includes": ["**", "!!**/dist", "!!tools/emojis.json"] }, "formatter": { "enabled": true, @@ -91,8 +91,35 @@ }, "overrides": [ { - "includes": ["**/*.spec.js"], - "javascript": { "globals": ["describe", "it", "expect"] } + "includes": ["**/*.spec.js", "test/fixtures/*.js"], + "javascript": { + "globals": [ + "vi", + "describe", + "it", + "test", + "expect", + "before", + "beforeEach", + "after", + "afterEach" + ] + } + }, + { + "includes": ["**/*.vue"], + "linter": { + "rules": { + "style": { + "useConst": "off", + "useImportType": "off" + }, + "correctness": { + "noUnusedVariables": "off", + "noUnusedImports": "off" + } + } + } } ], "assist": { diff --git a/build/emojis_plugin.js b/build/emojis_plugin.js index 4b3a2d33f..43a665e50 100644 --- a/build/emojis_plugin.js +++ b/build/emojis_plugin.js @@ -1,6 +1,6 @@ import { access } from 'node:fs/promises' import { resolve } from 'node:path' -import { langCodeToCldrName, languages } from '../src/i18n/languages.js' +import { languages } from '../src/i18n/languages.js' const annotationsImportPrefix = '@kazvmoe-infra/unicode-emoji-json/annotations/' const specialAnnotationsLocale = { @@ -24,6 +24,7 @@ const getAllAccessibleAnnotations = async (projectRoot) => { await access(importFile) return `'${lang}': () => import('${importModule}')` } catch (e) { + console.error(e) return } }), diff --git a/build/sw_plugin.js b/build/sw_plugin.js index f9d17b376..88520ba31 100644 --- a/build/sw_plugin.js +++ b/build/sw_plugin.js @@ -30,7 +30,9 @@ export const devSwPlugin = ({ swSrc, swDest, transformSW, alias }) => { return { name: 'dev-sw-plugin', apply: 'serve', - configResolved(conf) {}, + configResolved() { + /* no-op */ + }, resolveId(id) { const name = id.startsWith('/') ? id.slice(1) : id if (name === swDest) { diff --git a/src/components/contrast_ratio/contrast_ratio.vue b/src/components/contrast_ratio/contrast_ratio.vue index 94cc9fb7c..6294e6dd1 100644 --- a/src/components/contrast_ratio/contrast_ratio.vue +++ b/src/components/contrast_ratio/contrast_ratio.vue @@ -82,7 +82,9 @@ export default { contrast: { required: false, type: Object, - default: () => ({}), + default: () => ({ + /* no-op */ + }), }, showRatio: { required: false, diff --git a/src/components/dialog_modal/dialog_modal.js b/src/components/dialog_modal/dialog_modal.js index fa7b6b364..8070d3429 100644 --- a/src/components/dialog_modal/dialog_modal.js +++ b/src/components/dialog_modal/dialog_modal.js @@ -5,7 +5,9 @@ const DialogModal = { type: Boolean, }, onCancel: { - default: () => {}, + default: () => { + /* no-op */ + }, type: Function, }, }, diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index 4a81978e7..77bfa0ff5 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -45,7 +45,6 @@ library.add( ) const NavPanel = { props: ['forceExpand', 'forceEditMode'], - created() {}, components: { BookmarkFoldersMenuContent, ListsMenuContent, diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx index 1815ba43e..1a64b813f 100644 --- a/src/components/rich_content/rich_content.jsx +++ b/src/components/rich_content/rich_content.jsx @@ -1,7 +1,8 @@ -import { flattenDeep, unescape } from 'lodash' +import { flattenDeep, unescape as ldUnescape } from 'lodash' import HashtagLink from 'src/components/hashtag_link/hashtag_link.vue' import { MENTIONS_LIMIT } from 'src/components/mentions_line/mentions_line.js' import MentionsLine from 'src/components/mentions_line/mentions_line.vue' +import StillImage from 'src/components/still-image/still-image.vue' import StillImageEmojiPopover from 'src/components/still-image/still-image-emoji-popover.vue' import { convertHtmlToLines } from 'src/services/html_converter/html_line_converter.service.js' import { convertHtmlToTree } from 'src/services/html_converter/html_tree_converter.service.js' @@ -268,7 +269,7 @@ export default { const emptyText = item.trim() === '' if (emptyText) return item if (!encounteredTextReverse) encounteredTextReverse = true - return unescape(item) + return ldUnescape(item) } else if (Array.isArray(item)) { // Handle tag nodes const [opener, children] = item diff --git a/src/components/settings_modal/tabs/mutes_and_blocks_tab.js b/src/components/settings_modal/tabs/mutes_and_blocks_tab.js index 60f8a9124..10af49633 100644 --- a/src/components/settings_modal/tabs/mutes_and_blocks_tab.js +++ b/src/components/settings_modal/tabs/mutes_and_blocks_tab.js @@ -17,14 +17,18 @@ const BlockList = withLoadMore({ fetch: (props, $store) => $store.dispatch('fetchBlocks'), select: (props, $store) => get($store.state.users.currentUser, 'blockIds', []), - destroy: () => {}, + destroy: () => { + /* no-op */ + }, childPropName: 'items', })(SelectableList) const MuteList = withLoadMore({ fetch: (props, $store) => $store.dispatch('fetchMutes'), select: (props, $store) => get($store.state.users.currentUser, 'muteIds', []), - destroy: () => {}, + destroy: () => { + /* no-op */ + }, childPropName: 'items', })(SelectableList) diff --git a/src/components/settings_modal/tabs/security_tab/confirm.js b/src/components/settings_modal/tabs/security_tab/confirm.js index 050530240..a8d0fc53a 100644 --- a/src/components/settings_modal/tabs/security_tab/confirm.js +++ b/src/components/settings_modal/tabs/security_tab/confirm.js @@ -1,6 +1,8 @@ const Confirm = { props: ['disabled'], - data: () => ({}), + data: () => ({ + /* no-op */ + }), methods: { confirm() { this.$emit('confirm') diff --git a/src/components/settings_modal/tabs/security_tab/mfa_backup_codes.js b/src/components/settings_modal/tabs/security_tab/mfa_backup_codes.js index cdd9d8d06..ad47bfdb7 100644 --- a/src/components/settings_modal/tabs/security_tab/mfa_backup_codes.js +++ b/src/components/settings_modal/tabs/security_tab/mfa_backup_codes.js @@ -8,7 +8,9 @@ export default { }), }, }, - data: () => ({}), + data: () => ({ + /* no-op */ + }), computed: { inProgress() { return this.backupCodes.inProgress diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.js b/src/components/settings_modal/tabs/style_tab/style_tab.js index 6a9bde8a9..4620c0fbb 100644 --- a/src/components/settings_modal/tabs/style_tab/style_tab.js +++ b/src/components/settings_modal/tabs/style_tab/style_tab.js @@ -56,8 +56,7 @@ import Preview from '../old_theme_tab/theme_preview.vue' import VirtualDirectivesTab from './virtual_directives_tab.vue' // helper for debugging -// eslint-disable-next-line no-unused-vars -const toValue = (x) => JSON.parse(JSON.stringify(x === undefined ? 'null' : x)) +// const toValue = (x) => JSON.parse(JSON.stringify(x === undefined ? 'null' : x)) // helper to make states comparable const normalizeStates = (states) => diff --git a/src/components/settings_modal/tabs/style_tab/virtual_directives_tab.js b/src/components/settings_modal/tabs/style_tab/virtual_directives_tab.js index 5e2dddf0c..ff1fcba1c 100644 --- a/src/components/settings_modal/tabs/style_tab/virtual_directives_tab.js +++ b/src/components/settings_modal/tabs/style_tab/virtual_directives_tab.js @@ -7,8 +7,7 @@ import { serializeShadow } from 'src/services/theme_data/iss_serializer.js' import { computed, inject, ref, watch } from 'vue' // helper for debugging -// eslint-disable-next-line no-unused-vars -const toValue = (x) => JSON.parse(JSON.stringify(x === undefined ? 'null' : x)) +// const toValue = (x) => JSON.parse(JSON.stringify(x === undefined ? 'null' : x)) export default { components: { diff --git a/src/components/status/status.js b/src/components/status/status.js index b176b5a7a..206d25aae 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -20,7 +20,7 @@ import { faThumbtack, faTimes, } from '@fortawesome/free-solid-svg-icons' -import { unescape, uniqBy } from 'lodash' +import { unescape as ldUnescape, uniqBy } from 'lodash' import MentionLink from 'src/components/mention_link/mention_link.vue' import MentionsLine from 'src/components/mentions_line/mentions_line.vue' import RichContent from 'src/components/rich_content/rich_content.jsx' @@ -425,7 +425,7 @@ const Status = { }, replySubject() { if (!this.status.summary) return '' - const decodedSummary = unescape(this.status.summary) + const decodedSummary = ldUnescape(this.status.summary) const behavior = this.mergedConfig.subjectLineBehavior const startsWithRe = decodedSummary.match(/^re[: ]/i) if ((behavior !== 'noop' && startsWithRe) || behavior === 'masto') { diff --git a/src/components/status_action_buttons/action_button.js b/src/components/status_action_buttons/action_button.js index e35e8a89c..057e6d200 100644 --- a/src/components/status_action_buttons/action_button.js +++ b/src/components/status_action_buttons/action_button.js @@ -123,7 +123,12 @@ export default { this.$store.dispatch('reactWithEmoji', { id: this.status.id, emoji }) } }, - doActionWrap(button, close = () => {}) { + doActionWrap( + button, + close = () => { + /* no-op */ + }, + ) { if ( this.button.interactive ? !this.button.interactive(this.funcArg) : false ) diff --git a/src/components/status_action_buttons/status_action_buttons.js b/src/components/status_action_buttons/status_action_buttons.js index c79b50275..87324cd1f 100644 --- a/src/components/status_action_buttons/status_action_buttons.js +++ b/src/components/status_action_buttons/status_action_buttons.js @@ -20,7 +20,9 @@ const StatusActionButtons = { currentConfirmTitle: '', currentConfirmOkText: '', currentConfirmCancelText: '', - currentConfirmAction: () => {}, + currentConfirmAction: () => { + /* no-op */ + }, randomSeed: genRandomSeed(), } }, diff --git a/src/components/status_action_buttons/status_action_buttons.vue b/src/components/status_action_buttons/status_action_buttons.vue index 40884425c..c1d0d9571 100644 --- a/src/components/status_action_buttons/status_action_buttons.vue +++ b/src/components/status_action_buttons/status_action_buttons.vue @@ -15,7 +15,7 @@ :func-arg="funcArg" :get-class="getClass" :get-component="getComponent" - :close="() => {}" + :close="() => { /* no-op */ }" :do-action="doAction" @interacted="e => $emit('interacted')" /> diff --git a/src/components/thread_tree/thread_tree.js b/src/components/thread_tree/thread_tree.js index cd115f677..6a7eec7d6 100644 --- a/src/components/thread_tree/thread_tree.js +++ b/src/components/thread_tree/thread_tree.js @@ -54,10 +54,15 @@ const ThreadTree = { return selfSuspendable }, reverseLookupTable() { - return this.conversation.reduce((table, status, index) => { - table[status.id] = index - return table - }, {}) + return this.conversation.reduce( + (table, status, index) => { + table[status.id] = index + return table + }, + { + /* no-op */ + }, + ) }, currentReplies() { return this.getReplies(this.status.id).map(({ id }) => @@ -75,9 +80,15 @@ const ThreadTree = { statusById(id) { return this.conversation[this.reverseLookupTable[id]] }, - collapseThread() {}, - showThread() {}, - showAllSubthreads() {}, + collapseThread() { + /* no-op */ + }, + showThread() { + /* no-op */ + }, + showAllSubthreads() { + /* no-op */ + }, toggleCurrentProp(name) { this.toggleStatusContentProperty(this.status.id, name) }, diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index d0642b5e8..6236e09de 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -13,7 +13,7 @@ import { } from '@fortawesome/free-solid-svg-icons' import isEqual from 'lodash/isEqual' import merge from 'lodash/merge' -import unescape from 'lodash/unescape' +import ldUnescape from 'lodash/unescape' import Checkbox from 'src/components/checkbox/checkbox.vue' import ColorInput from 'src/components/color_input/color_input.vue' import DialogModal from 'src/components/dialog_modal/dialog_modal.vue' @@ -128,7 +128,7 @@ export default { newName: user.name_unescaped, editingName: false, - newBio: unescape(user.description), + newBio: ldUnescape(user.description), editingBio: false, newAvatar: null, diff --git a/src/i18n/en.json b/src/i18n/en.json index 3b098ddab..d1e591225 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -688,7 +688,6 @@ "name_bio": "Name & bio", "new_email": "New email", "new_password": "New password", - "posts": "Posts", "user_profiles": "User Profiles", "notification_visibility": "Types of notifications to show", "notification_visibility_in_column": "Show in notifications column/drawer", @@ -777,7 +776,6 @@ "column_sizes_sidebar": "Sidebar", "column_sizes_content": "Content", "column_sizes_notifs": "Notifications", - "layout": "Layout", "scale_and_font": "Scale and Font", "theme_editor_min_width": "Minimum width of theme editor (0 for \"fit-content\")", "tree_advanced": "Allow more flexible navigation in tree view", @@ -1188,9 +1186,6 @@ "restrictions": "Restrictions", "activitypub": "ActivityPub" }, - "http": { - "outbound": "Outbound HTTP requests" - }, "auth": { "MFA": "Multi-factor Authentication", "LDAP": "LDAP Settings", @@ -1245,24 +1240,6 @@ "web_push": "Web Push", "web_push_description": "Web Push VAPID settings. You can use the mix task web_push.gen.keypair to generate it." }, - "instance": { - "instance": "Instance information", - "branding": "Branding", - "registrations": "User sign-ups", - "captcha_header": "CAPTCHA", - "kocaptcha": "KoCaptcha settings", - "access": "Instance access", - "rich_metadata": "Metadata", - "restrict": { - "header": "Restrict access for anonymous visitors", - "description": "Detailed setting for allowing/disallowing access to certain aspects of API. By default (indeterminate state) it will disallow if instance is not public, ticked checkbox means disallow access even if instance is public, unticked means allow access even if instance is private. Please note that unexpected behavior might happen if some settings are set, i.e. if profile access is disabled posts will show without profile information.", - "timelines": "Timelines access", - "profiles": "User profiles access", - "activities": "Statuses/activities access" - }, - ":unauthenticated": "Unauthenticated", - ":all": "Everyone" - }, "registrations": { "welcome": { "title": "Welcome message", @@ -1394,6 +1371,9 @@ }, "instance": { "instance": "Instance information", + "registrations": "User sign-ups", + "captcha_header": "CAPTCHA", + "kocaptcha": "KoCaptcha settings", "pwa": { "manifest": "PWA Manifest", "optional": "(optional)", @@ -1530,7 +1510,7 @@ "weeks_suffix": "week(s)", "years": "{0} year | {0} years", "years_short": "{0}y", - "years": "year(s)" + "years_suffix": "year(s)" }, "in_future": "in {0}", "in_past": "{0} ago", @@ -1779,7 +1759,6 @@ "repeat": "Repeat", "unrepeat": "Unrepeat", "reply": "Reply", - "add_reaction": "Add reaction", "favorite": "Favorite", "unfavorite": "Unfavorite", "add_reaction": "Add Reaction", diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js index f842eb94a..fe6cc3554 100644 --- a/src/lib/persisted_state.js +++ b/src/lib/persisted_state.js @@ -166,8 +166,12 @@ export const piniaPersistPlugin = afterLoad, paths = [], saveImmediatelyActions, - onSaveSuccess = () => {}, - onSaveError = () => {}, + onSaveSuccess = () => { + /* no-op */ + }, + onSaveError = () => { + /* no-op */ + }, } = options.persist || {} const loadedGuard = { loaded: false } diff --git a/src/main.js b/src/main.js index 6578ef68f..d75fb0740 100644 --- a/src/main.js +++ b/src/main.js @@ -104,7 +104,8 @@ const persistedStateOptions = { })() // These are inlined by webpack's DefinePlugin -/* eslint-disable */ +// biome-ignore-start lint: added in build process window.___pleromafe_mode = process.env window.___pleromafe_commit_hash = COMMIT_HASH window.___pleromafe_dev_overrides = DEV_OVERRIDES +// biome-ignore-end lint: added in build process diff --git a/src/modules/drafts.js b/src/modules/drafts.js index e6ef17305..d16f49e95 100644 --- a/src/modules/drafts.js +++ b/src/modules/drafts.js @@ -30,7 +30,11 @@ const storageKey = 'pleroma-fe-drafts' * different keys, which will just pollute the whole storage. * It is indeed best to have backend support for this. */ -const getStorageData = async () => (await storage.getItem(storageKey)) || {} +const getStorageData = async () => + (await storage.getItem(storageKey)) || + { + /* no-op */ + } const saveDraftToStorage = async (draft) => { const currentData = await getStorageData() diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 477b3ceed..63f06017e 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -550,7 +550,7 @@ const fetchFriends = ({ id, maxId, sinceId, limit = 20, credentials }) => { } const exportFriends = ({ id, credentials }) => { - // eslint-disable-next-line no-async-promise-executor + // biome-ignore lint/suspicious/noAsyncPromiseExecutor: TODO refactor this return new Promise(async (resolve, reject) => { try { let friends = [] @@ -1794,7 +1794,14 @@ export const ProcessedWS = ({ return eventTarget } -export const handleMastoWS = (wsEvent, { onAuthenticated = () => {} } = {}) => { +export const handleMastoWS = ( + wsEvent, + { + onAuthenticated = () => { + /* no-op */ + }, + } = {}, +) => { const { data } = wsEvent if (!data) return const parsedEvent = JSON.parse(data) diff --git a/src/services/bookmark_folders_fetcher/bookmark_folders_fetcher.service.js b/src/services/bookmark_folders_fetcher/bookmark_folders_fetcher.service.js index 3e96ce998..50afb4564 100644 --- a/src/services/bookmark_folders_fetcher/bookmark_folders_fetcher.service.js +++ b/src/services/bookmark_folders_fetcher/bookmark_folders_fetcher.service.js @@ -9,9 +9,13 @@ const fetchAndUpdate = ({ credentials }) => { (bookmarkFolders) => { useBookmarkFoldersStore().setBookmarkFolders(bookmarkFolders) }, - () => {}, + (rej) => { + console.error(rej) + }, ) - .catch(() => {}) + .catch((e) => { + console.error(e) + }) } const startFetching = ({ credentials, store }) => { diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index 51c4ff564..c3ca88481 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -1,5 +1,5 @@ import { parseLinkHeader } from '@web3-storage/parse-link-header' -import escape from 'escape-html' +import escapeHtml from 'escape-html' import punycode from 'punycode.js' import { isStatusNotification } from '../notification_utils/notification_utils.js' @@ -69,7 +69,7 @@ export const parseUser = (data) => { } output.emoji = data.emojis - output.name = escape(data.display_name) + output.name = escapeHtml(data.display_name) output.name_html = output.name output.name_unescaped = data.display_name @@ -80,7 +80,7 @@ export const parseUser = (data) => { output.fields = data.fields output.fields_html = data.fields.map((field) => { return { - name: escape(field.name), + name: escapeHtml(field.name), value: field.value, } }) @@ -367,13 +367,13 @@ export const parseStatus = (data) => { output.retweeted_status = parseStatus(data.reblog) } - output.summary_raw_html = escape(data.spoiler_text) + output.summary_raw_html = escapeHtml(data.spoiler_text) output.external_url = data.url output.poll = data.poll if (output.poll) { output.poll.options = (output.poll.options || []).map((field) => ({ ...field, - title_html: escape(field.title), + title_html: escapeHtml(field.title), })) } output.pinned = data.pinned diff --git a/src/services/follow_request_fetcher/follow_request_fetcher.service.js b/src/services/follow_request_fetcher/follow_request_fetcher.service.js index 6cdc5fd3b..530c98aa7 100644 --- a/src/services/follow_request_fetcher/follow_request_fetcher.service.js +++ b/src/services/follow_request_fetcher/follow_request_fetcher.service.js @@ -9,9 +9,13 @@ const fetchAndUpdate = ({ store, credentials }) => { store.commit('setFollowRequests', requests) store.commit('addNewUsers', requests) }, - () => {}, + (rej) => { + console.error(rej) + }, ) - .catch(() => {}) + .catch((e) => { + console.error(e) + }) } const startFetching = ({ credentials, store }) => { diff --git a/src/services/gesture_service/gesture_service.js b/src/services/gesture_service/gesture_service.js index f3b81dce6..ff11775d5 100644 --- a/src/services/gesture_service/gesture_service.js +++ b/src/services/gesture_service/gesture_service.js @@ -93,12 +93,14 @@ class SwipeAndClickGesture { perpendicularTolerance = 1.0, disableClickThreshold = 1, }) { - const nop = () => {} + const noop = () => { + /* no-op */ + } this.direction = direction - this.swipePreviewCallback = swipePreviewCallback || nop - this.swipeEndCallback = swipeEndCallback || nop - this.swipeCancelCallback = swipeCancelCallback || nop - this.swipelessClickCallback = swipelessClickCallback || nop + this.swipePreviewCallback = swipePreviewCallback || noop + this.swipeEndCallback = swipeEndCallback || noop + this.swipeCancelCallback = swipeCancelCallback || noop + this.swipelessClickCallback = swipelessClickCallback || noop this.threshold = typeof threshold === 'function' ? threshold : () => threshold this.disableClickThreshold = diff --git a/src/services/html_converter/html_tree_converter.service.js b/src/services/html_converter/html_tree_converter.service.js index 46854a30b..4c5a380a1 100644 --- a/src/services/html_converter/html_tree_converter.service.js +++ b/src/services/html_converter/html_tree_converter.service.js @@ -1,4 +1,4 @@ -import { unescape } from 'lodash' +import { unescape as ldUnescape } from 'lodash' import { getTagName } from './utility.service.js' /** @@ -64,7 +64,7 @@ export const convertHtmlToTree = (html = '') => { const handleOpen = (tag) => { const curBuf = getCurrentBuffer() - const newLevel = [unescape(tag), []] + const newLevel = [ldUnescape(tag), []] levels.push(newLevel) curBuf.push(newLevel) } diff --git a/src/services/lists_fetcher/lists_fetcher.service.js b/src/services/lists_fetcher/lists_fetcher.service.js index 0f6ca0c70..6744fb696 100644 --- a/src/services/lists_fetcher/lists_fetcher.service.js +++ b/src/services/lists_fetcher/lists_fetcher.service.js @@ -9,9 +9,13 @@ const fetchAndUpdate = ({ credentials }) => { (lists) => { useListsStore().setLists(lists) }, - () => {}, + (rej) => { + console.error(rej) + }, ) - .catch(() => {}) + .catch((e) => { + console.error(e) + }) } const startFetching = ({ credentials, store }) => { diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js index 01c2f3466..60bf88e75 100644 --- a/src/services/style_setter/style_setter.js +++ b/src/services/style_setter/style_setter.js @@ -77,9 +77,15 @@ const LAZY_STYLE_ID = 'pleroma-lazy-styles' export const generateTheme = (inputRuleset, callbacks, debug) => { const { - onNewRule = () => {}, - onLazyFinished = () => {}, - onEagerFinished = () => {}, + onNewRule = () => { + /* no-op */ + }, + onLazyFinished = () => { + /* no-op */ + }, + onEagerFinished = () => { + /* no-op */ + }, } = callbacks const themes3 = init({ @@ -152,8 +158,12 @@ export const tryLoadCache = async () => { export const applyTheme = ( input, - onEagerFinish = () => {}, - onFinish = () => {}, + onEagerFinish = () => { + /* no-op */ + }, + onFinish = () => { + /* no-op */ + }, debug, ) => { const eagerStyles = createStyleSheet(EAGER_STYLE_ID, 10) diff --git a/src/stores/interface.js b/src/stores/interface.js index b63044ac0..d39a6d742 100644 --- a/src/stores/interface.js +++ b/src/stores/interface.js @@ -27,8 +27,12 @@ export const useInterfaceStore = defineStore('interface', { themeDataUsed: null, temporaryChangesTimeoutId: null, temporaryChangesCountdown: -1, // used for temporary options that revert after a timeout - temporaryChangesConfirm: () => {}, // used for applying temporary options - temporaryChangesRevert: () => {}, // used for reverting temporary options + temporaryChangesConfirm: () => { + /* no-op */ + }, // used for applying temporary options + temporaryChangesRevert: () => { + /* no-op */ + }, // used for reverting temporary options settingsModalState: 'hidden', settingsModalLoadedUser: false, settingsModalLoadedAdmin: false, @@ -73,8 +77,12 @@ export const useInterfaceStore = defineStore('interface', { clearTimeout(this.temporaryChangesTimeoutId) this.temporaryChangesTimeoutId = null this.temporaryChangesCountdown = -1 - this.temporaryChangesConfirm = () => {} - this.temporaryChangesRevert = () => {} + this.temporaryChangesConfirm = () => { + /* no-op */ + } + this.temporaryChangesRevert = () => { + /* no-op */ + } }, setPageTitle(option = '') { try { diff --git a/test/fixtures/mock_api.js b/test/fixtures/mock_api.js index bae65c8bd..b2cd16982 100644 --- a/test/fixtures/mock_api.js +++ b/test/fixtures/mock_api.js @@ -8,7 +8,7 @@ export const injectMswToTest = (defaultHandlers) => { return testBase.extend({ worker: [ - async ({}, use) => { + async (_, use) => { await worker.start() await use(worker) diff --git a/test/fixtures/setup_test.js b/test/fixtures/setup_test.js index 37a18b847..6ebc08658 100644 --- a/test/fixtures/setup_test.js +++ b/test/fixtures/setup_test.js @@ -12,7 +12,11 @@ const applyAfterStore = (store, afterStore) => { return store } -const getDefaultOpts = ({ afterStore = () => {} } = {}) => ({ +const getDefaultOpts = ({ + afterStore = () => { + /* no-op */ + }, +} = {}) => ({ global: { plugins: [ applyAfterStore(makeMockStore(), afterStore), diff --git a/test/unit/specs/components/emoji_input.spec.js b/test/unit/specs/components/emoji_input.spec.js index 7919b6c51..11c0c22d6 100644 --- a/test/unit/specs/components/emoji_input.spec.js +++ b/test/unit/specs/components/emoji_input.spec.js @@ -22,7 +22,9 @@ const generateInput = (value, padEmoji = true) => { Popover: { template: `
`, methods: { - updateStyles() {}, + updateStyles() { + /* no-op */ + }, }, }, }, diff --git a/test/unit/specs/components/user_profile.spec.js b/test/unit/specs/components/user_profile.spec.js index b55f526cb..41ca04f3d 100644 --- a/test/unit/specs/components/user_profile.spec.js +++ b/test/unit/specs/components/user_profile.spec.js @@ -5,12 +5,18 @@ import backendInteractorService from 'src/services/backend_interactor_service/ba import { createStore } from 'vuex' const mutations = { - clearTimeline: () => {}, + clearTimeline: () => { + /* no-op */ + }, } const actions = { - fetchUser: () => {}, - fetchUserByScreenName: () => {}, + fetchUser: () => { + /* no-op */ + }, + fetchUserByScreenName: () => { + /* no-op */ + }, } const testGetters = { diff --git a/test/unit/specs/lib/persisted_state.spec.js b/test/unit/specs/lib/persisted_state.spec.js index cfa62fe09..d8635931a 100644 --- a/test/unit/specs/lib/persisted_state.spec.js +++ b/test/unit/specs/lib/persisted_state.spec.js @@ -34,7 +34,7 @@ beforeEach(() => { describe('piniaPersistPlugin', () => { describe('initial state', () => { - test('it does not load anything if it is not enabled', async () => { + it('does not load anything if it is not enabled', async () => { await mockStorage.setItem('pinia-local-test', { a: 3 }) const useTestStore = defineStore('test', { @@ -62,7 +62,7 @@ describe('piniaPersistPlugin', () => { await expect(test.$persistLoaded).rejects.toThrowError(error) }) - test('it loads from pinia storage', async () => { + it('loads from pinia storage', async () => { await mockStorage.setItem('pinia-local-test', { a: 3, c: { d: 0 } }) await mockStorage.setItem('vuex-lz', { test: { a: 4 } }) @@ -79,7 +79,7 @@ describe('piniaPersistPlugin', () => { expect(test.c.e).to.eql(5) }) - test('it loads from vuex storage as fallback', async () => { + it('loads from vuex storage as fallback', async () => { await mockStorage.setItem('vuex-lz', { test: { a: 4, c: { d: 0 } } }) const useTestStore = defineStore('test', { @@ -95,7 +95,7 @@ describe('piniaPersistPlugin', () => { expect(test.c.e).to.eql(5) }) - test('it loads from vuex storage and writes it into pinia storage', async () => { + it('loads from vuex storage and writes it into pinia storage', async () => { await mockStorage.setItem('vuex-lz', { test: { a: 4, c: { d: 0 } } }) const useTestStore = defineStore('test', { @@ -122,7 +122,7 @@ describe('piniaPersistPlugin', () => { expect(test.c.e).to.eql(5) }) - test('it does not modify state if there is nothing to load', async () => { + it('does not modify state if there is nothing to load', async () => { await mockStorage.setItem('vuex-lz', { test2: { a: 4 } }) const useTestStore = defineStore('test', { @@ -138,7 +138,7 @@ describe('piniaPersistPlugin', () => { }) describe('paths', () => { - test('it saves everything if paths is unspecified', async () => { + it('saves everything if paths is unspecified', async () => { const useTestStore = defineStore('test', { state: () => ({ a: 1, b: 2 }), persist: {}, @@ -154,7 +154,7 @@ describe('piniaPersistPlugin', () => { }) }) - test('it saves only specified paths', async () => { + it('saves only specified paths', async () => { const useTestStore = defineStore('test', { state: () => ({ a: 1, b: 2, c: { d: 4, e: 5 } }), persist: { @@ -173,7 +173,7 @@ describe('piniaPersistPlugin', () => { }) }) - test('it only saves after load', async () => { + it('only saves after load', async () => { const onSaveError = vi.fn() const onSaveSuccess = vi.fn() const useTestStore = defineStore('test', { @@ -199,7 +199,7 @@ describe('piniaPersistPlugin', () => { }) describe('saveImmediatelyActions', () => { - test('it should only persist state after specified actions', async () => { + it('should only persist state after specified actions', async () => { const useTestStore = defineStore('test', { state: () => ({ a: 1, b: 2 }), actions: { @@ -285,7 +285,7 @@ describe('piniaPersistPlugin', () => { }) describe('afterLoad', () => { - test('it is called with the saved state object', async () => { + it('is called with the saved state object', async () => { await mockStorage.setItem('pinia-local-test', { a: 2 }) const afterLoad = vi.fn(async (orig) => { return { a: orig.a + 1 } @@ -304,7 +304,7 @@ describe('piniaPersistPlugin', () => { expect(test.a).to.eql(3) }) - test('it is called with empty object if there is no saved state', async () => { + it('is called with empty object if there is no saved state', async () => { const afterLoad = vi.fn(async () => { return { a: 3 } })