style: remove unnecessary function whitespace

Remove the unnecessary whitespace between the function name or the
'function' keyword and the opening parenthesis.
This commit is contained in:
2026-08-08 15:23:29 +02:00
parent 9d252d5e62
commit 2520fff771
31 changed files with 55 additions and 55 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ const route = useRoute();
const { getSetting } = useSettings();
const colorScheme = computed(() => getSetting(['appearance', 'colorScheme']));
const updateColorScheme = function updateColorScheme (newColorScheme) {
const updateColorScheme = function updateColorScheme(newColorScheme) {
document.body.style.setProperty(colorScheme, {
auto: 'normal',
dark: 'dark',
+1 -1
View File
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
export const getAssetsUrl = function getAssetsUrl () {
export const getAssetsUrl = function getAssetsUrl() {
return new URL(
`${import.meta.env.VITE_ASSETS_BUILD_ID}/`,
import.meta.env.VITE_ASSETS_BASE_URL
@@ -38,11 +38,11 @@ const colorSchemeIconMapper = {
'auto': 'circle-black-white'
};
const getTooltipTranslation = function (colorScheme) {
const getTooltipTranslation = function(colorScheme) {
return t(`preferences.colorScheme.switch.${colorSchemeNextMapper[colorScheme]}`);
};
const setColorScheme = function setColorScheme (newColorScheme) {
const setColorScheme = function setColorScheme(newColorScheme) {
setSetting(['appearance', 'colorScheme'], newColorScheme);
};
</script>
@@ -23,7 +23,7 @@ const { getSetting } = useSettings();
const colorSchemeSettingPath = ['appearance', 'colorScheme'];
const getWrapper = function getWrapper () {
const getWrapper = function getWrapper() {
return mountComponent(ColorSchemeButton);
};
@@ -29,19 +29,19 @@ const { setSetting, getSetting } = useSettings();
const isOpen = ref(false);
const languageDropdown = ref(null);
const selectLanguage = function selectLanguage (code) {
const selectLanguage = function selectLanguage(code) {
setSetting(LANGUAGE_PATH, code);
close();
};
watch(() => getSetting(LANGUAGE_PATH), setLocale);
const close = function () {
const close = function() {
document.removeEventListener('click', closeWrapperOnClickOutside);
isOpen.value = false;
};
const closeWrapperOnClickOutside = function (e) {
const closeWrapperOnClickOutside = function(e) {
if (languageDropdown.value) {
if (!languageDropdown.value.contains(e.target)) {
close();
@@ -49,7 +49,7 @@ const closeWrapperOnClickOutside = function (e) {
};
};
const open = function () {
const open = function() {
if (!isOpen.value) {
isOpen.value = true;
setTimeout(() => {
@@ -20,7 +20,7 @@ import { mountComponent } from '@/test-utils/mountComponent.js';
import { expect, test, describe } from 'vitest';
import LanguageSwitchButton from '../LanguageSwitchButton.vue';
const getWrapper = function getWrapper () {
const getWrapper = function getWrapper() {
return mountComponent(LanguageSwitchButton);
};
+1 -1
View File
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
export const getNavigatorLanguage = function getNavigatorLanguage () {
export const getNavigatorLanguage = function getNavigatorLanguage() {
const locale = new Intl.Locale(navigator.language);
return locale.language;
};
@@ -17,7 +17,7 @@ limitations under the License.
import { FetchError } from '../errors';
import { getAssetsUrl } from '@/config/env';
const fetchHtml = async function fetchHtml (url, options) {
const fetchHtml = async function fetchHtml(url, options) {
let response;
try {
response = await fetch(url, options);
@@ -29,7 +29,7 @@ const fetchHtml = async function fetchHtml (url, options) {
else throw new FetchError();
};
export const getLegalNotice = async function getLegalNotice () {
export const getLegalNotice = async function getLegalNotice() {
const legalNoticeUrl = new URL('legal/legal_notice.html', getAssetsUrl()).href;
const html = await fetchHtml(legalNoticeUrl);
+1 -1
View File
@@ -27,7 +27,7 @@ const { t } = useI18n();
const router = useRouter();
const props = defineProps(['autoSubmit']);
const submitSearch = function () {
const submitSearch = function() {
if (props.autoSubmit !== undefined) {
router.push({
name: 'searchResults',
@@ -22,7 +22,7 @@ import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const normalizeSelectedValue = function normalizeSelectedValue (value) {
const normalizeSelectedValue = function normalizeSelectedValue(value) {
if (props.setting.allowMultiple) {
if (Array.isArray(value)) {
return value;
@@ -65,7 +65,7 @@ watch(inputModel, () => {
doneButtonInitial.value = false;
});
const apply = function apply () {
const apply = function apply() {
store.set(props.path, inputModel.value);
};
</script>
@@ -33,7 +33,7 @@ const props = defineProps({
}
});
const followLink = function followLink () {
const followLink = function followLink() {
goToSettingsPage(props.target);
};
</script>
+1 -1
View File
@@ -42,7 +42,7 @@ watch(store, (newStore) => {
// set value after registering watcher to avoid immediate value change
enabled.value = store.get(props.path) ?? props.setting.default;
const toggle = function toggle () {
const toggle = function toggle() {
enabled.value = !enabled.value;
store.set(props.path, enabled.value);
};
@@ -20,7 +20,7 @@ import { useSettingsStore } from '../../stores/settingsStore.js';
import { expect, describe, test } from 'vitest';
import { nextTick } from 'vue';
const getWrapper = function getWrapper ({
const getWrapper = function getWrapper({
i18n = 'selection',
options = [],
allowMultiple = false,
@@ -43,7 +43,7 @@ const getWrapper = function getWrapper ({
}, translations, [], piniaOptions);
};
const getChecked = function getChecked (inputs) {
const getChecked = function getChecked(inputs) {
return inputs.map((input) => input.element.matches(':checked'));
};
@@ -199,20 +199,20 @@ describe('Selection', () => {
});
test('stores multiple values', async () => {
const setValue = async function setValue (input, value) {
const setValue = async function setValue(input, value) {
input.setValue(value);
await nextTick();
};
const check = function check (input) {
const check = function check(input) {
return setValue(input, true);
};
const uncheck = function uncheck (input) {
const uncheck = function uncheck(input) {
return setValue(input, false);
};
const expectSelectionValue = function expectSelectionValue (value, options = exampleOptions) {
const expectSelectionValue = function expectSelectionValue(value, options = exampleOptions) {
value.sort();
expect(store.get('selection').sort()).toStrictEqual(value);
const checkedInputs = getChecked(inputs);
@@ -20,7 +20,7 @@ import { useSettingsStore } from '../../stores/settingsStore.js';
import { expect, describe, test } from 'vitest';
import { nextTick } from 'vue';
const getWrapper = function getWrapper ({
const getWrapper = function getWrapper({
i18n = 'switch1',
defaultValue = undefined,
translations = {},
@@ -21,13 +21,13 @@ import { getSettingRecursively } from '../utils/getSetting';
/**
* Provides access to the stored settings.
*/
export const useSettings = function useSettings () {
export const useSettings = function useSettings() {
/**
* Returns the value of a specific setting.
* @param {string[]} key - The settings key.
* @return The value of the setting.
*/
const getSetting = function getSetting (key) {
const getSetting = function getSetting(key) {
const settingsStore = useSettingsStore();
return (
@@ -43,7 +43,7 @@ export const useSettings = function useSettings () {
* @param {string[]} key - The setting key.
* @param value - The new value for the setting.
*/
const setSetting = function setSetting (key, value) {
const setSetting = function setSetting(key, value) {
const settingsStore = useSettingsStore();
settingsStore.set(key.join('.'), value);
};
@@ -17,10 +17,10 @@ limitations under the License.
import { getSettingsPagePathSegments } from '../utils/settingsPage';
import { useRouter } from 'vue-router';
export const useSettingsPage = function useSettingsPage () {
export const useSettingsPage = function useSettingsPage() {
const router = useRouter();
const goToSettingsPage = function goToSettingsPage (pagePath) {
const goToSettingsPage = function goToSettingsPage(pagePath) {
return router.push({
name: 'settings',
params: {
@@ -20,19 +20,19 @@ import { reactive } from 'vue';
export const useSettingsStore = defineStore('settings', () => {
const settings = reactive({});
const set = function set (key, value) {
const set = function set(key, value) {
settings[key] = value;
};
const get = function get (key) {
const get = function get(key) {
return settings[key];
};
const remove = function remove (key) {
const remove = function remove(key) {
delete settings[key];
};
const clear = function clear () {
const clear = function clear() {
Object.keys(settings).forEach(key => delete settings[key]);
};
+3 -3
View File
@@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
export const getSetting = function getSetting (name, settings) {
export const getSetting = function getSetting(name, settings) {
return settings.filter((setting) => setting.name === name)[0];
};
export const getSettingRecursively = function getSettingRecursively (sectionPath, settings) {
const oneSettingsLevel = function oneSettingsLevel (cursor, acc) {
export const getSettingRecursively = function getSettingRecursively(sectionPath, settings) {
const oneSettingsLevel = function oneSettingsLevel(cursor, acc) {
const setting = getSetting(cursor[0], acc.content);
if (!setting) return;
+1 -1
View File
@@ -19,7 +19,7 @@ limitations under the License.
* @param {string} path - The settings page path.
* @returns {Array} The settings page path segments.
*/
export const getSettingsPagePathSegments = function getSettingsPagePathSegments (path) {
export const getSettingsPagePathSegments = function getSettingsPagePathSegments(path) {
if (typeof path !== 'string') return [];
return path
.replace(/^\.+|\.+$/g, '')
@@ -16,13 +16,13 @@ limitations under the License.
const VALID_TYPES = ['bool', 'number', 'string', 'selection', 'section'];
export const assertString = function assertString (value, path) {
export const assertString = function assertString(value, path) {
if (typeof value !== 'string' || value.trim() === '') {
throw new Error(`[settings] "${path}" must be a non-empty string`);
}
};
export const assertType = function assertType (value, path) {
export const assertType = function assertType(value, path) {
if (!VALID_TYPES.includes(value)) {
throw new Error(
`[settings] "${path}" has invalid type "${value}". Must be one of: ${VALID_TYPES.join(', ')}`
@@ -30,7 +30,7 @@ export const assertType = function assertType (value, path) {
}
};
export const validateSelectionOptions = function validateSelectionOptions (options, path) {
export const validateSelectionOptions = function validateSelectionOptions(options, path) {
if (!Array.isArray(options) || options.length === 0) {
throw new Error(`[settings] "${path}.options" must be a non-empty array`);
}
@@ -40,7 +40,7 @@ export const validateSelectionOptions = function validateSelectionOptions (optio
});
};
export const validateEntry = function validateEntry (entry, path) {
export const validateEntry = function validateEntry(entry, path) {
assertType(entry.type, `${path}.type`);
assertString(entry.name, `${path}.name`);
@@ -98,7 +98,7 @@ export const validateEntry = function validateEntry (entry, path) {
}
};
export const validateFirstLevelSection = function validateFirstLevelSection (section, path) {
export const validateFirstLevelSection = function validateFirstLevelSection(section, path) {
assertString(section.name);
assertString(section.i18n);
+2 -2
View File
@@ -39,7 +39,7 @@ const activePath = computed(() => {
});
const activeSection = ref(null);
const updateSettings = async function updateSettings () {
const updateSettings = async function updateSettings() {
const setting = getSettingRecursively(activePath.value, settings);
if (setting) {
activeSection.value = setting;
@@ -50,7 +50,7 @@ const updateSettings = async function updateSettings () {
watch(route, (newRoute) => updateSettings(newRoute));
onMounted(updateSettings);
const toggleSidebarIfSmallScreen = function toggleSidebarIfSmallScreen (toggleSidebarFunction) {
const toggleSidebarIfSmallScreen = function toggleSidebarIfSmallScreen(toggleSidebarFunction) {
if (matchMedia('(max-width: 48rem)').matches) toggleSidebarFunction();
};
</script>
@@ -211,7 +211,7 @@ vi.mock('vue-router', async (importOriginal) => {
};
});
const getWrapper = function getWrapper ({ translations = {} } = {}) {
const getWrapper = function getWrapper({ translations = {} } = {}) {
return mountComponent(SettingsView, {}, translations, [], {});
};
+1 -1
View File
@@ -26,7 +26,7 @@ const props = defineProps({
});
const emit = defineEmits(['toggleExpanded']);
const toggleSidebar = function toggleSidebar () {
const toggleSidebar = function toggleSidebar() {
emit('toggleExpanded');
};
</script>
@@ -19,7 +19,7 @@ import Icon from '@/features/icons/components/Icon.vue';
const emit = defineEmits(['click']);
const click = function click (event) {
const click = function click(event) {
emit('click', event);
};
</script>
+2 -2
View File
@@ -40,7 +40,7 @@ export const i18n = createI18n({
const loadedLanguages = new Set();
export async function loadLanguage (locale) {
export async function loadLanguage(locale) {
if (!SUPPORTED_LANGUAGES.includes(locale)) {
locale = fallbackLocale;
}
@@ -58,7 +58,7 @@ export async function loadLanguage (locale) {
loadedLanguages.add(locale);
};
export const setLocale = async function setLocale (locale) {
export const setLocale = async function setLocale(locale) {
await loadLanguage(locale);
document.documentElement.lang = locale;
document.documentElement.dir = LANGUAGES_RTL.includes(locale) ? 'rtl' : 'ltr';
+1 -1
View File
@@ -29,7 +29,7 @@ const props = defineProps({
const expanded = ref(props.expanded);
const toggleSidebar = function toggleSidebar () {
const toggleSidebar = function toggleSidebar() {
expanded.value = !expanded.value;
};
</script>
+1 -1
View File
@@ -68,7 +68,7 @@ const router = createRouter({
routes
});
export const updatePageTitle = function updatePageTitle (route) {
export const updatePageTitle = function updatePageTitle(route) {
const title =
typeof route.meta.title === 'function'
? route.meta.title(route)
+1 -1
View File
@@ -20,7 +20,7 @@ import { mount } from '@vue/test-utils';
import { createI18n } from 'vue-i18n';
import { createMemoryHistory, createRouter } from 'vue-router';
export const mountComponent = function mountComponent (component, options = {}, i18nMessages = {}, routes = [], piniaOptions = {}) {
export const mountComponent = function mountComponent(component, options = {}, i18nMessages = {}, routes = [], piniaOptions = {}) {
const {
setupStores,
...testingPiniaOptions
+1 -1
View File
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
export const ensureUnit = function (d) {
export const ensureUnit = function(d) {
if (!d) d = 0;
// ensure that it is a string
+1 -1
View File
@@ -26,7 +26,7 @@ const router = useRouter();
const searchQuery = ref('');
const submitSearch = function () {
const submitSearch = function() {
};
</script>