From 00945a3608e5d923462fab8c0a89e1a3d3b2ab46 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sat, 3 Aug 2019 13:49:37 -0700 Subject: [PATCH] chore: update standard to v13 (#1370) --- bin/build-inline-script.js | 12 +- bin/build-now-json.js | 48 +- bin/build-sass.js | 10 +- bin/build-svg.js | 24 +- bin/build-template-html.js | 14 +- bin/mastodon-data.js | 4 +- bin/restore-mastodon-data.js | 16 +- bin/run-mastodon.js | 14 +- bin/wait-for-mastodon-data.js | 2 +- bin/wait-for-mastodon-to-start.js | 4 +- package.json | 2 +- server.js | 4 +- src/inline-script/inline-script.js | 2 +- .../_a11y/getAccessibleLabelForStatus.js | 14 +- src/routes/_a11y/getAccountAccessibleName.js | 2 +- src/routes/_actions/accounts.js | 12 +- src/routes/_actions/addInstance.js | 24 +- .../_actions/addStatusOrNotification.js | 36 +- src/routes/_actions/autosuggest.js | 42 +- .../_actions/autosuggestAccountSearch.js | 10 +- src/routes/_actions/autosuggestEmojiSearch.js | 6 +- src/routes/_actions/block.js | 2 +- src/routes/_actions/compose.js | 36 +- src/routes/_actions/contentWarnings.js | 6 +- src/routes/_actions/copyText.js | 2 +- src/routes/_actions/createMakeProps.js | 2 +- src/routes/_actions/delete.js | 4 +- src/routes/_actions/deleteAndRedraft.js | 8 +- src/routes/_actions/deleteStatuses.js | 28 +- src/routes/_actions/emoji.js | 16 +- src/routes/_actions/favorite.js | 6 +- src/routes/_actions/follow.js | 2 +- src/routes/_actions/followRequests.js | 6 +- src/routes/_actions/instances.js | 26 +- src/routes/_actions/lists.js | 6 +- src/routes/_actions/media.js | 8 +- src/routes/_actions/mention.js | 2 +- src/routes/_actions/mute.js | 2 +- src/routes/_actions/muteConversation.js | 2 +- src/routes/_actions/onUserIsLoggedOut.js | 2 +- src/routes/_actions/pin.js | 2 +- src/routes/_actions/pinnedStatuses.js | 6 +- src/routes/_actions/polls.js | 8 +- src/routes/_actions/reblog.js | 6 +- src/routes/_actions/report.js | 2 +- src/routes/_actions/reportStatuses.js | 2 +- src/routes/_actions/requests.js | 2 +- src/routes/_actions/search.js | 6 +- src/routes/_actions/setDomainBlocked.js | 2 +- src/routes/_actions/setShowReblogs.js | 4 +- src/routes/_actions/showMoreAndScrollToTop.js | 12 +- .../_actions/showShareDialogIfNecessary.js | 4 +- src/routes/_actions/statuses.js | 4 +- src/routes/_actions/stream/streaming.js | 4 +- src/routes/_actions/timeline.js | 32 +- src/routes/_api/block.js | 4 +- src/routes/_api/blockDomain.js | 4 +- src/routes/_api/delete.js | 2 +- src/routes/_api/emoji.js | 2 +- src/routes/_api/favorite.js | 4 +- src/routes/_api/follow.js | 4 +- src/routes/_api/instance.js | 2 +- src/routes/_api/lists.js | 2 +- src/routes/_api/media.js | 6 +- src/routes/_api/mute.js | 4 +- src/routes/_api/muteConversation.js | 4 +- src/routes/_api/oauth.js | 12 +- src/routes/_api/pin.js | 4 +- src/routes/_api/polls.js | 4 +- src/routes/_api/reblog.js | 4 +- src/routes/_api/relationships.js | 4 +- src/routes/_api/report.js | 2 +- src/routes/_api/requests.js | 4 +- src/routes/_api/search.js | 2 +- src/routes/_api/showReblogs.js | 2 +- src/routes/_api/statuses.js | 12 +- src/routes/_api/stream/TimelineStream.js | 2 +- src/routes/_api/stream/getStreamUrl.js | 6 +- src/routes/_api/timelines.js | 4 +- src/routes/_api/updateCredentials.js | 2 +- src/routes/_api/user.js | 4 +- src/routes/_api/utils.js | 2 +- src/routes/_components/AccountsListPage.html | 6 +- src/routes/_components/Draggable.html | 20 +- src/routes/_components/IconButton.html | 4 +- src/routes/_components/NavItem.html | 16 +- src/routes/_components/NavShortcuts.html | 4 +- src/routes/_components/NonAutoplayImg.html | 4 +- src/routes/_components/SvgIcon.html | 4 +- src/routes/_components/Tooltip.html | 2 +- .../_components/community/PageListItem.html | 4 +- .../_components/compose/ComposeAuthor.html | 2 +- .../_components/compose/ComposeBox.html | 18 +- .../compose/ComposeContentWarning.html | 2 +- .../_components/compose/ComposeFileDrop.html | 6 +- .../_components/compose/ComposeInput.html | 20 +- .../compose/ComposeLengthGauge.html | 6 +- .../compose/ComposeLengthIndicator.html | 4 +- .../_components/compose/ComposeMediaItem.html | 16 +- .../_components/compose/ComposePoll.html | 32 +- .../compose/ComposeStickyButton.html | 18 +- .../_components/compose/ComposeToolbar.html | 16 +- .../AccountProfileOptionsDialog.html | 18 +- .../dialog/components/ConfirmationDialog.html | 2 +- .../dialog/components/CopyDialog.html | 10 +- .../dialog/components/EmojiDialog.html | 10 +- .../components/GenericConfirmationDialog.html | 2 +- .../dialog/components/MediaDialog.html | 38 +- .../components/MediaFocalPointDialog.html | 22 +- .../dialog/components/MediaInDialog.html | 6 +- .../dialog/components/ModalDialog.html | 12 +- .../dialog/components/MuteDialog.html | 2 +- .../dialog/components/PinchZoomable.html | 4 +- .../dialog/components/PostPrivacyDialog.html | 2 +- .../dialog/components/ReportDialog.html | 12 +- .../components/StatusOptionsDialog.html | 22 +- .../_components/dialog/creators/showDialog.js | 2 +- .../_components/dialog/helpers/closeDialog.js | 2 +- .../dialog/helpers/createDialogElement.js | 2 +- .../dialog/helpers/onCreateDialog.js | 2 +- .../_components/dialog/helpers/showDialog.js | 2 +- src/routes/_components/list/List.html | 6 +- src/routes/_components/list/ListLazyItem.html | 4 +- .../profile/AccountDisplayName.html | 2 +- .../profile/AccountProfileDetails.html | 4 +- .../profile/AccountProfileFollow.html | 4 +- .../profile/AccountProfilePage.html | 2 +- .../_components/settings/SettingsNav.html | 8 +- .../instance/GenericInstanceSettings.html | 10 +- .../settings/instance/InstanceActions.html | 6 +- .../instance/PushNotificationSettings.html | 8 +- .../settings/instance/ThemeSettings.html | 6 +- .../shortcut/ScrollListShortcuts.html | 16 +- src/routes/_components/shortcut/Shortcut.html | 4 +- src/routes/_components/snackbar/Snackbar.html | 2 +- src/routes/_components/snackbar/snackbar.js | 2 +- src/routes/_components/status/Media.html | 6 +- .../_components/status/Notification.html | 4 +- src/routes/_components/status/Status.html | 16 +- .../_components/status/StatusComposeBox.html | 6 +- .../_components/status/StatusContent.html | 16 +- .../_components/status/StatusDetails.html | 2 +- .../status/StatusMediaAttachments.html | 6 +- src/routes/_components/status/StatusPoll.html | 28 +- .../_components/status/StatusSpoiler.html | 6 +- .../_components/status/StatusToolbar.html | 22 +- .../_components/timeline/LazyTimeline.html | 4 +- .../_components/timeline/LoadingFooter.html | 6 +- .../_components/timeline/MoreHeader.html | 2 +- .../_components/timeline/PinnedStatuses.html | 2 +- src/routes/_components/timeline/Timeline.html | 40 +- src/routes/_components/toast/Toast.html | 2 +- src/routes/_components/toast/toast.js | 2 +- .../_components/virtualList/VirtualList.html | 6 +- .../virtualList/VirtualListContainer.html | 14 +- .../virtualList/VirtualListFooter.html | 4 +- .../virtualList/VirtualListHeader.html | 4 +- .../virtualList/VirtualListItem.html | 14 +- .../virtualList/VirtualListLazyItem.html | 4 +- .../virtualList/virtualListStore.js | 20 +- src/routes/_database/accounts.js | 2 +- src/routes/_database/asyncDatabase.js | 2 +- src/routes/_database/cache.js | 14 +- src/routes/_database/cleanup.js | 14 +- src/routes/_database/databaseLifecycle.js | 18 +- src/routes/_database/helpers.js | 10 +- src/routes/_database/keys.js | 6 +- src/routes/_database/meta.js | 2 +- src/routes/_database/migrations.js | 22 +- src/routes/_database/timelines/deletion.js | 12 +- .../_database/timelines/fetchNotification.js | 2 +- src/routes/_database/timelines/fetchStatus.js | 2 +- .../timelines/getStatusOrNotification.js | 12 +- src/routes/_database/timelines/insertion.js | 32 +- src/routes/_database/timelines/lookup.js | 6 +- src/routes/_database/timelines/pagination.js | 34 +- .../_database/timelines/pinnedStatuses.js | 20 +- .../_database/timelines/updateStatus.js | 8 +- src/routes/_database/utils.js | 2 +- src/routes/_intl/formatTimeagoDate.js | 4 +- src/routes/_pages/community/index.html | 2 +- src/routes/_pages/pinned.html | 6 +- src/routes/_pages/settings/general.html | 2 +- .../settings/instances/[instanceName].html | 2 +- src/routes/_pages/settings/instances/add.html | 2 +- src/routes/_pages/settings/wellness.html | 2 +- src/routes/_react/createEmojiMartPicker.js | 2 +- src/routes/_static/polls.js | 28 +- src/routes/_store/LocalStorageStore.js | 6 +- .../computations/autosuggestComputations.js | 6 +- .../_store/computations/navComputations.js | 4 +- .../computations/timelineComputations.js | 6 +- src/routes/_store/mixins/autosuggestMixins.js | 14 +- src/routes/_store/mixins/instanceMixins.js | 16 +- src/routes/_store/mixins/statusMixins.js | 4 +- src/routes/_store/mixins/timelineMixins.js | 22 +- .../_store/observers/autosuggestObservers.js | 6 +- .../observers/customScrollbarObservers.js | 2 +- .../_store/observers/instanceObservers.js | 10 +- src/routes/_store/observers/navObservers.js | 2 +- .../_store/observers/timelineObservers.js | 14 +- src/routes/_store/observers/touchObservers.js | 2 +- src/routes/_store/storeLite.js | 2 +- .../_thirdparty/a11y-dialog/a11y-dialog.js | 4 +- src/routes/_thirdparty/autosize/autosize.js | 10 +- src/routes/_transitions/slide.js | 2 +- src/routes/_utils/PromiseThrottler.js | 2 +- src/routes/_utils/RealmStore.js | 16 +- src/routes/_utils/ajax.js | 12 +- src/routes/_utils/animate.js | 12 +- src/routes/_utils/arrays.js | 10 +- src/routes/_utils/classname.js | 4 +- .../createAutosuggestAccessibleLabel.js | 4 +- src/routes/_utils/delegate.js | 8 +- src/routes/_utils/emojifyText.js | 6 +- src/routes/_utils/eventBus.js | 2 +- src/routes/_utils/events.js | 8 +- src/routes/_utils/historyEvents.js | 6 +- src/routes/_utils/loadCSS.js | 4 +- src/routes/_utils/lodash-lite.js | 6 +- src/routes/_utils/measureText.js | 4 +- src/routes/_utils/once.js | 2 +- src/routes/_utils/removeEmoji.js | 4 +- src/routes/_utils/replaceEmoji.js | 8 +- src/routes/_utils/reselect.js | 2 +- src/routes/_utils/scheduleIdleTask.js | 6 +- src/routes/_utils/scrollIntoView.js | 28 +- src/routes/_utils/scrollToTop.js | 4 +- src/routes/_utils/setFavicon.js | 6 +- src/routes/_utils/shortcuts.js | 22 +- src/routes/_utils/smoothScroll.js | 2 +- src/routes/_utils/statusHtmlToPlainText.js | 22 +- src/routes/_utils/statusIdSorting.js | 10 +- src/routes/_utils/sync.js | 4 +- src/routes/_utils/testStorage.js | 4 +- src/routes/_utils/themeEngine.js | 8 +- src/routes/_utils/throttleRaf.js | 2 +- src/routes/settings/quick-login.html | 6 +- src/routes/share.html | 4 +- src/service-worker.js | 26 +- tests/blobUtils.js | 8 +- tests/serverActions.js | 2 +- tests/spec/008-status-media.js | 8 +- tests/spec/010-focus.js | 2 +- tests/spec/017-compose-reply.js | 6 +- tests/spec/022-status-aria-label.js | 2 +- tests/spec/023-mark-media-as-sensitive.js | 24 +- tests/spec/025-shortcuts-status.js | 12 +- tests/spec/026-shortcuts-notification.js | 10 +- tests/spec/029-back-button-modal.js | 2 +- tests/spec/030-shortcuts-modal.js | 4 +- tests/spec/100-favorite-unfavorite.js | 2 +- tests/spec/101-reblog-unreblog.js | 2 +- tests/spec/102-notifications.js | 4 +- tests/spec/105-deletes.js | 14 +- tests/spec/106-follow-requests.js | 2 +- tests/spec/110-compose-content-warnings.js | 4 +- tests/spec/112-status-links.js | 2 +- tests/spec/113-block-unblock.js | 2 +- tests/spec/114-mute-unmute.js | 2 +- tests/spec/119-status-counts-update.js | 12 +- tests/spec/120-status-aria-label.js | 4 +- tests/spec/121-delete-and-redraft.js | 2 +- tests/spec/123-notification-mentions.js | 2 +- tests/spec/124-home-timeline-filters.js | 2 +- .../spec/125-notification-timeline-filters.js | 12 +- tests/submitMedia.js | 2 +- tests/unit/test-database.js | 26 +- tests/unit/test-emoji.js | 16 +- tests/unit/test-id-sorting.js | 64 +-- tests/unit/test-shortcuts.js | 46 +- tests/utils.js | 18 +- webpack/shared.config.js | 2 +- yarn.lock | 528 ++++++++++-------- 274 files changed, 1472 insertions(+), 1422 deletions(-) diff --git a/bin/build-inline-script.js b/bin/build-inline-script.js index bd296a73..42270eb8 100644 --- a/bin/build-inline-script.js +++ b/bin/build-inline-script.js @@ -13,9 +13,9 @@ const writeFile = promisify(fs.writeFile) const themeColors = fromPairs(themes.map(_ => ([_.name, _.color]))) export async function buildInlineScript () { - let inlineScriptPath = path.join(__dirname, '../src/inline-script/inline-script.js') + const inlineScriptPath = path.join(__dirname, '../src/inline-script/inline-script.js') - let bundle = await rollup({ + const bundle = await rollup({ input: inlineScriptPath, plugins: [ replace({ @@ -28,15 +28,15 @@ export async function buildInlineScript () { }) ] }) - let { output } = await bundle.generate({ + const { output } = await bundle.generate({ format: 'iife', sourcemap: true }) - let { code, map } = output[0] + const { code, map } = output[0] - let fullCode = `${code}//# sourceMappingURL=/inline-script.js.map` - let checksum = crypto.createHash('sha256').update(fullCode).digest('base64') + const fullCode = `${code}//# sourceMappingURL=/inline-script.js.map` + const checksum = crypto.createHash('sha256').update(fullCode).digest('base64') await writeFile(path.resolve(__dirname, '../src/inline-script/checksum.js'), `module.exports = ${JSON.stringify(checksum)}`, 'utf8') diff --git a/bin/build-now-json.js b/bin/build-now-json.js index 007b201c..0a05b3c7 100644 --- a/bin/build-now-json.js +++ b/bin/build-now-json.js @@ -13,42 +13,42 @@ import { sapperInlineScriptChecksums } from '../src/server/sapperInlineScriptChe const writeFile = promisify(fs.writeFile) const JSON_TEMPLATE = { - 'version': 2, - 'env': { - 'NODE_ENV': 'production' + version: 2, + env: { + NODE_ENV: 'production' }, - 'builds': [ + builds: [ { - 'src': 'package.json', - 'use': '@now/static-build', - 'config': { - 'distDir': '__sapper__/export' + src: 'package.json', + use: '@now/static-build', + config: { + distDir: '__sapper__/export' } } ], - 'routes': [ + routes: [ { - 'src': '^/service-worker\\.js$', - 'headers': { + src: '^/service-worker\\.js$', + headers: { 'cache-control': 'public,max-age=0' } }, { - 'src': '^/(report\\.html|stats\\.json)$', - 'headers': { + src: '^/(report\\.html|stats\\.json)$', + headers: { 'cache-control': 'public,max-age=3600' }, - 'dest': 'client/$1' + dest: 'client/$1' }, { - 'src': '^/client/.*\\.(js|css|map)$', - 'headers': { + src: '^/client/.*\\.(js|css|map)$', + headers: { 'cache-control': 'public,max-age=31536000,immutable' } }, { - 'src': '^/.*\\.(png|css|json|svg|jpe?g|map|txt)$', - 'headers': { + src: '^/.*\\.(png|css|json|svg|jpe?g|map|txt)$', + headers: { 'cache-control': 'public,max-age=3600' } } @@ -69,21 +69,21 @@ const HTML_HEADERS = { } async function main () { - let json = cloneDeep(JSON_TEMPLATE) + const json = cloneDeep(JSON_TEMPLATE) - let exportDir = path.resolve(__dirname, '../__sapper__/export') + const exportDir = path.resolve(__dirname, '../__sapper__/export') - for (let { pattern } of routes) { - let route = { + for (const { pattern } of routes) { + const route = { src: pattern.source, headers: cloneDeep(HTML_HEADERS) } // remove all the regexy stuff in the regex - let filename = pattern.source.replace(/^\^\\\//, '').replace(/(\\\/)?\?\$$/, '').replace(/\\\//g, '/') + const filename = pattern.source.replace(/^\^\\\//, '').replace(/(\\\/)?\?\$$/, '').replace(/\\\//g, '/') // try two different possible paths - let filePath = [ + const filePath = [ `${filename}.html`, path.join(filename, 'index.html') ].map(_ => path.resolve(exportDir, _)).find(_ => fs.existsSync(_)) diff --git a/bin/build-sass.js b/bin/build-sass.js index a61a0095..d6a0b22d 100755 --- a/bin/build-sass.js +++ b/bin/build-sass.js @@ -20,24 +20,24 @@ async function renderCss (file) { } async function compileGlobalSass () { - let mainStyle = (await Promise.all([defaultThemeScss, globalScss].map(renderCss))).join('') - let scrollbarStyle = (await renderCss(customScrollbarScss)) + const mainStyle = (await Promise.all([defaultThemeScss, globalScss].map(renderCss))).join('') + const scrollbarStyle = (await renderCss(customScrollbarScss)) return `\n` + `\n` } async function compileThemesSass () { - let files = (await readdir(themesScssDir)).filter(file => !path.basename(file).startsWith('_')) + const files = (await readdir(themesScssDir)).filter(file => !path.basename(file).startsWith('_')) await Promise.all(files.map(async file => { let css = await renderCss(path.join(themesScssDir, file)) css = cssDedoupe(new TextDecoder('utf-8').decode(css)) // remove duplicate custom properties - let outputFilename = 'theme-' + path.basename(file).replace(/\.scss$/, '.css') + const outputFilename = 'theme-' + path.basename(file).replace(/\.scss$/, '.css') await writeFile(path.join(assetsDir, outputFilename), css, 'utf8') })) } export async function buildSass () { - let [ result ] = await Promise.all([compileGlobalSass(), compileThemesSass()]) + const [result] = await Promise.all([compileGlobalSass(), compileThemesSass()]) return result } diff --git a/bin/build-svg.js b/bin/build-svg.js index ef185c2e..93fe7c44 100755 --- a/bin/build-svg.js +++ b/bin/build-svg.js @@ -10,12 +10,12 @@ const readFile = promisify(fs.readFile) const writeFile = promisify(fs.writeFile) async function readSvg (svg) { - let filepath = path.join(__dirname, '../', svg.src) - let content = await readFile(filepath, 'utf8') - let optimized = (await svgo.optimize(content)) - let $optimized = $(optimized.data) - let $path = $optimized.find('path').removeAttr('fill') - let $symbol = $('') + const filepath = path.join(__dirname, '../', svg.src) + const content = await readFile(filepath, 'utf8') + const optimized = (await svgo.optimize(content)) + const $optimized = $(optimized.data) + const $path = $optimized.find('path').removeAttr('fill') + const $symbol = $('') .attr('id', svg.id) .attr('viewBox', `0 0 ${optimized.info.width} ${optimized.info.height}`) .append($path) @@ -23,14 +23,14 @@ async function readSvg (svg) { } export async function buildSvg () { - let inlineSvgs = svgs.filter(_ => _.inline) - let regularSvgs = svgs.filter(_ => !_.inline) + const inlineSvgs = svgs.filter(_ => _.inline) + const regularSvgs = svgs.filter(_ => !_.inline) - let inlineSvgStrings = (await Promise.all(inlineSvgs.map(readSvg))).join('') - let regularSvgStrings = (await Promise.all(regularSvgs.map(readSvg))).join('') + const inlineSvgStrings = (await Promise.all(inlineSvgs.map(readSvg))).join('') + const regularSvgStrings = (await Promise.all(regularSvgs.map(readSvg))).join('') - let inlineOutput = `${inlineSvgStrings}` - let regularOutput = `${regularSvgStrings}` + const inlineOutput = `${inlineSvgStrings}` + const regularOutput = `${regularSvgStrings}` await writeFile(path.resolve(__dirname, '../static/icons.svg'), regularOutput, 'utf8') diff --git a/bin/build-template-html.js b/bin/build-template-html.js index 2c573ae4..22752a28 100644 --- a/bin/build-template-html.js +++ b/bin/build-template-html.js @@ -34,17 +34,17 @@ const builders = [ const partials = buildPartials() function buildPartials () { - let rawTemplate = fs.readFileSync(path.resolve(__dirname, '../src/build/template.html'), 'utf8') + const rawTemplate = fs.readFileSync(path.resolve(__dirname, '../src/build/template.html'), 'utf8') - let partials = [rawTemplate] + const partials = [rawTemplate] builders.forEach(builder => { for (let i = 0; i < partials.length; i++) { - let partial = partials[i] + const partial = partials[i] if (typeof partial !== 'string') { continue } - let idx = partial.indexOf(builder.comment) + const idx = partial.indexOf(builder.comment) if (idx !== -1) { partials.splice( i, @@ -77,8 +77,8 @@ function doWatch () { } async function buildAll () { - let start = now() - let html = (await Promise.all(partials.map(async partial => { + const start = now() + const html = (await Promise.all(partials.map(async partial => { if (typeof partial === 'string') { return partial } @@ -89,7 +89,7 @@ async function buildAll () { }))).join('') await writeFile(path.resolve(__dirname, '../src/template.html'), html, 'utf8') - let end = now() + const end = now() console.log(`Built template.html in ${(end - start).toFixed(2)}ms`) } diff --git a/bin/mastodon-data.js b/bin/mastodon-data.js index ea75c86a..fc2337a8 100644 --- a/bin/mastodon-data.js +++ b/bin/mastodon-data.js @@ -1,13 +1,13 @@ import times from 'lodash-es/times' function unrollThread (user, prefix, privacy, thread) { - let res = [] + const res = [] function unroll (node, parentKey) { if (!node) { return } - for (let key of Object.keys(node)) { + for (const key of Object.keys(node)) { res.push({ user: user, post: { diff --git a/bin/restore-mastodon-data.js b/bin/restore-mastodon-data.js index d057e814..41159d91 100644 --- a/bin/restore-mastodon-data.js +++ b/bin/restore-mastodon-data.js @@ -15,24 +15,24 @@ global.fetch = fetch export async function restoreMastodonData () { console.log('Restoring mastodon data...') - let internalIdsToIds = {} - for (let action of actions) { + const internalIdsToIds = {} + for (const action of actions) { if (!action.post) { // If the action is a boost, favorite, etc., then it needs to // be delayed, otherwise it may appear in an unpredictable order and break the tests. await new Promise(resolve => setTimeout(resolve, 1000)) } console.log(JSON.stringify(action)) - let accessToken = users[action.user].accessToken + const accessToken = users[action.user].accessToken if (action.post) { - let { text, media, sensitive, spoiler, privacy, inReplyTo, internalId } = action.post - let mediaIds = media && await Promise.all(media.map(async mediaItem => { - let mediaResponse = await submitMedia(accessToken, mediaItem, 'kitten') + const { text, media, sensitive, spoiler, privacy, inReplyTo, internalId } = action.post + const mediaIds = media && await Promise.all(media.map(async mediaItem => { + const mediaResponse = await submitMedia(accessToken, mediaItem, 'kitten') return mediaResponse.id })) - let inReplyToId = inReplyTo && internalIdsToIds[inReplyTo] - let status = await postStatus('localhost:3000', accessToken, text, inReplyToId, mediaIds, + const inReplyToId = inReplyTo && internalIdsToIds[inReplyTo] + const status = await postStatus('localhost:3000', accessToken, text, inReplyToId, mediaIds, sensitive, spoiler, privacy || 'public') if (typeof internalId !== 'undefined') { internalIdsToIds[internalId] = status.id diff --git a/bin/run-mastodon.js b/bin/run-mastodon.js index 7fa917ad..1f1cb7fb 100644 --- a/bin/run-mastodon.js +++ b/bin/run-mastodon.js @@ -66,21 +66,21 @@ async function setupMastodonDatabase () { env: Object.assign({ PGPASSWORD: DB_PASS }, process.env) }) - let dumpFile = path.join(dir, '../tests/fixtures/dump.sql') + const dumpFile = path.join(dir, '../tests/fixtures/dump.sql') await exec(`psql -h 127.0.0.1 -U ${DB_USER} -w -d ${DB_NAME} -f "${dumpFile}"`, { cwd: mastodonDir, env: Object.assign({ PGPASSWORD: DB_PASS }, process.env) }) - let tgzFile = path.join(dir, '../tests/fixtures/system.tgz') - let systemDir = path.join(mastodonDir, 'public/system') + const tgzFile = path.join(dir, '../tests/fixtures/system.tgz') + const systemDir = path.join(mastodonDir, 'public/system') await mkdirp(systemDir) await exec(`tar -xzf "${tgzFile}"`, { cwd: systemDir }) } async function runMastodon () { console.log('Running mastodon...') - let env = Object.assign({}, process.env, { + const env = Object.assign({}, process.env, { RAILS_ENV: 'development', NODE_ENV: 'development', DB_NAME, @@ -89,8 +89,8 @@ async function runMastodon () { DB_HOST, DB_PORT }) - let cwd = mastodonDir - let cmds = [ + const cwd = mastodonDir + const cmds = [ 'gem install bundler foreman', 'bundle install', 'bundle exec rails db:migrate', @@ -103,7 +103,7 @@ async function runMastodon () { console.log('Already installed Mastodon') } catch (e) { console.log('Installing Mastodon...') - for (let cmd of cmds) { + for (const cmd of cmds) { console.log(cmd) await exec(cmd, { cwd, env }) } diff --git a/bin/wait-for-mastodon-data.js b/bin/wait-for-mastodon-data.js index 6aabc74f..a332a7cf 100644 --- a/bin/wait-for-mastodon-data.js +++ b/bin/wait-for-mastodon-data.js @@ -10,7 +10,7 @@ const numStatuses = actions async function waitForMastodonData () { while (true) { try { - let json = await ((await fetch('http://127.0.0.1:3000/api/v1/instance')).json()) + const json = await ((await fetch('http://127.0.0.1:3000/api/v1/instance')).json()) if (json.stats.status_count === numStatuses) { break } else { diff --git a/bin/wait-for-mastodon-to-start.js b/bin/wait-for-mastodon-to-start.js index 7fff39a0..d0260c45 100644 --- a/bin/wait-for-mastodon-to-start.js +++ b/bin/wait-for-mastodon-to-start.js @@ -3,7 +3,7 @@ import fetch from 'node-fetch' export async function waitForMastodonUiToStart () { while (true) { try { - let html = await ((await fetch('http://127.0.0.1:3035/packs/common.js')).text()) + const html = await ((await fetch('http://127.0.0.1:3035/packs/common.js')).text()) if (html) { break } @@ -18,7 +18,7 @@ export async function waitForMastodonUiToStart () { export async function waitForMastodonApiToStart () { while (true) { try { - let json = await ((await fetch('http://127.0.0.1:3000/api/v1/instance')).json()) + const json = await ((await fetch('http://127.0.0.1:3000/api/v1/instance')).json()) if (json.uri) { break } diff --git a/package.json b/package.json index 484f268e..eb929a66 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "fake-indexeddb": "^2.1.1", "mocha": "^6.1.4", "now": "^15.7.0", - "standard": "^12.0.1", + "standard": "^13.1.0", "testcafe": "^1.2.1" }, "engines": { diff --git a/server.js b/server.js index 23cc92d5..4d1e812a 100755 --- a/server.js +++ b/server.js @@ -19,8 +19,8 @@ app.use(compression({ threshold: 0 })) app.use(express.static(exportDir, { setHeaders (res, thisPath) { - let localPath = '/' + path.relative(exportDir, thisPath) - for (let { regex, headers } of routes) { + const localPath = '/' + path.relative(exportDir, thisPath) + for (const { regex, headers } of routes) { if (regex.test(localPath)) { res.set(headers) return diff --git a/src/inline-script/inline-script.js b/src/inline-script/inline-script.js index 044aab38..938431ad 100644 --- a/src/inline-script/inline-script.js +++ b/src/inline-script/inline-script.js @@ -23,7 +23,7 @@ const theme = (instanceThemes && instanceThemes[currentInstance]) || DEFAULT_THE if (currentInstance) { // Do preconnect if we're logged in, so we can connect faster to the other origin. - let link = document.createElement('link') + const link = document.createElement('link') link.setAttribute('rel', 'preconnect') link.setAttribute('href', basename(currentInstance)) link.setAttribute('crossorigin', 'anonymous') diff --git a/src/routes/_a11y/getAccessibleLabelForStatus.js b/src/routes/_a11y/getAccessibleLabelForStatus.js index c792f147..ae8abeb3 100644 --- a/src/routes/_a11y/getAccessibleLabelForStatus.js +++ b/src/routes/_a11y/getAccessibleLabelForStatus.js @@ -5,7 +5,7 @@ function getNotificationText (notification, omitEmojiInDisplayNames) { if (!notification) { return } - let notificationAccountDisplayName = getAccountAccessibleName(notification.account, omitEmojiInDisplayNames) + const notificationAccountDisplayName = getAccountAccessibleName(notification.account, omitEmojiInDisplayNames) if (notification.type === 'reblog') { return `${notificationAccountDisplayName} boosted your status` } else if (notification.type === 'favourite') { @@ -14,7 +14,7 @@ function getNotificationText (notification, omitEmojiInDisplayNames) { } function getPrivacyText (visibility) { - for (let option of POST_PRIVACY_OPTIONS) { + for (const option of POST_PRIVACY_OPTIONS) { if (option.key === visibility) { return option.label } @@ -25,7 +25,7 @@ function getReblogText (reblog, account, omitEmojiInDisplayNames) { if (!reblog) { return } - let accountDisplayName = getAccountAccessibleName(account, omitEmojiInDisplayNames) + const accountDisplayName = getAccountAccessibleName(account, omitEmojiInDisplayNames) return `Boosted by ${accountDisplayName}` } @@ -37,11 +37,11 @@ export function getAccessibleLabelForStatus (originalAccount, account, plainText timeagoFormattedDate, spoilerText, showContent, reblog, notification, visibility, omitEmojiInDisplayNames, disableLongAriaLabels) { - let originalAccountDisplayName = getAccountAccessibleName(originalAccount, omitEmojiInDisplayNames) - let contentTextToShow = (showContent || !spoilerText) + const originalAccountDisplayName = getAccountAccessibleName(originalAccount, omitEmojiInDisplayNames) + const contentTextToShow = (showContent || !spoilerText) ? cleanupText(plainTextContent) : `Content warning: ${cleanupText(spoilerText)}` - let privacyText = getPrivacyText(visibility) + const privacyText = getPrivacyText(visibility) if (disableLongAriaLabels) { // Long text can crash NVDA; allow users to shorten it like we had it before. @@ -49,7 +49,7 @@ export function getAccessibleLabelForStatus (originalAccount, account, plainText return `${privacyText} status by ${originalAccountDisplayName}` } - let values = [ + const values = [ getNotificationText(notification, omitEmojiInDisplayNames), originalAccountDisplayName, contentTextToShow, diff --git a/src/routes/_a11y/getAccountAccessibleName.js b/src/routes/_a11y/getAccountAccessibleName.js index e5df001a..81a30a1b 100644 --- a/src/routes/_a11y/getAccountAccessibleName.js +++ b/src/routes/_a11y/getAccountAccessibleName.js @@ -1,7 +1,7 @@ import { removeEmoji } from '../_utils/removeEmoji' export function getAccountAccessibleName (account, omitEmojiInDisplayNames) { - let emojis = account.emojis + const emojis = account.emojis let displayName = account.display_name || account.username if (omitEmojiInDisplayNames) { displayName = removeEmoji(displayName, emojis) || displayName diff --git a/src/routes/_actions/accounts.js b/src/routes/_actions/accounts.js index 5f57e7db..f9c50402 100644 --- a/src/routes/_actions/accounts.js +++ b/src/routes/_actions/accounts.js @@ -4,8 +4,8 @@ import { database } from '../_database/database' import { store } from '../_store/store' async function _updateAccount (accountId, instanceName, accessToken) { - let localPromise = database.getAccount(instanceName, accountId) - let remotePromise = getAccount(instanceName, accessToken, accountId).then(account => { + const localPromise = database.getAccount(instanceName, accountId) + const remotePromise = getAccount(instanceName, accessToken, accountId).then(account => { /* no await */ database.setAccount(instanceName, account) return account }) @@ -23,8 +23,8 @@ async function _updateAccount (accountId, instanceName, accessToken) { } async function _updateRelationship (accountId, instanceName, accessToken) { - let localPromise = database.getRelationship(instanceName, accountId) - let remotePromise = getRelationship(instanceName, accessToken, accountId).then(relationship => { + const localPromise = database.getRelationship(instanceName, accountId) + const remotePromise = getRelationship(instanceName, accessToken, accountId).then(relationship => { /* no await */ database.setRelationship(instanceName, relationship) return relationship }) @@ -57,7 +57,7 @@ export async function clearProfileAndRelationship () { } export async function updateProfileAndRelationship (accountId) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() await Promise.all([ _updateAccount(accountId, currentInstance, accessToken), @@ -66,7 +66,7 @@ export async function updateProfileAndRelationship (accountId) { } export async function updateRelationship (accountId) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() await _updateRelationship(accountId, currentInstance, accessToken) } diff --git a/src/routes/_actions/addInstance.js b/src/routes/_actions/addInstance.js index d1091e45..b6e43995 100644 --- a/src/routes/_actions/addInstance.js +++ b/src/routes/_actions/addInstance.js @@ -12,7 +12,7 @@ const REDIRECT_URI = (typeof location !== 'undefined' ? location.origin : 'https://pinafore.social') + '/settings/instances/add' function createKnownError (message) { - let err = new Error(message) + const err = new Error(message) err.knownError = true return err } @@ -23,20 +23,20 @@ async function redirectToOauth () { if (Object.keys(loggedInInstances).includes(instanceNameInSearch)) { throw createKnownError(`You've already logged in to ${instanceNameInSearch}`) } - let instanceHostname = new URL(`http://${instanceNameInSearch}`).hostname + const instanceHostname = new URL(`http://${instanceNameInSearch}`).hostname if (DOMAIN_BLOCKS.some(domain => new RegExp(`(?:\\.|^)${domain}$`, 'i').test(instanceHostname))) { throw createKnownError('This service is blocked') } - let registrationPromise = registerApplication(instanceNameInSearch, REDIRECT_URI) - let instanceInfo = await getInstanceInfo(instanceNameInSearch) + const registrationPromise = registerApplication(instanceNameInSearch, REDIRECT_URI) + const instanceInfo = await getInstanceInfo(instanceNameInSearch) await database.setInstanceInfo(instanceNameInSearch, instanceInfo) // cache for later - let instanceData = await registrationPromise + const instanceData = await registrationPromise store.set({ currentRegisteredInstanceName: instanceNameInSearch, currentRegisteredInstance: instanceData }) store.save() - let oauthUrl = generateAuthLink( + const oauthUrl = generateAuthLink( instanceNameInSearch, instanceData.client_id, REDIRECT_URI @@ -53,12 +53,12 @@ export async function logInToInstance () { await redirectToOauth() } catch (err) { console.error(err) - let error = `${err.message || err.name}. ` + + const error = `${err.message || err.name}. ` + (err.knownError ? '' : (navigator.onLine ? `Is this a valid Mastodon instance? Is a browser extension blocking the request? Are you in private browsing mode?` : `Are you offline?`)) - let { instanceNameInSearch } = store.get() + const { instanceNameInSearch } = store.get() store.set({ logInToInstanceError: error, logInToInstanceErrorForText: instanceNameInSearch @@ -69,15 +69,15 @@ export async function logInToInstance () { } async function registerNewInstance (code) { - let { currentRegisteredInstanceName, currentRegisteredInstance } = store.get() - let instanceData = await getAccessTokenFromAuthCode( + const { currentRegisteredInstanceName, currentRegisteredInstance } = store.get() + const instanceData = await getAccessTokenFromAuthCode( currentRegisteredInstanceName, currentRegisteredInstance.client_id, currentRegisteredInstance.client_secret, code, REDIRECT_URI ) - let { loggedInInstances, loggedInInstancesInOrder, instanceThemes } = store.get() + const { loggedInInstances, loggedInInstancesInOrder, instanceThemes } = store.get() instanceThemes[currentRegisteredInstanceName] = DEFAULT_THEME loggedInInstances[currentRegisteredInstanceName] = instanceData if (!loggedInInstancesInOrder.includes(currentRegisteredInstanceName)) { @@ -93,7 +93,7 @@ async function registerNewInstance (code) { instanceThemes: instanceThemes }) store.save() - let { enableGrayscale } = store.get() + const { enableGrayscale } = store.get() switchToTheme(DEFAULT_THEME, enableGrayscale) // fire off these requests so they're cached /* no await */ updateVerifyCredentialsForInstance(currentRegisteredInstanceName) diff --git a/src/routes/_actions/addStatusOrNotification.js b/src/routes/_actions/addStatusOrNotification.js index 25248374..731cf116 100644 --- a/src/routes/_actions/addStatusOrNotification.js +++ b/src/routes/_actions/addStatusOrNotification.js @@ -8,13 +8,13 @@ import { scheduleIdleTask } from '../_utils/scheduleIdleTask' import { timelineItemToSummary } from '../_utils/timelineItemToSummary' function getExistingItemIdsSet (instanceName, timelineName) { - let timelineItemSummaries = store.getForTimeline(instanceName, timelineName, 'timelineItemSummaries') || [] + const timelineItemSummaries = store.getForTimeline(instanceName, timelineName, 'timelineItemSummaries') || [] return new Set(timelineItemSummaries.map(_ => _.id)) } function removeDuplicates (instanceName, timelineName, updates) { // remove duplicates, including duplicates due to reblogs - let existingItemIds = getExistingItemIdsSet(instanceName, timelineName) + const existingItemIds = getExistingItemIdsSet(instanceName, timelineName) return updates.filter(update => !existingItemIds.has(update.id)) } @@ -27,12 +27,12 @@ async function insertUpdatesIntoTimeline (instanceName, timelineName, updates) { await database.insertTimelineItems(instanceName, timelineName, updates) - let itemSummariesToAdd = store.getForTimeline(instanceName, timelineName, 'timelineItemSummariesToAdd') || [] + const itemSummariesToAdd = store.getForTimeline(instanceName, timelineName, 'timelineItemSummariesToAdd') || [] console.log('itemSummariesToAdd', JSON.parse(JSON.stringify(itemSummariesToAdd))) console.log('updates.map(timelineItemToSummary)', JSON.parse(JSON.stringify(updates.map(timelineItemToSummary)))) console.log('concat(itemSummariesToAdd, updates.map(timelineItemToSummary))', JSON.parse(JSON.stringify(concat(itemSummariesToAdd, updates.map(timelineItemToSummary))))) - let newItemSummariesToAdd = uniqBy( + const newItemSummariesToAdd = uniqBy( concat(itemSummariesToAdd, updates.map(timelineItemToSummary)), _ => _.id ) @@ -44,12 +44,12 @@ async function insertUpdatesIntoTimeline (instanceName, timelineName, updates) { } function isValidStatusForThread (thread, timelineName, itemSummariesToAdd) { - let itemSummariesToAddIdSet = new Set(itemSummariesToAdd.map(_ => _.id)) - let threadIdSet = new Set(thread.map(_ => _.id)) - let focusedStatusId = timelineName.split('/')[1] // e.g. "status/123456" - let focusedStatusIdx = thread.findIndex(_ => _.id === focusedStatusId) + const itemSummariesToAddIdSet = new Set(itemSummariesToAdd.map(_ => _.id)) + const threadIdSet = new Set(thread.map(_ => _.id)) + const focusedStatusId = timelineName.split('/')[1] // e.g. "status/123456" + const focusedStatusIdx = thread.findIndex(_ => _.id === focusedStatusId) return status => { - let repliedToStatusIdx = thread.findIndex(_ => _.id === status.in_reply_to_id) + const repliedToStatusIdx = thread.findIndex(_ => _.id === status.in_reply_to_id) return ( // A reply to an ancestor status is not valid for this thread, but for the focused status // itself or any of its descendents, it is valid. @@ -67,17 +67,17 @@ async function insertUpdatesIntoThreads (instanceName, updates) { return } - let threads = store.getThreads(instanceName) - let timelineNames = Object.keys(threads) - for (let timelineName of timelineNames) { - let thread = threads[timelineName] + const threads = store.getThreads(instanceName) + const timelineNames = Object.keys(threads) + for (const timelineName of timelineNames) { + const thread = threads[timelineName] - let itemSummariesToAdd = store.getForTimeline(instanceName, timelineName, 'timelineItemSummariesToAdd') || [] - let validUpdates = updates.filter(isValidStatusForThread(thread, timelineName, itemSummariesToAdd)) + const itemSummariesToAdd = store.getForTimeline(instanceName, timelineName, 'timelineItemSummariesToAdd') || [] + const validUpdates = updates.filter(isValidStatusForThread(thread, timelineName, itemSummariesToAdd)) if (!validUpdates.length) { continue } - let newItemSummariesToAdd = uniqBy( + const newItemSummariesToAdd = uniqBy( concat(itemSummariesToAdd, validUpdates.map(timelineItemToSummary)), _ => _.id ) @@ -91,9 +91,9 @@ async function insertUpdatesIntoThreads (instanceName, updates) { async function processFreshUpdates (instanceName, timelineName) { mark('processFreshUpdates') - let freshUpdates = store.getForTimeline(instanceName, timelineName, 'freshUpdates') + const freshUpdates = store.getForTimeline(instanceName, timelineName, 'freshUpdates') if (freshUpdates && freshUpdates.length) { - let updates = freshUpdates.slice() + const updates = freshUpdates.slice() store.setForTimeline(instanceName, timelineName, { freshUpdates: [] }) await Promise.all([ diff --git a/src/routes/_actions/autosuggest.js b/src/routes/_actions/autosuggest.js index d276043f..f3f51fba 100644 --- a/src/routes/_actions/autosuggest.js +++ b/src/routes/_actions/autosuggest.js @@ -1,59 +1,59 @@ import { store } from '../_store/store' export async function insertUsername (realm, username, startIndex, endIndex) { - let { currentInstance } = store.get() - let oldText = store.getComposeData(realm, 'text') - let pre = oldText.substring(0, startIndex) - let post = oldText.substring(endIndex) - let newText = `${pre}@${username} ${post}` + const { currentInstance } = store.get() + const oldText = store.getComposeData(realm, 'text') + const pre = oldText.substring(0, startIndex) + const post = oldText.substring(endIndex) + const newText = `${pre}@${username} ${post}` store.setComposeData(realm, { text: newText }) store.setForAutosuggest(currentInstance, realm, { autosuggestSearchResults: [] }) } export async function clickSelectedAutosuggestionUsername (realm) { - let { + const { composeSelectionStart, autosuggestSearchText, autosuggestSelected, autosuggestSearchResults } = store.get() - let account = autosuggestSearchResults[autosuggestSelected] - let startIndex = composeSelectionStart - autosuggestSearchText.length - let endIndex = composeSelectionStart + const account = autosuggestSearchResults[autosuggestSelected] + const startIndex = composeSelectionStart - autosuggestSearchText.length + const endIndex = composeSelectionStart await insertUsername(realm, account.acct, startIndex, endIndex) } export function insertEmojiAtPosition (realm, emoji, startIndex, endIndex) { - let { currentInstance } = store.get() - let oldText = store.getComposeData(realm, 'text') || '' - let pre = oldText.substring(0, startIndex) - let post = oldText.substring(endIndex) - let newText = `${pre}:${emoji.shortcode}: ${post}` + const { currentInstance } = store.get() + const oldText = store.getComposeData(realm, 'text') || '' + const pre = oldText.substring(0, startIndex) + const post = oldText.substring(endIndex) + const newText = `${pre}:${emoji.shortcode}: ${post}` store.setComposeData(realm, { text: newText }) store.setForAutosuggest(currentInstance, realm, { autosuggestSearchResults: [] }) } export async function clickSelectedAutosuggestionEmoji (realm) { - let { + const { composeSelectionStart, autosuggestSearchText, autosuggestSelected, autosuggestSearchResults } = store.get() - let emoji = autosuggestSearchResults[autosuggestSelected] - let startIndex = composeSelectionStart - autosuggestSearchText.length - let endIndex = composeSelectionStart + const emoji = autosuggestSearchResults[autosuggestSelected] + const startIndex = composeSelectionStart - autosuggestSearchText.length + const endIndex = composeSelectionStart await insertEmojiAtPosition(realm, emoji, startIndex, endIndex) } export function selectAutosuggestItem (item) { - let { + const { currentComposeRealm, composeSelectionStart, autosuggestSearchText } = store.get() - let startIndex = composeSelectionStart - autosuggestSearchText.length - let endIndex = composeSelectionStart + const startIndex = composeSelectionStart - autosuggestSearchText.length + const endIndex = composeSelectionStart if (item.acct) { /* no await */ insertUsername(currentComposeRealm, item.acct, startIndex, endIndex) } else { diff --git a/src/routes/_actions/autosuggestAccountSearch.js b/src/routes/_actions/autosuggestAccountSearch.js index b0ed65df..89e92714 100644 --- a/src/routes/_actions/autosuggestAccountSearch.js +++ b/src/routes/_actions/autosuggestAccountSearch.js @@ -11,8 +11,8 @@ const DATABASE_SEARCH_RESULTS_LIMIT = 30 const promiseThrottler = new PromiseThrottler(200) // Mastodon FE also uses 200ms function byUsername (a, b) { - let usernameA = a.acct.toLowerCase() - let usernameB = b.acct.toLowerCase() + const usernameA = a.acct.toLowerCase() + const usernameB = b.acct.toLowerCase() return usernameA < usernameB ? -1 : usernameA === usernameB ? 0 : 1 } @@ -25,7 +25,7 @@ export function doAccountSearch (searchText) { let canceled = false let localResults let remoteResults - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() let controller = typeof AbortController === 'function' && new AbortController() function abortFetch () { @@ -60,7 +60,7 @@ export function doAccountSearch (searchText) { .slice(0, SEARCH_RESULTS_LIMIT) if (results.length < SEARCH_RESULTS_LIMIT) { - let topRemoteResults = (remoteResults || []) + const topRemoteResults = (remoteResults || []) .sort(byUsername) .slice(0, SEARCH_RESULTS_LIMIT - results.length) results = concat(results, topRemoteResults) @@ -74,7 +74,7 @@ export function doAccountSearch (searchText) { if (canceled) { return } - let results = mergeAndTruncateResults() + const results = mergeAndTruncateResults() store.setForCurrentAutosuggest({ autosuggestType: 'account', autosuggestSelected: 0, diff --git a/src/routes/_actions/autosuggestEmojiSearch.js b/src/routes/_actions/autosuggestEmojiSearch.js index d086688e..3b1b16e5 100644 --- a/src/routes/_actions/autosuggestEmojiSearch.js +++ b/src/routes/_actions/autosuggestEmojiSearch.js @@ -4,8 +4,8 @@ import { scheduleIdleTask } from '../_utils/scheduleIdleTask' function searchEmoji (searchText) { searchText = searchText.toLowerCase().substring(1) - let { currentCustomEmoji } = store.get() - let results = currentCustomEmoji.filter(emoji => emoji.shortcode.toLowerCase().startsWith(searchText)) + const { currentCustomEmoji } = store.get() + const results = currentCustomEmoji.filter(emoji => emoji.shortcode.toLowerCase().startsWith(searchText)) .sort((a, b) => a.shortcode.toLowerCase() < b.shortcode.toLowerCase() ? -1 : 1) .slice(0, SEARCH_RESULTS_LIMIT) return results @@ -18,7 +18,7 @@ export function doEmojiSearch (searchText) { if (canceled) { return } - let results = searchEmoji(searchText) + const results = searchEmoji(searchText) store.setForCurrentAutosuggest({ autosuggestType: 'emoji', autosuggestSelected: 0, diff --git a/src/routes/_actions/block.js b/src/routes/_actions/block.js index f3ac1e05..a0efee1c 100644 --- a/src/routes/_actions/block.js +++ b/src/routes/_actions/block.js @@ -5,7 +5,7 @@ import { updateLocalRelationship } from './accounts' import { emit } from '../_utils/eventBus' export async function setAccountBlocked (accountId, block, toastOnSuccess) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { let relationship if (block) { diff --git a/src/routes/_actions/compose.js b/src/routes/_actions/compose.js index 0dcd7fcb..0daf5c66 100644 --- a/src/routes/_actions/compose.js +++ b/src/routes/_actions/compose.js @@ -7,11 +7,11 @@ import { emit } from '../_utils/eventBus' import { putMediaMetadata } from '../_api/media' export async function insertHandleForReply (statusId) { - let { currentInstance } = store.get() - let status = await database.getStatus(currentInstance, statusId) - let { currentVerifyCredentials } = store.get() - let originalStatus = status.reblog || status - let accounts = [originalStatus.account].concat(originalStatus.mentions || []) + const { currentInstance } = store.get() + const status = await database.getStatus(currentInstance, statusId) + const { currentVerifyCredentials } = store.get() + const originalStatus = status.reblog || status + const accounts = [originalStatus.account].concat(originalStatus.mentions || []) .filter(account => account.id !== currentVerifyCredentials.id) if (!store.getComposeData(statusId, 'text') && accounts.length) { store.setComposeData(statusId, { @@ -23,7 +23,7 @@ export async function insertHandleForReply (statusId) { export async function postStatus (realm, text, inReplyToId, mediaIds, sensitive, spoilerText, visibility, mediaDescriptions, inReplyToUuid, poll, mediaFocalPoints) { - let { currentInstance, accessToken, online } = store.get() + const { currentInstance, accessToken, online } = store.get() if (!online) { toast.say('You cannot post while offline') @@ -32,7 +32,7 @@ export async function postStatus (realm, text, inReplyToId, mediaIds, text = text || '' - let mediaMetadata = (mediaIds || []).map((mediaId, idx) => { + const mediaMetadata = (mediaIds || []).map((mediaId, idx) => { return { description: mediaDescriptions && mediaDescriptions[idx], focalPoint: mediaFocalPoints && mediaFocalPoints[idx] @@ -50,7 +50,7 @@ export async function postStatus (realm, text, inReplyToId, mediaIds, return putMediaMetadata(currentInstance, accessToken, mediaIds[i], description, focalPoint) } })) - let status = await postStatusToServer(currentInstance, accessToken, text, + const status = await postStatusToServer(currentInstance, accessToken, text, inReplyToId, mediaIds, sensitive, spoilerText, visibility, poll, mediaFocalPoints) addStatusOrNotification(currentInstance, 'home', status) store.clearComposeData(realm) @@ -64,8 +64,8 @@ export async function postStatus (realm, text, inReplyToId, mediaIds, } export function setReplySpoiler (realm, spoiler) { - let contentWarning = store.getComposeData(realm, 'contentWarning') - let contentWarningShown = store.getComposeData(realm, 'contentWarningShown') + const contentWarning = store.getComposeData(realm, 'contentWarning') + const contentWarningShown = store.getComposeData(realm, 'contentWarningShown') if (typeof contentWarningShown !== 'undefined' || contentWarning) { return // user has already interacted with the CW } @@ -76,22 +76,22 @@ export function setReplySpoiler (realm, spoiler) { } const PRIVACY_LEVEL = { - 'direct': 1, - 'private': 2, - 'unlisted': 3, - 'public': 4 + direct: 1, + private: 2, + unlisted: 3, + public: 4 } export function setReplyVisibility (realm, replyVisibility) { // return the most private between the user's preferred default privacy // and the privacy of the status they're replying to - let postPrivacy = store.getComposeData(realm, 'postPrivacy') + const postPrivacy = store.getComposeData(realm, 'postPrivacy') if (typeof postPrivacy !== 'undefined') { return // user has already set the postPrivacy } - let { currentVerifyCredentials } = store.get() - let defaultVisibility = currentVerifyCredentials.source.privacy - let visibility = PRIVACY_LEVEL[replyVisibility] < PRIVACY_LEVEL[defaultVisibility] + const { currentVerifyCredentials } = store.get() + const defaultVisibility = currentVerifyCredentials.source.privacy + const visibility = PRIVACY_LEVEL[replyVisibility] < PRIVACY_LEVEL[defaultVisibility] ? replyVisibility : defaultVisibility store.setComposeData(realm, { postPrivacy: visibility }) diff --git a/src/routes/_actions/contentWarnings.js b/src/routes/_actions/contentWarnings.js index 43aef349..6cca8008 100644 --- a/src/routes/_actions/contentWarnings.js +++ b/src/routes/_actions/contentWarnings.js @@ -1,9 +1,9 @@ import { store } from '../_store/store' export function toggleContentWarningShown (realm) { - let shown = store.getComposeData(realm, 'contentWarningShown') - let contentWarning = store.getComposeData(realm, 'contentWarning') - let newShown = !shown + const shown = store.getComposeData(realm, 'contentWarningShown') + const contentWarning = store.getComposeData(realm, 'contentWarning') + const newShown = !shown store.setComposeData(realm, { contentWarning: newShown ? contentWarning : '', contentWarningShown: newShown diff --git a/src/routes/_actions/copyText.js b/src/routes/_actions/copyText.js index 2e31d156..a05d6591 100644 --- a/src/routes/_actions/copyText.js +++ b/src/routes/_actions/copyText.js @@ -12,6 +12,6 @@ export async function copyText (text) { } } - let showCopyDialog = await importShowCopyDialog() + const showCopyDialog = await importShowCopyDialog() showCopyDialog(text) } diff --git a/src/routes/_actions/createMakeProps.js b/src/routes/_actions/createMakeProps.js index 2f483d55..08e1dde3 100644 --- a/src/routes/_actions/createMakeProps.js +++ b/src/routes/_actions/createMakeProps.js @@ -36,7 +36,7 @@ export function createMakeProps (instanceName, timelineType, timelineValue) { return (itemId) => { taskCount++ - let promise = timelineType === 'notifications' + const promise = timelineType === 'notifications' ? getNotification(instanceName, timelineType, timelineValue, itemId) : getStatus(instanceName, timelineType, timelineValue, itemId) diff --git a/src/routes/_actions/delete.js b/src/routes/_actions/delete.js index 95a440a1..9c0c9b2e 100644 --- a/src/routes/_actions/delete.js +++ b/src/routes/_actions/delete.js @@ -4,9 +4,9 @@ import { toast } from '../_components/toast/toast' import { deleteStatus as deleteStatusLocally } from './deleteStatuses' export async function doDeleteStatus (statusId) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { - let deletedStatus = await deleteStatus(currentInstance, accessToken, statusId) + const deletedStatus = await deleteStatus(currentInstance, accessToken, statusId) deleteStatusLocally(currentInstance, statusId) toast.say('Status deleted.') return deletedStatus diff --git a/src/routes/_actions/deleteAndRedraft.js b/src/routes/_actions/deleteAndRedraft.js index 3cca19f1..738e69e1 100644 --- a/src/routes/_actions/deleteAndRedraft.js +++ b/src/routes/_actions/deleteAndRedraft.js @@ -4,9 +4,9 @@ import { doDeleteStatus } from './delete' import { store } from '../_store/store' export async function deleteAndRedraft (status) { - let deleteStatusPromise = doDeleteStatus(status.id) - let dialogPromise = importShowComposeDialog() - let deletedStatus = await deleteStatusPromise + const deleteStatusPromise = doDeleteStatus(status.id) + const dialogPromise = importShowComposeDialog() + const deletedStatus = await deleteStatusPromise store.setComposeData('dialog', { text: deletedStatus.text || statusHtmlToPlainText(status.content, status.mentions), @@ -24,6 +24,6 @@ export async function deleteAndRedraft (status) { options: (status.poll.options || []).map(option => option.title) } }) - let showComposeDialog = await dialogPromise + const showComposeDialog = await dialogPromise showComposeDialog() } diff --git a/src/routes/_actions/deleteStatuses.js b/src/routes/_actions/deleteStatuses.js index e8f13d83..e6ed6efd 100644 --- a/src/routes/_actions/deleteStatuses.js +++ b/src/routes/_actions/deleteStatuses.js @@ -5,17 +5,17 @@ import { database } from '../_database/database' import { scheduleIdleTask } from '../_utils/scheduleIdleTask' function filterItemIdsFromTimelines (instanceName, timelineFilter, idFilter) { - let keys = ['timelineItemSummaries', 'timelineItemSummariesToAdd'] - let summaryFilter = _ => idFilter(_.id) + const keys = ['timelineItemSummaries', 'timelineItemSummariesToAdd'] + const summaryFilter = _ => idFilter(_.id) keys.forEach(key => { - let timelineData = store.getAllTimelineData(instanceName, key) + const timelineData = store.getAllTimelineData(instanceName, key) Object.keys(timelineData).forEach(timelineName => { - let summaries = timelineData[timelineName] + const summaries = timelineData[timelineName] if (!timelineFilter(timelineName)) { return } - let filteredSummaries = summaries.filter(summaryFilter) + const filteredSummaries = summaries.filter(summaryFilter) if (!isEqual(summaries, filteredSummaries)) { console.log('deleting an item from timelineName', timelineName, 'for key', key) store.setForTimeline(instanceName, timelineName, { @@ -27,17 +27,17 @@ function filterItemIdsFromTimelines (instanceName, timelineFilter, idFilter) { } function deleteStatusIdsFromStore (instanceName, idsToDelete) { - let idsToDeleteSet = new Set(idsToDelete) - let idWasNotDeleted = id => !idsToDeleteSet.has(id) - let notNotificationTimeline = timelineName => timelineName !== 'notifications' + const idsToDeleteSet = new Set(idsToDelete) + const idWasNotDeleted = id => !idsToDeleteSet.has(id) + const notNotificationTimeline = timelineName => timelineName !== 'notifications' filterItemIdsFromTimelines(instanceName, notNotificationTimeline, idWasNotDeleted) } function deleteNotificationIdsFromStore (instanceName, idsToDelete) { - let idsToDeleteSet = new Set(idsToDelete) - let idWasNotDeleted = id => !idsToDeleteSet.has(id) - let isNotificationTimeline = timelineName => timelineName === 'notifications' + const idsToDeleteSet = new Set(idsToDelete) + const idWasNotDeleted = id => !idsToDeleteSet.has(id) + const isNotificationTimeline = timelineName => timelineName === 'notifications' filterItemIdsFromTimelines(instanceName, isNotificationTimeline, idWasNotDeleted) } @@ -50,9 +50,9 @@ async function deleteStatusesAndNotifications (instanceName, statusIdsToDelete, async function doDeleteStatus (instanceName, statusId) { console.log('deleting statusId', statusId) - let rebloggedIds = await getIdsThatRebloggedThisStatus(instanceName, statusId) - let statusIdsToDelete = Array.from(new Set([statusId].concat(rebloggedIds).filter(Boolean))) - let notificationIdsToDelete = Array.from(new Set(await getNotificationIdsForStatuses(instanceName, statusIdsToDelete))) + const rebloggedIds = await getIdsThatRebloggedThisStatus(instanceName, statusId) + const statusIdsToDelete = Array.from(new Set([statusId].concat(rebloggedIds).filter(Boolean))) + const notificationIdsToDelete = Array.from(new Set(await getNotificationIdsForStatuses(instanceName, statusIdsToDelete))) await deleteStatusesAndNotifications(instanceName, statusIdsToDelete, notificationIdsToDelete) } diff --git a/src/routes/_actions/emoji.js b/src/routes/_actions/emoji.js index 21576864..10ab2b38 100644 --- a/src/routes/_actions/emoji.js +++ b/src/routes/_actions/emoji.js @@ -9,7 +9,7 @@ export async function updateCustomEmojiForInstance (instanceName) { () => database.getCustomEmoji(instanceName), emoji => database.setCustomEmoji(instanceName, emoji), emoji => { - let { customEmoji } = store.get() + const { customEmoji } = store.get() customEmoji[instanceName] = emoji store.set({ customEmoji: customEmoji }) } @@ -17,12 +17,12 @@ export async function updateCustomEmojiForInstance (instanceName) { } export function insertEmoji (realm, emoji) { - let emojiText = emoji.custom ? emoji.colons : emoji.native - let { composeSelectionStart } = store.get() - let idx = composeSelectionStart || 0 - let oldText = store.getComposeData(realm, 'text') || '' - let pre = oldText.substring(0, idx) - let post = oldText.substring(idx) - let newText = `${pre}${emojiText} ${post}` + const emojiText = emoji.custom ? emoji.colons : emoji.native + const { composeSelectionStart } = store.get() + const idx = composeSelectionStart || 0 + const oldText = store.getComposeData(realm, 'text') || '' + const pre = oldText.substring(0, idx) + const post = oldText.substring(idx) + const newText = `${pre}${emojiText} ${post}` store.setComposeData(realm, { text: newText }) } diff --git a/src/routes/_actions/favorite.js b/src/routes/_actions/favorite.js index a056437f..b2953328 100644 --- a/src/routes/_actions/favorite.js +++ b/src/routes/_actions/favorite.js @@ -4,13 +4,13 @@ import { toast } from '../_components/toast/toast' import { database } from '../_database/database' export async function setFavorited (statusId, favorited) { - let { online } = store.get() + const { online } = store.get() if (!online) { toast.say(`You cannot ${favorited ? 'favorite' : 'unfavorite'} while offline.`) return } - let { currentInstance, accessToken } = store.get() - let networkPromise = favorited + const { currentInstance, accessToken } = store.get() + const networkPromise = favorited ? favoriteStatus(currentInstance, accessToken, statusId) : unfavoriteStatus(currentInstance, accessToken, statusId) store.setStatusFavorited(currentInstance, statusId, favorited) // optimistic update diff --git a/src/routes/_actions/follow.js b/src/routes/_actions/follow.js index 12e2ac52..668a94c2 100644 --- a/src/routes/_actions/follow.js +++ b/src/routes/_actions/follow.js @@ -4,7 +4,7 @@ import { toast } from '../_components/toast/toast' import { updateLocalRelationship } from './accounts' export async function setAccountFollowed (accountId, follow, toastOnSuccess) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { let relationship if (follow) { diff --git a/src/routes/_actions/followRequests.js b/src/routes/_actions/followRequests.js index 2e3d5c7e..0099644b 100644 --- a/src/routes/_actions/followRequests.js +++ b/src/routes/_actions/followRequests.js @@ -2,16 +2,16 @@ import { DEFAULT_TIMEOUT, get, post, WRITE_TIMEOUT } from '../_utils/ajax' import { auth, basename } from '../_api/utils' export async function getFollowRequests (instanceName, accessToken) { - let url = `${basename(instanceName)}/api/v1/follow_requests` + const url = `${basename(instanceName)}/api/v1/follow_requests` return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) } export async function authorizeFollowRequest (instanceName, accessToken, id) { - let url = `${basename(instanceName)}/api/v1/follow_requests/${id}/authorize` + const url = `${basename(instanceName)}/api/v1/follow_requests/${id}/authorize` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } export async function rejectFollowRequest (instanceName, accessToken, id) { - let url = `${basename(instanceName)}/api/v1/follow_requests/${id}/reject` + const url = `${basename(instanceName)}/api/v1/follow_requests/${id}/reject` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_actions/instances.js b/src/routes/_actions/instances.js index 92807f5f..fe5dc095 100644 --- a/src/routes/_actions/instances.js +++ b/src/routes/_actions/instances.js @@ -8,31 +8,31 @@ import { getInstanceInfo } from '../_api/instance' import { database } from '../_database/database' export function changeTheme (instanceName, newTheme) { - let { instanceThemes } = store.get() + const { instanceThemes } = store.get() instanceThemes[instanceName] = newTheme store.set({ instanceThemes: instanceThemes }) store.save() - let { currentInstance } = store.get() + const { currentInstance } = store.get() if (instanceName === currentInstance) { - let { enableGrayscale } = store.get() + const { enableGrayscale } = store.get() switchToTheme(newTheme, enableGrayscale) } } export function switchToInstance (instanceName) { - let { instanceThemes } = store.get() + const { instanceThemes } = store.get() store.set({ currentInstance: instanceName, searchResults: null, queryInSearch: '' }) store.save() - let { enableGrayscale } = store.get() + const { enableGrayscale } = store.get() switchToTheme(instanceThemes[instanceName], enableGrayscale) } export async function logOutOfInstance (instanceName) { - let { + const { loggedInInstances, instanceThemes, loggedInInstancesInOrder, @@ -40,7 +40,7 @@ export async function logOutOfInstance (instanceName) { currentInstance } = store.get() loggedInInstancesInOrder.splice(loggedInInstancesInOrder.indexOf(instanceName), 1) - let newInstance = instanceName === currentInstance + const newInstance = instanceName === currentInstance ? loggedInInstancesInOrder[0] : currentInstance delete loggedInInstances[instanceName] @@ -57,21 +57,21 @@ export async function logOutOfInstance (instanceName) { }) store.save() toast.say(`Logged out of ${instanceName}`) - let { enableGrayscale } = store.get() + const { enableGrayscale } = store.get() switchToTheme(instanceThemes[newInstance], enableGrayscale) /* no await */ database.clearDatabaseForInstance(instanceName) goto('/settings/instances') } function setStoreVerifyCredentials (instanceName, thisVerifyCredentials) { - let { verifyCredentials } = store.get() + const { verifyCredentials } = store.get() verifyCredentials[instanceName] = thisVerifyCredentials store.set({ verifyCredentials: verifyCredentials }) } export async function updateVerifyCredentialsForInstance (instanceName) { - let { loggedInInstances } = store.get() - let accessToken = loggedInInstances[instanceName].access_token + const { loggedInInstances } = store.get() + const accessToken = loggedInInstances[instanceName].access_token await cacheFirstUpdateAfter( () => getVerifyCredentials(instanceName, accessToken), () => database.getInstanceVerifyCredentials(instanceName), @@ -81,7 +81,7 @@ export async function updateVerifyCredentialsForInstance (instanceName) { } export async function updateVerifyCredentialsForCurrentInstance () { - let { currentInstance } = store.get() + const { currentInstance } = store.get() await updateVerifyCredentialsForInstance(currentInstance) } @@ -91,7 +91,7 @@ export async function updateInstanceInfo (instanceName) { () => database.getInstanceInfo(instanceName), info => database.setInstanceInfo(instanceName, info), info => { - let { instanceInfos } = store.get() + const { instanceInfos } = store.get() instanceInfos[instanceName] = info store.set({ instanceInfos: instanceInfos }) } diff --git a/src/routes/_actions/lists.js b/src/routes/_actions/lists.js index d903273b..8dba682b 100644 --- a/src/routes/_actions/lists.js +++ b/src/routes/_actions/lists.js @@ -4,15 +4,15 @@ import { cacheFirstUpdateAfter } from '../_utils/sync' import { database } from '../_database/database' export async function updateListsForInstance (instanceName) { - let { loggedInInstances } = store.get() - let accessToken = loggedInInstances[instanceName].access_token + const { loggedInInstances } = store.get() + const accessToken = loggedInInstances[instanceName].access_token await cacheFirstUpdateAfter( () => getLists(instanceName, accessToken), () => database.getLists(instanceName), lists => database.setLists(instanceName, lists), lists => { - let { instanceLists } = store.get() + const { instanceLists } = store.get() instanceLists[instanceName] = lists store.set({ instanceLists: instanceLists }) } diff --git a/src/routes/_actions/media.js b/src/routes/_actions/media.js index 57434037..6719929c 100644 --- a/src/routes/_actions/media.js +++ b/src/routes/_actions/media.js @@ -4,11 +4,11 @@ import { toast } from '../_components/toast/toast' import { scheduleIdleTask } from '../_utils/scheduleIdleTask' export async function doMediaUpload (realm, file) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() store.set({ uploadingMedia: true }) try { - let response = await uploadMedia(currentInstance, accessToken, file) - let composeMedia = store.getComposeData(realm, 'media') || [] + const response = await uploadMedia(currentInstance, accessToken, file) + const composeMedia = store.getComposeData(realm, 'media') || [] if (composeMedia.length === 4) { throw new Error('Only 4 media max are allowed') } @@ -30,7 +30,7 @@ export async function doMediaUpload (realm, file) { } export function deleteMedia (realm, i) { - let composeMedia = store.getComposeData(realm, 'media') + const composeMedia = store.getComposeData(realm, 'media') composeMedia.splice(i, 1) store.setComposeData(realm, { diff --git a/src/routes/_actions/mention.js b/src/routes/_actions/mention.js index 68bf84e2..a3e615b1 100644 --- a/src/routes/_actions/mention.js +++ b/src/routes/_actions/mention.js @@ -3,6 +3,6 @@ import { store } from '../_store/store' export async function composeNewStatusMentioning (account) { store.setComposeData('dialog', { text: `@${account.acct} ` }) - let showComposeDialog = await importShowComposeDialog() + const showComposeDialog = await importShowComposeDialog() showComposeDialog() } diff --git a/src/routes/_actions/mute.js b/src/routes/_actions/mute.js index 549bc06c..6d34cb69 100644 --- a/src/routes/_actions/mute.js +++ b/src/routes/_actions/mute.js @@ -5,7 +5,7 @@ import { updateLocalRelationship } from './accounts' import { emit } from '../_utils/eventBus' export async function setAccountMuted (accountId, mute, notifications, toastOnSuccess) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { let relationship if (mute) { diff --git a/src/routes/_actions/muteConversation.js b/src/routes/_actions/muteConversation.js index ab6b48da..620a2e34 100644 --- a/src/routes/_actions/muteConversation.js +++ b/src/routes/_actions/muteConversation.js @@ -4,7 +4,7 @@ import { toast } from '../_components/toast/toast' import { database } from '../_database/database' export async function setConversationMuted (statusId, mute, toastOnSuccess) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { if (mute) { await muteConversation(currentInstance, accessToken, statusId) diff --git a/src/routes/_actions/onUserIsLoggedOut.js b/src/routes/_actions/onUserIsLoggedOut.js index c1829963..9155144d 100644 --- a/src/routes/_actions/onUserIsLoggedOut.js +++ b/src/routes/_actions/onUserIsLoggedOut.js @@ -4,7 +4,7 @@ export function onUserIsLoggedOut () { if (document.getElementById('hiddenFromSsrStyle')) { return } - let style = document.createElement('style') + const style = document.createElement('style') style.setAttribute('id', 'hiddenFromSsrStyle') style.textContent = '.hidden-from-ssr { opacity: 1 !important; }' document.head.appendChild(style) diff --git a/src/routes/_actions/pin.js b/src/routes/_actions/pin.js index 717b2421..94137645 100644 --- a/src/routes/_actions/pin.js +++ b/src/routes/_actions/pin.js @@ -5,7 +5,7 @@ import { database } from '../_database/database' import { emit } from '../_utils/eventBus' export async function setStatusPinnedOrUnpinned (statusId, pinned, toastOnSuccess) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { if (pinned) { await pinStatus(currentInstance, accessToken, statusId) diff --git a/src/routes/_actions/pinnedStatuses.js b/src/routes/_actions/pinnedStatuses.js index 02923858..f38f5c58 100644 --- a/src/routes/_actions/pinnedStatuses.js +++ b/src/routes/_actions/pinnedStatuses.js @@ -6,12 +6,12 @@ import { } from '../_api/pinnedStatuses' export async function updatePinnedStatusesForAccount (accountId) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() await cacheFirstUpdateAfter( () => getPinnedStatuses(currentInstance, accessToken, accountId), async () => { - let pinnedStatuses = await database.getPinnedStatuses(currentInstance, accountId) + const pinnedStatuses = await database.getPinnedStatuses(currentInstance, accountId) if (!pinnedStatuses || !pinnedStatuses.every(Boolean)) { throw new Error('missing pinned statuses in idb') } @@ -19,7 +19,7 @@ export async function updatePinnedStatusesForAccount (accountId) { }, statuses => database.insertPinnedStatuses(currentInstance, accountId, statuses), statuses => { - let { pinnedStatuses } = store.get() + const { pinnedStatuses } = store.get() pinnedStatuses[currentInstance] = pinnedStatuses[currentInstance] || {} pinnedStatuses[currentInstance][accountId] = statuses store.set({ pinnedStatuses: pinnedStatuses }) diff --git a/src/routes/_actions/polls.js b/src/routes/_actions/polls.js index b4195815..5e532c44 100644 --- a/src/routes/_actions/polls.js +++ b/src/routes/_actions/polls.js @@ -3,9 +3,9 @@ import { store } from '../_store/store' import { toast } from '../_components/toast/toast' export async function getPoll (pollId) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { - let poll = await getPollApi(currentInstance, accessToken, pollId) + const poll = await getPollApi(currentInstance, accessToken, pollId) return poll } catch (e) { console.error(e) @@ -14,9 +14,9 @@ export async function getPoll (pollId) { } export async function voteOnPoll (pollId, choices) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { - let poll = await voteOnPollApi(currentInstance, accessToken, pollId, choices.map(_ => _.toString())) + const poll = await voteOnPollApi(currentInstance, accessToken, pollId, choices.map(_ => _.toString())) return poll } catch (e) { console.error(e) diff --git a/src/routes/_actions/reblog.js b/src/routes/_actions/reblog.js index 11338803..87b9f007 100644 --- a/src/routes/_actions/reblog.js +++ b/src/routes/_actions/reblog.js @@ -4,13 +4,13 @@ import { reblogStatus, unreblogStatus } from '../_api/reblog' import { database } from '../_database/database' export async function setReblogged (statusId, reblogged) { - let online = store.get() + const online = store.get() if (!online) { toast.say(`You cannot ${reblogged ? 'boost' : 'unboost'} while offline.`) return } - let { currentInstance, accessToken } = store.get() - let networkPromise = reblogged + const { currentInstance, accessToken } = store.get() + const networkPromise = reblogged ? reblogStatus(currentInstance, accessToken, statusId) : unreblogStatus(currentInstance, accessToken, statusId) store.setStatusReblogged(currentInstance, statusId, reblogged) // optimistic update diff --git a/src/routes/_actions/report.js b/src/routes/_actions/report.js index 55aef1f9..63d7f461 100644 --- a/src/routes/_actions/report.js +++ b/src/routes/_actions/report.js @@ -1,6 +1,6 @@ import { importShowReportDialog } from '../_components/dialog/asyncDialogs' export async function reportStatusOrAccount ({ status, account }) { - let showReportDialog = await importShowReportDialog() + const showReportDialog = await importShowReportDialog() showReportDialog({ status, account }) } diff --git a/src/routes/_actions/reportStatuses.js b/src/routes/_actions/reportStatuses.js index fc67bf7c..46806024 100644 --- a/src/routes/_actions/reportStatuses.js +++ b/src/routes/_actions/reportStatuses.js @@ -3,7 +3,7 @@ import { toast } from '../_components/toast/toast' import { report } from '../_api/report' export async function reportStatuses (account, statusIds, comment, forward) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { await report(currentInstance, accessToken, account.id, statusIds, comment, forward) toast.say('Submitted report') diff --git a/src/routes/_actions/requests.js b/src/routes/_actions/requests.js index 3122dd6d..2d46668d 100644 --- a/src/routes/_actions/requests.js +++ b/src/routes/_actions/requests.js @@ -4,7 +4,7 @@ import { emit } from '../_utils/eventBus' import { toast } from '../_components/toast/toast' export async function setFollowRequestApprovedOrRejected (accountId, approved, toastOnSuccess) { - let { + const { currentInstance, accessToken } = store.get() diff --git a/src/routes/_actions/search.js b/src/routes/_actions/search.js index 9a98d490..13a30e03 100644 --- a/src/routes/_actions/search.js +++ b/src/routes/_actions/search.js @@ -3,11 +3,11 @@ import { toast } from '../_components/toast/toast' import { search } from '../_api/search' export async function doSearch () { - let { currentInstance, accessToken, queryInSearch } = store.get() + const { currentInstance, accessToken, queryInSearch } = store.get() store.set({ searchLoading: true }) try { - let results = await search(currentInstance, accessToken, queryInSearch) - let { queryInSearch: newQueryInSearch } = store.get() // avoid race conditions + const results = await search(currentInstance, accessToken, queryInSearch) + const { queryInSearch: newQueryInSearch } = store.get() // avoid race conditions if (newQueryInSearch === queryInSearch) { store.set({ searchResultsForQuery: queryInSearch, diff --git a/src/routes/_actions/setDomainBlocked.js b/src/routes/_actions/setDomainBlocked.js index e0c753ba..a9a635b0 100644 --- a/src/routes/_actions/setDomainBlocked.js +++ b/src/routes/_actions/setDomainBlocked.js @@ -4,7 +4,7 @@ import { toast } from '../_components/toast/toast' import { updateRelationship } from './accounts' export async function setDomainBlocked (accountId, domain, block, toastOnSuccess) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { if (block) { await blockDomain(currentInstance, accessToken, domain) diff --git a/src/routes/_actions/setShowReblogs.js b/src/routes/_actions/setShowReblogs.js index 1eb404aa..c7cb0dc6 100644 --- a/src/routes/_actions/setShowReblogs.js +++ b/src/routes/_actions/setShowReblogs.js @@ -4,9 +4,9 @@ import { toast } from '../_components/toast/toast' import { updateLocalRelationship } from './accounts' export async function setShowReblogs (accountId, showReblogs, toastOnSuccess) { - let { currentInstance, accessToken } = store.get() + const { currentInstance, accessToken } = store.get() try { - let relationship = await setShowReblogsApi(currentInstance, accessToken, accountId, showReblogs) + const relationship = await setShowReblogsApi(currentInstance, accessToken, accountId, showReblogs) await updateLocalRelationship(currentInstance, accountId, relationship) if (toastOnSuccess) { if (showReblogs) { diff --git a/src/routes/_actions/showMoreAndScrollToTop.js b/src/routes/_actions/showMoreAndScrollToTop.js index 6d0ed67d..188fea86 100644 --- a/src/routes/_actions/showMoreAndScrollToTop.js +++ b/src/routes/_actions/showMoreAndScrollToTop.js @@ -11,27 +11,27 @@ export function showMoreAndScrollToTop () { // Similar to Twitter, pressing "." will click the "show more" button and select // the first toot. showMoreItemsForCurrentTimeline() - let { + const { currentInstance, timelineItemSummaries, currentTimelineType, currentTimelineValue } = store.get() - let firstItemSummary = timelineItemSummaries && timelineItemSummaries[0] + const firstItemSummary = timelineItemSummaries && timelineItemSummaries[0] if (!firstItemSummary) { return } - let notificationId = currentTimelineType === 'notifications' && firstItemSummary.id - let statusId = currentTimelineType !== 'notifications' && firstItemSummary.id + const notificationId = currentTimelineType === 'notifications' && firstItemSummary.id + const statusId = currentTimelineType !== 'notifications' && firstItemSummary.id scrollToTop(/* smooth */ false) // try 5 times to wait for the element to be rendered and then focus it let count = 0 const tryToFocusElement = () => { - let uuid = createStatusOrNotificationUuid( + const uuid = createStatusOrNotificationUuid( currentInstance, currentTimelineType, currentTimelineValue, notificationId, statusId ) - let element = document.getElementById(uuid) + const element = document.getElementById(uuid) if (element) { try { element.focus({ preventScroll: true }) diff --git a/src/routes/_actions/showShareDialogIfNecessary.js b/src/routes/_actions/showShareDialogIfNecessary.js index c7207441..ef70a745 100644 --- a/src/routes/_actions/showShareDialogIfNecessary.js +++ b/src/routes/_actions/showShareDialogIfNecessary.js @@ -2,10 +2,10 @@ import { store } from '../_store/store' import { importShowComposeDialog } from '../_components/dialog/asyncDialogs' export async function showShareDialogIfNecessary () { - let { isUserLoggedIn, openShareDialog } = store.get() + const { isUserLoggedIn, openShareDialog } = store.get() store.set({ openShareDialog: false }) if (isUserLoggedIn && openShareDialog) { - let showComposeDialog = await importShowComposeDialog() + const showComposeDialog = await importShowComposeDialog() showComposeDialog() } } diff --git a/src/routes/_actions/statuses.js b/src/routes/_actions/statuses.js index de07418d..295e307f 100644 --- a/src/routes/_actions/statuses.js +++ b/src/routes/_actions/statuses.js @@ -1,12 +1,12 @@ import { database } from '../_database/database' export async function getIdThatThisStatusReblogged (instanceName, statusId) { - let status = await database.getStatus(instanceName, statusId) + const status = await database.getStatus(instanceName, statusId) return status.reblog && status.reblog.id } export async function getIdsThatTheseStatusesReblogged (instanceName, statusIds) { - let reblogIds = await Promise.all(statusIds.map(async statusId => { + const reblogIds = await Promise.all(statusIds.map(async statusId => { return getIdThatThisStatusReblogged(instanceName, statusId) })) return reblogIds.filter(Boolean) diff --git a/src/routes/_actions/stream/streaming.js b/src/routes/_actions/stream/streaming.js index 5fe8b171..61cd45ac 100644 --- a/src/routes/_actions/stream/streaming.js +++ b/src/routes/_actions/stream/streaming.js @@ -35,11 +35,11 @@ export function createStream (api, instanceName, accessToken, timelineName, firs console.log(`streaming ${instanceName} ${timelineName}: reconnected`) // When reconnecting, we recompute the firstStatusId and firstNotificationId because these may have // changed since we first started streaming. - let newFirstStatusId = store.getFirstTimelineItemId(instanceName, timelineName) + const newFirstStatusId = store.getFirstTimelineItemId(instanceName, timelineName) fillGap(timelineName, newFirstStatusId) if (timelineName === 'home') { // special case - home timeline stream also handles notifications - let newFirstNotificationId = store.getFirstTimelineItemId(instanceName, 'notifications') + const newFirstNotificationId = store.getFirstTimelineItemId(instanceName, 'notifications') fillGap('notifications', newFirstNotificationId) } } diff --git a/src/routes/_actions/timeline.js b/src/routes/_actions/timeline.js index fcaf2a0a..298d5bb3 100644 --- a/src/routes/_actions/timeline.js +++ b/src/routes/_actions/timeline.js @@ -25,10 +25,10 @@ async function storeFreshTimelineItemsInDatabase (instanceName, timelineName, it async function fetchTimelineItemsFromNetwork (instanceName, accessToken, timelineName, lastTimelineItemId) { if (timelineName.startsWith('status/')) { // special case - this is a list of descendents and ancestors - let statusId = timelineName.split('/').slice(-1)[0] - let statusRequest = getStatus(instanceName, accessToken, statusId) - let contextRequest = getStatusContext(instanceName, accessToken, statusId) - let [ status, context ] = await Promise.all([statusRequest, contextRequest]) + const statusId = timelineName.split('/').slice(-1)[0] + const statusRequest = getStatus(instanceName, accessToken, statusId) + const contextRequest = getStatusContext(instanceName, accessToken, statusId) + const [status, context] = await Promise.all([statusRequest, contextRequest]) return concat(context.ancestors, status, context.descendants) } else { // normal timeline return getTimeline(instanceName, accessToken, timelineName, lastTimelineItemId, null, TIMELINE_BATCH_SIZE) @@ -61,16 +61,16 @@ async function fetchTimelineItems (instanceName, accessToken, timelineName, last async function addTimelineItems (instanceName, timelineName, items, stale) { console.log('addTimelineItems, length:', items.length) mark('addTimelineItemSummaries') - let newSummaries = items.map(timelineItemToSummary) + const newSummaries = items.map(timelineItemToSummary) addTimelineItemSummaries(instanceName, timelineName, newSummaries, stale) stop('addTimelineItemSummaries') } export async function addTimelineItemSummaries (instanceName, timelineName, newSummaries, newStale) { - let oldSummaries = store.getForTimeline(instanceName, timelineName, 'timelineItemSummaries') || [] - let oldStale = store.getForTimeline(instanceName, timelineName, 'timelineItemSummariesAreStale') + const oldSummaries = store.getForTimeline(instanceName, timelineName, 'timelineItemSummaries') || [] + const oldStale = store.getForTimeline(instanceName, timelineName, 'timelineItemSummariesAreStale') - let mergedSummaries = mergeArrays(oldSummaries, newSummaries, compareTimelineItemSummaries) + const mergedSummaries = mergeArrays(oldSummaries, newSummaries, compareTimelineItemSummaries) if (!isEqual(oldSummaries, mergedSummaries)) { store.setForTimeline(instanceName, timelineName, { timelineItemSummaries: mergedSummaries }) @@ -82,7 +82,7 @@ export async function addTimelineItemSummaries (instanceName, timelineName, newS async function fetchTimelineItemsAndPossiblyFallBack () { mark('fetchTimelineItemsAndPossiblyFallBack') - let { + const { currentTimeline, currentInstance, accessToken, @@ -90,7 +90,7 @@ async function fetchTimelineItemsAndPossiblyFallBack () { online } = store.get() - let { items, stale } = await fetchTimelineItems(currentInstance, accessToken, currentTimeline, lastTimelineItemId, online) + const { items, stale } = await fetchTimelineItems(currentInstance, accessToken, currentTimeline, lastTimelineItemId, online) addTimelineItems(currentInstance, currentTimeline, items, stale) stop('fetchTimelineItemsAndPossiblyFallBack') } @@ -101,7 +101,7 @@ export async function setupTimeline () { // (i.e. via offline mode), then we need to re-fetch // Also do this if it's a thread, because threads change pretty frequently and // we don't have a good way to update them. - let { + const { timelineItemSummaries, timelineItemSummariesAreStale, currentTimeline @@ -136,7 +136,7 @@ export async function showMoreItemsForTimeline (instanceName, timelineName) { } export function showMoreItemsForCurrentTimeline () { - let { currentInstance, currentTimeline } = store.get() + const { currentInstance, currentTimeline } = store.get() return showMoreItemsForTimeline( currentInstance, currentTimeline @@ -145,11 +145,11 @@ export function showMoreItemsForCurrentTimeline () { export async function showMoreItemsForThread (instanceName, timelineName) { mark('showMoreItemsForThread') - let itemSummariesToAdd = store.getForTimeline(instanceName, timelineName, 'timelineItemSummariesToAdd') - let timelineItemSummaries = store.getForTimeline(instanceName, timelineName, 'timelineItemSummaries') - let timelineItemIds = new Set(timelineItemSummaries.map(_ => _.id)) + const itemSummariesToAdd = store.getForTimeline(instanceName, timelineName, 'timelineItemSummariesToAdd') + const timelineItemSummaries = store.getForTimeline(instanceName, timelineName, 'timelineItemSummaries') + const timelineItemIds = new Set(timelineItemSummaries.map(_ => _.id)) // TODO: update database and do the thread merge correctly - for (let itemSummaryToAdd of itemSummariesToAdd) { + for (const itemSummaryToAdd of itemSummariesToAdd) { if (!timelineItemIds.has(itemSummaryToAdd.id)) { timelineItemSummaries.push(itemSummaryToAdd) } diff --git a/src/routes/_api/block.js b/src/routes/_api/block.js index 00488215..730d0c3c 100644 --- a/src/routes/_api/block.js +++ b/src/routes/_api/block.js @@ -2,11 +2,11 @@ import { auth, basename } from './utils' import { post, WRITE_TIMEOUT } from '../_utils/ajax' export async function blockAccount (instanceName, accessToken, accountId) { - let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/block` + const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/block` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } export async function unblockAccount (instanceName, accessToken, accountId) { - let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/unblock` + const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/unblock` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/blockDomain.js b/src/routes/_api/blockDomain.js index 0790b32a..ae022e95 100644 --- a/src/routes/_api/blockDomain.js +++ b/src/routes/_api/blockDomain.js @@ -2,11 +2,11 @@ import { post, WRITE_TIMEOUT, paramsString, del } from '../_utils/ajax' import { auth, basename } from './utils' export async function blockDomain (instanceName, accessToken, domain) { - let url = `${basename(instanceName)}/api/v1/domain_blocks?${paramsString({ domain })}` + const url = `${basename(instanceName)}/api/v1/domain_blocks?${paramsString({ domain })}` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } export async function unblockDomain (instanceName, accessToken, domain) { - let url = `${basename(instanceName)}/api/v1/domain_blocks?${paramsString({ domain })}` + const url = `${basename(instanceName)}/api/v1/domain_blocks?${paramsString({ domain })}` return del(url, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/delete.js b/src/routes/_api/delete.js index 326f734b..d8a9a765 100644 --- a/src/routes/_api/delete.js +++ b/src/routes/_api/delete.js @@ -2,6 +2,6 @@ import { auth, basename } from './utils' import { del, WRITE_TIMEOUT } from '../_utils/ajax' export async function deleteStatus (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}` return del(url, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/emoji.js b/src/routes/_api/emoji.js index 45459a0a..1c210db4 100644 --- a/src/routes/_api/emoji.js +++ b/src/routes/_api/emoji.js @@ -2,6 +2,6 @@ import { basename } from './utils' import { DEFAULT_TIMEOUT, get } from '../_utils/ajax' export async function getCustomEmoji (instanceName) { - let url = `${basename(instanceName)}/api/v1/custom_emojis` + const url = `${basename(instanceName)}/api/v1/custom_emojis` return get(url, null, { timeout: DEFAULT_TIMEOUT }) } diff --git a/src/routes/_api/favorite.js b/src/routes/_api/favorite.js index 0eb60cf3..5232cac7 100644 --- a/src/routes/_api/favorite.js +++ b/src/routes/_api/favorite.js @@ -2,11 +2,11 @@ import { post, WRITE_TIMEOUT } from '../_utils/ajax' import { basename, auth } from './utils' export async function favoriteStatus (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/favourite` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/favourite` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } export async function unfavoriteStatus (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/unfavourite` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/unfavourite` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/follow.js b/src/routes/_api/follow.js index 9cc4ba71..3e16b0a7 100644 --- a/src/routes/_api/follow.js +++ b/src/routes/_api/follow.js @@ -2,11 +2,11 @@ import { post, WRITE_TIMEOUT } from '../_utils/ajax' import { auth, basename } from './utils' export async function followAccount (instanceName, accessToken, accountId) { - let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/follow` + const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/follow` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } export async function unfollowAccount (instanceName, accessToken, accountId) { - let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/unfollow` + const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/unfollow` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/instance.js b/src/routes/_api/instance.js index 30afb2eb..1b7cb624 100644 --- a/src/routes/_api/instance.js +++ b/src/routes/_api/instance.js @@ -2,6 +2,6 @@ import { get, DEFAULT_TIMEOUT } from '../_utils/ajax' import { basename } from './utils' export function getInstanceInfo (instanceName) { - let url = `${basename(instanceName)}/api/v1/instance` + const url = `${basename(instanceName)}/api/v1/instance` return get(url, null, { timeout: DEFAULT_TIMEOUT }) } diff --git a/src/routes/_api/lists.js b/src/routes/_api/lists.js index 09c6b404..c1f79a14 100644 --- a/src/routes/_api/lists.js +++ b/src/routes/_api/lists.js @@ -2,6 +2,6 @@ import { get, DEFAULT_TIMEOUT } from '../_utils/ajax' import { auth, basename } from './utils' export function getLists (instanceName, accessToken) { - let url = `${basename(instanceName)}/api/v1/lists` + const url = `${basename(instanceName)}/api/v1/lists` return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) } diff --git a/src/routes/_api/media.js b/src/routes/_api/media.js index c06dd40a..68bd0d21 100644 --- a/src/routes/_api/media.js +++ b/src/routes/_api/media.js @@ -2,16 +2,16 @@ import { auth, basename } from './utils' import { post, put, MEDIA_WRITE_TIMEOUT, WRITE_TIMEOUT } from '../_utils/ajax' export async function uploadMedia (instanceName, accessToken, file, description) { - let formData = new FormData() + const formData = new FormData() formData.append('file', file) if (description) { formData.append('description', description) } - let url = `${basename(instanceName)}/api/v1/media` + const url = `${basename(instanceName)}/api/v1/media` return post(url, formData, auth(accessToken), { timeout: MEDIA_WRITE_TIMEOUT }) } export async function putMediaMetadata (instanceName, accessToken, mediaId, description, focus) { - let url = `${basename(instanceName)}/api/v1/media/${mediaId}` + const url = `${basename(instanceName)}/api/v1/media/${mediaId}` return put(url, { description, focus: (focus && focus.join(',')) }, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/mute.js b/src/routes/_api/mute.js index 64d22e8d..cecc7f69 100644 --- a/src/routes/_api/mute.js +++ b/src/routes/_api/mute.js @@ -2,11 +2,11 @@ import { auth, basename } from './utils' import { post, WRITE_TIMEOUT } from '../_utils/ajax' export async function muteAccount (instanceName, accessToken, accountId, notifications) { - let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/mute` + const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/mute` return post(url, { notifications }, auth(accessToken), { timeout: WRITE_TIMEOUT }) } export async function unmuteAccount (instanceName, accessToken, accountId) { - let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/unmute` + const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/unmute` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/muteConversation.js b/src/routes/_api/muteConversation.js index 8eae4215..c9c9a7da 100644 --- a/src/routes/_api/muteConversation.js +++ b/src/routes/_api/muteConversation.js @@ -2,11 +2,11 @@ import { auth, basename } from './utils' import { post, WRITE_TIMEOUT } from '../_utils/ajax' export async function muteConversation (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/mute` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/mute` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } export async function unmuteConversation (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/unmute` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/unmute` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/oauth.js b/src/routes/_api/oauth.js index 8ab5ecc3..b804dc88 100644 --- a/src/routes/_api/oauth.js +++ b/src/routes/_api/oauth.js @@ -16,17 +16,17 @@ export function registerApplication (instanceName, redirectUri) { } export function generateAuthLink (instanceName, clientId, redirectUri) { - let params = paramsString({ - 'client_id': clientId, - 'redirect_uri': redirectUri, - 'response_type': 'code', - 'scope': SCOPES + const params = paramsString({ + client_id: clientId, + redirect_uri: redirectUri, + response_type: 'code', + scope: SCOPES }) return `${basename(instanceName)}/oauth/authorize?${params}` } export function getAccessTokenFromAuthCode (instanceName, clientId, clientSecret, code, redirectUri) { - let url = `${basename(instanceName)}/oauth/token` + const url = `${basename(instanceName)}/oauth/token` return post(url, { client_id: clientId, client_secret: clientSecret, diff --git a/src/routes/_api/pin.js b/src/routes/_api/pin.js index 9158d5bd..61960eeb 100644 --- a/src/routes/_api/pin.js +++ b/src/routes/_api/pin.js @@ -2,11 +2,11 @@ import { post, WRITE_TIMEOUT } from '../_utils/ajax' import { auth, basename } from './utils' export async function pinStatus (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/pin` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/pin` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } export async function unpinStatus (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/unpin` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/unpin` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/polls.js b/src/routes/_api/polls.js index f3cd5aed..b4163779 100644 --- a/src/routes/_api/polls.js +++ b/src/routes/_api/polls.js @@ -2,11 +2,11 @@ import { get, post, DEFAULT_TIMEOUT, WRITE_TIMEOUT } from '../_utils/ajax' import { auth, basename } from './utils' export async function getPoll (instanceName, accessToken, pollId) { - let url = `${basename(instanceName)}/api/v1/polls/${pollId}` + const url = `${basename(instanceName)}/api/v1/polls/${pollId}` return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) } export async function voteOnPoll (instanceName, accessToken, pollId, choices) { - let url = `${basename(instanceName)}/api/v1/polls/${pollId}/votes` + const url = `${basename(instanceName)}/api/v1/polls/${pollId}/votes` return post(url, { choices }, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/reblog.js b/src/routes/_api/reblog.js index 31dcac6e..ccfc650a 100644 --- a/src/routes/_api/reblog.js +++ b/src/routes/_api/reblog.js @@ -2,11 +2,11 @@ import { post } from '../_utils/ajax' import { basename, auth } from './utils' export async function reblogStatus (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/reblog` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/reblog` return post(url, null, auth(accessToken)) } export async function unreblogStatus (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/unreblog` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/unreblog` return post(url, null, auth(accessToken)) } diff --git a/src/routes/_api/relationships.js b/src/routes/_api/relationships.js index 636895f8..e1a6acd9 100644 --- a/src/routes/_api/relationships.js +++ b/src/routes/_api/relationships.js @@ -2,7 +2,7 @@ import { basename, auth } from './utils' import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax' export async function getRelationship (instanceName, accessToken, accountId) { - let url = `${basename(instanceName)}/api/v1/accounts/relationships?${paramsString({ id: accountId })}` - let res = await get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) + const url = `${basename(instanceName)}/api/v1/accounts/relationships?${paramsString({ id: accountId })}` + const res = await get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) return res[0] } diff --git a/src/routes/_api/report.js b/src/routes/_api/report.js index 97afeab0..f002f96d 100644 --- a/src/routes/_api/report.js +++ b/src/routes/_api/report.js @@ -2,7 +2,7 @@ import { auth, basename } from './utils' import { post } from '../_utils/ajax' export async function report (instanceName, accessToken, accountId, statusIds, comment, forward) { - let url = `${basename(instanceName)}/api/v1/reports` + const url = `${basename(instanceName)}/api/v1/reports` return post(url, { account_id: accountId, status_ids: statusIds, diff --git a/src/routes/_api/requests.js b/src/routes/_api/requests.js index 4d74c01d..fc8c0668 100644 --- a/src/routes/_api/requests.js +++ b/src/routes/_api/requests.js @@ -2,11 +2,11 @@ import { post, WRITE_TIMEOUT } from '../_utils/ajax' import { auth, basename } from './utils' export async function approveFollowRequest (instanceName, accessToken, accountId) { - let url = `${basename(instanceName)}/api/v1/follow_requests/${accountId}/authorize` + const url = `${basename(instanceName)}/api/v1/follow_requests/${accountId}/authorize` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } export async function rejectFollowRequest (instanceName, accessToken, accountId) { - let url = `${basename(instanceName)}/api/v1/follow_requests/${accountId}/reject` + const url = `${basename(instanceName)}/api/v1/follow_requests/${accountId}/reject` return post(url, null, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/search.js b/src/routes/_api/search.js index de6f46fb..40f00044 100644 --- a/src/routes/_api/search.js +++ b/src/routes/_api/search.js @@ -2,7 +2,7 @@ import { get, paramsString, DEFAULT_TIMEOUT } from '../_utils/ajax' import { auth, basename } from './utils' export function search (instanceName, accessToken, query, resolve = true, limit = 5, signal = null) { - let url = `${basename(instanceName)}/api/v1/search?` + paramsString({ + const url = `${basename(instanceName)}/api/v1/search?` + paramsString({ q: query, resolve, limit diff --git a/src/routes/_api/showReblogs.js b/src/routes/_api/showReblogs.js index 80da9b3b..45bf9bcc 100644 --- a/src/routes/_api/showReblogs.js +++ b/src/routes/_api/showReblogs.js @@ -2,6 +2,6 @@ import { auth, basename } from './utils' import { post, WRITE_TIMEOUT } from '../_utils/ajax' export function setShowReblogs (instanceName, accessToken, accountId, showReblogs) { - let url = `${basename(instanceName)}/api/v1/accounts/${accountId}/follow` + const url = `${basename(instanceName)}/api/v1/accounts/${accountId}/follow` return post(url, { reblogs: !!showReblogs }, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/statuses.js b/src/routes/_api/statuses.js index 13a5649c..5edf0a72 100644 --- a/src/routes/_api/statuses.js +++ b/src/routes/_api/statuses.js @@ -3,9 +3,9 @@ import { DEFAULT_TIMEOUT, get, post, WRITE_TIMEOUT } from '../_utils/ajax' export async function postStatus (instanceName, accessToken, text, inReplyToId, mediaIds, sensitive, spoilerText, visibility, poll) { - let url = `${basename(instanceName)}/api/v1/statuses` + const url = `${basename(instanceName)}/api/v1/statuses` - let body = { + const body = { status: text, in_reply_to_id: inReplyToId, media_ids: mediaIds, @@ -15,8 +15,8 @@ export async function postStatus (instanceName, accessToken, text, inReplyToId, poll: poll } - for (let key of Object.keys(body)) { - let value = body[key] + for (const key of Object.keys(body)) { + const value = body[key] // remove any unnecessary fields, except 'status' which must at least be an empty string if (key !== 'status' && (!value || (Array.isArray(value) && !value.length))) { delete body[key] @@ -27,11 +27,11 @@ export async function postStatus (instanceName, accessToken, text, inReplyToId, } export async function getStatusContext (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}/context` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}/context` return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) } export async function getStatus (instanceName, accessToken, statusId) { - let url = `${basename(instanceName)}/api/v1/statuses/${statusId}` + const url = `${basename(instanceName)}/api/v1/statuses/${statusId}` return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) } diff --git a/src/routes/_api/stream/TimelineStream.js b/src/routes/_api/stream/TimelineStream.js index c11a7eef..4fbab2c9 100644 --- a/src/routes/_api/stream/TimelineStream.js +++ b/src/routes/_api/stream/TimelineStream.js @@ -22,7 +22,7 @@ export class TimelineStream extends EventEmitter { this._teardownEvents() // events-light currently does not support removeAllListeners() // https://github.com/patrick-steele-idem/events-light/issues/2 - for (let event of ['open', 'close', 'reconnect', 'message']) { + for (const event of ['open', 'close', 'reconnect', 'message']) { this.removeAllListeners(event) } } diff --git a/src/routes/_api/stream/getStreamUrl.js b/src/routes/_api/stream/getStreamUrl.js index 32a6e99b..fa9268c4 100644 --- a/src/routes/_api/stream/getStreamUrl.js +++ b/src/routes/_api/stream/getStreamUrl.js @@ -22,10 +22,10 @@ function getStreamName (timeline) { } export function getStreamUrl (streamingApi, accessToken, timeline) { - let url = `${streamingApi}/api/v1/streaming` - let streamName = getStreamName(timeline) + const url = `${streamingApi}/api/v1/streaming` + const streamName = getStreamName(timeline) - let params = { + const params = { stream: streamName } diff --git a/src/routes/_api/timelines.js b/src/routes/_api/timelines.js index 2a27a6b9..ba06c950 100644 --- a/src/routes/_api/timelines.js +++ b/src/routes/_api/timelines.js @@ -26,7 +26,7 @@ function getTimelineUrlPath (timeline) { } export async function getTimeline (instanceName, accessToken, timeline, maxId, since, limit) { - let timelineUrlName = getTimelineUrlPath(timeline) + const timelineUrlName = getTimelineUrlPath(timeline) let url = `${basename(instanceName)}/api/v1/${timelineUrlName}` if (timeline.startsWith('tag/')) { @@ -37,7 +37,7 @@ export async function getTimeline (instanceName, accessToken, timeline, maxId, s url += '/' + timeline.split('/')[1] } - let params = {} + const params = {} if (since) { params.since_id = since } diff --git a/src/routes/_api/updateCredentials.js b/src/routes/_api/updateCredentials.js index fb7ba270..4226a70d 100644 --- a/src/routes/_api/updateCredentials.js +++ b/src/routes/_api/updateCredentials.js @@ -2,6 +2,6 @@ import { WRITE_TIMEOUT, patch } from '../_utils/ajax' import { auth, basename } from './utils' export async function updateCredentials (instanceName, accessToken, accountData) { - let url = `${basename(instanceName)}/api/v1/accounts/update_credentials` + const url = `${basename(instanceName)}/api/v1/accounts/update_credentials` return patch(url, accountData, auth(accessToken), { timeout: WRITE_TIMEOUT }) } diff --git a/src/routes/_api/user.js b/src/routes/_api/user.js index ddf0b5fb..0ad2778a 100644 --- a/src/routes/_api/user.js +++ b/src/routes/_api/user.js @@ -2,11 +2,11 @@ import { get, DEFAULT_TIMEOUT } from '../_utils/ajax' import { auth, basename } from './utils' export function getVerifyCredentials (instanceName, accessToken) { - let url = `${basename(instanceName)}/api/v1/accounts/verify_credentials` + const url = `${basename(instanceName)}/api/v1/accounts/verify_credentials` return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) } export function getAccount (instanceName, accessToken, accountId) { - let url = `${basename(instanceName)}/api/v1/accounts/${accountId}` + const url = `${basename(instanceName)}/api/v1/accounts/${accountId}` return get(url, auth(accessToken), { timeout: DEFAULT_TIMEOUT }) } diff --git a/src/routes/_api/utils.js b/src/routes/_api/utils.js index 654f5180..2ebbe94d 100644 --- a/src/routes/_api/utils.js +++ b/src/routes/_api/utils.js @@ -11,6 +11,6 @@ export function basename (instanceName) { export function auth (accessToken) { return { - 'Authorization': `Bearer ${accessToken}` + Authorization: `Bearer ${accessToken}` } } diff --git a/src/routes/_components/AccountsListPage.html b/src/routes/_components/AccountsListPage.html index 3459c20a..56530660 100644 --- a/src/routes/_components/AccountsListPage.html +++ b/src/routes/_components/AccountsListPage.html @@ -61,12 +61,12 @@ }, methods: { onClickAction (event) { - let { action, accountId } = event + const { action, accountId } = event action.onclick(accountId) }, async refreshAccounts () { - let { accountsFetcher } = this.get() - let accounts = await accountsFetcher() + const { accountsFetcher } = this.get() + const accounts = await accountsFetcher() this.set({ accounts: accounts }) } } diff --git a/src/routes/_components/Draggable.html b/src/routes/_components/Draggable.html index 56882678..f93dfeb2 100644 --- a/src/routes/_components/Draggable.html +++ b/src/routes/_components/Draggable.html @@ -53,7 +53,7 @@ onPointerDown (e) { e.preventDefault() e.stopPropagation() - let rect = this.refs.indicator.getBoundingClientRect() + const rect = this.refs.indicator.getBoundingClientRect() this.set({ dragging: true, dragOffsetX: e.clientX - rect.left, @@ -64,13 +64,13 @@ if (this.get().dragging) { e.preventDefault() e.stopPropagation() - let { indicatorWidth, indicatorHeight, dragOffsetX, dragOffsetY } = this.get() + const { indicatorWidth, indicatorHeight, dragOffsetX, dragOffsetY } = this.get() throttledRaf(() => { - let rect = this.refs.area.getBoundingClientRect() - let offsetX = dragOffsetX - (indicatorWidth / 2) - let offsetY = dragOffsetY - (indicatorHeight / 2) - let x = clamp((e.clientX - rect.left - offsetX) / rect.width) - let y = clamp((e.clientY - rect.top - offsetY) / rect.height) + const rect = this.refs.area.getBoundingClientRect() + const offsetX = dragOffsetX - (indicatorWidth / 2) + const offsetY = dragOffsetY - (indicatorHeight / 2) + const x = clamp((e.clientX - rect.left - offsetX) / rect.width) + const y = clamp((e.clientY - rect.top - offsetY) / rect.height) this.set({ x, y }) this.fire('change', { x, y }) }) @@ -90,9 +90,9 @@ if (!e.target.classList.contains('draggable-indicator')) { e.preventDefault() e.stopPropagation() - let rect = this.refs.area.getBoundingClientRect() - let x = clamp((e.clientX - rect.left) / rect.width) - let y = clamp((e.clientY - rect.top) / rect.height) + const rect = this.refs.area.getBoundingClientRect() + const x = clamp((e.clientX - rect.left) / rect.width) + const y = clamp((e.clientY - rect.top) / rect.height) this.set({ x, y }) this.fire('change', { x, y }) } diff --git a/src/routes/_components/IconButton.html b/src/routes/_components/IconButton.html index f525eb6c..f4ce3c6b 100644 --- a/src/routes/_components/IconButton.html +++ b/src/routes/_components/IconButton.html @@ -93,7 +93,7 @@ export default { oncreate () { - let { clickListener, elementId } = this.get() + const { clickListener, elementId } = this.get() if (clickListener) { this.onClick = this.onClick.bind(this) this.refs.node.addEventListener('click', this.onClick) @@ -103,7 +103,7 @@ } }, ondestroy () { - let { clickListener } = this.get() + const { clickListener } = this.get() if (clickListener) { this.refs.node.removeEventListener('click', this.onClick) } diff --git a/src/routes/_components/NavItem.html b/src/routes/_components/NavItem.html index 60d3b83a..82845b38 100644 --- a/src/routes/_components/NavItem.html +++ b/src/routes/_components/NavItem.html @@ -109,14 +109,14 @@ export default { oncreate () { - let { name } = this.get() - let indicator = this.refs.indicator + const { name } = this.get() + const indicator = this.refs.indicator on('animateNavPart1', this, ({ fromPage, toPage }) => { if (fromPage !== name) { return } mark('animateNavPart1 gBCR') - let fromRect = indicator.getBoundingClientRect() + const fromRect = indicator.getBoundingClientRect() stop('animateNavPart1 gBCR') emit('animateNavPart2', { fromRect, fromPage, toPage }) }) @@ -125,12 +125,12 @@ return } mark('animateNavPart2 gBCR') - let toRect = indicator.getBoundingClientRect() + const toRect = indicator.getBoundingClientRect() stop('animateNavPart2 gBCR') - let translateX = fromRect.left - toRect.left - let scaleX = fromRect.width / toRect.width + const translateX = fromRect.left - toRect.left + const scaleX = fromRect.width / toRect.width indicator.style.transform = `translateX(${translateX}px) scaleX(${scaleX})` - let onTransitionEnd = () => { + const onTransitionEnd = () => { indicator.removeEventListener('transitionend', onTransitionEnd) indicator.classList.remove('animate') } @@ -163,7 +163,7 @@ }, methods: { onClick (e) { - let { selected } = this.get() + const { selected } = this.get() if (!selected) { return } diff --git a/src/routes/_components/NavShortcuts.html b/src/routes/_components/NavShortcuts.html index 00f03a81..167dbd72 100644 --- a/src/routes/_components/NavShortcuts.html +++ b/src/routes/_components/NavShortcuts.html @@ -26,11 +26,11 @@ methods: { goto, async showShortcutHelpDialog () { - let showShortcutHelpDialog = await importShowShortcutHelpDialog() + const showShortcutHelpDialog = await importShowShortcutHelpDialog() showShortcutHelpDialog() }, async showComposeDialog () { - let showComposeDialog = await importShowComposeDialog() + const showComposeDialog = await importShowComposeDialog() showComposeDialog() } } diff --git a/src/routes/_components/NonAutoplayImg.html b/src/routes/_components/NonAutoplayImg.html index d47ee265..367b3e61 100644 --- a/src/routes/_components/NonAutoplayImg.html +++ b/src/routes/_components/NonAutoplayImg.html @@ -25,9 +25,9 @@ export default { async oncreate () { - let { currentSrc } = this.get() + const { currentSrc } = this.get() try { - let image = new Image() + const image = new Image() image.src = currentSrc await decodeImage(image) this.set({ loaded: true }) diff --git a/src/routes/_components/SvgIcon.html b/src/routes/_components/SvgIcon.html index f15126ed..1e08d933 100644 --- a/src/routes/_components/SvgIcon.html +++ b/src/routes/_components/SvgIcon.html @@ -25,11 +25,11 @@ }, methods: { animate (animation) { - let { reduceMotion } = this.store.get() + const { reduceMotion } = this.store.get() if (!animation || reduceMotion) { return } - let svg = this.refs.svg + const svg = this.refs.svg animate(svg, animation) } } diff --git a/src/routes/_components/Tooltip.html b/src/routes/_components/Tooltip.html index c7920425..72cb3337 100644 --- a/src/routes/_components/Tooltip.html +++ b/src/routes/_components/Tooltip.html @@ -60,7 +60,7 @@ toggle (e) { e.preventDefault() e.stopPropagation() - let { shown, mouseover } = this.get() + const { shown, mouseover } = this.get() if (!mouseover) { this.set({ shown: !shown }) } diff --git a/src/routes/_components/community/PageListItem.html b/src/routes/_components/community/PageListItem.html index 8b406b73..04754ba8 100644 --- a/src/routes/_components/community/PageListItem.html +++ b/src/routes/_components/community/PageListItem.html @@ -87,8 +87,8 @@ methods: { onPinClick (e) { e.preventDefault() - let { currentInstance, pinnedPages } = this.store.get() - let { href } = this.get() + const { currentInstance, pinnedPages } = this.store.get() + const { href } = this.get() pinnedPages[currentInstance] = href this.store.set({ pinnedPages: pinnedPages }) this.store.save() diff --git a/src/routes/_components/compose/ComposeAuthor.html b/src/routes/_components/compose/ComposeAuthor.html index d9b0c277..360b741b 100644 --- a/src/routes/_components/compose/ComposeAuthor.html +++ b/src/routes/_components/compose/ComposeAuthor.html @@ -95,7 +95,7 @@ }, methods: { onClick (e) { - let { realm, dialogId, href } = this.get() + const { realm, dialogId, href } = this.get() if (realm === 'dialog') { e.preventDefault() e.stopPropagation() diff --git a/src/routes/_components/compose/ComposeBox.html b/src/routes/_components/compose/ComposeBox.html index 38f9bff0..269af273 100644 --- a/src/routes/_components/compose/ComposeBox.html +++ b/src/routes/_components/compose/ComposeBox.html @@ -105,7 +105,7 @@ export default { oncreate () { - let { realm, replySpoiler, replyVisibility } = this.get() + const { realm, replySpoiler, replyVisibility } = this.get() if (realm !== 'home' && realm !== 'dialog') { // if this is a reply, populate the handle immediately /* no await */ insertHandleForReply(realm) @@ -179,7 +179,7 @@ }, methods: { doPostStatus () { - let { + const { text, media, postPrivacyKey, @@ -190,17 +190,17 @@ inReplyToId, // delete-and-redraft replies, using standard id poll } = this.get() - let sensitive = media.length && !!contentWarning - let mediaIds = media.map(_ => _.data.id) - let mediaDescriptions = media.map(_ => _.description) - let mediaFocalPoints = media.map(_ => [_.focusX, _.focusY]) - let inReplyTo = inReplyToId || ((realm === 'home' || realm === 'dialog') ? null : realm) + const sensitive = media.length && !!contentWarning + const mediaIds = media.map(_ => _.data.id) + const mediaDescriptions = media.map(_ => _.description) + const mediaFocalPoints = media.map(_ => [_.focusX, _.focusY]) + const inReplyTo = inReplyToId || ((realm === 'home' || realm === 'dialog') ? null : realm) if (overLimit || (!text && !media.length)) { return // do nothing if invalid } - let hasPoll = poll && poll.options && poll.options.length + const hasPoll = poll && poll.options && poll.options.length if (hasPoll) { // validate poll if (poll.options.length < 2 || !poll.options.every(Boolean)) { @@ -209,7 +209,7 @@ } // convert internal poll format to the format Mastodon's REST API uses - let pollToPost = hasPoll && { + const pollToPost = hasPoll && { expires_in: (poll.expiry || POLL_EXPIRY_DEFAULT).toString(), multiple: !!poll.multiple, options: poll.options diff --git a/src/routes/_components/compose/ComposeContentWarning.html b/src/routes/_components/compose/ComposeContentWarning.html index 56360a79..c78b968b 100644 --- a/src/routes/_components/compose/ComposeContentWarning.html +++ b/src/routes/_components/compose/ComposeContentWarning.html @@ -39,7 +39,7 @@ const saveText = debounce(() => scheduleIdleTask(() => this.store.save()), 1000) this.observe('rawText', rawText => { - let { realm } = this.get() + const { realm } = this.get() this.store.setComposeData(realm, { contentWarning: rawText }) diff --git a/src/routes/_components/compose/ComposeFileDrop.html b/src/routes/_components/compose/ComposeFileDrop.html index 01125980..f81e47ab 100644 --- a/src/routes/_components/compose/ComposeFileDrop.html +++ b/src/routes/_components/compose/ComposeFileDrop.html @@ -76,9 +76,9 @@ }), methods: { async onFileDrop (e) { - let { files } = e - let { realm } = this.get() - for (let file of files) { // upload one at a time to avoid hitting limits + const { files } = e + const { realm } = this.get() + for (const file of files) { // upload one at a time to avoid hitting limits await doMediaUpload(realm, file) } } diff --git a/src/routes/_components/compose/ComposeInput.html b/src/routes/_components/compose/ComposeInput.html index f99f204e..4bb079fe 100644 --- a/src/routes/_components/compose/ComposeInput.html +++ b/src/routes/_components/compose/ComposeInput.html @@ -83,10 +83,10 @@ methods: { observe, setupSyncFromStore () { - let textarea = this.refs.textarea + const textarea = this.refs.textarea let firstTime = true this.observe('text', text => { - let { rawText } = this.get() + const { rawText } = this.get() if (rawText !== text) { this.set({ rawText: text }) // this next autosize is required to resize after @@ -97,7 +97,7 @@ } if (firstTime) { firstTime = false - let { autoFocus } = this.get() + const { autoFocus } = this.get() if (autoFocus) { requestAnimationFrame(() => textarea.focus({ preventScroll: true })) } @@ -109,14 +109,14 @@ this.observe('rawText', rawText => { mark('observe rawText') - let { realm } = this.get() + const { realm } = this.get() this.store.setComposeData(realm, { text: rawText }) saveStore() stop('observe rawText') }, { init: false }) }, setupAutosize () { - let textarea = this.refs.textarea + const textarea = this.refs.textarea requestAnimationFrame(() => { mark('autosize()') autosize(textarea) @@ -135,7 +135,7 @@ }, onFocus () { scheduleIdleTask(() => { - let { realm } = this.get() + const { realm } = this.get() this.store.set({ currentComposeRealm: realm }) this.store.setForCurrentAutosuggest({ composeFocused: true }) }) @@ -146,7 +146,7 @@ }) }, onKeydown (e) { - let { keyCode } = e + const { keyCode } = e // ctrl or cmd (on macs) was pressed; ctrl-enter means post a toot const ctrlPressed = e.getModifierState('Control') || e.getModifierState('Meta') switch (keyCode) { @@ -172,7 +172,7 @@ } }, clickSelectedAutosuggestion (event) { - let { + const { autosuggestShown, autosuggestType } = this.store.get() @@ -183,7 +183,7 @@ event.stopPropagation() const clickAutosuggestedItem = async () => { - let { realm } = this.get() + const { realm } = this.get() /* autosuggestSelecting prevents a flash of searched content */ this.store.setForCurrentAutosuggest({ autosuggestSelecting: true }) if (autosuggestType === 'account') { @@ -217,7 +217,7 @@ event.stopPropagation() }, clearAutosuggestions (event) { - let { autosuggestShown } = this.store.get() + const { autosuggestShown } = this.store.get() if (!autosuggestShown) { return } diff --git a/src/routes/_components/compose/ComposeLengthGauge.html b/src/routes/_components/compose/ComposeLengthGauge.html index af00a2e0..21bbcab7 100644 --- a/src/routes/_components/compose/ComposeLengthGauge.html +++ b/src/routes/_components/compose/ComposeLengthGauge.html @@ -25,13 +25,13 @@ export default { oncreate () { - let { lengthAsFraction } = this.get() + const { lengthAsFraction } = this.get() this.set({ lengthAsFractionDeferred: lengthAsFraction }) // perf improvement for keyboard input latency this.observe('lengthAsFraction', () => { scheduleIdleTask(() => { mark('set lengthAsFractionDeferred') - let { lengthAsFraction } = this.get() + const { lengthAsFraction } = this.get() this.set({ lengthAsFractionDeferred: lengthAsFraction }) stop('set lengthAsFractionDeferred') requestAnimationFrame(() => this.set({ shouldAnimate: true })) @@ -46,7 +46,7 @@ computed: { lengthAsFraction: ({ length, $maxStatusChars }) => { // We don't need to update the gauge for every decimal point, so round it to the nearest 0.02 - let int = Math.round(Math.min($maxStatusChars, length) / $maxStatusChars * 100) + const int = Math.round(Math.min($maxStatusChars, length) / $maxStatusChars * 100) return (int - (int % 2)) / 100 } }, diff --git a/src/routes/_components/compose/ComposeLengthIndicator.html b/src/routes/_components/compose/ComposeLengthIndicator.html index 2fc00026..047428c3 100644 --- a/src/routes/_components/compose/ComposeLengthIndicator.html +++ b/src/routes/_components/compose/ComposeLengthIndicator.html @@ -23,13 +23,13 @@ export default { oncreate () { - let { lengthToDisplay } = this.get() + const { lengthToDisplay } = this.get() this.set({ lengthToDisplayDeferred: lengthToDisplay }) // perf improvement for keyboard input latency this.observe('lengthToDisplay', () => { scheduleIdleTask(() => { mark('set lengthToDisplayDeferred') - let { lengthToDisplay } = this.get() + const { lengthToDisplay } = this.get() this.set({ lengthToDisplayDeferred: lengthToDisplay }) stop('set lengthToDisplayDeferred') }) diff --git a/src/routes/_components/compose/ComposeMediaItem.html b/src/routes/_components/compose/ComposeMediaItem.html index c4eb2d22..f58c9475 100644 --- a/src/routes/_components/compose/ComposeMediaItem.html +++ b/src/routes/_components/compose/ComposeMediaItem.html @@ -172,13 +172,13 @@ setupSyncFromStore () { this.observe('media', media => { media = media || [] - let { index, rawText } = this.get() - let text = get(media, [index, 'description'], '') + const { index, rawText } = this.get() + const text = get(media, [index, 'description'], '') if (rawText !== text) { this.set({ rawText: text }) } - let focusX = get(media, [index, 'focusX'], 0) - let focusY = get(media, [index, 'focusY'], 0) + const focusX = get(media, [index, 'focusX'], 0) + const focusY = get(media, [index, 'focusY'], 0) this.set({ focusX, focusY }) }) }, @@ -186,7 +186,7 @@ const saveStore = debounce(() => scheduleIdleTask(() => this.store.save()), 1000) this.observe('rawText', rawText => { - let { realm, index, media } = this.get() + const { realm, index, media } = this.get() if (media[index].description !== rawText) { media[index].description = rawText this.store.setComposeData(realm, { media }) @@ -201,12 +201,12 @@ autosize.destroy(this.refs.textarea) }, onDeleteMedia () { - let { realm, index } = this.get() + const { realm, index } = this.get() deleteMedia(realm, index) }, async onSetFocalPoint () { - let { realm, index } = this.get() - let showMediaFocalPointDialog = await importMediaFocalPointDialog() + const { realm, index } = this.get() + const showMediaFocalPointDialog = await importMediaFocalPointDialog() showMediaFocalPointDialog(realm, index) } }, diff --git a/src/routes/_components/compose/ComposePoll.html b/src/routes/_components/compose/ComposePoll.html index 5a751e8c..90cc6fd1 100644 --- a/src/routes/_components/compose/ComposePoll.html +++ b/src/routes/_components/compose/ComposePoll.html @@ -83,15 +83,15 @@ function flushPollOptionsToDom (poll, realm) { for (let i = 0; i < poll.options.length; i++) { - let element = document.getElementById(`poll-option-${realm}-${i}`) + const element = document.getElementById(`poll-option-${realm}-${i}`) element.value = poll.options[i] } } export default { oncreate () { - let { realm } = this.get() - let poll = this.store.getComposeData(realm, 'poll') + const { realm } = this.get() + const poll = this.store.getComposeData(realm, 'poll') flushPollOptionsToDom(poll, realm) document.getElementById(`poll-option-multiple-${realm}`).checked = !!poll.multiple this.set({ pollExpiryDefaultValue: poll.expiry || POLL_EXPIRY_DEFAULT }) @@ -104,26 +104,26 @@ methods: { onChange (i) { scheduleIdleTask(() => { - let { realm } = this.get() - let element = document.getElementById(`poll-option-${realm}-${i}`) - let poll = this.store.getComposeData(realm, 'poll') + const { realm } = this.get() + const element = document.getElementById(`poll-option-${realm}-${i}`) + const poll = this.store.getComposeData(realm, 'poll') poll.options[i] = element.value this.store.setComposeData(realm, { poll }) }) }, onMultipleChange () { requestAnimationFrame(() => { - let { realm } = this.get() - let element = document.getElementById(`poll-option-multiple-${realm}`) - let poll = this.store.getComposeData(realm, 'poll') + const { realm } = this.get() + const element = document.getElementById(`poll-option-multiple-${realm}`) + const poll = this.store.getComposeData(realm, 'poll') poll.multiple = !!element.checked this.store.setComposeData(realm, { poll }) }) }, onDeleteClick (i) { requestAnimationFrame(() => { - let { realm } = this.get() - let poll = this.store.getComposeData(realm, 'poll') + const { realm } = this.get() + const poll = this.store.getComposeData(realm, 'poll') poll.options.splice(i, 1) this.store.setComposeData(realm, { poll }) flushPollOptionsToDom(poll, realm) @@ -131,8 +131,8 @@ }, onAddClick () { requestAnimationFrame(() => { - let { realm } = this.get() - let poll = this.store.getComposeData(realm, 'poll') + const { realm } = this.get() + const poll = this.store.getComposeData(realm, 'poll') if (!poll.options.length !== 4) { poll.options.push('') } @@ -141,9 +141,9 @@ }, onExpiryChange (e) { requestAnimationFrame(() => { - let { realm } = this.get() - let { value } = e.target - let poll = this.store.getComposeData(realm, 'poll') + const { realm } = this.get() + const { value } = e.target + const poll = this.store.getComposeData(realm, 'poll') poll.expiry = parseInt(value, 10) this.store.setComposeData(realm, { poll }) }) diff --git a/src/routes/_components/compose/ComposeStickyButton.html b/src/routes/_components/compose/ComposeStickyButton.html index f79c3eca..ba393d14 100644 --- a/src/routes/_components/compose/ComposeStickyButton.html +++ b/src/routes/_components/compose/ComposeStickyButton.html @@ -74,7 +74,7 @@ methods: { observe, onClickButton () { - let { sticky } = this.get() + const { sticky } = this.get() if (sticky) { // when the button is sticky, we're scrolled down the home timeline, // so we should launch a new compose dialog @@ -95,13 +95,13 @@ // because its parent is now the scrolling context. So for iOS only, we // create a fake sticky button by listening to intersecting events // and inserting a permanently fixed-position element into the DOM. - let { showSticky } = this.get() + const { showSticky } = this.get() if (!USE_IOS_WORKAROUND || !showSticky) { return } - let cleanup = () => { - let existingElement = document.getElementById('the-sticky-button') + const cleanup = () => { + const existingElement = document.getElementById('the-sticky-button') if (existingElement) { document.body.removeChild(existingElement) } @@ -111,13 +111,13 @@ } } - let createFixedStickyButton = () => { - let element = document.createElement('div') + const createFixedStickyButton = () => { + const element = document.createElement('div') element.setAttribute('id', 'the-sticky-button') element.classList.add('compose-box-button-wrapper') element.classList.add('compose-box-button-fixed') document.body.appendChild(element) - let rect = this.refs.wrapper.getBoundingClientRect() + const rect = this.refs.wrapper.getBoundingClientRect() Object.assign(element.style, { left: `${rect.left}px`, position: 'fixed' @@ -141,7 +141,7 @@ this.on('destroy', () => cleanup()) }, setupStickyObserver () { - let sentinel = this.refs.sentinel + const sentinel = this.refs.sentinel this.__stickyObserver = new IntersectionObserver(entries => this.onObserve(entries)) this.__stickyObserver.observe(sentinel) @@ -151,7 +151,7 @@ // manually, the other observer doesn't necessarily fire this.observe('timelineInitialized', timelineInitialized => { if (timelineInitialized) { - let observer = new IntersectionObserver(entries => { + const observer = new IntersectionObserver(entries => { this.onObserve(entries) observer.disconnect() }) diff --git a/src/routes/_components/compose/ComposeToolbar.html b/src/routes/_components/compose/ComposeToolbar.html index 9b7a2d6a..9e291820 100644 --- a/src/routes/_components/compose/ComposeToolbar.html +++ b/src/routes/_components/compose/ComposeToolbar.html @@ -79,29 +79,29 @@ store: () => store, methods: { async onEmojiClick () { - let { realm } = this.get() - let showEmojiDialog = await importShowEmojiDialog() + const { realm } = this.get() + const showEmojiDialog = await importShowEmojiDialog() showEmojiDialog(realm) }, onMediaClick () { this.refs.input.click() }, onFileChange (e) { - let file = e.target.files[0] - let { realm } = this.get() + const file = e.target.files[0] + const { realm } = this.get() doMediaUpload(realm, file) }, async onPostPrivacyClick () { - let { realm } = this.get() - let showPostPrivacyDialog = await importShowPostPrivacyDialog() + const { realm } = this.get() + const showPostPrivacyDialog = await importShowPostPrivacyDialog() showPostPrivacyDialog(realm) }, onContentWarningClick () { - let { realm } = this.get() + const { realm } = this.get() toggleContentWarningShown(realm) }, onPollClick () { - let { poll, realm } = this.get() + const { poll, realm } = this.get() if (poll && poll.options && poll.options.length) { disablePoll(realm) } else { diff --git a/src/routes/_components/dialog/components/AccountProfileOptionsDialog.html b/src/routes/_components/dialog/components/AccountProfileOptionsDialog.html index e476350c..f9b47998 100644 --- a/src/routes/_components/dialog/components/AccountProfileOptionsDialog.html +++ b/src/routes/_components/dialog/components/AccountProfileOptionsDialog.html @@ -146,43 +146,43 @@ export default { } }, async onMentionClicked () { - let { account } = this.get() + const { account } = this.get() this.close() await composeNewStatusMentioning(account) }, async onFollowClicked () { - let { accountId, following } = this.get() + const { accountId, following } = this.get() this.close() await setAccountFollowed(accountId, !following, true) }, async onBlockClicked () { - let { accountId, blocking } = this.get() + const { accountId, blocking } = this.get() this.close() await setAccountBlocked(accountId, !blocking, true) }, async onMuteClicked () { - let { account, muting } = this.get() + const { account, muting } = this.get() this.close() await toggleMute(account, !muting) }, async onShowReblogsClicked () { - let { accountId, showingReblogs } = this.get() + const { accountId, showingReblogs } = this.get() this.close() await setShowReblogs(accountId, !showingReblogs, true) }, async onBlockDomainClicked () { - let { accountId, domain, blockingDomain } = this.get() + const { accountId, domain, blockingDomain } = this.get() this.close() await setDomainBlocked(accountId, domain, !blockingDomain, true) }, async onCopyClicked () { - let { account } = this.get() - let { url } = account + const { account } = this.get() + const { url } = account this.close() await copyText(url) }, async onReport () { - let { account } = this.get() + const { account } = this.get() this.close() await reportStatusOrAccount({ account }) } diff --git a/src/routes/_components/dialog/components/ConfirmationDialog.html b/src/routes/_components/dialog/components/ConfirmationDialog.html index 9fde2fff..8845282f 100644 --- a/src/routes/_components/dialog/components/ConfirmationDialog.html +++ b/src/routes/_components/dialog/components/ConfirmationDialog.html @@ -60,7 +60,7 @@ show, close, onDestroyDialog (thisId) { - let { + const { id, positiveResult, onPositive, diff --git a/src/routes/_components/dialog/components/CopyDialog.html b/src/routes/_components/dialog/components/CopyDialog.html index 36991dd5..ee111427 100644 --- a/src/routes/_components/dialog/components/CopyDialog.html +++ b/src/routes/_components/dialog/components/CopyDialog.html @@ -36,9 +36,9 @@ function copyFromInput (input) { // workarounds for iOS, via https://stackoverflow.com/a/34046084 - let range = document.createRange() + const range = document.createRange() range.selectNodeContents(input) - let selection = window.getSelection() + const selection = window.getSelection() selection.removeAllRanges() selection.addRange(range) input.setSelectionRange(0, 9999999) @@ -53,14 +53,14 @@ show, close, onClick () { - let { input } = this.refs + const { input } = this.refs copyFromInput(input) toast.say('Copied to clipboard') this.close() }, onShow () { - let { text } = this.get() - let { input } = this.refs + const { text } = this.get() + const { input } = this.refs // double raf is to work around a11y-dialog trying to set the input doubleRAF(() => { input.focus() diff --git a/src/routes/_components/dialog/components/EmojiDialog.html b/src/routes/_components/dialog/components/EmojiDialog.html index 4ae9bd38..f188adb8 100644 --- a/src/routes/_components/dialog/components/EmojiDialog.html +++ b/src/routes/_components/dialog/components/EmojiDialog.html @@ -100,7 +100,7 @@ onCreateDialog.call(this) on('emoji-selected', this, emoji => this.onEmojiSelected(emoji)) try { - let Picker = await createEmojiMartPicker() + const Picker = await createEmojiMartPicker() if (!customElements.get('emoji-mart')) { define({ 'emoji-mart': Picker }) } @@ -164,7 +164,7 @@ show, close, onEmojiSelected (emoji) { - let { realm } = this.get() + const { realm } = this.get() insertEmoji(realm, emoji) this.close() }, @@ -172,16 +172,16 @@ this.focusIfNecessary() }, focusIfNecessary () { - let { autoFocus } = this.get() + const { autoFocus } = this.get() if (!autoFocus) { return } // The setTimeout is to work around timing issues where // sometimes the search input isn't rendered yet. setTimeout(() => requestAnimationFrame(() => { - let container = this.refs.container + const container = this.refs.container if (container) { - let searchInput = container.querySelector('emoji-mart .emoji-mart-search input') + const searchInput = container.querySelector('emoji-mart .emoji-mart-search input') if (searchInput) { // do this manually because emoji-mart's built in autofocus doesn't work consistently searchInput.focus() diff --git a/src/routes/_components/dialog/components/GenericConfirmationDialog.html b/src/routes/_components/dialog/components/GenericConfirmationDialog.html index eccdff36..39e270c1 100644 --- a/src/routes/_components/dialog/components/GenericConfirmationDialog.html +++ b/src/routes/_components/dialog/components/GenericConfirmationDialog.html @@ -50,7 +50,7 @@ show, close, onDestroyDialog (thisId) { - let { + const { id, positiveResult } = this.get() diff --git a/src/routes/_components/dialog/components/MediaDialog.html b/src/routes/_components/dialog/components/MediaDialog.html index d7d03adc..5cb6fe04 100644 --- a/src/routes/_components/dialog/components/MediaDialog.html +++ b/src/routes/_components/dialog/components/MediaDialog.html @@ -274,35 +274,35 @@ this.refs.scroller.removeEventListener('scroll', this.onScroll) }, onScroll () { - let { length } = this.get() - let { scroller } = this.refs + const { length } = this.get() + const { scroller } = this.refs if (!scroller) { return } - let { scrollWidth, scrollLeft } = scroller - let scrolledItem = Math.round((scrollLeft / scrollWidth) * length) + const { scrollWidth, scrollLeft } = scroller + const scrolledItem = Math.round((scrollLeft / scrollWidth) * length) this.set({ scrolledItem }) }, onButtonClick (i) { - let { scrolledItem } = this.get() + const { scrolledItem } = this.get() if (scrolledItem !== i) { this.scrollToItem(i, true) } }, next () { - let { scrolledItem, length } = this.get() + const { scrolledItem, length } = this.get() if (scrolledItem < length - 1) { this.scrollToItem(scrolledItem + 1, true) } }, prev () { - let { scrolledItem } = this.get() + const { scrolledItem } = this.get() if (scrolledItem > 0) { this.scrollToItem(scrolledItem - 1, true) } }, onShow () { - let { scrolledItem } = this.get() + const { scrolledItem } = this.get() if (scrolledItem) { requestAnimationFrame(() => { this.scrollToItem(scrolledItem, false) @@ -314,10 +314,10 @@ }, scrollToItem (scrolledItem, smooth) { this.set({ scrolledItem: scrolledItem }) - let { length } = this.get() - let { scroller } = this.refs - let { scrollWidth } = scroller - let scrollLeft = Math.floor(scrollWidth * (scrolledItem / length)) + const { length } = this.get() + const { scroller } = this.refs + const { scrollWidth } = scroller + const scrollLeft = Math.floor(scrollWidth * (scrolledItem / length)) if (smooth) { if (!hasNativeSmoothScroll && 'StyleMedia' in window) { // Edge has a weird bug where it changes the height if we try to @@ -335,7 +335,7 @@ this.set({ pinchZoomMode: !this.get().pinchZoomMode }) }, onImageClick (e) { - let { nativeWidth, nativeHeight, pinchZoomMode } = this.get() + const { nativeWidth, nativeHeight, pinchZoomMode } = this.get() if (pinchZoomMode) { return } @@ -347,10 +347,10 @@ left: rect.left + IMAGE_AREA_PADDING.left, top: rect.top + IMAGE_AREA_PADDING.top } - let scale = intrinsicScale(rect.width, rect.height, nativeWidth, nativeHeight) - let x = e.clientX - rect.left - let y = e.clientY - rect.top - let insideImage = x >= scale.x && x <= (scale.x + scale.width) && y >= scale.y && y <= (scale.y + scale.height) + const scale = intrinsicScale(rect.width, rect.height, nativeWidth, nativeHeight) + const x = e.clientX - rect.left + const y = e.clientY - rect.top + const insideImage = x >= scale.x && x <= (scale.x + scale.width) && y >= scale.y && y <= (scale.y + scale.height) if (!insideImage) { // close dialog when clicking outside of image e.preventDefault() @@ -359,11 +359,11 @@ } }, onMediaControlsClick (e) { - let { pinchZoomMode } = this.get() + const { pinchZoomMode } = this.get() if (pinchZoomMode) { return } - let { target } = e + const { target } = e if (target.tagName !== 'BUTTON' && !target.classList.contains('media-controls')) { e.preventDefault() e.stopPropagation() diff --git a/src/routes/_components/dialog/components/MediaFocalPointDialog.html b/src/routes/_components/dialog/components/MediaFocalPointDialog.html index fe18b94a..6db356fd 100644 --- a/src/routes/_components/dialog/components/MediaFocalPointDialog.html +++ b/src/routes/_components/dialog/components/MediaFocalPointDialog.html @@ -235,8 +235,8 @@ get(mediaItem, ['file', 'name']) || get(mediaItem, ['description']) || 'media' ), intrinsicsize: ({ mediaItem }) => { - let width = get(mediaItem, ['data', 'meta', 'original', 'width']) - let height = get(mediaItem, ['data', 'meta', 'original', 'height']) + const width = get(mediaItem, ['data', 'meta', 'original', 'width']) + const height = get(mediaItem, ['data', 'meta', 'original', 'height']) if (width && height) { return `${width} x ${height}` } @@ -261,11 +261,11 @@ close, setupSyncFromStore () { this.observe('mediaItem', mediaItem => { - let { rawFocusX, rawFocusY } = this.get() + const { rawFocusX, rawFocusY } = this.get() const syncFromStore = (rawKey, rawFocus, key) => { - let focus = get(mediaItem, [key], 0) || 0 - let focusAsString = focus.toString() + const focus = get(mediaItem, [key], 0) || 0 + const focusAsString = focus.toString() if (focusAsString !== rawFocus) { this.set({ [rawKey]: focusAsString }) } @@ -280,8 +280,8 @@ const observeAndSync = (rawKey, key) => { this.observe(rawKey, rawFocus => { - let { realm, index, media } = this.get() - let rawFocusDecimal = parseAndValidateFloat(rawFocus) + const { realm, index, media } = this.get() + const rawFocusDecimal = parseAndValidateFloat(rawFocus) if (media[index][key] !== rawFocusDecimal) { media[index][key] = rawFocusDecimal this.store.setComposeData(realm, { media }) @@ -297,9 +297,9 @@ const saveStore = debounce(() => scheduleIdleTask(() => this.store.save()), 1000) scheduleIdleTask(() => { - let focusX = percentToCoords(x * 100) - let focusY = percentToCoords(100 - (y * 100)) - let { realm, index, media } = this.get() + const focusX = percentToCoords(x * 100) + const focusY = percentToCoords(100 - (y * 100)) + const { realm, index, media } = this.get() media[index].focusX = parseAndValidateFloat(focusX) media[index].focusY = parseAndValidateFloat(focusY) this.store.setComposeData(realm, { media }) @@ -311,7 +311,7 @@ if (!this.refs.container) { return } - let rect = this.refs.container.getBoundingClientRect() + const rect = this.refs.container.getBoundingClientRect() this.set({ containerWidth: rect.width, containerHeight: rect.height diff --git a/src/routes/_components/dialog/components/MediaInDialog.html b/src/routes/_components/dialog/components/MediaInDialog.html index bdd1b62f..52036eee 100644 --- a/src/routes/_components/dialog/components/MediaInDialog.html +++ b/src/routes/_components/dialog/components/MediaInDialog.html @@ -79,8 +79,8 @@ poster: ({ media }) => media.preview_url, static_url: ({ media }) => media.static_url, intrinsicsize: ({ media }) => { - let width = get(media, ['meta', 'original', 'width']) - let height = get(media, ['meta', 'original', 'height']) + const width = get(media, ['meta', 'original', 'width']) + const height = get(media, ['meta', 'original', 'height']) if (width && height) { return `${width} x ${height}` } @@ -88,7 +88,7 @@ } }, ondestroy () { - let player = this.refs.player + const player = this.refs.player if (player && !player.paused) { player.pause() } diff --git a/src/routes/_components/dialog/components/ModalDialog.html b/src/routes/_components/dialog/components/ModalDialog.html index ccd905d6..cb2d3302 100644 --- a/src/routes/_components/dialog/components/ModalDialog.html +++ b/src/routes/_components/dialog/components/ModalDialog.html @@ -158,9 +158,9 @@ export default { oncreate () { - let { id } = this.get() + const { id } = this.get() this.onPopState = this.onPopState.bind(this) - let dialogElement = this.refs.node.parentElement + const dialogElement = this.refs.node.parentElement this._a11yDialog = new A11yDialog(dialogElement) this._a11yDialog.on('hide', () => { document.body.classList.toggle('modal-open', false) @@ -175,7 +175,7 @@ }, ondestroy () { window.removeEventListener('popstate', this.onPopState) - let { statePopped, statePushed, id } = this.get() + const { statePopped, statePushed, id } = this.get() if (statePushed && !statePopped) { // If we weren't closed due to popstate, then pop state to ensure the correct history. window.history.back() @@ -214,7 +214,7 @@ }, methods: { showDialog (otherId) { - let { id } = this.get() + const { id } = this.get() if (otherId !== id) { return } @@ -233,7 +233,7 @@ }) }, onPopState (event) { - let { id } = this.get() + const { id } = this.get() if (!(event.state && event.state.modal === id)) { // If the new state is not us, just assume that we need to be closed. // This will only fail if modals are ever nested more than 2 levels deep. @@ -242,7 +242,7 @@ } }, closeDialog (otherId) { - let { id } = this.get() + const { id } = this.get() if (id !== otherId) { return } diff --git a/src/routes/_components/dialog/components/MuteDialog.html b/src/routes/_components/dialog/components/MuteDialog.html index a53b6597..607ff584 100644 --- a/src/routes/_components/dialog/components/MuteDialog.html +++ b/src/routes/_components/dialog/components/MuteDialog.html @@ -44,7 +44,7 @@ show, close, async doMute () { - let { account, muteNotifications } = this.get() + const { account, muteNotifications } = this.get() this.close() await setAccountMuted( account.id, diff --git a/src/routes/_components/dialog/components/PinchZoomable.html b/src/routes/_components/dialog/components/PinchZoomable.html index 2ef63bcf..8393c9e0 100644 --- a/src/routes/_components/dialog/components/PinchZoomable.html +++ b/src/routes/_components/dialog/components/PinchZoomable.html @@ -76,8 +76,8 @@ this.zoomBy(-ZOOM_INCREMENT) }, zoomBy (increment) { - let { node } = this.refs - let scale = node.scale || 1 + const { node } = this.refs + const scale = node.scale || 1 node.scaleTo(scale + increment, { originX: '50%', originY: '50%' diff --git a/src/routes/_components/dialog/components/PostPrivacyDialog.html b/src/routes/_components/dialog/components/PostPrivacyDialog.html index 31310b34..706914f2 100644 --- a/src/routes/_components/dialog/components/PostPrivacyDialog.html +++ b/src/routes/_components/dialog/components/PostPrivacyDialog.html @@ -31,7 +31,7 @@ show, close, onClick (item) { - let { realm } = this.get() + const { realm } = this.get() setPostPrivacy(realm, item.key) this.close() } diff --git a/src/routes/_components/dialog/components/ReportDialog.html b/src/routes/_components/dialog/components/ReportDialog.html index 039d8386..6466e706 100644 --- a/src/routes/_components/dialog/components/ReportDialog.html +++ b/src/routes/_components/dialog/components/ReportDialog.html @@ -168,12 +168,12 @@ export default { async oncreate () { onCreateDialog.call(this) - let { account, status, reportMap } = this.get() + const { account, status, reportMap } = this.get() if (status) { reportMap[status.id] = true } try { - let recentStatuses = await getRecentStatusesForAccount(account.id) + const recentStatuses = await getRecentStatusesForAccount(account.id) console.log('recentStatuses', recentStatuses) this.set({ recentStatuses }) } catch (err) { @@ -211,13 +211,13 @@ show, close, onChange (statusId, event) { - let report = event.target.checked - let { reportMap } = this.get() + const report = event.target.checked + const { reportMap } = this.get() reportMap[statusId] = report }, async doReport () { - let { displayStatuses, account, comment, forward, reportMap } = this.get() - let statusIds = displayStatuses.map(({ id }) => id).filter(id => reportMap[id]) + const { displayStatuses, account, comment, forward, reportMap } = this.get() + const statusIds = displayStatuses.map(({ id }) => id).filter(id => reportMap[id]) if (!statusIds.length) { toast.say(`No toots to report.`) } else { diff --git a/src/routes/_components/dialog/components/StatusOptionsDialog.html b/src/routes/_components/dialog/components/StatusOptionsDialog.html index a869ad23..959de080 100644 --- a/src/routes/_components/dialog/components/StatusOptionsDialog.html +++ b/src/routes/_components/dialog/components/StatusOptionsDialog.html @@ -172,53 +172,53 @@ export default { } }, async onDeleteClicked () { - let { statusId } = this.get() + const { statusId } = this.get() this.close() await doDeleteStatus(statusId) }, async onPinClicked () { - let { statusId, pinned } = this.get() + const { statusId, pinned } = this.get() this.close() await setStatusPinnedOrUnpinned(statusId, !pinned, true) }, async onFollowClicked () { - let { accountId, following } = this.get() + const { accountId, following } = this.get() this.close() await setAccountFollowed(accountId, !following, true) }, async onBlockClicked () { - let { accountId, blocking } = this.get() + const { accountId, blocking } = this.get() this.close() await setAccountBlocked(accountId, !blocking, true) }, async onMuteClicked () { - let { account, muting } = this.get() + const { account, muting } = this.get() this.close() await toggleMute(account, !muting) }, async onMuteConversationClicked () { - let { statusId, mutingConversation } = this.get() + const { statusId, mutingConversation } = this.get() this.close() await setConversationMuted(statusId, !mutingConversation, true) }, async onCopyClicked () { - let { status } = this.get() - let { url } = status + const { status } = this.get() + const { url } = status this.close() await copyText(url) }, async onRedraft () { - let { status } = this.get() + const { status } = this.get() this.close() await deleteAndRedraft(status) }, async onShare () { - let { status } = this.get() + const { status } = this.get() this.close() await shareStatus(status) }, async onReport () { - let { status, account } = this.get() + const { status, account } = this.get() this.close() await reportStatusOrAccount(({ status, account })) } diff --git a/src/routes/_components/dialog/creators/showDialog.js b/src/routes/_components/dialog/creators/showDialog.js index 9f31df6c..dd2806d8 100644 --- a/src/routes/_components/dialog/creators/showDialog.js +++ b/src/routes/_components/dialog/creators/showDialog.js @@ -2,7 +2,7 @@ import { createDialogElement } from '../helpers/createDialogElement' import { createDialogId } from '../helpers/createDialogId' export function showDialog (Dialog, data) { - let dialog = new Dialog({ + const dialog = new Dialog({ target: createDialogElement(), data: Object.assign({ id: createDialogId() diff --git a/src/routes/_components/dialog/helpers/closeDialog.js b/src/routes/_components/dialog/helpers/closeDialog.js index 669d8243..9a7056ae 100644 --- a/src/routes/_components/dialog/helpers/closeDialog.js +++ b/src/routes/_components/dialog/helpers/closeDialog.js @@ -1,6 +1,6 @@ import { emit } from '../../../_utils/eventBus' export function close () { - let { id } = this.get() + const { id } = this.get() emit('closeDialog', id) } diff --git a/src/routes/_components/dialog/helpers/createDialogElement.js b/src/routes/_components/dialog/helpers/createDialogElement.js index 57a35639..cc075021 100644 --- a/src/routes/_components/dialog/helpers/createDialogElement.js +++ b/src/routes/_components/dialog/helpers/createDialogElement.js @@ -1,5 +1,5 @@ export function createDialogElement () { - let div = document.createElement('div') + const div = document.createElement('div') div.setAttribute('class', 'modal-dialog') div.setAttribute('aria-hidden', 'true') document.body.appendChild(div) diff --git a/src/routes/_components/dialog/helpers/onCreateDialog.js b/src/routes/_components/dialog/helpers/onCreateDialog.js index 42b0c859..e78d1fab 100644 --- a/src/routes/_components/dialog/helpers/onCreateDialog.js +++ b/src/routes/_components/dialog/helpers/onCreateDialog.js @@ -1,7 +1,7 @@ import { on } from '../../../_utils/eventBus' function onDestroy (thisId) { - let { id } = this.get() + const { id } = this.get() if (id !== thisId) { return } diff --git a/src/routes/_components/dialog/helpers/showDialog.js b/src/routes/_components/dialog/helpers/showDialog.js index 2b0e501c..133e7c53 100644 --- a/src/routes/_components/dialog/helpers/showDialog.js +++ b/src/routes/_components/dialog/helpers/showDialog.js @@ -1,6 +1,6 @@ import { emit } from '../../../_utils/eventBus' export function show () { - let { id } = this.get() + const { id } = this.get() emit('showDialog', id) } diff --git a/src/routes/_components/list/List.html b/src/routes/_components/list/List.html index 0752e607..ab207f56 100644 --- a/src/routes/_components/list/List.html +++ b/src/routes/_components/list/List.html @@ -23,7 +23,7 @@ export default { oncreate () { - let { realm } = this.get() + const { realm } = this.get() this.store.setCurrentRealm(realm) }, ondestroy () { @@ -39,9 +39,9 @@ } }, initialize () { - let { scrollToItem } = this.get() + const { scrollToItem } = this.get() if (scrollToItem) { - let element = document.getElementById(`list-item-${scrollToItem}`) + const element = document.getElementById(`list-item-${scrollToItem}`) requestAnimationFrame(() => { console.log('scrolling element into view') // TODO: this is hacky diff --git a/src/routes/_components/list/ListLazyItem.html b/src/routes/_components/list/ListLazyItem.html index 13f286b7..d6d18f24 100644 --- a/src/routes/_components/list/ListLazyItem.html +++ b/src/routes/_components/list/ListLazyItem.html @@ -14,9 +14,9 @@ export default { async oncreate () { - let { makeProps, key } = this.get() + const { makeProps, key } = this.get() if (makeProps) { - let props = await makeProps(key) + const props = await makeProps(key) mark('ListLazyItem set props') this.set({ props: props }) this.fire('initialized') diff --git a/src/routes/_components/profile/AccountDisplayName.html b/src/routes/_components/profile/AccountDisplayName.html index 3dff1ff8..3c475707 100644 --- a/src/routes/_components/profile/AccountDisplayName.html +++ b/src/routes/_components/profile/AccountDisplayName.html @@ -19,7 +19,7 @@ accountName = escapeHtml(accountName) if ($omitEmojiInDisplayNames) { // display name emoji are annoying to some screenreader users - let emojiFreeDisplayName = removeEmoji(accountName, emojis) + const emojiFreeDisplayName = removeEmoji(accountName, emojis) if (emojiFreeDisplayName) { return emojiFreeDisplayName } diff --git a/src/routes/_components/profile/AccountProfileDetails.html b/src/routes/_components/profile/AccountProfileDetails.html index a95b4518..ebdce2f3 100644 --- a/src/routes/_components/profile/AccountProfileDetails.html +++ b/src/routes/_components/profile/AccountProfileDetails.html @@ -138,8 +138,8 @@ }, methods: { async onMoreOptionsClick () { - let { account, relationship, verifyCredentials } = this.get() - let showAccountProfileOptionsDialog = await importShowAccountProfileOptionsDialog() + const { account, relationship, verifyCredentials } = this.get() + const showAccountProfileOptionsDialog = await importShowAccountProfileOptionsDialog() showAccountProfileOptionsDialog(account, relationship, verifyCredentials) } }, diff --git a/src/routes/_components/profile/AccountProfileFollow.html b/src/routes/_components/profile/AccountProfileFollow.html index 6bf44269..e4bc23d1 100644 --- a/src/routes/_components/profile/AccountProfileFollow.html +++ b/src/routes/_components/profile/AccountProfileFollow.html @@ -31,7 +31,7 @@ async onFollowButtonClick (e) { e.preventDefault() e.stopPropagation() - let { + const { account, accountId, following, @@ -41,7 +41,7 @@ if (blocking) { // unblock await setAccountBlocked(accountId, false) } else { // follow/unfollow - let newFollowingValue = !(following || followRequested) + const newFollowingValue = !(following || followRequested) if (!account.locked) { // be optimistic, show the user that it succeeded this.set({ overrideFollowing: newFollowingValue }) } diff --git a/src/routes/_components/profile/AccountProfilePage.html b/src/routes/_components/profile/AccountProfilePage.html index c3c1057e..2a12661d 100644 --- a/src/routes/_components/profile/AccountProfilePage.html +++ b/src/routes/_components/profile/AccountProfilePage.html @@ -33,7 +33,7 @@ export default { oncreate () { - let { accountId } = this.get() + const { accountId } = this.get() clearProfileAndRelationship() updateProfileAndRelationship(accountId) }, diff --git a/src/routes/_components/settings/SettingsNav.html b/src/routes/_components/settings/SettingsNav.html index 5f769c3f..ecf49f24 100644 --- a/src/routes/_components/settings/SettingsNav.html +++ b/src/routes/_components/settings/SettingsNav.html @@ -41,7 +41,7 @@ import SettingsNavItem from './SettingsNavItem.html' const NAV_ITEMS = { - 'settings': 'Settings', + settings: 'Settings', 'settings/about': 'About Pinafore', 'settings/general': 'General', 'settings/instances': 'Instances', @@ -54,11 +54,11 @@ }, computed: { navItems: ({ page }) => { - let res = [] - let breadcrumbs = page.split('/') + const res = [] + const breadcrumbs = page.split('/') let path = '' for (let i = 0; i < breadcrumbs.length - 1; i++) { - let currentPage = breadcrumbs[i] + const currentPage = breadcrumbs[i] path += currentPage res.push({ label: NAV_ITEMS[path], diff --git a/src/routes/_components/settings/instance/GenericInstanceSettings.html b/src/routes/_components/settings/instance/GenericInstanceSettings.html index d7c220e3..7ebc8584 100644 --- a/src/routes/_components/settings/instance/GenericInstanceSettings.html +++ b/src/routes/_components/settings/instance/GenericInstanceSettings.html @@ -30,16 +30,16 @@ export default { oncreate () { - let { instanceName, options } = this.get() - let { form } = this.refs - for (let { key, defaultValue } of options) { + const { instanceName, options } = this.get() + const { form } = this.refs + for (const { key, defaultValue } of options) { form.elements[key].checked = this.store.getInstanceSetting(instanceName, key, defaultValue) } }, methods: { onChange (event) { - let { instanceName } = this.get() - let { target } = event + const { instanceName } = this.get() + const { target } = event this.store.setInstanceSetting(instanceName, target.name, target.checked) } }, diff --git a/src/routes/_components/settings/instance/InstanceActions.html b/src/routes/_components/settings/instance/InstanceActions.html index bb5ade5c..6ffdb73e 100644 --- a/src/routes/_components/settings/instance/InstanceActions.html +++ b/src/routes/_components/settings/instance/InstanceActions.html @@ -29,14 +29,14 @@ methods: { onSwitchToThisInstance (e) { e.preventDefault() - let { instanceName } = this.get() + const { instanceName } = this.get() switchToInstance(instanceName) }, async onLogOut (e) { e.preventDefault() - let { instanceName } = this.get() + const { instanceName } = this.get() - let showTextConfirmationDialog = await importShowTextConfirmationDialog() + const showTextConfirmationDialog = await importShowTextConfirmationDialog() showTextConfirmationDialog({ text: `Log out of ${instanceName}?` }).on('positive', () => { diff --git a/src/routes/_components/settings/instance/PushNotificationSettings.html b/src/routes/_components/settings/instance/PushNotificationSettings.html index 0ed44e27..34be2ebd 100644 --- a/src/routes/_components/settings/instance/PushNotificationSettings.html +++ b/src/routes/_components/settings/instance/PushNotificationSettings.html @@ -49,13 +49,13 @@ export default { async oncreate () { - let { instanceName, options } = this.get() + const { instanceName, options } = this.get() await updatePushSubscriptionForInstance(instanceName) const { form } = this.refs const pushSubscription = this.store.getInstanceData(instanceName, 'pushSubscriptions') - for (let { key } of options) { + for (const { key } of options) { form.elements[key].checked = get(pushSubscription, ['alerts', key]) } }, @@ -93,7 +93,7 @@ const { form } = this.refs const alerts = {} - for (let { key } of options) { + for (const { key } of options) { alerts[key] = form.elements[key].checked } @@ -104,7 +104,7 @@ // TODO: Better way to detect missing authorization scope if (err.message.startsWith('403:')) { - let showTextConfirmationDialog = await importShowTextConfirmationDialog() + const showTextConfirmationDialog = await importShowTextConfirmationDialog() showTextConfirmationDialog({ text: `You need to reauthenticate in order to enable push notification. Log out of ${instanceName}?` }).on('positive', () => { diff --git a/src/routes/_components/settings/instance/ThemeSettings.html b/src/routes/_components/settings/instance/ThemeSettings.html index bcb435e9..c772cbdb 100644 --- a/src/routes/_components/settings/instance/ThemeSettings.html +++ b/src/routes/_components/settings/instance/ThemeSettings.html @@ -90,8 +90,8 @@ export default { async oncreate () { - let { instanceName } = this.get() - let { instanceThemes } = this.store.get() + const { instanceName } = this.get() + const { instanceThemes } = this.store.get() this.set({ selectedTheme: instanceThemes[instanceName] || DEFAULT_THEME }) @@ -116,7 +116,7 @@ }, methods: { onThemeChange () { - let { selectedTheme, instanceName } = this.get() + const { selectedTheme, instanceName } = this.get() changeTheme(instanceName, selectedTheme) } } diff --git a/src/routes/_components/shortcut/ScrollListShortcuts.html b/src/routes/_components/shortcut/ScrollListShortcuts.html index c0e85c8d..88a0c5d6 100644 --- a/src/routes/_components/shortcut/ScrollListShortcuts.html +++ b/src/routes/_components/shortcut/ScrollListShortcuts.html @@ -43,8 +43,8 @@ } let activeItemKey = this.checkActiveItem(event.timeStamp) if (!activeItemKey) { - let { elements } = this.get() - let index = firstVisibleElementIndex(elements).first + const { elements } = this.get() + const index = firstVisibleElementIndex(elements).first if (index >= 0) { activeItemKey = elementToKey(elements[index]) } @@ -54,11 +54,11 @@ } }, changeActiveItem (movement, timeStamp) { - let { elements } = this.get() + const { elements } = this.get() let index = -1 let activeItemKey = this.checkActiveItem(timeStamp) if (activeItemKey) { - let len = elements.length + const len = elements.length let i = -1 while (++i < len) { if (elementToKey(elements[i]) === activeItemKey) { @@ -74,7 +74,7 @@ return } if (index === -1) { - let { first, firstComplete } = firstVisibleElementIndex(elements) + const { first, firstComplete } = firstVisibleElementIndex(elements) index = (movement > 0) ? firstComplete : first } else { index += movement @@ -86,15 +86,15 @@ } }, checkActiveItem (timeStamp) { - let activeElement = document.activeElement + const activeElement = document.activeElement if (!activeElement) { return null } - let activeItem = activeElement.getAttribute('id') + const activeItem = activeElement.getAttribute('id') if (!activeItem) { return null } - let { activeItemChangeTime } = this.get() + const { activeItemChangeTime } = this.get() if ((timeStamp - activeItemChangeTime) > VISIBILITY_CHECK_DELAY_MS && !isVisible(keyToElement(activeItem))) { this.setActiveItem(null, 0) diff --git a/src/routes/_components/shortcut/Shortcut.html b/src/routes/_components/shortcut/Shortcut.html index 790b6cdd..3e6d3f1e 100644 --- a/src/routes/_components/shortcut/Shortcut.html +++ b/src/routes/_components/shortcut/Shortcut.html @@ -5,11 +5,11 @@ export default { data: () => ({ scope: 'global', key: null }), oncreate () { - let { scope, key } = this.get() + const { scope, key } = this.get() addToShortcutScope(scope, key, this) }, ondestroy () { - let { scope, key } = this.get() + const { scope, key } = this.get() removeFromShortcutScope(scope, key, this) }, methods: { diff --git a/src/routes/_components/snackbar/Snackbar.html b/src/routes/_components/snackbar/Snackbar.html index ab3599f2..a528d5e3 100644 --- a/src/routes/_components/snackbar/Snackbar.html +++ b/src/routes/_components/snackbar/Snackbar.html @@ -142,7 +142,7 @@ onClick (e) { e.preventDefault() e.stopPropagation() - let { buttonAction } = this.get() + const { buttonAction } = this.get() if (buttonAction) { buttonAction() } diff --git a/src/routes/_components/snackbar/snackbar.js b/src/routes/_components/snackbar/snackbar.js index 17d94434..597ee215 100644 --- a/src/routes/_components/snackbar/snackbar.js +++ b/src/routes/_components/snackbar/snackbar.js @@ -5,7 +5,7 @@ let snackbar const lazySnackbar = { async announce (text, buttonText, buttonAction) { if (!snackbar) { - let Snackbar = await importSnackbar() + const Snackbar = await importSnackbar() if (!snackbar) { snackbar = new Snackbar({ target: document.querySelector('#theSnackbar') diff --git a/src/routes/_components/status/Media.html b/src/routes/_components/status/Media.html index f01ba78b..192682aa 100644 --- a/src/routes/_components/status/Media.html +++ b/src/routes/_components/status/Media.html @@ -94,7 +94,7 @@ export default { oncreate () { - let { elementId } = this.get() + const { elementId } = this.get() registerClickDelegate(this, elementId, () => this.onClick()) }, computed: { @@ -132,8 +132,8 @@ methods: { onClick () { (async () => { - let { mediaAttachments, index } = this.get() - let showMediaDialog = await importShowMediaDialog() + const { mediaAttachments, index } = this.get() + const showMediaDialog = await importShowMediaDialog() showMediaDialog(mediaAttachments, index) })() return true diff --git a/src/routes/_components/status/Notification.html b/src/routes/_components/status/Notification.html index 8ac7f687..c338d9a1 100644 --- a/src/routes/_components/status/Notification.html +++ b/src/routes/_components/status/Notification.html @@ -77,11 +77,11 @@ }, methods: { openAuthorProfile () { - let { accountId } = this.get() + const { accountId } = this.get() goto(`/accounts/${accountId}`) }, async mentionAuthor () { - let { account } = this.get() + const { account } = this.get() await composeNewStatusMentioning(account) } } diff --git a/src/routes/_components/status/Status.html b/src/routes/_components/status/Status.html index 99315b7c..c3dcfa2b 100644 --- a/src/routes/_components/status/Status.html +++ b/src/routes/_components/status/Status.html @@ -144,8 +144,8 @@ export default { oncreate () { - let { elementId, isStatusInOwnThread, showContent } = this.get() - let { disableTapOnStatus } = this.store.get() + const { elementId, isStatusInOwnThread, showContent } = this.get() + const { disableTapOnStatus } = this.store.get() if (!isStatusInOwnThread && !disableTapOnStatus) { // the whole
is clickable in this case registerClickDelegate(this, elementId, (e) => this.onClickOrKeydown(e)) @@ -184,10 +184,10 @@ store: () => store, methods: { onClickOrKeydown (e) { - let { type, keyCode, target } = e + const { type, keyCode, target } = e - let isClick = type === 'click' - let isEnter = type === 'keydown' && keyCode === 13 + const isClick = type === 'click' + const isEnter = type === 'keydown' && keyCode === 13 if (!isClick && !isEnter) { return false } @@ -205,15 +205,15 @@ return true }, open () { - let { originalStatusId } = this.get() + const { originalStatusId } = this.get() goto(`/statuses/${originalStatusId}`) }, openAuthorProfile () { - let { accountForShortcut } = this.get() + const { accountForShortcut } = this.get() goto(`/accounts/${accountForShortcut.id}`) }, async mentionAuthor () { - let { accountForShortcut } = this.get() + const { accountForShortcut } = this.get() await composeNewStatusMentioning(accountForShortcut) } }, diff --git a/src/routes/_components/status/StatusComposeBox.html b/src/routes/_components/status/StatusComposeBox.html index 51dd7add..5c7b8560 100644 --- a/src/routes/_components/status/StatusComposeBox.html +++ b/src/routes/_components/status/StatusComposeBox.html @@ -37,13 +37,13 @@ methods: { observe, onPostedStatus (realm) { - let { originalStatusId } = this.get() + const { originalStatusId } = this.get() if (realm !== originalStatusId) { return } requestAnimationFrame(() => { - let { uuid } = this.get() - let { repliesShown } = this.store.get() + const { uuid } = this.get() + const { repliesShown } = this.store.get() repliesShown[uuid] = false this.store.set({ repliesShown }) this.fire('recalculateHeight') diff --git a/src/routes/_components/status/StatusContent.html b/src/routes/_components/status/StatusContent.html index 74489333..ecb4b3da 100644 --- a/src/routes/_components/status/StatusContent.html +++ b/src/routes/_components/status/StatusContent.html @@ -110,16 +110,16 @@ methods: { hydrateContent () { mark('hydrateContent') - let node = this.refs.node - let { originalStatus, uuid } = this.get() - let { mentions, tags } = originalStatus + const node = this.refs.node + const { originalStatus, uuid } = this.get() + const { mentions, tags } = originalStatus let count = 0 - let anchors = Array.from(node.getElementsByTagName('A')) + const anchors = Array.from(node.getElementsByTagName('A')) - for (let anchor of anchors) { + for (const anchor of anchors) { // hydrate hashtag if (tags && anchor.classList.contains('hashtag')) { - for (let tag of tags) { + for (const tag of tags) { if (anchor.getAttribute('href').endsWith(`/tags/${tag.name}`)) { anchor.setAttribute('href', `/tags/${tag.name}`) anchor.setAttribute('id', `status-content-link-${uuid}-${++count}`) @@ -129,7 +129,7 @@ } // hydrate mention } else if (mentions && anchor.classList.contains('mention')) { - for (let mention of mentions) { + for (const mention of mentions) { if (anchor.getAttribute('href') === mention.url) { anchor.setAttribute('href', `/accounts/${mention.id}`) anchor.setAttribute('title', `@${mention.acct}`) @@ -140,7 +140,7 @@ } } // hydrate external links - let href = anchor.getAttribute('href') + const href = anchor.getAttribute('href') if (new URL(href, location.href).origin !== location.origin) { anchor.setAttribute('title', href) anchor.setAttribute('target', '_blank') diff --git a/src/routes/_components/status/StatusDetails.html b/src/routes/_components/status/StatusDetails.html index 8c537af7..81bd4295 100644 --- a/src/routes/_components/status/StatusDetails.html +++ b/src/routes/_components/status/StatusDetails.html @@ -138,7 +138,7 @@ export default { oncreate () { - let { originalStatusId } = this.get() + const { originalStatusId } = this.get() on('statusUpdated', this, status => { if (status.id === originalStatusId) { this.set({ diff --git a/src/routes/_components/status/StatusMediaAttachments.html b/src/routes/_components/status/StatusMediaAttachments.html index 86cfd28f..cf0480e3 100644 --- a/src/routes/_components/status/StatusMediaAttachments.html +++ b/src/routes/_components/status/StatusMediaAttachments.html @@ -155,7 +155,7 @@ export default { oncreate () { - let { elementId } = this.get() + const { elementId } = this.get() registerClickDelegate(this, elementId, () => this.toggleSensitiveMedia()) }, components: { @@ -185,8 +185,8 @@ }, methods: { toggleSensitiveMedia () { - let { uuid } = this.get() - let { sensitivesShown } = this.store.get() + const { uuid } = this.get() + const { sensitivesShown } = this.store.get() sensitivesShown[uuid] = !sensitivesShown[uuid] this.store.set({ sensitivesShown }) this.fire('recalculateHeight') diff --git a/src/routes/_components/status/StatusPoll.html b/src/routes/_components/status/StatusPoll.html index f7e717a2..88ef378e 100644 --- a/src/routes/_components/status/StatusPoll.html +++ b/src/routes/_components/status/StatusPoll.html @@ -224,9 +224,9 @@ const REFRESH_MIN_DELAY = 1000 async function doAsyncActionWithDelay (func) { - let start = Date.now() - let res = await func() - let timeElapsed = Date.now() - start + const start = Date.now() + const res = await func() + const timeElapsed = Date.now() - start if (timeElapsed < REFRESH_MIN_DELAY) { // If less than five seconds, then continue to show the loading animation // so it's clear that something happened. @@ -236,7 +236,7 @@ } function getChoices (form, options) { - let res = [] + const res = [] for (let i = 0; i < options.length; i++) { if (form.elements[i].checked) { res.push(i) @@ -248,7 +248,7 @@ export default { oncreate () { this.onRefreshClick = this.onRefreshClick.bind(this) - let { refreshElementId } = this.get() + const { refreshElementId } = this.get() registerClickDelegate(this, refreshElementId, this.onRefreshClick) }, data: () => ({ @@ -289,12 +289,12 @@ methods: { onRefreshClick () { (async () => { - let { pollId } = this.get() + const { pollId } = this.get() this.set({ loading: true }) try { - let poll = await doAsyncActionWithDelay(() => getPoll(pollId)) + const poll = await doAsyncActionWithDelay(() => getPoll(pollId)) if (poll) { - let { polls } = this.store.get() + const { polls } = this.store.get() polls[pollId] = poll this.store.set({ polls }) } @@ -307,16 +307,16 @@ async onSubmit (e) { e.preventDefault() e.stopPropagation() - let { pollId, options, formDisabled } = this.get() + const { pollId, options, formDisabled } = this.get() if (formDisabled) { return } - let choices = getChoices(this.refs.form, options) + const choices = getChoices(this.refs.form, options) this.set({ loading: true }) try { - let poll = await doAsyncActionWithDelay(() => voteOnPoll(pollId, choices)) + const poll = await doAsyncActionWithDelay(() => voteOnPoll(pollId, choices)) if (poll) { - let { polls } = this.store.get() + const { polls } = this.store.get() polls[pollId] = poll this.store.set({ polls }) } @@ -325,8 +325,8 @@ } }, onChange () { - let { options } = this.get() - let choices = getChoices(this.refs.form, options) + const { options } = this.get() + const choices = getChoices(this.refs.form, options) this.set({ choices: choices }) } }, diff --git a/src/routes/_components/status/StatusSpoiler.html b/src/routes/_components/status/StatusSpoiler.html index 377503f3..07c2665f 100644 --- a/src/routes/_components/status/StatusSpoiler.html +++ b/src/routes/_components/status/StatusSpoiler.html @@ -56,7 +56,7 @@ export default { oncreate () { - let { elementId } = this.get() + const { elementId } = this.get() registerClickDelegate(this, elementId, () => this.toggleSpoilers()) }, store: () => store, @@ -74,8 +74,8 @@ toggleSpoilers () { requestAnimationFrame(() => { mark('clickSpoilerButton') - let { uuid } = this.get() - let { spoilersShown } = this.store.get() + const { uuid } = this.get() + const { spoilersShown } = this.store.get() spoilersShown[uuid] = !spoilersShown[uuid] this.store.set({ spoilersShown }) this.fire('recalculateHeight') diff --git a/src/routes/_components/status/StatusToolbar.html b/src/routes/_components/status/StatusToolbar.html index 63e10ecc..d2370400 100644 --- a/src/routes/_components/status/StatusToolbar.html +++ b/src/routes/_components/status/StatusToolbar.html @@ -70,7 +70,7 @@ export default { oncreate () { - let { + const { favoriteKey, reblogKey, replyKey, @@ -103,16 +103,16 @@ store: () => store, methods: { toggleFavorite () { - let { originalStatusId, favorited } = this.get() - let newFavoritedValue = !favorited + const { originalStatusId, favorited } = this.get() + const newFavoritedValue = !favorited /* no await */ setFavorited(originalStatusId, newFavoritedValue) if (newFavoritedValue) { this.refs.favoriteIcon.animate(FAVORITE_ANIMATION) } }, reblog () { - let { originalStatusId, reblogged } = this.get() - let newRebloggedValue = !reblogged + const { originalStatusId, reblogged } = this.get() + const newRebloggedValue = !reblogged /* no await */ setReblogged(originalStatusId, newRebloggedValue) if (newRebloggedValue) { this.refs.reblogIcon.animate(REBLOG_ANIMATION) @@ -120,22 +120,22 @@ }, reply () { requestAnimationFrame(() => { - let { uuid } = this.get() - let { repliesShown } = this.store.get() + const { uuid } = this.get() + const { repliesShown } = this.store.get() repliesShown[uuid] = !repliesShown[uuid] this.store.set({ repliesShown }) this.fire('recalculateHeight') }) }, async onOptionsClick () { - let { originalStatus, originalAccountId } = this.get() - let updateRelationshipPromise = updateProfileAndRelationship(originalAccountId) - let showStatusOptionsDialog = await importShowStatusOptionsDialog() + const { originalStatus, originalAccountId } = this.get() + const updateRelationshipPromise = updateProfileAndRelationship(originalAccountId) + const showStatusOptionsDialog = await importShowStatusOptionsDialog() await updateRelationshipPromise showStatusOptionsDialog(originalStatus) }, onPostedStatus (realm, inReplyToUuid) { - let { + const { originalStatusId, uuid } = this.get() diff --git a/src/routes/_components/timeline/LazyTimeline.html b/src/routes/_components/timeline/LazyTimeline.html index a56a143c..a641d280 100644 --- a/src/routes/_components/timeline/LazyTimeline.html +++ b/src/routes/_components/timeline/LazyTimeline.html @@ -18,8 +18,8 @@ export default { oncreate () { - let { currentInstance } = this.store.get() - let { timeline } = this.get() + const { currentInstance } = this.store.get() + const { timeline } = this.get() this.store.set({ currentTimeline: timeline }) this.store.setForTimeline(currentInstance, timeline, { runningUpdate: false }) }, diff --git a/src/routes/_components/timeline/LoadingFooter.html b/src/routes/_components/timeline/LoadingFooter.html index 1d569711..c418c8e7 100644 --- a/src/routes/_components/timeline/LoadingFooter.html +++ b/src/routes/_components/timeline/LoadingFooter.html @@ -80,13 +80,13 @@ onClickLoadMore (e) { e.preventDefault() e.stopPropagation() - let { currentInstance, currentTimeline } = this.store.get() + const { currentInstance, currentTimeline } = this.store.get() /* no await */ fetchMoreItemsAtBottomOfTimeline(currentInstance, currentTimeline) // focus the last item in the timeline; it makes the most sense to me since the button disappears try { // TODO: should probably expose this as an API on the virtual list instead of reaching into the DOM - let virtualListItems = document.querySelector('.virtual-list').children - let lastItem = virtualListItems[virtualListItems.length - 2] // -2 because the footer is last + const virtualListItems = document.querySelector('.virtual-list').children + const lastItem = virtualListItems[virtualListItems.length - 2] // -2 because the footer is last lastItem.querySelector('article').focus() } catch (e) { console.error(e) diff --git a/src/routes/_components/timeline/MoreHeader.html b/src/routes/_components/timeline/MoreHeader.html index ea24c163..807ee0c6 100644 --- a/src/routes/_components/timeline/MoreHeader.html +++ b/src/routes/_components/timeline/MoreHeader.html @@ -15,7 +15,7 @@ export default { methods: { onClick (event) { - let { onClick } = this.get() + const { onClick } = this.get() if (onClick) { onClick(event) } diff --git a/src/routes/_components/timeline/PinnedStatuses.html b/src/routes/_components/timeline/PinnedStatuses.html index 6ead5063..93bd0419 100644 --- a/src/routes/_components/timeline/PinnedStatuses.html +++ b/src/routes/_components/timeline/PinnedStatuses.html @@ -42,7 +42,7 @@ }, methods: { async updatePinnedStatuses () { - let { accountId } = this.get() + const { accountId } = this.get() await updatePinnedStatusesForAccount(accountId) } } diff --git a/src/routes/_components/timeline/Timeline.html b/src/routes/_components/timeline/Timeline.html index 684b3056..5a05c6d7 100644 --- a/src/routes/_components/timeline/Timeline.html +++ b/src/routes/_components/timeline/Timeline.html @@ -143,7 +143,7 @@ methods: { observe, initialize () { - let { initializeStarted } = this.get() + const { initializeStarted } = this.get() if (initializeStarted) { return } @@ -159,20 +159,20 @@ this.set({ scrollTop: scrollTop }) }, onScrollToBottom () { - let { timelineType } = this.get() - let { timelineInitialized, runningUpdate, disableInfiniteScroll } = this.store.get() + const { timelineType } = this.get() + const { timelineInitialized, runningUpdate, disableInfiniteScroll } = this.store.get() if (!timelineInitialized || runningUpdate || disableInfiniteScroll || timelineType === 'status') { // for status contexts, we've already fetched the whole thread return } - let { currentInstance } = this.store.get() - let { timeline } = this.get() + const { currentInstance } = this.store.get() + const { timeline } = this.get() /* no await */ fetchMoreItemsAtBottomOfTimeline(currentInstance, timeline) }, onScrollToTop () { - let { shouldShowHeader } = this.store.get() + const { shouldShowHeader } = this.store.get() if (shouldShowHeader) { this.store.setForCurrentTimeline({ showHeader: true, @@ -181,16 +181,16 @@ } }, setupStreaming () { - let { currentInstance, disableInfiniteScroll } = this.store.get() - let { timeline, timelineType } = this.get() - let handleItemIdsToAdd = () => { - let { itemIdsToAdd } = this.get() + const { currentInstance, disableInfiniteScroll } = this.store.get() + const { timeline, timelineType } = this.get() + const handleItemIdsToAdd = () => { + const { itemIdsToAdd } = this.get() if (!itemIdsToAdd || !itemIdsToAdd.length) { return } mark('handleItemIdsToAdd') - let { scrollTop } = this.get() - let { + const { scrollTop } = this.get() + const { shouldShowHeader, showHeader } = this.store.get() @@ -235,10 +235,10 @@ }, saveFocus (e) { try { - let { currentInstance } = this.store.get() - let { timeline } = this.get() + const { currentInstance } = this.store.get() + const { timeline } = this.get() let lastFocusedElementId - let activeElement = e.target + const activeElement = e.target if (activeElement) { lastFocusedElementId = activeElement.getAttribute('id') } @@ -252,13 +252,13 @@ }, clearFocus () { try { - let { ignoreBlurEvents } = this.store.get() + const { ignoreBlurEvents } = this.store.get() if (ignoreBlurEvents) { return } console.log('clearing focus') - let { currentInstance } = this.store.get() - let { timeline } = this.get() + const { currentInstance } = this.store.get() + const { timeline } = this.get() this.store.setForTimeline(currentInstance, timeline, { lastFocusedElementId: null }) @@ -267,14 +267,14 @@ } }, restoreFocus () { - let { lastFocusedElementId } = this.store.get() + const { lastFocusedElementId } = this.store.get() if (!lastFocusedElementId) { return } console.log('restoreFocus', lastFocusedElementId) requestAnimationFrame(() => { requestAnimationFrame(() => { - let element = document.getElementById(lastFocusedElementId) + const element = document.getElementById(lastFocusedElementId) if (element) { element.focus({ preventScroll: true }) } diff --git a/src/routes/_components/toast/Toast.html b/src/routes/_components/toast/Toast.html index 19ebd887..5ccc0250 100644 --- a/src/routes/_components/toast/Toast.html +++ b/src/routes/_components/toast/Toast.html @@ -75,7 +75,7 @@ onNewToast (text) { this._queue = this._queue.then(() => { this.set({ - 'text': text, + text: text, shown: true }) return new Promise(resolve => { diff --git a/src/routes/_components/toast/toast.js b/src/routes/_components/toast/toast.js index ac35fc65..be4e89ac 100644 --- a/src/routes/_components/toast/toast.js +++ b/src/routes/_components/toast/toast.js @@ -5,7 +5,7 @@ let toast const lazyToast = { async say (text) { if (!toast) { - let Toast = await importToast() + const Toast = await importToast() if (!toast) { toast = new Toast({ target: document.querySelector('#theToast') diff --git a/src/routes/_components/virtualList/VirtualList.html b/src/routes/_components/virtualList/VirtualList.html index 6f91486d..4faa9d36 100644 --- a/src/routes/_components/virtualList/VirtualList.html +++ b/src/routes/_components/virtualList/VirtualList.html @@ -115,14 +115,14 @@ observe, calculateListOffset () { // TODO: better way to get the offset top? - let node = this.refs.node + const node = this.refs.node if (!node) { return } mark('calculateListOffset') - let { offsetParent } = node + const { offsetParent } = node // TODO: offsetParent is null sometimes in testcafe tests - let listOffset = offsetParent ? offsetParent.offsetTop : 0 + const listOffset = offsetParent ? offsetParent.offsetTop : 0 this.store.setForRealm({ listOffset }) stop('calculateListOffset') } diff --git a/src/routes/_components/virtualList/VirtualListContainer.html b/src/routes/_components/virtualList/VirtualListContainer.html index 4839ff21..faefac60 100644 --- a/src/routes/_components/virtualList/VirtualListContainer.html +++ b/src/routes/_components/virtualList/VirtualListContainer.html @@ -19,21 +19,21 @@ export default { oncreate () { mark('onCreate VirtualListContainer') - let { + const { realm } = this.get() this.store.setCurrentRealm(realm) this.setupScroll() this.setupFullscreen() this.onResize = this.onResize.bind(this) - let { scrollTop } = this.store.get() - let scrollContainer = getScrollContainer() + const { scrollTop } = this.store.get() + const scrollContainer = getScrollContainer() if (scrollTop > 0) { this.observe('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight => { console.log('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight) - let { initializedScrollTop } = this.get() + const { initializedScrollTop } = this.get() if (!initializedScrollTop && allVisibleItemsHaveHeight) { - this.set({ 'initializedScrollTop': true }) + this.set({ initializedScrollTop: true }) requestAnimationFrame(() => { mark('set scrollTop') console.log('forcing scroll top to ', scrollTop) @@ -70,7 +70,7 @@ observe, setupScroll () { this.scrollListener = throttle(event => { - let { fullscreen } = this.get() + const { fullscreen } = this.get() if (fullscreen) { return } @@ -92,7 +92,7 @@ detachFullscreenListener(this.onFullscreenChange) }, onScroll () { - let { scrollTop, scrollHeight } = getScrollContainer() + const { scrollTop, scrollHeight } = getScrollContainer() doubleRAF(() => { mark('onScroll -> setForRealm()') diff --git a/src/routes/_components/virtualList/VirtualListFooter.html b/src/routes/_components/virtualList/VirtualListFooter.html index a374dedd..13c46178 100644 --- a/src/routes/_components/virtualList/VirtualListFooter.html +++ b/src/routes/_components/virtualList/VirtualListFooter.html @@ -17,13 +17,13 @@ export default { oncreate () { requestAnimationFrame(() => { - let node = this.refs.node + const node = this.refs.node if (!node) { return } mark('VirtualListFooter gBCR') - let rect = node.getBoundingClientRect() + const rect = node.getBoundingClientRect() stop('VirtualListFooter gBCR') this.store.setForRealm({ footerHeight: rect.height }) }) diff --git a/src/routes/_components/virtualList/VirtualListHeader.html b/src/routes/_components/virtualList/VirtualListHeader.html index d67eed02..30f43f5f 100644 --- a/src/routes/_components/virtualList/VirtualListHeader.html +++ b/src/routes/_components/virtualList/VirtualListHeader.html @@ -44,14 +44,14 @@ methods: { observe, doCalculateHeight () { - let { heightCalculated } = this.get() + const { heightCalculated } = this.get() if (heightCalculated) { // only need to calculate once, it never changes return } this.set({ heightCalculated: true }) requestAnimationFrame(() => { mark('VirtualListHeader gBCR') - let rect = this.refs.node.getBoundingClientRect() + const rect = this.refs.node.getBoundingClientRect() stop('VirtualListHeader gBCR') this.store.setForRealm({ headerHeight: rect.height }) }) diff --git a/src/routes/_components/virtualList/VirtualListItem.html b/src/routes/_components/virtualList/VirtualListItem.html index 663f1dce..fae5f02e 100644 --- a/src/routes/_components/virtualList/VirtualListItem.html +++ b/src/routes/_components/virtualList/VirtualListItem.html @@ -31,14 +31,14 @@ export default { oncreate () { - let { key } = this.get() - let node = this.refs.node + const { key } = this.get() + const node = this.refs.node requestAnimationFrame(() => { if (!node || !key) { return } mark('VirtualListItem gBCR') - let rect = node.getBoundingClientRect() + const rect = node.getBoundingClientRect() stop('VirtualListItem gBCR') // update all item heights in one batch for better perf this.store.batchUpdateForRealm('itemHeights', key, rect.height) @@ -51,15 +51,15 @@ }, store: () => virtualListStore, computed: { - 'shown': ({ $itemHeights, key }) => $itemHeights[key] > 0 + shown: ({ $itemHeights, key }) => $itemHeights[key] > 0 }, methods: { doRecalculateHeight () { // Recalculate immediately because this is done on-demand, e.g. // when clicking the "More" button on a spoiler. - let rect = this.refs.node.getBoundingClientRect() - let { key } = this.get() - let { itemHeights } = this.store.get() + const rect = this.refs.node.getBoundingClientRect() + const { key } = this.get() + const { itemHeights } = this.store.get() itemHeights[key] = rect.height this.store.setForRealm({ itemHeights }) } diff --git a/src/routes/_components/virtualList/VirtualListLazyItem.html b/src/routes/_components/virtualList/VirtualListLazyItem.html index 0c3b8cc7..2b42a550 100644 --- a/src/routes/_components/virtualList/VirtualListLazyItem.html +++ b/src/routes/_components/virtualList/VirtualListLazyItem.html @@ -12,9 +12,9 @@ export default { async oncreate () { - let { makeProps, key } = this.get() + const { makeProps, key } = this.get() if (makeProps) { - let props = await makeProps(key) + const props = await makeProps(key) mark('VirtualListLazyItem set props') this.set({ props: props }) stop('VirtualListLazyItem set props') diff --git a/src/routes/_components/virtualList/virtualListStore.js b/src/routes/_components/virtualList/virtualListStore.js index c7a2a6cd..3b4dbdda 100644 --- a/src/routes/_components/virtualList/virtualListStore.js +++ b/src/routes/_components/virtualList/virtualListStore.js @@ -33,18 +33,18 @@ virtualListStore.compute('rawVisibleItems', if (!items) { return null } - let effectiveScrollTop = scrollTop - listOffset - let renderBuffer = RENDER_BUFFER_FACTOR * offsetHeight - let visibleItems = [] + const effectiveScrollTop = scrollTop - listOffset + const renderBuffer = RENDER_BUFFER_FACTOR * offsetHeight + const visibleItems = [] let totalOffset = showHeader ? headerHeight : 0 - let len = items.length + const len = items.length let i = -1 while (++i < len) { - let key = items[i] - let height = itemHeights[key] || 0 - let currentOffset = totalOffset + const key = items[i] + const height = itemHeights[key] || 0 + const currentOffset = totalOffset totalOffset += height - let isAboveViewport = (currentOffset < effectiveScrollTop) + const isAboveViewport = (currentOffset < effectiveScrollTop) if (isAboveViewport) { if ((effectiveScrollTop - height - renderBuffer) > currentOffset) { continue // above the area we want to render @@ -74,7 +74,7 @@ virtualListStore.compute('heightWithoutFooter', } let sum = showHeader ? headerHeight : 0 let i = -1 - let len = items.length + const len = items.length while (++i < len) { sum += itemHeights[items[i]] || 0 } @@ -95,7 +95,7 @@ virtualListStore.compute('allVisibleItemsHaveHeight', if (!visibleItems) { return false } - for (let visibleItem of visibleItems) { + for (const visibleItem of visibleItems) { if (!itemHeights[visibleItem.key]) { return false } diff --git a/src/routes/_database/accounts.js b/src/routes/_database/accounts.js index 89b6e62a..c87d5c24 100644 --- a/src/routes/_database/accounts.js +++ b/src/routes/_database/accounts.js @@ -16,7 +16,7 @@ export async function searchAccountsByUsername (instanceName, usernamePrefix, li limit = limit || 20 const db = await getDatabase(instanceName) return dbPromise(db, ACCOUNTS_STORE, 'readonly', (accountsStore, callback) => { - let keyRange = createAccountUsernamePrefixKeyRange(usernamePrefix.toLowerCase()) + const keyRange = createAccountUsernamePrefixKeyRange(usernamePrefix.toLowerCase()) accountsStore.index(USERNAME_LOWERCASE).getAll(keyRange, limit).onsuccess = e => { callback(e.target.result) } diff --git a/src/routes/_database/asyncDatabase.js b/src/routes/_database/asyncDatabase.js index c574a483..a9694e2e 100644 --- a/src/routes/_database/asyncDatabase.js +++ b/src/routes/_database/asyncDatabase.js @@ -8,7 +8,7 @@ const handler = { get: function (obj, prop) { return async function (...args) { if (!obj[prop]) { - let database = await importDatabase() + const database = await importDatabase() obj[prop] = database[prop] } return obj[prop].apply(null, args) diff --git a/src/routes/_database/cache.js b/src/routes/_database/cache.js index edf9abf7..eac588c7 100644 --- a/src/routes/_database/cache.js +++ b/src/routes/_database/cache.js @@ -43,24 +43,24 @@ export function clearCache (cache, instanceName) { delete cache.caches[instanceName] } export function clearAllCaches (instanceName) { - let allCaches = [statusesCache, accountsCache, relationshipsCache, metaCache, notificationsCache] - for (let cache of allCaches) { + const allCaches = [statusesCache, accountsCache, relationshipsCache, metaCache, notificationsCache] + for (const cache of allCaches) { clearCache(cache, instanceName) } } export function setInCache (cache, instanceName, key, value) { - let instanceCache = getOrCreateInstanceCache(cache, instanceName) + const instanceCache = getOrCreateInstanceCache(cache, instanceName) return instanceCache.set(key, value) } export function getInCache (cache, instanceName, key) { - let instanceCache = getOrCreateInstanceCache(cache, instanceName) + const instanceCache = getOrCreateInstanceCache(cache, instanceName) return instanceCache.get(key) } export function hasInCache (cache, instanceName, key) { - let instanceCache = getOrCreateInstanceCache(cache, instanceName) - let res = instanceCache.has(key) + const instanceCache = getOrCreateInstanceCache(cache, instanceName) + const res = instanceCache.has(key) if (process.env.NODE_ENV !== 'production') { if (res) { cache.hits = (cache.hits || 0) + 1 @@ -72,6 +72,6 @@ export function hasInCache (cache, instanceName, key) { } export function deleteFromCache (cache, instanceName, key) { - let instanceCache = getOrCreateInstanceCache(cache, instanceName) + const instanceCache = getOrCreateInstanceCache(cache, instanceName) instanceCache.delete(key) } diff --git a/src/routes/_database/cleanup.js b/src/routes/_database/cleanup.js index cad4af22..04c0f815 100644 --- a/src/routes/_database/cleanup.js +++ b/src/routes/_database/cleanup.js @@ -24,7 +24,7 @@ const DELAY = 5 * 60 * 1000 // five minutes function batchedGetAll (callGetAll, callback) { function nextBatch () { callGetAll().onsuccess = function (e) { - let results = e.target.result + const results = e.target.result callback(results) if (results.length) { nextBatch() @@ -101,8 +101,8 @@ function cleanupRelationships (relationshipsStore, cutoff) { export async function cleanup (instanceName) { console.log('cleanup', instanceName) mark(`cleanup:${instanceName}`) - let db = await getDatabase(instanceName) - let storeNames = [ + const db = await getDatabase(instanceName) + const storeNames = [ STATUSES_STORE, STATUS_TIMELINES_STORE, NOTIFICATIONS_STORE, @@ -113,7 +113,7 @@ export async function cleanup (instanceName) { PINNED_STATUSES_STORE ] await dbPromise(db, storeNames, 'readwrite', (stores) => { - let [ + const [ statusesStore, statusTimelinesStore, notificationsStore, @@ -124,7 +124,7 @@ export async function cleanup (instanceName) { pinnedStatusesStore ] = stores - let cutoff = Date.now() - TIME_AGO + const cutoff = Date.now() - TIME_AGO cleanupStatuses(statusesStore, statusTimelinesStore, threadsStore, cutoff) cleanupNotifications(notificationsStore, notificationTimelinesStore, cutoff) @@ -141,8 +141,8 @@ function doCleanup (instanceName) { async function scheduledCleanup () { console.log('scheduledCleanup') - let knownInstances = await getKnownInstances() - for (let instance of knownInstances) { + const knownInstances = await getKnownInstances() + for (const instance of knownInstances) { doCleanup(instance) } } diff --git a/src/routes/_database/databaseLifecycle.js b/src/routes/_database/databaseLifecycle.js index f778febb..5bd89a98 100644 --- a/src/routes/_database/databaseLifecycle.js +++ b/src/routes/_database/databaseLifecycle.js @@ -9,23 +9,23 @@ const databaseCache = {} function createDatabase (instanceName) { return new Promise((resolve, reject) => { - let req = indexedDB.open(instanceName, DB_VERSION_CURRENT.version) + const req = indexedDB.open(instanceName, DB_VERSION_CURRENT.version) openReqs[instanceName] = req req.onerror = reject req.onblocked = () => { console.error('idb blocked') } req.onupgradeneeded = (e) => { - let db = req.result - let tx = e.currentTarget.transaction + const db = req.result + const tx = e.currentTarget.transaction - let migrationsToDo = migrations.filter(({ version }) => e.oldVersion < version) + const migrationsToDo = migrations.filter(({ version }) => e.oldVersion < version) function doNextMigration () { if (!migrationsToDo.length) { return } - let { migration } = migrationsToDo.shift() + const { migration } = migrationsToDo.shift() migration(db, tx, doNextMigration) } doNextMigration() @@ -48,7 +48,7 @@ export async function getDatabase (instanceName) { export async function dbPromise (db, storeName, readOnlyOrReadWrite, cb) { return new Promise((resolve, reject) => { const tx = db.transaction(storeName, readOnlyOrReadWrite) - let store = typeof storeName === 'string' + const store = typeof storeName === 'string' ? tx.objectStore(storeName) : storeName.map(name => tx.objectStore(name)) let res @@ -64,13 +64,13 @@ export async function dbPromise (db, storeName, readOnlyOrReadWrite, cb) { export function deleteDatabase (instanceName) { return new Promise((resolve, reject) => { // close any open requests - let openReq = openReqs[instanceName] + const openReq = openReqs[instanceName] if (openReq && openReq.result) { openReq.result.close() } delete openReqs[instanceName] delete databaseCache[instanceName] - let req = indexedDB.deleteDatabase(instanceName) + const req = indexedDB.deleteDatabase(instanceName) req.onsuccess = () => resolve() req.onerror = () => reject(req.error) req.onblocked = () => console.error(`database ${instanceName} blocked`) @@ -80,7 +80,7 @@ export function deleteDatabase (instanceName) { export function closeDatabase (instanceName) { // close any open requests - let openReq = openReqs[instanceName] + const openReq = openReqs[instanceName] if (openReq && openReq.result) { openReq.result.close() } diff --git a/src/routes/_database/helpers.js b/src/routes/_database/helpers.js index c0117a70..4f1f12d4 100644 --- a/src/routes/_database/helpers.js +++ b/src/routes/_database/helpers.js @@ -9,7 +9,7 @@ export async function getGenericEntityWithId (store, cache, instanceName, id) { return getInCache(cache, instanceName, id) } const db = await getDatabase(instanceName) - let result = await dbPromise(db, store, 'readonly', (store, callback) => { + const result = await dbPromise(db, store, 'readonly', (store, callback) => { store.get(id).onsuccess = (e) => callback(e.target.result) }) setInCache(cache, instanceName, id, result) @@ -25,10 +25,10 @@ export async function setGenericEntityWithId (store, cache, instanceName, entity } export function cloneForStorage (obj) { - let res = {} - let keys = Object.keys(obj) - for (let key of keys) { - let value = obj[key] + const res = {} + const keys = Object.keys(obj) + for (const key of keys) { + const value = obj[key] // save storage space by skipping nulls, 0s, falses, empty strings, and empty arrays if (!value || (Array.isArray(value) && value.length === 0)) { continue diff --git a/src/routes/_database/keys.js b/src/routes/_database/keys.js index 6e471d37..0f30dc90 100644 --- a/src/routes/_database/keys.js +++ b/src/routes/_database/keys.js @@ -10,9 +10,9 @@ export function createTimelineId (timeline, id) { } export function createTimelineKeyRange (timeline, maxId) { - let negBigInt = maxId && toReversePaddedBigInt(maxId) - let start = negBigInt ? (timeline + '\u0000' + negBigInt) : (timeline + '\u0000') - let end = timeline + '\u0000\uffff' + const negBigInt = maxId && toReversePaddedBigInt(maxId) + const start = negBigInt ? (timeline + '\u0000' + negBigInt) : (timeline + '\u0000') + const end = timeline + '\u0000\uffff' return IDBKeyRange.bound(start, end, true, true) } diff --git a/src/routes/_database/meta.js b/src/routes/_database/meta.js index 9c48ea04..868db0f6 100644 --- a/src/routes/_database/meta.js +++ b/src/routes/_database/meta.js @@ -7,7 +7,7 @@ async function getMetaProperty (instanceName, key) { return getInCache(metaCache, instanceName, key) } const db = await getDatabase(instanceName) - let result = await dbPromise(db, META_STORE, 'readonly', (store, callback) => { + const result = await dbPromise(db, META_STORE, 'readonly', (store, callback) => { store.get(key).onsuccess = (e) => { callback(e.target.result) } diff --git a/src/routes/_database/migrations.js b/src/routes/_database/migrations.js index 58c73811..984c1543 100644 --- a/src/routes/_database/migrations.js +++ b/src/routes/_database/migrations.js @@ -13,7 +13,7 @@ import { toReversePaddedBigInt } from '../_utils/statusIdSorting' function initialMigration (db, tx, done) { function createObjectStore (name, init, indexes) { - let store = init + const store = init ? db.createObjectStore(name, init) : db.createObjectStore(name) if (indexes) { @@ -28,14 +28,14 @@ function initialMigration (db, tx, done) { [REBLOG_ID]: REBLOG_ID }) createObjectStore(STATUS_TIMELINES_STORE, null, { - 'statusId': '' + statusId: '' }) createObjectStore(NOTIFICATIONS_STORE, { keyPath: 'id' }, { [TIMESTAMP]: TIMESTAMP, [STATUS_ID]: STATUS_ID }) createObjectStore(NOTIFICATION_TIMELINES_STORE, null, { - 'notificationId': '' + notificationId: '' }) createObjectStore(ACCOUNTS_STORE, { keyPath: 'id' }, { [TIMESTAMP]: TIMESTAMP @@ -44,10 +44,10 @@ function initialMigration (db, tx, done) { [TIMESTAMP]: TIMESTAMP }) createObjectStore(THREADS_STORE, null, { - 'statusId': '' + statusId: '' }) createObjectStore(PINNED_STATUSES_STORE, null, { - 'statusId': '' + statusId: '' }) createObjectStore(META_STORE) done() @@ -60,20 +60,20 @@ function addSearchAccountsMigration (db, tx, done) { } function snowflakeIdsMigration (db, tx, done) { - let stores = [STATUS_TIMELINES_STORE, NOTIFICATION_TIMELINES_STORE] + const stores = [STATUS_TIMELINES_STORE, NOTIFICATION_TIMELINES_STORE] let storeDoneCount = 0 // Here we have to convert the old "reversePaddedBigInt" format to the new // one which is compatible with Pleroma-style snowflake IDs. stores.forEach(store => { - let objectStore = tx.objectStore(store) - let cursor = objectStore.openCursor() + const objectStore = tx.objectStore(store) + const cursor = objectStore.openCursor() cursor.onsuccess = e => { - let { result } = e.target + const { result } = e.target if (result) { - let { key, value } = result + const { key, value } = result // key is timeline name plus delimiter plus reverse padded big int - let newKey = key.split('\u0000')[0] + '\u0000' + toReversePaddedBigInt(value) + const newKey = key.split('\u0000')[0] + '\u0000' + toReversePaddedBigInt(value) objectStore.delete(key).onsuccess = () => { objectStore.add(value, newKey).onsuccess = () => { diff --git a/src/routes/_database/timelines/deletion.js b/src/routes/_database/timelines/deletion.js index 77ab7ff2..3efb6e9d 100644 --- a/src/routes/_database/timelines/deletion.js +++ b/src/routes/_database/timelines/deletion.js @@ -16,14 +16,14 @@ import { import { deleteAll } from '../utils' export async function deleteStatusesAndNotifications (instanceName, statusIds, notificationIds) { - for (let statusId of statusIds) { + for (const statusId of statusIds) { deleteFromCache(statusesCache, instanceName, statusId) } - for (let notificationId of notificationIds) { + for (const notificationId of notificationIds) { deleteFromCache(notificationsCache, instanceName, notificationId) } const db = await getDatabase(instanceName) - let storeNames = [ + const storeNames = [ STATUSES_STORE, STATUS_TIMELINES_STORE, NOTIFICATIONS_STORE, @@ -32,7 +32,7 @@ export async function deleteStatusesAndNotifications (instanceName, statusIds, n THREADS_STORE ] await dbPromise(db, storeNames, 'readwrite', (stores) => { - let [ + const [ statusesStore, statusTimelinesStore, notificationsStore, @@ -74,10 +74,10 @@ export async function deleteStatusesAndNotifications (instanceName, statusIds, n ) } - for (let statusId of statusIds) { + for (const statusId of statusIds) { deleteStatus(statusId) } - for (let notificationId of notificationIds) { + for (const notificationId of notificationIds) { deleteNotification(notificationId) } }) diff --git a/src/routes/_database/timelines/fetchNotification.js b/src/routes/_database/timelines/fetchNotification.js index 18cb77e3..13ddab1e 100644 --- a/src/routes/_database/timelines/fetchNotification.js +++ b/src/routes/_database/timelines/fetchNotification.js @@ -4,7 +4,7 @@ import { fetchStatus } from './fetchStatus' export function fetchNotification (notificationsStore, statusesStore, accountsStore, id, callback) { notificationsStore.get(id).onsuccess = e => { - let notification = e.target.result + const notification = e.target.result callback(notification) fetchAccount(accountsStore, notification[ACCOUNT_ID], account => { notification.account = account diff --git a/src/routes/_database/timelines/fetchStatus.js b/src/routes/_database/timelines/fetchStatus.js index e5bf027b..678e8ba9 100644 --- a/src/routes/_database/timelines/fetchStatus.js +++ b/src/routes/_database/timelines/fetchStatus.js @@ -3,7 +3,7 @@ import { ACCOUNT_ID, REBLOG_ID } from '../constants' export function fetchStatus (statusesStore, accountsStore, id, callback) { statusesStore.get(id).onsuccess = e => { - let status = e.target.result + const status = e.target.result callback(status) if (!status) { return diff --git a/src/routes/_database/timelines/getStatusOrNotification.js b/src/routes/_database/timelines/getStatusOrNotification.js index ac8c9e7b..ea44b7ea 100644 --- a/src/routes/_database/timelines/getStatusOrNotification.js +++ b/src/routes/_database/timelines/getStatusOrNotification.js @@ -13,9 +13,9 @@ export async function getStatus (instanceName, id) { return getInCache(statusesCache, instanceName, id) } const db = await getDatabase(instanceName) - let storeNames = [STATUSES_STORE, ACCOUNTS_STORE] - let result = await dbPromise(db, storeNames, 'readonly', (stores, callback) => { - let [ statusesStore, accountsStore ] = stores + const storeNames = [STATUSES_STORE, ACCOUNTS_STORE] + const result = await dbPromise(db, storeNames, 'readonly', (stores, callback) => { + const [statusesStore, accountsStore] = stores fetchStatus(statusesStore, accountsStore, id, callback) }) setInCache(statusesCache, instanceName, id, result) @@ -27,9 +27,9 @@ export async function getNotification (instanceName, id) { return getInCache(notificationsCache, instanceName, id) } const db = await getDatabase(instanceName) - let storeNames = [NOTIFICATIONS_STORE, STATUSES_STORE, ACCOUNTS_STORE] - let result = await dbPromise(db, storeNames, 'readonly', (stores, callback) => { - let [ notificationsStore, statusesStore, accountsStore ] = stores + const storeNames = [NOTIFICATIONS_STORE, STATUSES_STORE, ACCOUNTS_STORE] + const result = await dbPromise(db, storeNames, 'readonly', (stores, callback) => { + const [notificationsStore, statusesStore, accountsStore] = stores fetchNotification(notificationsStore, statusesStore, accountsStore, id, callback) }) setInCache(notificationsCache, instanceName, id, result) diff --git a/src/routes/_database/timelines/insertion.js b/src/routes/_database/timelines/insertion.js index 3e545862..2e1492ff 100644 --- a/src/routes/_database/timelines/insertion.js +++ b/src/routes/_database/timelines/insertion.js @@ -53,7 +53,7 @@ export function storeNotification (notificationsStore, statusesStore, accountsSt } async function insertTimelineNotifications (instanceName, timeline, notifications) { - for (let notification of notifications) { + for (const notification of notifications) { setInCache(notificationsCache, instanceName, notification.id, notification) setInCache(accountsCache, instanceName, notification.account.id, notification.account) if (notification.status) { @@ -61,10 +61,10 @@ async function insertTimelineNotifications (instanceName, timeline, notification } } const db = await getDatabase(instanceName) - let storeNames = [NOTIFICATION_TIMELINES_STORE, NOTIFICATIONS_STORE, ACCOUNTS_STORE, STATUSES_STORE] + const storeNames = [NOTIFICATION_TIMELINES_STORE, NOTIFICATIONS_STORE, ACCOUNTS_STORE, STATUSES_STORE] await dbPromise(db, storeNames, 'readwrite', (stores) => { - let [ timelineStore, notificationsStore, accountsStore, statusesStore ] = stores - for (let notification of notifications) { + const [timelineStore, notificationsStore, accountsStore, statusesStore] = stores + for (const notification of notifications) { storeNotification(notificationsStore, statusesStore, accountsStore, notification) timelineStore.put(notification.id, createTimelineId(timeline, notification.id)) } @@ -72,14 +72,14 @@ async function insertTimelineNotifications (instanceName, timeline, notification } async function insertTimelineStatuses (instanceName, timeline, statuses) { - for (let status of statuses) { + for (const status of statuses) { cacheStatus(status, instanceName) } const db = await getDatabase(instanceName) - let storeNames = [STATUS_TIMELINES_STORE, STATUSES_STORE, ACCOUNTS_STORE] + const storeNames = [STATUS_TIMELINES_STORE, STATUSES_STORE, ACCOUNTS_STORE] await dbPromise(db, storeNames, 'readwrite', (stores) => { - let [ timelineStore, statusesStore, accountsStore ] = stores - for (let status of statuses) { + const [timelineStore, statusesStore, accountsStore] = stores + for (const status of statuses) { storeStatus(statusesStore, accountsStore, status) timelineStore.put(status.id, createTimelineId(timeline, status.id)) } @@ -87,18 +87,18 @@ async function insertTimelineStatuses (instanceName, timeline, statuses) { } async function insertStatusThread (instanceName, statusId, statuses) { - for (let status of statuses) { + for (const status of statuses) { cacheStatus(status, instanceName) } const db = await getDatabase(instanceName) - let storeNames = [THREADS_STORE, STATUSES_STORE, ACCOUNTS_STORE] + const storeNames = [THREADS_STORE, STATUSES_STORE, ACCOUNTS_STORE] await dbPromise(db, storeNames, 'readwrite', (stores) => { - let [ threadsStore, statusesStore, accountsStore ] = stores + const [threadsStore, statusesStore, accountsStore] = stores threadsStore.getAllKeys(createThreadKeyRange(statusId)).onsuccess = e => { - let existingKeys = e.target.result - let newKeys = times(statuses.length, i => createThreadId(statusId, i)) - let keysToDelete = difference(existingKeys, newKeys) - for (let key of keysToDelete) { + const existingKeys = e.target.result + const newKeys = times(statuses.length, i => createThreadId(statusId, i)) + const keysToDelete = difference(existingKeys, newKeys) + for (const key of keysToDelete) { threadsStore.delete(key) } } @@ -114,7 +114,7 @@ export async function insertTimelineItems (instanceName, timeline, timelineItems if (timeline === 'notifications' || timeline === 'notifications/mentions') { return insertTimelineNotifications(instanceName, timeline, timelineItems) } else if (timeline.startsWith('status/')) { - let statusId = timeline.split('/').slice(-1)[0] + const statusId = timeline.split('/').slice(-1)[0] return insertStatusThread(instanceName, statusId, timelineItems) } else { return insertTimelineStatuses(instanceName, timeline, timelineItems) diff --git a/src/routes/_database/timelines/lookup.js b/src/routes/_database/timelines/lookup.js index 7c540d54..39544b34 100644 --- a/src/routes/_database/timelines/lookup.js +++ b/src/routes/_database/timelines/lookup.js @@ -13,12 +13,12 @@ export async function getReblogsForStatus (instanceName, id) { export async function getNotificationIdsForStatuses (instanceName, statusIds) { const db = await getDatabase(instanceName) return dbPromise(db, NOTIFICATIONS_STORE, 'readonly', (notificationsStore, callback) => { - let res = [] + const res = [] callback(res) statusIds.forEach(statusId => { - let req = notificationsStore.index(STATUS_ID).getAllKeys(IDBKeyRange.only(statusId)) + const req = notificationsStore.index(STATUS_ID).getAllKeys(IDBKeyRange.only(statusId)) req.onsuccess = e => { - for (let id of e.target.result) { + for (const id of e.target.result) { res.push(id) } } diff --git a/src/routes/_database/timelines/pagination.js b/src/routes/_database/timelines/pagination.js index c011c299..90c1c2f4 100644 --- a/src/routes/_database/timelines/pagination.js +++ b/src/routes/_database/timelines/pagination.js @@ -16,15 +16,15 @@ import { fetchNotification } from './fetchNotification' import { TIMELINE_BATCH_SIZE } from '../../_static/timelines' async function getNotificationTimeline (instanceName, timeline, maxId, limit) { - let storeNames = [NOTIFICATION_TIMELINES_STORE, NOTIFICATIONS_STORE, STATUSES_STORE, ACCOUNTS_STORE] + const storeNames = [NOTIFICATION_TIMELINES_STORE, NOTIFICATIONS_STORE, STATUSES_STORE, ACCOUNTS_STORE] const db = await getDatabase(instanceName) return dbPromise(db, storeNames, 'readonly', (stores, callback) => { - let [ timelineStore, notificationsStore, statusesStore, accountsStore ] = stores - let keyRange = createTimelineKeyRange(timeline, maxId) + const [timelineStore, notificationsStore, statusesStore, accountsStore] = stores + const keyRange = createTimelineKeyRange(timeline, maxId) timelineStore.getAll(keyRange, limit).onsuccess = e => { - let timelineResults = e.target.result - let res = new Array(timelineResults.length) + const timelineResults = e.target.result + const res = new Array(timelineResults.length) timelineResults.forEach((notificationId, i) => { fetchNotification(notificationsStore, statusesStore, accountsStore, notificationId, notification => { res[i] = notification @@ -36,14 +36,14 @@ async function getNotificationTimeline (instanceName, timeline, maxId, limit) { } async function getStatusTimeline (instanceName, timeline, maxId, limit) { - let storeNames = [STATUS_TIMELINES_STORE, STATUSES_STORE, ACCOUNTS_STORE] + const storeNames = [STATUS_TIMELINES_STORE, STATUSES_STORE, ACCOUNTS_STORE] const db = await getDatabase(instanceName) return dbPromise(db, storeNames, 'readonly', (stores, callback) => { - let [ timelineStore, statusesStore, accountsStore ] = stores - let getReq = timelineStore.getAll(createTimelineKeyRange(timeline, maxId), limit) + const [timelineStore, statusesStore, accountsStore] = stores + const getReq = timelineStore.getAll(createTimelineKeyRange(timeline, maxId), limit) getReq.onsuccess = e => { - let timelineResults = e.target.result - let res = new Array(timelineResults.length) + const timelineResults = e.target.result + const res = new Array(timelineResults.length) timelineResults.forEach((statusId, i) => { fetchStatus(statusesStore, accountsStore, statusId, status => { res[i] = status @@ -55,15 +55,15 @@ async function getStatusTimeline (instanceName, timeline, maxId, limit) { } async function getStatusThread (instanceName, statusId) { - let storeNames = [THREADS_STORE, STATUSES_STORE, ACCOUNTS_STORE] + const storeNames = [THREADS_STORE, STATUSES_STORE, ACCOUNTS_STORE] const db = await getDatabase(instanceName) return dbPromise(db, storeNames, 'readonly', (stores, callback) => { - let [ threadsStore, statusesStore, accountsStore ] = stores - let keyRange = createThreadKeyRange(statusId) + const [threadsStore, statusesStore, accountsStore] = stores + const keyRange = createThreadKeyRange(statusId) threadsStore.getAll(keyRange).onsuccess = e => { - let thread = e.target.result + const thread = e.target.result if (thread.length) { - let res = new Array(thread.length) + const res = new Array(thread.length) callback(res) thread.forEach((otherStatusId, i) => { fetchStatus(statusesStore, accountsStore, otherStatusId, status => { @@ -73,7 +73,7 @@ async function getStatusThread (instanceName, statusId) { } else { // thread not cached; just make a "fake" thread with only one status in it fetchStatus(statusesStore, accountsStore, statusId, status => { - let res = [status] + const res = [status] callback(res) }) } @@ -87,7 +87,7 @@ export async function getTimeline (instanceName, timeline, maxId, limit) { if (timeline === 'notifications' || timeline === 'notifications/mentions') { return getNotificationTimeline(instanceName, timeline, maxId, limit) } else if (timeline.startsWith('status/')) { - let statusId = timeline.split('/').slice(-1)[0] + const statusId = timeline.split('/').slice(-1)[0] return getStatusThread(instanceName, statusId) } else { return getStatusTimeline(instanceName, timeline, maxId, limit) diff --git a/src/routes/_database/timelines/pinnedStatuses.js b/src/routes/_database/timelines/pinnedStatuses.js index 9e388b61..57faad31 100644 --- a/src/routes/_database/timelines/pinnedStatuses.js +++ b/src/routes/_database/timelines/pinnedStatuses.js @@ -6,18 +6,18 @@ import { storeStatus } from './insertion' import { fetchStatus } from './fetchStatus' export async function insertPinnedStatuses (instanceName, accountId, statuses) { - for (let status of statuses) { + for (const status of statuses) { cacheStatus(status, instanceName) } const db = await getDatabase(instanceName) - let storeNames = [PINNED_STATUSES_STORE, STATUSES_STORE, ACCOUNTS_STORE] + const storeNames = [PINNED_STATUSES_STORE, STATUSES_STORE, ACCOUNTS_STORE] await dbPromise(db, storeNames, 'readwrite', (stores) => { - let [ pinnedStatusesStore, statusesStore, accountsStore ] = stores + const [pinnedStatusesStore, statusesStore, accountsStore] = stores - let keyRange = createPinnedStatusKeyRange(accountId) + const keyRange = createPinnedStatusKeyRange(accountId) pinnedStatusesStore.getAll(keyRange).onsuccess = e => { // if there was e.g. 1 pinned status before and 2 now, then we need to delete the old one - let existingPinnedStatuses = e.target.result + const existingPinnedStatuses = e.target.result for (let i = statuses.length; i < existingPinnedStatuses.length; i++) { pinnedStatusesStore.delete(createPinnedStatusKeyRange(accountId, i)) } @@ -30,14 +30,14 @@ export async function insertPinnedStatuses (instanceName, accountId, statuses) { } export async function getPinnedStatuses (instanceName, accountId) { - let storeNames = [PINNED_STATUSES_STORE, STATUSES_STORE, ACCOUNTS_STORE] + const storeNames = [PINNED_STATUSES_STORE, STATUSES_STORE, ACCOUNTS_STORE] const db = await getDatabase(instanceName) return dbPromise(db, storeNames, 'readonly', (stores, callback) => { - let [ pinnedStatusesStore, statusesStore, accountsStore ] = stores - let keyRange = createPinnedStatusKeyRange(accountId) + const [pinnedStatusesStore, statusesStore, accountsStore] = stores + const keyRange = createPinnedStatusKeyRange(accountId) pinnedStatusesStore.getAll(keyRange).onsuccess = e => { - let pinnedResults = e.target.result - let res = new Array(pinnedResults.length) + const pinnedResults = e.target.result + const res = new Array(pinnedResults.length) pinnedResults.forEach((statusId, i) => { fetchStatus(statusesStore, accountsStore, statusId, status => { res[i] = status diff --git a/src/routes/_database/timelines/updateStatus.js b/src/routes/_database/timelines/updateStatus.js index 71dc8774..8d4b63c3 100644 --- a/src/routes/_database/timelines/updateStatus.js +++ b/src/routes/_database/timelines/updateStatus.js @@ -11,13 +11,13 @@ import { putStatus } from './insertion' async function updateStatus (instanceName, statusId, updateFunc) { const db = await getDatabase(instanceName) if (hasInCache(statusesCache, instanceName, statusId)) { - let status = getInCache(statusesCache, instanceName, statusId) + const status = getInCache(statusesCache, instanceName, statusId) updateFunc(status) cacheStatus(status, instanceName) } return dbPromise(db, STATUSES_STORE, 'readwrite', (statusesStore) => { statusesStore.get(statusId).onsuccess = e => { - let status = e.target.result + const status = e.target.result updateFunc(status) putStatus(statusesStore, status) } @@ -26,7 +26,7 @@ async function updateStatus (instanceName, statusId, updateFunc) { export async function setStatusFavorited (instanceName, statusId, favorited) { return updateStatus(instanceName, statusId, status => { - let delta = (favorited ? 1 : 0) - (status.favourited ? 1 : 0) + const delta = (favorited ? 1 : 0) - (status.favourited ? 1 : 0) status.favourited = favorited status.favourites_count = (status.favourites_count || 0) + delta }) @@ -34,7 +34,7 @@ export async function setStatusFavorited (instanceName, statusId, favorited) { export async function setStatusReblogged (instanceName, statusId, reblogged) { return updateStatus(instanceName, statusId, status => { - let delta = (reblogged ? 1 : 0) - (status.reblogged ? 1 : 0) + const delta = (reblogged ? 1 : 0) - (status.reblogged ? 1 : 0) status.reblogged = reblogged status.reblogs_count = (status.reblogs_count || 0) + delta }) diff --git a/src/routes/_database/utils.js b/src/routes/_database/utils.js index b881a5bf..0aec12e3 100644 --- a/src/routes/_database/utils.js +++ b/src/routes/_database/utils.js @@ -1,6 +1,6 @@ export function deleteAll (store, index, keyRange) { index.getAllKeys(keyRange).onsuccess = e => { - for (let result of e.target.result) { + for (const result of e.target.result) { store.delete(result) } } diff --git a/src/routes/_intl/formatTimeagoDate.js b/src/routes/_intl/formatTimeagoDate.js index d0ef1df2..0ff57d98 100644 --- a/src/routes/_intl/formatTimeagoDate.js +++ b/src/routes/_intl/formatTimeagoDate.js @@ -5,7 +5,7 @@ import { mark, stop } from '../_utils/marks' export function formatTimeagoDate (date, now) { mark('formatTimeagoDate') // use Math.max() to avoid things like "in 10 seconds" when the timestamps are slightly off - let res = format(date, Math.max(now, date)) + const res = format(date, Math.max(now, date)) stop('formatTimeagoDate') return res } @@ -14,7 +14,7 @@ export function formatTimeagoDate (date, now) { export function formatTimeagoFutureDate (date, now) { mark('formatTimeagoFutureDate') // use Math.min() for same reason as above - let res = format(date, Math.min(now, date)) + const res = format(date, Math.min(now, date)) stop('formatTimeagoFutureDate') return res } diff --git a/src/routes/_pages/community/index.html b/src/routes/_pages/community/index.html index 4dc7c4ac..e0e77cb8 100644 --- a/src/routes/_pages/community/index.html +++ b/src/routes/_pages/community/index.html @@ -112,7 +112,7 @@ export default { async oncreate () { - let { currentInstance } = this.store.get() + const { currentInstance } = this.store.get() if (currentInstance) { await updateListsForInstance(currentInstance) } diff --git a/src/routes/_pages/pinned.html b/src/routes/_pages/pinned.html index 67e19e38..9c5ce9b3 100644 --- a/src/routes/_pages/pinned.html +++ b/src/routes/_pages/pinned.html @@ -41,10 +41,10 @@ export default { async oncreate () { try { - let { currentInstance } = this.store.get() + const { currentInstance } = this.store.get() await updateVerifyCredentialsForInstance(currentInstance) - let { accessToken, currentVerifyCredentials } = this.store.get() - let statuses = await getPinnedStatuses(currentInstance, accessToken, currentVerifyCredentials.id) + const { accessToken, currentVerifyCredentials } = this.store.get() + const statuses = await getPinnedStatuses(currentInstance, accessToken, currentVerifyCredentials.id) this.set({ statuses: statuses }) } catch (e) { toast.say('Error: ' + (e.name || '') + ' ' + (e.message || '')) diff --git a/src/routes/_pages/settings/general.html b/src/routes/_pages/settings/general.html index 6660eaa3..1981189e 100644 --- a/src/routes/_pages/settings/general.html +++ b/src/routes/_pages/settings/general.html @@ -113,7 +113,7 @@ methods: { onChange (event) { // these two are mutually exclusive - let { markMediaAsSensitive, neverMarkMediaAsSensitive } = this.store.get() + const { markMediaAsSensitive, neverMarkMediaAsSensitive } = this.store.get() if (markMediaAsSensitive && neverMarkMediaAsSensitive) { if (event.target.id === 'choice-mark-media-sensitive') { this.store.set({ neverMarkMediaAsSensitive: false }) diff --git a/src/routes/_pages/settings/instances/[instanceName].html b/src/routes/_pages/settings/instances/[instanceName].html index 0d3a84c5..53de18bd 100644 --- a/src/routes/_pages/settings/instances/[instanceName].html +++ b/src/routes/_pages/settings/instances/[instanceName].html @@ -36,7 +36,7 @@ export default { async oncreate () { - let { instanceName } = this.get() + const { instanceName } = this.get() await updateVerifyCredentialsForInstance(instanceName) }, store: () => store, diff --git a/src/routes/_pages/settings/instances/add.html b/src/routes/_pages/settings/instances/add.html index 478d21fd..07324044 100644 --- a/src/routes/_pages/settings/instances/add.html +++ b/src/routes/_pages/settings/instances/add.html @@ -90,7 +90,7 @@ export default { async oncreate () { - let codeMatch = location.search.match(/code=([^&]+)/) + const codeMatch = location.search.match(/code=([^&]+)/) if (codeMatch) { return handleOauthCode(codeMatch[1]) } diff --git a/src/routes/_pages/settings/wellness.html b/src/routes/_pages/settings/wellness.html index 077a9655..92ddd3ff 100644 --- a/src/routes/_pages/settings/wellness.html +++ b/src/routes/_pages/settings/wellness.html @@ -134,7 +134,7 @@ enableGrayscale }, onCheckAllChange (e) { - let { checked } = e.target + const { checked } = e.target this.store.set({ disableFollowerCounts: checked, disableReblogCounts: checked, diff --git a/src/routes/_react/createEmojiMartPicker.js b/src/routes/_react/createEmojiMartPicker.js index b6c4d3b4..4a3bf7d8 100644 --- a/src/routes/_react/createEmojiMartPicker.js +++ b/src/routes/_react/createEmojiMartPicker.js @@ -10,7 +10,7 @@ let Picker // cache so we don't have to recreate every time export async function createEmojiMartPicker () { if (!Picker) { loadCSS('/emoji-mart.css') - let [data, createEmojiMartPickerFromData] = await Promise.all([ + const [data, createEmojiMartPickerFromData] = await Promise.all([ fetchEmojiMartData(), importEmojiMart() ]) diff --git a/src/routes/_static/polls.js b/src/routes/_static/polls.js index 2b5bc74c..47a3c2fd 100644 --- a/src/routes/_static/polls.js +++ b/src/routes/_static/polls.js @@ -1,31 +1,31 @@ export const POLL_EXPIRY_OPTIONS = [ { - 'value': 300, - 'label': '5 minutes' + value: 300, + label: '5 minutes' }, { - 'value': 1800, - 'label': '30 minutes' + value: 1800, + label: '30 minutes' }, { - 'value': 3600, - 'label': '1 hour' + value: 3600, + label: '1 hour' }, { - 'value': 21600, - 'label': '6 hours' + value: 21600, + label: '6 hours' }, { - 'value': 86400, - 'label': '1 day' + value: 86400, + label: '1 day' }, { - 'value': 259200, - 'label': '3 days' + value: 259200, + label: '3 days' }, { - 'value': 604800, - 'label': '7 days' + value: 604800, + label: '7 days' } ] diff --git a/src/routes/_store/LocalStorageStore.js b/src/routes/_store/LocalStorageStore.js index edfa019c..9cbe7836 100644 --- a/src/routes/_store/LocalStorageStore.js +++ b/src/routes/_store/LocalStorageStore.js @@ -11,11 +11,11 @@ export class LocalStorageStore extends Store { } this._keysToWatch = keysToWatch this._keysToSave = {} - let newState = {} + const newState = {} for (let i = 0, len = LS.length; i < len; i++) { - let key = LS.key(i) + const key = LS.key(i) if (key.startsWith('store_')) { - let item = LS.getItem(key) + const item = LS.getItem(key) newState[key.substring(6)] = safeParse(item) } } diff --git a/src/routes/_store/computations/autosuggestComputations.js b/src/routes/_store/computations/autosuggestComputations.js index 2915ecf9..70ca3d13 100644 --- a/src/routes/_store/computations/autosuggestComputations.js +++ b/src/routes/_store/computations/autosuggestComputations.js @@ -35,13 +35,13 @@ export function autosuggestComputations (store) { 'autosuggestSearchText', ['currentComposeText', 'composeSelectionStart'], (currentComposeText, composeSelectionStart) => { - let selectionStart = composeSelectionStart + const selectionStart = composeSelectionStart if (!currentComposeText || selectionStart < MIN_PREFIX_LENGTH) { return '' } - let textUpToCursor = currentComposeText.substring(0, selectionStart) - let match = textUpToCursor.match(ACCOUNT_SEARCH_REGEX) || textUpToCursor.match(EMOJI_SEARCH_REGEX) + const textUpToCursor = currentComposeText.substring(0, selectionStart) + const match = textUpToCursor.match(ACCOUNT_SEARCH_REGEX) || textUpToCursor.match(EMOJI_SEARCH_REGEX) return (match && match[1]) || '' } ) diff --git a/src/routes/_store/computations/navComputations.js b/src/routes/_store/computations/navComputations.js index 2263199f..f5417bcc 100644 --- a/src/routes/_store/computations/navComputations.js +++ b/src/routes/_store/computations/navComputations.js @@ -6,8 +6,8 @@ export function navComputations (store) { if (!pinnedPage.startsWith('/lists')) { return } - let listId = pinnedPage.split('/').slice(-1)[0] - let list = lists.find(_ => _.id === listId) + const listId = pinnedPage.split('/').slice(-1)[0] + const list = lists.find(_ => _.id === listId) return list ? list.title : '' } ) diff --git a/src/routes/_store/computations/timelineComputations.js b/src/routes/_store/computations/timelineComputations.js index 068b15cb..f81c656c 100644 --- a/src/routes/_store/computations/timelineComputations.js +++ b/src/routes/_store/computations/timelineComputations.js @@ -27,7 +27,7 @@ function computeTimelineFilter (store, computationName, timelinesToSettingsKeys) computationName, ['currentInstance', 'instanceSettings', 'currentTimeline'], (currentInstance, instanceSettings, currentTimeline) => { - let settingsKey = timelinesToSettingsKeys[currentTimeline] + const settingsKey = timelinesToSettingsKeys[currentTimeline] return settingsKey ? get(instanceSettings, [currentInstance, settingsKey], true) : true } ) @@ -61,8 +61,8 @@ export function timelineComputations (store) { if (!currentTimeline) { return void 0 } - let split = currentTimeline.split('/') - let len = split.length + const split = currentTimeline.split('/') + const len = split.length if (split[len - 1] === 'with_replies' || split[len - 1] === 'media') { return split[len - 2] } diff --git a/src/routes/_store/mixins/autosuggestMixins.js b/src/routes/_store/mixins/autosuggestMixins.js index 7ab43b06..f21efd9c 100644 --- a/src/routes/_store/mixins/autosuggestMixins.js +++ b/src/routes/_store/mixins/autosuggestMixins.js @@ -2,11 +2,11 @@ import { get } from '../../_utils/lodash-lite' export function autosuggestMixins (Store) { Store.prototype.setForAutosuggest = function (instanceName, realm, obj) { - let valuesToSet = {} - for (let key of Object.keys(obj)) { - let rootKey = `autosuggestData_${key}` - let root = this.get()[rootKey] || {} - let instanceData = root[instanceName] = root[instanceName] || {} + const valuesToSet = {} + for (const key of Object.keys(obj)) { + const rootKey = `autosuggestData_${key}` + const root = this.get()[rootKey] || {} + const instanceData = root[instanceName] = root[instanceName] || {} instanceData[realm] = obj[key] valuesToSet[rootKey] = root } @@ -15,12 +15,12 @@ export function autosuggestMixins (Store) { } Store.prototype.setForCurrentAutosuggest = function (obj) { - let { currentInstance, currentComposeRealm } = this.get() + const { currentInstance, currentComposeRealm } = this.get() this.setForAutosuggest(currentInstance, currentComposeRealm, obj) } Store.prototype.getForCurrentAutosuggest = function (key) { - let { currentInstance, currentComposeRealm } = this.get() + const { currentInstance, currentComposeRealm } = this.get() return get(this.get()[`autosuggestData_${key}`], [currentInstance, currentComposeRealm]) } } diff --git a/src/routes/_store/mixins/instanceMixins.js b/src/routes/_store/mixins/instanceMixins.js index b76fa2cc..8a61c384 100644 --- a/src/routes/_store/mixins/instanceMixins.js +++ b/src/routes/_store/mixins/instanceMixins.js @@ -2,21 +2,21 @@ import { get } from '../../_utils/lodash-lite' export function instanceMixins (Store) { Store.prototype.setComposeData = function (realm, obj) { - let { composeData, currentInstance } = this.get() - let instanceNameData = composeData[currentInstance] = composeData[currentInstance] || {} + const { composeData, currentInstance } = this.get() + const instanceNameData = composeData[currentInstance] = composeData[currentInstance] || {} instanceNameData[realm] = Object.assign(instanceNameData[realm] || {}, obj) this.set({ composeData }) } Store.prototype.getComposeData = function (realm, key) { - let { composeData, currentInstance } = this.get() + const { composeData, currentInstance } = this.get() return composeData[currentInstance] && composeData[currentInstance][realm] && composeData[currentInstance][realm][key] } Store.prototype.clearComposeData = function (realm) { - let { composeData, currentInstance } = this.get() + const { composeData, currentInstance } = this.get() if (composeData && composeData[currentInstance]) { delete composeData[currentInstance][realm] } @@ -24,12 +24,12 @@ export function instanceMixins (Store) { } Store.prototype.getInstanceSetting = function (instanceName, settingName, defaultValue) { - let { instanceSettings } = this.get() + const { instanceSettings } = this.get() return get(instanceSettings, [instanceName, settingName], defaultValue) } Store.prototype.setInstanceSetting = function (instanceName, settingName, value) { - let { instanceSettings } = this.get() + const { instanceSettings } = this.get() if (!instanceSettings[instanceName]) { instanceSettings[instanceName] = {} } @@ -38,13 +38,13 @@ export function instanceMixins (Store) { } Store.prototype.setInstanceData = function (instanceName, key, value) { - let instanceData = this.get()[key] || {} + const instanceData = this.get()[key] || {} instanceData[instanceName] = value this.set({ [key]: instanceData }) } Store.prototype.getInstanceData = function (instanceName, key) { - let instanceData = this.get()[key] || {} + const instanceData = this.get()[key] || {} return instanceData[instanceName] } } diff --git a/src/routes/_store/mixins/statusMixins.js b/src/routes/_store/mixins/statusMixins.js index cf3e42c2..8eafaebe 100644 --- a/src/routes/_store/mixins/statusMixins.js +++ b/src/routes/_store/mixins/statusMixins.js @@ -1,5 +1,5 @@ function getStatusModifications (store, instanceName) { - let { statusModifications } = store.get() + const { statusModifications } = store.get() statusModifications[instanceName] = statusModifications[instanceName] || { favorites: {}, reblogs: {}, @@ -9,7 +9,7 @@ function getStatusModifications (store, instanceName) { } function setStatusModification (store, instanceName, statusId, key, value) { - let statusModifications = getStatusModifications(store, instanceName) + const statusModifications = getStatusModifications(store, instanceName) statusModifications[instanceName][key][statusId] = value store.set({ statusModifications }) } diff --git a/src/routes/_store/mixins/timelineMixins.js b/src/routes/_store/mixins/timelineMixins.js index 13c93eae..e4fe3ad1 100644 --- a/src/routes/_store/mixins/timelineMixins.js +++ b/src/routes/_store/mixins/timelineMixins.js @@ -3,11 +3,11 @@ import { getFirstIdFromItemSummaries } from '../../_utils/getIdFromItemSummaries export function timelineMixins (Store) { Store.prototype.setForTimeline = function (instanceName, timelineName, obj) { - let valuesToSet = {} - for (let key of Object.keys(obj)) { - let rootKey = `timelineData_${key}` - let root = this.get()[rootKey] || {} - let instanceData = root[instanceName] = root[instanceName] || {} + const valuesToSet = {} + for (const key of Object.keys(obj)) { + const rootKey = `timelineData_${key}` + const root = this.get()[rootKey] || {} + const instanceData = root[instanceName] = root[instanceName] || {} instanceData[timelineName] = obj[key] valuesToSet[rootKey] = root } @@ -16,28 +16,28 @@ export function timelineMixins (Store) { } Store.prototype.getForTimeline = function (instanceName, timelineName, key) { - let rootKey = `timelineData_${key}` - let root = this.get()[rootKey] + const rootKey = `timelineData_${key}` + const root = this.get()[rootKey] return get(root, [instanceName, timelineName]) } Store.prototype.getAllTimelineData = function (instanceName, key) { - let root = this.get()[`timelineData_${key}`] || {} + const root = this.get()[`timelineData_${key}`] || {} return root[instanceName] || {} } Store.prototype.getFirstTimelineItemId = function (instanceName, timelineName) { - let summaries = this.getForTimeline(instanceName, timelineName, 'timelineItemSummaries') + const summaries = this.getForTimeline(instanceName, timelineName, 'timelineItemSummaries') return getFirstIdFromItemSummaries(summaries) } Store.prototype.setForCurrentTimeline = function (obj) { - let { currentInstance, currentTimeline } = this.get() + const { currentInstance, currentTimeline } = this.get() this.setForTimeline(currentInstance, currentTimeline, obj) } Store.prototype.getThreads = function (instanceName) { - let instanceData = this.getAllTimelineData(instanceName, 'timelineItemSummaries') + const instanceData = this.getAllTimelineData(instanceName, 'timelineItemSummaries') return pickBy(instanceData, (value, key) => { return key.startsWith('status/') diff --git a/src/routes/_store/observers/autosuggestObservers.js b/src/routes/_store/observers/autosuggestObservers.js index e1643a2a..3415810b 100644 --- a/src/routes/_store/observers/autosuggestObservers.js +++ b/src/routes/_store/observers/autosuggestObservers.js @@ -13,13 +13,13 @@ export function autosuggestObservers () { } // autosuggestSelecting indicates that the user has pressed Enter or clicked on an item // and the results are being processed. Returning early avoids a flash of searched content. - let { composeFocused } = store.get() - let autosuggestSelecting = store.getForCurrentAutosuggest('autosuggestSelecting') + const { composeFocused } = store.get() + const autosuggestSelecting = store.getForCurrentAutosuggest('autosuggestSelecting') if (!composeFocused || !autosuggestSearchText || autosuggestSelecting) { return } - let autosuggestType = autosuggestSearchText.startsWith('@') ? 'account' : 'emoji' + const autosuggestType = autosuggestSearchText.startsWith('@') ? 'account' : 'emoji' if (autosuggestType === 'emoji') { lastSearch = doEmojiSearch(autosuggestSearchText) diff --git a/src/routes/_store/observers/customScrollbarObservers.js b/src/routes/_store/observers/customScrollbarObservers.js index 0a038669..056960fb 100644 --- a/src/routes/_store/observers/customScrollbarObservers.js +++ b/src/routes/_store/observers/customScrollbarObservers.js @@ -1,6 +1,6 @@ import { store } from '../store' -let theScrollbarStyle = process.browser && document.getElementById('theScrollbarStyle') +const theScrollbarStyle = process.browser && document.getElementById('theScrollbarStyle') export function customScrollbarObservers () { store.observe('disableCustomScrollbars', disableCustomScrollbars => { diff --git a/src/routes/_store/observers/instanceObservers.js b/src/routes/_store/observers/instanceObservers.js index 9caa2406..234f95a6 100644 --- a/src/routes/_store/observers/instanceObservers.js +++ b/src/routes/_store/observers/instanceObservers.js @@ -31,7 +31,7 @@ async function doRefreshInstanceDataAndStream (store, instanceName) { return } - let { currentInstanceInfo } = store.get() + const { currentInstanceInfo } = store.get() if (!currentInstanceInfo) { return } @@ -53,10 +53,10 @@ async function refreshInstanceData (instanceName) { } function stream (store, instanceName, currentInstanceInfo) { - let { accessToken } = store.get() - let streamingApi = currentInstanceInfo.urls.streaming_api - let firstStatusId = store.getFirstTimelineItemId(instanceName, 'home') - let firstNotificationId = store.getFirstTimelineItemId(instanceName, 'notifications') + const { accessToken } = store.get() + const streamingApi = currentInstanceInfo.urls.streaming_api + const firstStatusId = store.getFirstTimelineItemId(instanceName, 'home') + const firstNotificationId = store.getFirstTimelineItemId(instanceName, 'notifications') currentInstanceStream = createStream(streamingApi, instanceName, accessToken, 'home', firstStatusId, firstNotificationId) diff --git a/src/routes/_store/observers/navObservers.js b/src/routes/_store/observers/navObservers.js index 4b0105de..68c11b68 100644 --- a/src/routes/_store/observers/navObservers.js +++ b/src/routes/_store/observers/navObservers.js @@ -2,7 +2,7 @@ import { emit } from '../../_utils/eventBus' export function navObservers (store) { function pageIsInNav (store, page) { - let { navPages } = store.get() + const { navPages } = store.get() return !!navPages.find(_ => _.name === page) } diff --git a/src/routes/_store/observers/timelineObservers.js b/src/routes/_store/observers/timelineObservers.js index 45c18925..21ca9f92 100644 --- a/src/routes/_store/observers/timelineObservers.js +++ b/src/routes/_store/observers/timelineObservers.js @@ -39,12 +39,12 @@ export function timelineObservers () { return } - let { currentInstance } = store.get() - let { accessToken } = store.get() + const { currentInstance } = store.get() + const { accessToken } = store.get() await updateInstanceInfo(currentInstance) - let currentTimelineIsUnchanged = () => { - let { + const currentTimelineIsUnchanged = () => { + const { currentInstance: newCurrentInstance, currentTimeline: newCurrentTimeline } = store.get() @@ -56,9 +56,9 @@ export function timelineObservers () { return } - let firstStatusId = store.getFirstTimelineItemId(currentInstance, currentTimeline) - let { currentInstanceInfo } = store.get() - let streamingApi = currentInstanceInfo.urls.streaming_api + const firstStatusId = store.getFirstTimelineItemId(currentInstance, currentTimeline) + const { currentInstanceInfo } = store.get() + const streamingApi = currentInstanceInfo.urls.streaming_api currentTimelineStream = createStream(streamingApi, currentInstance, accessToken, currentTimeline, firstStatusId) diff --git a/src/routes/_store/observers/touchObservers.js b/src/routes/_store/observers/touchObservers.js index 80e4bdbc..4f94998b 100644 --- a/src/routes/_store/observers/touchObservers.js +++ b/src/routes/_store/observers/touchObservers.js @@ -3,7 +3,7 @@ export function touchObservers (store) { return } - let onTouch = () => { + const onTouch = () => { store.set({ isUserTouching: true }) window.removeEventListener('touchstart', onTouch) } diff --git a/src/routes/_store/storeLite.js b/src/routes/_store/storeLite.js index 31af837b..86f0d0af 100644 --- a/src/routes/_store/storeLite.js +++ b/src/routes/_store/storeLite.js @@ -19,7 +19,7 @@ export const storeLite = { set (obj) { if (hasLocalStorage) { - for (let [key, value] of Object.entries(obj)) { + for (const [key, value] of Object.entries(obj)) { localStorage.setItem(`store_${key}`, JSON.stringify(value)) } } diff --git a/src/routes/_thirdparty/a11y-dialog/a11y-dialog.js b/src/routes/_thirdparty/a11y-dialog/a11y-dialog.js index 080b2c20..ba4c736f 100644 --- a/src/routes/_thirdparty/a11y-dialog/a11y-dialog.js +++ b/src/routes/_thirdparty/a11y-dialog/a11y-dialog.js @@ -309,11 +309,11 @@ function $$ (selector, context) { * @return {Array} */ function collect (target) { - if (NodeList.prototype.isPrototypeOf(target)) { + if (NodeList.prototype.isPrototypeOf(target)) { // eslint-disable-line no-prototype-builtins return toArray(target) } - if (Element.prototype.isPrototypeOf(target)) { + if (Element.prototype.isPrototypeOf(target)) { // eslint-disable-line no-prototype-builtins return [target] } diff --git a/src/routes/_thirdparty/autosize/autosize.js b/src/routes/_thirdparty/autosize/autosize.js index a14687a2..7f8275ff 100644 --- a/src/routes/_thirdparty/autosize/autosize.js +++ b/src/routes/_thirdparty/autosize/autosize.js @@ -9,7 +9,7 @@ import throttle from 'lodash-es/throttle' import { getScrollContainer } from '../../_utils/scrollContainer' const map = new Map() -let createEvent = (name) => new Event(name, { bubbles: true }) +const createEvent = (name) => new Event(name, { bubbles: true }) function assign (ta) { if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) { @@ -17,7 +17,7 @@ function assign (ta) { } // TODO: hack - grab our scroll container so we can maintain the scrollTop - let container = getScrollContainer() + const container = getScrollContainer() let heightOffset = null let cachedHeight = null @@ -35,7 +35,7 @@ function assign (ta) { function resize () { mark('autosize:resize()') - let res = _resize() + const res = _resize() stop('autosize:resize()') return res } @@ -68,7 +68,7 @@ function assign (ta) { } function _update () { - let newHeight = resize() + const newHeight = resize() if (cachedHeight !== newHeight) { cachedHeight = newHeight const evt = createEvent('autosize:resized') @@ -120,7 +120,7 @@ function update (ta) { } } -let autosize = (el, options) => { +const autosize = (el, options) => { if (el) { Array.prototype.forEach.call(el.length ? el : [el], x => assign(x, options)) } diff --git a/src/routes/_transitions/slide.js b/src/routes/_transitions/slide.js index 7f5bfaee..0219d298 100644 --- a/src/routes/_transitions/slide.js +++ b/src/routes/_transitions/slide.js @@ -4,7 +4,7 @@ import noop from 'lodash-es/noop' // same as svelte-transitions, but respecting reduceMotion export function slide (node, ref) { - let { reduceMotion } = store.get() + const { reduceMotion } = store.get() if (reduceMotion) { return { delay: 0, diff --git a/src/routes/_utils/PromiseThrottler.js b/src/routes/_utils/PromiseThrottler.js index 3d776857..60aced0a 100644 --- a/src/routes/_utils/PromiseThrottler.js +++ b/src/routes/_utils/PromiseThrottler.js @@ -7,7 +7,7 @@ export class PromiseThrottler { } next () { - let res = this._promise + const res = this._promise // update afterwards, so we get a "leading" XHR this._promise = this._promise.then(() => new Promise(resolve => setTimeout(resolve, this._timeout))) return res diff --git a/src/routes/_utils/RealmStore.js b/src/routes/_utils/RealmStore.js index 88cc8424..de3318d0 100644 --- a/src/routes/_utils/RealmStore.js +++ b/src/routes/_utils/RealmStore.js @@ -17,7 +17,7 @@ export class RealmStore extends Store { } setForRealm (obj) { - let { currentRealm, realms } = this.get() + const { currentRealm, realms } = this.get() realms.set(currentRealm, Object.assign(realms.get(currentRealm) || {}, obj)) this.set({ realms: realms }) } @@ -26,7 +26,7 @@ export class RealmStore extends Store { this.compute(key, ['realms', 'currentRealm'], (realms, currentRealm) => { - let realmData = realms.get(currentRealm) + const realmData = realms.get(currentRealm) return (realmData && realmData[key]) || defaultValue }) } @@ -36,7 +36,7 @@ export class RealmStore extends Store { * to a plain old javascript object. */ batchUpdateForRealm (key, subKey, value) { - let { currentRealm } = this.get() + const { currentRealm } = this.get() let realmBatches = this._batches[currentRealm] if (!realmBatches) { realmBatches = this._batches[currentRealm] = {} @@ -48,21 +48,21 @@ export class RealmStore extends Store { batch[subKey] = value requestAnimationFrame(() => { - let batch = this._batches[currentRealm] && this._batches[currentRealm][key] + const batch = this._batches[currentRealm] && this._batches[currentRealm][key] if (!batch) { return } - let updatedKeys = Object.keys(batch) + const updatedKeys = Object.keys(batch) if (!updatedKeys.length) { return } mark('batchUpdate') - let obj = this.get()[key] - for (let otherKey of updatedKeys) { + const obj = this.get()[key] + for (const otherKey of updatedKeys) { obj[otherKey] = batch[otherKey] } delete this._batches[currentRealm][key] - let { realms } = this.get() + const { realms } = this.get() realms.set(currentRealm, Object.assign(realms.get(currentRealm) || {}, { [key]: obj })) this.set({ realms: realms }) stop('batchUpdate') diff --git a/src/routes/_utils/ajax.js b/src/routes/_utils/ajax.js index bca8dd2b..82116a50 100644 --- a/src/routes/_utils/ajax.js +++ b/src/routes/_utils/ajax.js @@ -10,10 +10,10 @@ function fetchWithTimeout (url, fetchOptions, timeout) { } function makeFetchOptions (method, headers, options) { - let res = { + const res = { method, headers: Object.assign(headers || {}, { - 'Accept': 'application/json' + Accept: 'application/json' }) } if (options && options.signal) { @@ -23,7 +23,7 @@ function makeFetchOptions (method, headers, options) { } async function throwErrorIfInvalidResponse (response) { - let json = await response.json() + const json = await response.json() if (response.status >= 200 && response.status < 300) { return json } @@ -44,7 +44,7 @@ async function _fetch (url, fetchOptions, options) { } async function _putOrPostOrPatch (method, url, body, headers, options) { - let fetchOptions = makeFetchOptions(method, headers, options) + const fetchOptions = makeFetchOptions(method, headers, options) if (body) { if (body instanceof FormData) { fetchOptions.body = body @@ -80,9 +80,9 @@ export function paramsString (paramsObject) { let res = '' let count = -1 Object.keys(paramsObject).forEach(key => { - let value = paramsObject[key] + const value = paramsObject[key] if (Array.isArray(value)) { // rails convention for encoding multiple values - for (let item of value) { + for (const item of value) { res += (++count > 0 ? '&' : '') + encodeURIComponent(key) + '[]=' + encodeURIComponent(item) } } else { diff --git a/src/routes/_utils/animate.js b/src/routes/_utils/animate.js index 3792d47f..05f272fa 100644 --- a/src/routes/_utils/animate.js +++ b/src/routes/_utils/animate.js @@ -12,7 +12,7 @@ function hashCode (s) { } function generateCss (id, animations) { - let keyframes = animations.map(({ properties }, i) => ( + const keyframes = animations.map(({ properties }, i) => ( `@keyframes keyframe-${id}-${i} { ${properties.map((obj, i) => (`${Math.round(100 * i / (properties.length - 1))}% { ${Object.keys(obj).map(key => `${key}: ${obj[key]};`).join('')} @@ -21,7 +21,7 @@ function generateCss (id, animations) { }` )) - let animationCss = `.${id} { + const animationCss = `.${id} { animation: ${animations.map(({ options }, i) => { return `keyframe-${id}-${i} ${options.duration}ms ${options.easing}` }).join(',')}; @@ -37,11 +37,11 @@ export function animate (el, animations) { .map(anim => anim.play()) } - let hash = hashCode(JSON.stringify(animations)) - let id = `anim-${hash}` + const hash = hashCode(JSON.stringify(animations)) + const id = `anim-${hash}` if (!document.getElementById(id)) { - let style = document.createElement('style') + const style = document.createElement('style') style.id = id style.textContent = generateCss(id, animations) document.head.appendChild(style) @@ -49,7 +49,7 @@ export function animate (el, animations) { requestAnimationFrame(() => { el.classList.add(id) - let wait = Math.max.apply(Math, animations.map(({ options }) => options.duration)) + const wait = Math.max.apply(Math, animations.map(({ options }) => options.duration)) setTimeout(() => { requestAnimationFrame(() => { el.classList.remove(id) diff --git a/src/routes/_utils/arrays.js b/src/routes/_utils/arrays.js index 665c8a02..ca8c33e1 100644 --- a/src/routes/_utils/arrays.js +++ b/src/routes/_utils/arrays.js @@ -2,7 +2,7 @@ export function mergeArrays (leftArray, rightArray, comparator) { let leftIndex = 0 let rightIndex = 0 - let merged = [] + const merged = [] while (leftIndex < leftArray.length || rightIndex < rightArray.length) { if (leftIndex === leftArray.length) { merged.push(rightArray[rightIndex]) @@ -14,9 +14,9 @@ export function mergeArrays (leftArray, rightArray, comparator) { leftIndex++ continue } - let left = leftArray[leftIndex] - let right = rightArray[rightIndex] - let comparison = comparator(right, left) + const left = leftArray[leftIndex] + const right = rightArray[rightIndex] + const comparison = comparator(right, left) if (comparison === 0) { merged.push(left) rightIndex++ @@ -35,7 +35,7 @@ export function mergeArrays (leftArray, rightArray, comparator) { export function concat () { let res = [] for (let i = 0, len = arguments.length; i < len; i++) { - let arg = arguments[i] + const arg = arguments[i] if (Array.isArray(arg)) { res = res.concat(arguments[i]) } else { diff --git a/src/routes/_utils/classname.js b/src/routes/_utils/classname.js index be5d5b71..d1f00a21 100644 --- a/src/routes/_utils/classname.js +++ b/src/routes/_utils/classname.js @@ -1,9 +1,9 @@ export function classname () { let res = '' - let len = arguments.length + const len = arguments.length let i = -1 while (++i < len) { - let item = arguments[i] + const item = arguments[i] if (item) { if (res) { res += ' ' diff --git a/src/routes/_utils/createAutosuggestAccessibleLabel.js b/src/routes/_utils/createAutosuggestAccessibleLabel.js index 8e072cd1..5d5a2a22 100644 --- a/src/routes/_utils/createAutosuggestAccessibleLabel.js +++ b/src/routes/_utils/createAutosuggestAccessibleLabel.js @@ -3,13 +3,13 @@ import { removeEmoji } from './removeEmoji' export function createAutosuggestAccessibleLabel ( autosuggestType, $omitEmojiInDisplayNames, selectedIndex, searchResults) { - let selected = searchResults[selectedIndex] + const selected = searchResults[selectedIndex] let label if (autosuggestType === 'emoji') { label = `${selected.shortcode}` } else { // account let displayName = selected.display_name || selected.username - let emojis = selected.emojis || [] + const emojis = selected.emojis || [] displayName = $omitEmojiInDisplayNames ? removeEmoji(displayName, emojis) || displayName : displayName diff --git a/src/routes/_utils/delegate.js b/src/routes/_utils/delegate.js index 41994811..32f9babd 100644 --- a/src/routes/_utils/delegate.js +++ b/src/routes/_utils/delegate.js @@ -7,7 +7,7 @@ if (process.browser && process.env.NODE_ENV !== 'production') { } function onEvent (e) { - let { type, keyCode, target } = e + const { type, keyCode, target } = e if (!(type === 'click' || (type === 'keydown' && keyCode === 13))) { // we're not interested in any non-click or non-Enter events return @@ -22,13 +22,13 @@ function onEvent (e) { } if (key && callbacks[key]) { if (type === 'click') { - let selection = window.getSelection() - let selectionStr = selection && selection.toString() + const selection = window.getSelection() + const selectionStr = selection && selection.toString() if (selectionStr && selectionStr.length && target.contains(selection.anchorNode)) { return // ignore if the user is selecting text inside the clickable area } } - let res = callbacks[key](e) // callback returns true to indicate it has handled the action + const res = callbacks[key](e) // callback returns true to indicate it has handled the action if (process.env.NODE_ENV !== 'production' && typeof res !== 'boolean') { console.warn(`Callback returned a non-boolean response: "${key}". This should never happen.`) } diff --git a/src/routes/_utils/emojifyText.js b/src/routes/_utils/emojifyText.js index 8c7581cc..12bc79b2 100644 --- a/src/routes/_utils/emojifyText.js +++ b/src/routes/_utils/emojifyText.js @@ -7,9 +7,9 @@ export function emojifyText (text, emojis, autoplayGifs) { // replace custom emoji if (emojis) { - for (let emoji of emojis) { - let urlToUse = autoplayGifs ? emoji.url : emoji.static_url - let shortcodeWithColons = `:${emoji.shortcode}:` + for (const emoji of emojis) { + const urlToUse = autoplayGifs ? emoji.url : emoji.static_url + const shortcodeWithColons = `:${emoji.shortcode}:` text = replaceAll( text, shortcodeWithColons, diff --git a/src/routes/_utils/eventBus.js b/src/routes/_utils/eventBus.js index a9c32bb3..86302717 100644 --- a/src/routes/_utils/eventBus.js +++ b/src/routes/_utils/eventBus.js @@ -7,7 +7,7 @@ if (process.browser && process.env.NODE_ENV !== 'production') { } export function on (eventName, component, method) { - let callback = method.bind(component) + const callback = method.bind(component) eventBus.on(eventName, callback) component.on('destroy', () => { eventBus.removeListener(eventName, callback) diff --git a/src/routes/_utils/events.js b/src/routes/_utils/events.js index b8c0a199..7c1ac3a2 100644 --- a/src/routes/_utils/events.js +++ b/src/routes/_utils/events.js @@ -18,16 +18,16 @@ export function mouseover (node, callback) { } export function selectionChange (node, callback) { - let events = ['keyup', 'click', 'focus', 'blur'] - let listener = () => { + const events = ['keyup', 'click', 'focus', 'blur'] + const listener = () => { callback(node.selectionStart) } - for (let event of events) { + for (const event of events) { node.addEventListener(event, listener) } return { destroy () { - for (let event of events) { + for (const event of events) { node.removeEventListener(event, listener) } } diff --git a/src/routes/_utils/historyEvents.js b/src/routes/_utils/historyEvents.js index ad5a1534..cad5374d 100644 --- a/src/routes/_utils/historyEvents.js +++ b/src/routes/_utils/historyEvents.js @@ -2,10 +2,10 @@ // per https://stackoverflow.com/a/25673911/680742 function wrapper (type) { - let orig = history[type] + const orig = history[type] return function () { - let result = orig.apply(this, arguments) - let e = new Event(type) + const result = orig.apply(this, arguments) + const e = new Event(type) e.arguments = arguments window.dispatchEvent(e) return result diff --git a/src/routes/_utils/loadCSS.js b/src/routes/_utils/loadCSS.js index 367bae7e..b5948e10 100644 --- a/src/routes/_utils/loadCSS.js +++ b/src/routes/_utils/loadCSS.js @@ -1,10 +1,10 @@ export function loadCSS (href) { - let existingLink = document.querySelector(`link[href="${href}"]`) + const existingLink = document.querySelector(`link[href="${href}"]`) if (existingLink) { return } - let link = document.createElement('link') + const link = document.createElement('link') link.rel = 'stylesheet' link.href = href diff --git a/src/routes/_utils/lodash-lite.js b/src/routes/_utils/lodash-lite.js index e2f9a9b9..0e0fe4fd 100644 --- a/src/routes/_utils/lodash-lite.js +++ b/src/routes/_utils/lodash-lite.js @@ -2,7 +2,7 @@ // we can just do in idiomatic ES2015+ export function get (obj, keys, defaultValue) { - for (let key of keys) { + for (const key of keys) { if (obj && key in obj) { obj = obj[key] } else { @@ -13,8 +13,8 @@ export function get (obj, keys, defaultValue) { } export function pickBy (obj, predicate) { - let res = {} - for (let [key, value] of Object.entries(obj)) { + const res = {} + for (const [key, value] of Object.entries(obj)) { if (predicate(value, key)) { res[key] = value } diff --git a/src/routes/_utils/measureText.js b/src/routes/_utils/measureText.js index 8a750b9a..7ac136fd 100644 --- a/src/routes/_utils/measureText.js +++ b/src/routes/_utils/measureText.js @@ -12,10 +12,10 @@ export function measureText (inputText) { return 0 } mark('measureText()') - let normalizedText = inputText + const normalizedText = inputText .replace(urlRegex(), urlPlaceholder) .replace(handleRegex(), '$1@$3') - let len = length(normalizedText) + const len = length(normalizedText) stop('measureText()') return len } diff --git a/src/routes/_utils/once.js b/src/routes/_utils/once.js index 88b17cdb..b21b7838 100644 --- a/src/routes/_utils/once.js +++ b/src/routes/_utils/once.js @@ -1,7 +1,7 @@ // svelte helper to add a .once() method similar to .on, but only fires once export function once (eventName, callback) { - let listener = this.on(eventName, eventValue => { + const listener = this.on(eventName, eventValue => { listener.cancel() callback(eventValue) }) diff --git a/src/routes/_utils/removeEmoji.js b/src/routes/_utils/removeEmoji.js index 56198653..40e1c664 100644 --- a/src/routes/_utils/removeEmoji.js +++ b/src/routes/_utils/removeEmoji.js @@ -4,8 +4,8 @@ import { replaceEmoji } from './replaceEmoji' export function removeEmoji (text, emojis) { // remove custom emoji if (emojis) { - for (let emoji of emojis) { - let shortcodeWithColons = `:${emoji.shortcode}:` + for (const emoji of emojis) { + const shortcodeWithColons = `:${emoji.shortcode}:` text = replaceAll(text, shortcodeWithColons, '') } } diff --git a/src/routes/_utils/replaceEmoji.js b/src/routes/_utils/replaceEmoji.js index 8b6b811e..1383cbcc 100644 --- a/src/routes/_utils/replaceEmoji.js +++ b/src/routes/_utils/replaceEmoji.js @@ -1,14 +1,14 @@ import { getEmojiRegex } from './emojiRegex' // \ufe0f is a variation selector, which seems to appear for some reason in e.g. ™ -let NON_EMOJI_REGEX = new RegExp('^[0-9#*™®\ufe0f]+$') +const NON_EMOJI_REGEX = /^(?:[0-9#*]|™|®|\ufe0f)+$/ // replace emoji in HTML with something else, safely skipping HTML tags export function replaceEmoji (string, replacer) { let output = '' let leftAngleBracketIdx = string.indexOf('<') let currentIdx = 0 - let emojiRegex = getEmojiRegex() + const emojiRegex = getEmojiRegex() function safeReplacer (substring) { // emoji regex matches digits and pound sign https://git.io/fpl6J @@ -19,11 +19,11 @@ export function replaceEmoji (string, replacer) { } while (leftAngleBracketIdx !== -1) { - let substring = string.substring(currentIdx, leftAngleBracketIdx) + const substring = string.substring(currentIdx, leftAngleBracketIdx) output += substring.replace(emojiRegex, safeReplacer) - let rightAngleBracketIdx = string.indexOf('>', leftAngleBracketIdx + 1) + const rightAngleBracketIdx = string.indexOf('>', leftAngleBracketIdx + 1) if (rightAngleBracketIdx === -1) { // broken HTML, abort output += string.substring(leftAngleBracketIdx, string.length) return output diff --git a/src/routes/_utils/reselect.js b/src/routes/_utils/reselect.js index d858918d..da21311d 100644 --- a/src/routes/_utils/reselect.js +++ b/src/routes/_utils/reselect.js @@ -13,7 +13,7 @@ export function reselect (store, outputKey, inputKey) { let prevValue let nextValue let count = 0 - let countKey = `${outputKey}_reselectCount` + const countKey = `${outputKey}_reselectCount` store.compute(countKey, [inputKey], input => { if (process.browser && process.env.NODE_ENV !== 'production') { diff --git a/src/routes/_utils/scheduleIdleTask.js b/src/routes/_utils/scheduleIdleTask.js index dab78952..1ee6a984 100644 --- a/src/routes/_utils/scheduleIdleTask.js +++ b/src/routes/_utils/scheduleIdleTask.js @@ -18,7 +18,7 @@ function getRIC () { function runTasks (deadline) { mark('scheduleIdleTask:runTasks()') while (taskQueue.length && deadline.timeRemaining() > 0) { - let task = taskQueue.shift() + const task = taskQueue.shift() try { task() } catch (e) { @@ -26,7 +26,7 @@ function runTasks (deadline) { } } if (taskQueue.length) { - let rIC = getRIC() + const rIC = getRIC() rIC(runTasks) } else { runningRequestIdleCallback = false @@ -38,7 +38,7 @@ export function scheduleIdleTask (task) { taskQueue.push(task) if (!runningRequestIdleCallback) { runningRequestIdleCallback = true - let rIC = getRIC() + const rIC = getRIC() rIC(runTasks) } } diff --git a/src/routes/_utils/scrollIntoView.js b/src/routes/_utils/scrollIntoView.js index b0594aba..4a9cb802 100644 --- a/src/routes/_utils/scrollIntoView.js +++ b/src/routes/_utils/scrollIntoView.js @@ -15,25 +15,25 @@ export function isVisible (element) { if (!element) { return false } - let rect = element.getBoundingClientRect() - let offsetHeight = getOffsetHeight() - let topOverlay = getTopOverlay() + const rect = element.getBoundingClientRect() + const offsetHeight = getOffsetHeight() + const topOverlay = getTopOverlay() return rect.top < offsetHeight && rect.bottom >= topOverlay } export function firstVisibleElementIndex (elements) { - let offsetHeight = getOffsetHeight() - let topOverlay = getTopOverlay() + const offsetHeight = getOffsetHeight() + const topOverlay = getTopOverlay() let first = -1 let firstComplete = -1 - let len = elements.length + const len = elements.length let i = -1 while (++i < len) { - let element = elements[i] + const element = elements[i] if (!element) { continue } - let rect = element.getBoundingClientRect() + const rect = element.getBoundingClientRect() if (rect.top < offsetHeight && rect.bottom >= topOverlay) { first = i firstComplete = ( @@ -45,14 +45,14 @@ export function firstVisibleElementIndex (elements) { } export function scrollIntoViewIfNeeded (element) { - let rect = element.getBoundingClientRect() - let topOverlay = getTopOverlay() - let offsetHeight = getOffsetHeight() + const rect = element.getBoundingClientRect() + const topOverlay = getTopOverlay() + const offsetHeight = getOffsetHeight() let scrollY = 0 if (rect.top < topOverlay) { scrollY = topOverlay } else if (rect.bottom > offsetHeight) { - let height = rect.bottom - rect.top + const height = rect.bottom - rect.top if ((offsetHeight - topOverlay) > height) { scrollY = offsetHeight - height } else { @@ -63,7 +63,7 @@ export function scrollIntoViewIfNeeded (element) { } else { return // not needed } - let scrollContainer = getScrollContainer() - let scrollTop = scrollContainer.scrollTop + const scrollContainer = getScrollContainer() + const scrollTop = scrollContainer.scrollTop smoothScroll(scrollContainer, scrollTop + rect.top - scrollY) } diff --git a/src/routes/_utils/scrollToTop.js b/src/routes/_utils/scrollToTop.js index 6f21a98e..4b437ddb 100644 --- a/src/routes/_utils/scrollToTop.js +++ b/src/routes/_utils/scrollToTop.js @@ -2,8 +2,8 @@ import { getScrollContainer } from './scrollContainer' import { smoothScroll } from './smoothScroll' export function scrollToTop (smooth) { - let scroller = getScrollContainer() - let { scrollTop } = scroller + const scroller = getScrollContainer() + const { scrollTop } = scroller if (scrollTop === 0) { return false } diff --git a/src/routes/_utils/setFavicon.js b/src/routes/_utils/setFavicon.js index 92efd5e7..c0473b7f 100644 --- a/src/routes/_utils/setFavicon.js +++ b/src/routes/_utils/setFavicon.js @@ -1,13 +1,13 @@ // borrowed from https://github.com/HenrikJoreteg/favicon-setter export function setFavicon (href) { - let faviconId = 'theFavicon' - let oldLink = document.getElementById(faviconId) + const faviconId = 'theFavicon' + const oldLink = document.getElementById(faviconId) if (oldLink.getAttribute('href') === href) { return } - let link = document.createElement('link') + const link = document.createElement('link') link.id = faviconId link.rel = 'shortcut icon' link.type = 'image/png' diff --git a/src/routes/_utils/shortcuts.js b/src/routes/_utils/shortcuts.js index 702bc679..4851ad14 100644 --- a/src/routes/_utils/shortcuts.js +++ b/src/routes/_utils/shortcuts.js @@ -57,7 +57,7 @@ export function addToShortcutScope (scopeKey, keys, component) { } export function removeFromShortcutScope (scopeKey, keys, component) { - let keyMap = scopeKeyMaps[scopeKey] + const keyMap = scopeKeyMaps[scopeKey] if (!keyMap) { return } @@ -97,7 +97,7 @@ export function onKeyDownInShortcutScope (scopeKey, event) { return } } - let keyMap = scopeKeyMaps[scopeKey] + const keyMap = scopeKeyMaps[scopeKey] if (!keyMap) { return } @@ -107,11 +107,11 @@ export function onKeyDownInShortcutScope (scopeKey, event) { } function handleEvent (scopeKey, keyMap, key, event) { - let value = keyMap[key] + const value = keyMap[key] if (!value) { return false } - if (KeyMap.prototype.isPrototypeOf(value)) { + if (KeyMap.prototype.isPrototypeOf(value)) { // eslint-disable-line no-prototype-builtins prefixMap = value prefixMapScope = scopeKey } else { @@ -133,8 +133,8 @@ function onKeyDown (event) { function mapKeys (keyMap, keys, component) { keys.split('|').forEach( (seq) => { - let seqArray = seq.split(' ') - let prefixLen = seqArray.length - 1 + const seqArray = seq.split(' ') + const prefixLen = seqArray.length - 1 let currentMap = keyMap let i = -1 while (++i < prefixLen) { @@ -152,18 +152,18 @@ function mapKeys (keyMap, keys, component) { function unmapKeys (keyMap, keys, component) { keys.split('|').forEach( (seq) => { - let seqArray = seq.split(' ') - let prefixLen = seqArray.length - 1 + const seqArray = seq.split(' ') + const prefixLen = seqArray.length - 1 let currentMap = keyMap let i = -1 while (++i < prefixLen) { - let prefixMap = currentMap[seqArray[i]] + const prefixMap = currentMap[seqArray[i]] if (!prefixMap) { return } currentMap = prefixMap } - let lastKey = seqArray[prefixLen] + const lastKey = seqArray[prefixLen] if (currentMap[lastKey] === component) { delete currentMap[lastKey] } @@ -171,7 +171,7 @@ function unmapKeys (keyMap, keys, component) { } function acceptShortcutEvent (event) { - let { target } = event + const { target } = event return !( event.altKey || event.metaKey || diff --git a/src/routes/_utils/smoothScroll.js b/src/routes/_utils/smoothScroll.js index bc1325f1..23060551 100644 --- a/src/routes/_utils/smoothScroll.js +++ b/src/routes/_utils/smoothScroll.js @@ -49,7 +49,7 @@ function smoothScrollPolyfill (node, key, target) { function testSupportsSmoothScroll () { let supports = false try { - let div = document.createElement('div') + const div = document.createElement('div') div.scrollTo({ top: 0, get behavior () { diff --git a/src/routes/_utils/statusHtmlToPlainText.js b/src/routes/_utils/statusHtmlToPlainText.js index 2c63ea8b..ddee61a5 100644 --- a/src/routes/_utils/statusHtmlToPlainText.js +++ b/src/routes/_utils/statusHtmlToPlainText.js @@ -1,15 +1,15 @@ import { mark, stop } from './marks' import { massageStatusPlainText } from './massageStatusPlainText' -let domParser = process.browser && new DOMParser() +const domParser = process.browser && new DOMParser() // mentions like "@foo" have to be expanded to "@foo@example.com" function massageMentions (doc, mentions) { - let anchors = doc.querySelectorAll('a.mention') + const anchors = doc.querySelectorAll('a.mention') for (let i = 0; i < anchors.length; i++) { - let anchor = anchors[i] - let href = anchor.getAttribute('href') - let mention = mentions.find(mention => mention.url === href) + const anchor = anchors[i] + const href = anchor.getAttribute('href') + const mention = mentions.find(mention => mention.url === href) if (mention) { anchor.innerText = `@${mention.acct}` } @@ -20,12 +20,12 @@ function massageMentions (doc, mentions) { // single
s should become single newlines function innerTextRetainingNewlines (doc) { let res = '' - let paragraphs = doc.querySelectorAll('p') + const paragraphs = doc.querySelectorAll('p') for (let i = 0; i < paragraphs.length; i++) { - let paragraph = paragraphs[i] - let brs = paragraph.querySelectorAll('br') + const paragraph = paragraphs[i] + const brs = paragraph.querySelectorAll('br') for (let j = 0; j < brs.length; j++) { - let br = brs[j] + const br = brs[j] br.parentNode.replaceChild(doc.createTextNode('\n'), br) } res += (i > 0 ? '\n\n' : '') + paragraph.textContent @@ -39,9 +39,9 @@ export function statusHtmlToPlainText (html, mentions) { } mark('statusHtmlToPlainText') html = massageStatusPlainText(html) - let doc = domParser.parseFromString(html, 'text/html') + const doc = domParser.parseFromString(html, 'text/html') massageMentions(doc, mentions) - let res = innerTextRetainingNewlines(doc) + const res = innerTextRetainingNewlines(doc) stop('statusHtmlToPlainText') return res } diff --git a/src/routes/_utils/statusIdSorting.js b/src/routes/_utils/statusIdSorting.js index f7b585f9..427fca2e 100644 --- a/src/routes/_utils/statusIdSorting.js +++ b/src/routes/_utils/statusIdSorting.js @@ -19,18 +19,18 @@ export function toPaddedBigInt (id) { } export function toReversePaddedBigInt (id) { - let padded = toPaddedBigInt(id) + const padded = toPaddedBigInt(id) let reversed = '' for (let i = 0; i < padded.length; i++) { - let charCode = padded.charCodeAt(i) - let inverseCharCode = MIN_CHAR_CODE + MAX_CHAR_CODE - charCode + const charCode = padded.charCodeAt(i) + const inverseCharCode = MIN_CHAR_CODE + MAX_CHAR_CODE - charCode reversed += String.fromCharCode(inverseCharCode) } return reversed } export function compareTimelineItemSummaries (left, right) { - let leftPadded = toPaddedBigInt(left.id) - let rightPadded = toPaddedBigInt(right.id) + const leftPadded = toPaddedBigInt(left.id) + const rightPadded = toPaddedBigInt(right.id) return leftPadded < rightPadded ? -1 : leftPadded === rightPadded ? 0 : 1 } diff --git a/src/routes/_utils/sync.js b/src/routes/_utils/sync.js index 8cc3b190..8c7ce059 100644 --- a/src/routes/_utils/sync.js +++ b/src/routes/_utils/sync.js @@ -1,7 +1,7 @@ // Hit both the cache and the network, setting state for the cached version first, // then the network version (as it's assumed to be fresher). Also update the db afterwards. export async function cacheFirstUpdateAfter (networkFetcher, dbFetcher, dbUpdater, stateSetter) { - let networkPromise = networkFetcher() // kick off network request immediately + const networkPromise = networkFetcher() // kick off network request immediately let dbResponse try { dbResponse = await dbFetcher() @@ -11,7 +11,7 @@ export async function cacheFirstUpdateAfter (networkFetcher, dbFetcher, dbUpdate if (dbResponse) { stateSetter(dbResponse) } - let fetchAndUpdatePromise = networkPromise.then(networkResponse => { + const fetchAndUpdatePromise = networkPromise.then(networkResponse => { /* no await */ dbUpdater(networkResponse) stateSetter(networkResponse) }) diff --git a/src/routes/_utils/testStorage.js b/src/routes/_utils/testStorage.js index 6212df10..581a7ad7 100644 --- a/src/routes/_utils/testStorage.js +++ b/src/routes/_utils/testStorage.js @@ -26,8 +26,8 @@ export const testHasIndexedDB = thunk(async () => { } try { - let idbFailed = await new Promise(resolve => { - let db = indexedDB.open(testKey) + const idbFailed = await new Promise(resolve => { + const db = indexedDB.open(testKey) db.onerror = () => resolve(true) db.onsuccess = () => { indexedDB.deleteDatabase(testKey) diff --git a/src/routes/_utils/themeEngine.js b/src/routes/_utils/themeEngine.js index 3bfe9e73..824dddb9 100644 --- a/src/routes/_utils/themeEngine.js +++ b/src/routes/_utils/themeEngine.js @@ -11,16 +11,16 @@ function getExistingThemeLink () { } function resetExistingTheme () { - let existingLink = getExistingThemeLink() + const existingLink = getExistingThemeLink() if (existingLink) { document.head.removeChild(existingLink) } } function loadCSS (href) { - let existingLink = getExistingThemeLink() + const existingLink = getExistingThemeLink() - let link = document.createElement('link') + const link = document.createElement('link') link.rel = 'stylesheet' link.href = href @@ -38,7 +38,7 @@ export function switchToTheme (themeName = DEFAULT_THEME, enableGrayscale) { if (enableGrayscale) { themeName = prefersDarkTheme ? 'dark-grayscale' : 'grayscale' } - let themeColor = window.__themeColors[themeName] + const themeColor = window.__themeColors[themeName] meta.content = themeColor || window.__themeColors[DEFAULT_THEME] if (themeName !== INLINE_THEME) { loadCSS(`/theme-${themeName}.css`) diff --git a/src/routes/_utils/throttleRaf.js b/src/routes/_utils/throttleRaf.js index 28a88173..8755272d 100644 --- a/src/routes/_utils/throttleRaf.js +++ b/src/routes/_utils/throttleRaf.js @@ -8,7 +8,7 @@ export const throttleRaf = () => { if (!rafQueued) { rafQueued = true requestAnimationFrame(() => { - let cb = rafCallback + const cb = rafCallback rafCallback = null rafQueued = false cb() diff --git a/src/routes/settings/quick-login.html b/src/routes/settings/quick-login.html index caad859b..7e1b0bdd 100644 --- a/src/routes/settings/quick-login.html +++ b/src/routes/settings/quick-login.html @@ -6,9 +6,9 @@ export default { store: () => store, oncreate () { - let accessToken = location.search.match(/accessToken=([^&]+)/)[1] - let instanceName = location.search.match(/instanceName=([^&]+)/)[1] - let { + const accessToken = location.search.match(/accessToken=([^&]+)/)[1] + const instanceName = location.search.match(/instanceName=([^&]+)/)[1] + const { loggedInInstances, loggedInInstancesInOrder } = this.store.get() diff --git a/src/routes/share.html b/src/routes/share.html index d99c1d08..811d1969 100644 --- a/src/routes/share.html +++ b/src/routes/share.html @@ -9,9 +9,9 @@ export default { store: () => store, oncreate () { - let params = new URLSearchParams(location.search) + const params = new URLSearchParams(location.search) - let text = SHARE_KEYS + const text = SHARE_KEYS .map(key => params.get(key) && decodeURIComponentWithPluses(params.get(key))) .filter(Boolean) .join(' ') diff --git a/src/service-worker.js b/src/service-worker.js index 45ceab6f..a473f389 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -43,10 +43,10 @@ self.addEventListener('install', event => { self.addEventListener('activate', event => { event.waitUntil((async () => { - let keys = await caches.keys() + const keys = await caches.keys() // delete old asset/ondemand caches - for (let key of keys) { + for (const key of keys) { if (key !== ASSETS && !key.startsWith('webpack_assets_')) { await caches.delete(key) @@ -57,16 +57,16 @@ self.addEventListener('activate', event => { // them when the service worker has installed but the page has not // yet reloaded (e.g. when it gives the toast saying "please reload" // but then you don't refresh and instead load an async chunk) - let webpackKeysToDelete = keys + const webpackKeysToDelete = keys .filter(key => key.startsWith('webpack_assets_')) .sort((a, b) => { - let aTimestamp = parseInt(a.substring(15), 10) - let bTimestamp = parseInt(b.substring(15), 10) + const aTimestamp = parseInt(a.substring(15), 10) + const bTimestamp = parseInt(b.substring(15), 10) return bTimestamp < aTimestamp ? -1 : 1 }) .slice(2) - for (let key of webpackKeysToDelete) { + for (const key of webpackKeysToDelete) { await caches.delete(key) } @@ -84,19 +84,19 @@ self.addEventListener('fetch', event => { } event.respondWith((async () => { - let sameOrigin = url.origin === self.origin + const sameOrigin = url.origin === self.origin if (sameOrigin) { // always serve webpack-generated resources and // static from the cache if possible - let response = await caches.match(req) + const response = await caches.match(req) if (response) { return response } // for routes, serve the /service-worker-index.html file from the most recent // static cache if (routes.find(route => route.pattern.test(url.pathname))) { - let response = await caches.match('/service-worker-index.html') + const response = await caches.match('/service-worker-index.html') if (response) { return response } @@ -115,7 +115,7 @@ self.addEventListener('push', event => { try { const notification = await get(`${origin}/api/v1/notifications/${data.notification_id}`, { - 'Authorization': `Bearer ${data.access_token}` + Authorization: `Bearer ${data.access_token}` }, { timeout: 2000 }) await showRichNotification(data, notification) @@ -199,7 +199,7 @@ async function showRichNotification (data, notification) { const cloneNotification = notification => { const clone = {} - for (let k in notification) { + for (const k in notification) { // deliberately not doing a hasOwnProperty check, but skipping // functions and null props like onclick and onshow and showTrigger if (typeof notification[k] !== 'function' && notification[k] !== null) { @@ -224,7 +224,7 @@ self.addEventListener('notificationclick', event => { case 'reblog': { const url = `${event.notification.data.instance}/api/v1/statuses/${event.notification.data.status_id}/reblog` await post(url, null, { - 'Authorization': `Bearer ${event.notification.data.access_token}` + Authorization: `Bearer ${event.notification.data.access_token}` }) await updateNotificationWithoutAction(event.notification, 'reblog') break @@ -232,7 +232,7 @@ self.addEventListener('notificationclick', event => { case 'favourite': { const url = `${event.notification.data.instance}/api/v1/statuses/${event.notification.data.status_id}/favourite` await post(url, null, { - 'Authorization': `Bearer ${event.notification.data.access_token}` + Authorization: `Bearer ${event.notification.data.access_token}` }) await updateNotificationWithoutAction(event.notification, 'favourite') break diff --git a/tests/blobUtils.js b/tests/blobUtils.js index b9b4dacd..3e35c2b2 100644 --- a/tests/blobUtils.js +++ b/tests/blobUtils.js @@ -1,8 +1,8 @@ export function base64StringToBlob (base64, type) { function binaryStringToArrayBuffer (binary) { - let length = binary.length - let buf = new ArrayBuffer(length) - let arr = new Uint8Array(buf) + const length = binary.length + const buf = new ArrayBuffer(length) + const arr = new Uint8Array(buf) let i = -1 while (++i < length) { arr[i] = binary.charCodeAt(i) @@ -10,6 +10,6 @@ export function base64StringToBlob (base64, type) { return buf } - let parts = [binaryStringToArrayBuffer(atob(base64))] + const parts = [binaryStringToArrayBuffer(atob(base64))] return type ? new Blob(parts, { type: type }) : new Blob(parts) } diff --git a/tests/serverActions.js b/tests/serverActions.js index c55e24dd..72e68020 100644 --- a/tests/serverActions.js +++ b/tests/serverActions.js @@ -37,7 +37,7 @@ export async function postWithSpoilerAndPrivacyAs (username, text, spoiler, priv } export async function postEmptyStatusWithMediaAs (username, filename, alt) { - let mediaResponse = await submitMedia(users[username].accessToken, filename, alt) + const mediaResponse = await submitMedia(users[username].accessToken, filename, alt) return postStatus(instanceName, users[username].accessToken, '', null, [mediaResponse.id], false, null, 'public') } diff --git a/tests/spec/008-status-media.js b/tests/spec/008-status-media.js index e643a204..2de49f2e 100644 --- a/tests/spec/008-status-media.js +++ b/tests/spec/008-status-media.js @@ -9,8 +9,8 @@ fixture`008-status-media.js` test('shows sensitive images and videos', async t => { await loginAsFoobar(t) - let kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') - let videoIdx = homeTimeline.findIndex(_ => _.content === 'secret video') + const kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') + const videoIdx = homeTimeline.findIndex(_ => _.content === 'secret video') await scrollToStatus(t, 1 + kittenIdx) await t.expect($(`${getNthStatusSelector(1 + kittenIdx)} .status-media img`).exists).notOk() @@ -26,8 +26,8 @@ test('shows sensitive images and videos', async t => { test('click and close image and video modals', async t => { await loginAsFoobar(t) - let videoIdx = homeTimeline.findIndex(_ => _.content === "here's a video") - let kittenIdx = homeTimeline.findIndex(_ => _.content === "here's an animated kitten gif") + const videoIdx = homeTimeline.findIndex(_ => _.content === "here's a video") + const kittenIdx = homeTimeline.findIndex(_ => _.content === "here's an animated kitten gif") await scrollToStatus(t, 1 + videoIdx) await t.expect(modalDialogContents.exists).notOk() diff --git a/tests/spec/010-focus.js b/tests/spec/010-focus.js index 21442f63..a8b25379 100644 --- a/tests/spec/010-focus.js +++ b/tests/spec/010-focus.js @@ -14,7 +14,7 @@ fixture`010-focus.js` test('modal preserves focus', async t => { await loginAsFoobar(t) - let idx = homeTimeline.findIndex(_ => _.content === "here's a video") + const idx = homeTimeline.findIndex(_ => _.content === "here's a video") await scrollToStatus(t, 1 + idx) // explicitly hover-focus-click diff --git a/tests/spec/017-compose-reply.js b/tests/spec/017-compose-reply.js index 40ca1d0c..71ab4873 100644 --- a/tests/spec/017-compose-reply.js +++ b/tests/spec/017-compose-reply.js @@ -62,7 +62,7 @@ test('replies have same privacy as replied-to status by default', async t => { test('replies have same CW as replied-to status', async t => { await loginAsFoobar(t) - let kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') + const kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') await scrollToStatus(t, 1 + kittenIdx) await t.click(getNthReplyButton(1 + kittenIdx)) .expect(getNthReplyContentWarningInput(1 + kittenIdx).value).eql('kitten CW') @@ -74,7 +74,7 @@ test('replies have same CW as replied-to status', async t => { test('replies save deletions of CW', async t => { await loginAsFoobar(t) - let kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') + const kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') await scrollToStatus(t, 1 + kittenIdx) await t.click(getNthReplyButton(1 + kittenIdx)) .expect(getNthReplyContentWarningInput(1 + kittenIdx).value).eql('kitten CW') @@ -88,7 +88,7 @@ test('replies save deletions of CW', async t => { test('replies save changes to CW', async t => { await loginAsFoobar(t) - let kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') + const kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') await scrollToStatus(t, 1 + kittenIdx) await t.click(getNthReplyButton(1 + kittenIdx)) .expect(getNthReplyContentWarningInput(1 + kittenIdx).value).eql('kitten CW') diff --git a/tests/spec/022-status-aria-label.js b/tests/spec/022-status-aria-label.js index 7978b656..0200e990 100644 --- a/tests/spec/022-status-aria-label.js +++ b/tests/spec/022-status-aria-label.js @@ -29,7 +29,7 @@ test('basic aria-labels for statuses', async t => { test('aria-labels for CWed statuses', async t => { await loginAsFoobar(t) - let kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') + const kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') await scrollToStatus(t, 1 + kittenIdx) await t .hover(getNthStatus(1 + kittenIdx)) diff --git a/tests/spec/023-mark-media-as-sensitive.js b/tests/spec/023-mark-media-as-sensitive.js index 50040d1e..7157ab16 100644 --- a/tests/spec/023-mark-media-as-sensitive.js +++ b/tests/spec/023-mark-media-as-sensitive.js @@ -23,23 +23,23 @@ async function checkSensitivityForStatus (t, idx, sensitive) { } async function checkSensitivity (t, shouldBeSensitive) { - let sensitiveKittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') - let sensitiveVideoIdx = homeTimeline.findIndex(_ => _.content === 'secret video') - let videoIdx = homeTimeline.findIndex(_ => _.content === "here's a video") - let sensitiveAnimatedKittenIdx = homeTimeline.findIndex(_ => _.content === "here's a secret animated kitten gif") - let animatedKittenIdx = homeTimeline.findIndex(_ => _.content === "here's an animated kitten gif") + const sensitiveKittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') + const sensitiveVideoIdx = homeTimeline.findIndex(_ => _.content === 'secret video') + const videoIdx = homeTimeline.findIndex(_ => _.content === "here's a video") + const sensitiveAnimatedKittenIdx = homeTimeline.findIndex(_ => _.content === "here's a secret animated kitten gif") + const animatedKittenIdx = homeTimeline.findIndex(_ => _.content === "here's an animated kitten gif") await t.hover(getNthStatus(1)) - let expected = [ - [ sensitiveKittenIdx, shouldBeSensitive(true) ], - [ sensitiveVideoIdx, shouldBeSensitive(true) ], - [ videoIdx, shouldBeSensitive(false) ], - [ sensitiveAnimatedKittenIdx, shouldBeSensitive(true) ], - [ animatedKittenIdx, shouldBeSensitive(false) ] + const expected = [ + [sensitiveKittenIdx, shouldBeSensitive(true)], + [sensitiveVideoIdx, shouldBeSensitive(true)], + [videoIdx, shouldBeSensitive(false)], + [sensitiveAnimatedKittenIdx, shouldBeSensitive(true)], + [animatedKittenIdx, shouldBeSensitive(false)] ] - for (let [ idx, sensitive ] of expected) { + for (const [idx, sensitive] of expected) { await scrollToStatus(t, 1 + sensitiveKittenIdx) await checkSensitivityForStatus(t, idx, sensitive) } diff --git a/tests/spec/025-shortcuts-status.js b/tests/spec/025-shortcuts-status.js index c1413686..c1f57756 100644 --- a/tests/spec/025-shortcuts-status.js +++ b/tests/spec/025-shortcuts-status.js @@ -20,7 +20,7 @@ fixture`025-shortcuts-status.js` .page`http://localhost:4002` async function activateStatus (t, idx) { - let timeout = 20000 + const timeout = 20000 for (let i = 0; i <= idx; i++) { await t.expect(getNthStatus(1 + i).exists).ok({ timeout }) .pressKey('j') @@ -80,7 +80,7 @@ test('Shortcut o opens active status, backspace goes back', async t => { }) test('Shortcut x shows/hides spoilers', async t => { - let idx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') + const idx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW') await loginAsFoobar(t) await t .expect(getUrl()).eql('http://localhost:4002/') @@ -96,7 +96,7 @@ test('Shortcut x shows/hides spoilers', async t => { }) test('Shortcut y shows/hides sensitive image', async t => { - let idx = homeTimeline.findIndex(_ => _.content === "here's a secret kitten") + const idx = homeTimeline.findIndex(_ => _.content === "here's a secret kitten") await loginAsFoobar(t) await t .expect(getUrl()).eql('http://localhost:4002/') @@ -112,7 +112,7 @@ test('Shortcut y shows/hides sensitive image', async t => { }) test('Shortcut f toggles favorite status', async t => { - let idx = homeTimeline.findIndex(_ => _.content === 'this is unlisted') + const idx = homeTimeline.findIndex(_ => _.content === 'this is unlisted') await loginAsFoobar(t) await t .expect(getUrl()).eql('http://localhost:4002/') @@ -127,7 +127,7 @@ test('Shortcut f toggles favorite status', async t => { }) test('Shortcut p toggles profile', async t => { - let idx = homeTimeline.findIndex(_ => _.content === 'pinned toot 1') + const idx = homeTimeline.findIndex(_ => _.content === 'pinned toot 1') await loginAsFoobar(t) await t .expect(getUrl()).eql('http://localhost:4002/') @@ -139,7 +139,7 @@ test('Shortcut p toggles profile', async t => { }) test('Shortcut m toggles mention', async t => { - let idx = homeTimeline.findIndex(_ => _.content === 'pinned toot 1') + const idx = homeTimeline.findIndex(_ => _.content === 'pinned toot 1') await loginAsFoobar(t) await t .expect(getUrl()).eql('http://localhost:4002/') diff --git a/tests/spec/026-shortcuts-notification.js b/tests/spec/026-shortcuts-notification.js index d1feac9a..57a73130 100644 --- a/tests/spec/026-shortcuts-notification.js +++ b/tests/spec/026-shortcuts-notification.js @@ -12,7 +12,7 @@ fixture`026-shortcuts-notification.js` .page`http://localhost:4002` test('Shortcut f toggles favorite status in notification', async t => { - let idx = 0 + const idx = 0 await loginAsFoobar(t) await t .expect(getUrl()).eql('http://localhost:4002/') @@ -29,7 +29,7 @@ test('Shortcut f toggles favorite status in notification', async t => { }) test('Shortcut p toggles profile in a follow notification', async t => { - let idx = 5 // "@quux followed you" + const idx = 5 // "@quux followed you" await loginAsFoobar(t) await t .expect(getUrl()).eql('http://localhost:4002/') @@ -46,7 +46,7 @@ test('Shortcut p toggles profile in a follow notification', async t => { }) test('Shortcut m toggles mention in a follow notification', async t => { - let idx = 5 // "@quux followed you" + const idx = 5 // "@quux followed you" await loginAsFoobar(t) await t .expect(getUrl()).eql('http://localhost:4002/') @@ -62,7 +62,7 @@ test('Shortcut m toggles mention in a follow notification', async t => { }) test('Shortcut p refers to booster in a boost notification', async t => { - let idx = 1 // "@admin boosted your status" + const idx = 1 // "@admin boosted your status" await loginAsFoobar(t) await t .expect(getUrl()).eql('http://localhost:4002/') @@ -76,7 +76,7 @@ test('Shortcut p refers to booster in a boost notification', async t => { }) test('Shortcut m refers to favoriter in a favorite notification', async t => { - let idx = 0 // "@admin favorited your status" + const idx = 0 // "@admin favorited your status" await loginAsFoobar(t) await t .expect(getUrl()).eql('http://localhost:4002/') diff --git a/tests/spec/029-back-button-modal.js b/tests/spec/029-back-button-modal.js index c057c71a..54cab816 100644 --- a/tests/spec/029-back-button-modal.js +++ b/tests/spec/029-back-button-modal.js @@ -28,7 +28,7 @@ fixture`029-back-button-modal.js` test('Back button dismisses the modal', async t => { await loginAsFoobar(t) - let idx = homeTimeline.findIndex(_ => (_.content || '').includes('2 kitten photos')) + const idx = homeTimeline.findIndex(_ => (_.content || '').includes('2 kitten photos')) await scrollToStatus(t, idx + 1) await t .expect(getUrl()).eql('http://localhost:4002/') diff --git a/tests/spec/030-shortcuts-modal.js b/tests/spec/030-shortcuts-modal.js index 82e82822..9ad8135c 100644 --- a/tests/spec/030-shortcuts-modal.js +++ b/tests/spec/030-shortcuts-modal.js @@ -23,7 +23,7 @@ test('Backspace dismisses modal', async t => { test('Backspace dismisses media modal', async t => { await loginAsFoobar(t) - let idx = homeTimeline.findIndex(_ => (_.content || '').includes('2 kitten photos')) + const idx = homeTimeline.findIndex(_ => (_.content || '').includes('2 kitten photos')) await scrollToStatus(t, idx + 1) await t .click(getNthStatusMediaButton(idx + 1)) @@ -36,7 +36,7 @@ test('Backspace dismisses media modal', async t => { test('Left/right changes active media in modal', async t => { await loginAsFoobar(t) - let idx = homeTimeline.findIndex(_ => (_.content || '').includes('2 kitten photos')) + const idx = homeTimeline.findIndex(_ => (_.content || '').includes('2 kitten photos')) await scrollToStatus(t, idx + 1) await t .click(getNthStatusMediaButton(idx + 1)) diff --git a/tests/spec/100-favorite-unfavorite.js b/tests/spec/100-favorite-unfavorite.js index 8546295c..ff74f702 100644 --- a/tests/spec/100-favorite-unfavorite.js +++ b/tests/spec/100-favorite-unfavorite.js @@ -63,7 +63,7 @@ test('unfavorites a status', async t => { test('Keeps the correct favorites count', async t => { await loginAsFoobar(t) - let idx = homeTimeline.findIndex(_ => _.content === 'this is unlisted') + const idx = homeTimeline.findIndex(_ => _.content === 'this is unlisted') await t .hover(getNthStatus(1 + idx)) .click(getNthFavoriteButton(1 + idx)) diff --git a/tests/spec/101-reblog-unreblog.js b/tests/spec/101-reblog-unreblog.js index 635d2763..9eb8c624 100644 --- a/tests/spec/101-reblog-unreblog.js +++ b/tests/spec/101-reblog-unreblog.js @@ -67,7 +67,7 @@ test('unreblogs a status', async t => { }) test('Keeps the correct reblogs count', async t => { - let { id } = await postAs('foobar', 'this will be reblogged') + const { id } = await postAs('foobar', 'this will be reblogged') await reblogStatusAs('foobar', id) await reblogStatusAs('admin', id) await loginAsFoobar(t) diff --git a/tests/spec/102-notifications.js b/tests/spec/102-notifications.js index efc4b74f..379e1e58 100644 --- a/tests/spec/102-notifications.js +++ b/tests/spec/102-notifications.js @@ -8,7 +8,7 @@ fixture`102-notifications.js` .page`http://localhost:4002` test('shows unread notification', async t => { - let { id } = await postAs('foobar', 'somebody please favorite this to validate me') + const { id } = await postAs('foobar', 'somebody please favorite this to validate me') await loginAsFoobar(t) await t .expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications') @@ -35,7 +35,7 @@ test('shows unread notification', async t => { }) test('shows unread notifications, more than one', async t => { - let { id } = await postAs('foobar', 'I need lots of favorites on this one') + const { id } = await postAs('foobar', 'I need lots of favorites on this one') await loginAsFoobar(t) await t .expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications') diff --git a/tests/spec/105-deletes.js b/tests/spec/105-deletes.js index 2ac40c65..9b471eaf 100644 --- a/tests/spec/105-deletes.js +++ b/tests/spec/105-deletes.js @@ -9,11 +9,11 @@ fixture`105-deletes.js` .page`http://localhost:4002` test('deleted statuses are removed from the timeline', async t => { - let timeout = 20000 + const timeout = 20000 await loginAsFoobar(t) await t .hover(getNthStatus(1)) - let status = await postAs('admin', "I'm gonna delete this") + const status = await postAs('admin', "I'm gonna delete this") await t.expect(getNthStatus(1).innerText).contains("I'm gonna delete this", { timeout }) await deleteAs('admin', status.id) await t.expect(getNthStatus(1).innerText).notContains("I'm gonna delete this", { timeout }) @@ -30,12 +30,12 @@ test('deleted statuses are removed from the timeline', async t => { }) test('deleted statuses are removed from threads', async t => { - let timeout = 20000 + const timeout = 20000 await loginAsFoobar(t) await t .hover(getNthStatus(1)) - let status = await postAs('admin', "I won't delete this") - let reply = await postReplyAs('admin', 'But I will delete this', status.id) + const status = await postAs('admin', "I won't delete this") + const reply = await postReplyAs('admin', 'But I will delete this', status.id) await t.expect(getNthStatus(1).innerText).contains('But I will delete this', { timeout }) .expect(getNthStatus(2).innerText).contains("I won't delete this", { timeout }) .click(getNthStatus(2)) @@ -55,12 +55,12 @@ test('deleted statuses are removed from threads', async t => { }) test('deleted statuses result in deleted notifications', async t => { - let timeout = 20000 + const timeout = 20000 await loginAsFoobar(t) await t .hover(getNthStatus(1)) .expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications') - let status = await postAs('admin', "@foobar yo yo foobar what's up") + const status = await postAs('admin', "@foobar yo yo foobar what's up") await t.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications (1 notification)', { timeout }) await deleteAs('admin', status.id) await t.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications', { timeout }) diff --git a/tests/spec/106-follow-requests.js b/tests/spec/106-follow-requests.js index 79311112..2540be4e 100644 --- a/tests/spec/106-follow-requests.js +++ b/tests/spec/106-follow-requests.js @@ -23,7 +23,7 @@ test('can request to follow an account', async t => { .click(accountProfileFollowButton) .expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow (follow requested)') - let requests = await getFollowRequestsAs('LockedAccount') + const requests = await getFollowRequestsAs('LockedAccount') await authorizeFollowRequestAs('LockedAccount', requests.slice(-1)[0].id) await sleep(2000) diff --git a/tests/spec/110-compose-content-warnings.js b/tests/spec/110-compose-content-warnings.js index d29e562a..ccb05dd7 100644 --- a/tests/spec/110-compose-content-warnings.js +++ b/tests/spec/110-compose-content-warnings.js @@ -50,8 +50,8 @@ test('content warnings can have emoji', async t => { }) test('no XSS in content warnings or text', async t => { - let pwned1 = `` - let pwned2 = `` + const pwned1 = `` + const pwned2 = `` await loginAsFoobar(t) await t .typeText(composeInput, pwned1) diff --git a/tests/spec/112-status-links.js b/tests/spec/112-status-links.js index 503fe1ed..66c7be67 100644 --- a/tests/spec/112-status-links.js +++ b/tests/spec/112-status-links.js @@ -10,7 +10,7 @@ fixture`112-status-links.js` .page`http://localhost:4002` test('External links, hashtags, and mentions have correct attributes', async t => { - let text = 'Why hello there @admin and @baz and @quux ' + + const text = 'Why hello there @admin and @baz and @quux ' + 'and also #tag and #anotherTag and #yetAnotherTag ' + 'and also http://example.com and https://joinmastodon.org and ' + 'https://mastodon.social.' diff --git a/tests/spec/113-block-unblock.js b/tests/spec/113-block-unblock.js index 58e86573..4a2d8e0e 100644 --- a/tests/spec/113-block-unblock.js +++ b/tests/spec/113-block-unblock.js @@ -11,7 +11,7 @@ fixture`113-block-unblock.js` .page`http://localhost:4002` test('Can block and unblock an account from a status', async t => { - let post = 'a very silly statement that should probably get me blocked' + const post = 'a very silly statement that should probably get me blocked' await postAs('admin', post) await loginAsFoobar(t) await t diff --git a/tests/spec/114-mute-unmute.js b/tests/spec/114-mute-unmute.js index 9832c946..6f5cdf5c 100644 --- a/tests/spec/114-mute-unmute.js +++ b/tests/spec/114-mute-unmute.js @@ -20,7 +20,7 @@ fixture`114-mute-unmute.js` test('Can mute and unmute an account', async t => { await loginAsFoobar(t) - let post = 'blah blah blah' + const post = 'blah blah blah' await postAs('admin', post) await t.expect(getNthStatus(1).innerText).contains(post, { timeout: 20000 }) diff --git a/tests/spec/119-status-counts-update.js b/tests/spec/119-status-counts-update.js index b3f3093b..ac8ee020 100644 --- a/tests/spec/119-status-counts-update.js +++ b/tests/spec/119-status-counts-update.js @@ -9,8 +9,8 @@ fixture`119-status-counts-update.js` .page`http://localhost:4002` test('Fav stats update', async t => { - let status = await postAs('foobar', 'hey hello look at this toot') - let statusId = status.id + const status = await postAs('foobar', 'hey hello look at this toot') + const statusId = status.id await favoriteStatusAs('admin', statusId) await loginAsFoobar(t) await t @@ -35,8 +35,8 @@ test('Fav stats update', async t => { }) test('Reblog stats update', async t => { - let status = await postAs('foobar', 'oh why hello it looks like another toot') - let statusId = status.id + const status = await postAs('foobar', 'oh why hello it looks like another toot') + const statusId = status.id await reblogStatusAs('admin', statusId) await loginAsFoobar(t) await t @@ -61,8 +61,8 @@ test('Reblog stats update', async t => { }) test('Fav and reblog stats update for a boosted toot', async t => { - let status = await postAs('ExternalLinks', 'this will get boosted') - let statusId = status.id + const status = await postAs('ExternalLinks', 'this will get boosted') + const statusId = status.id await reblogStatusAs('admin', statusId) await favoriteStatusAs('admin', statusId) await favoriteStatusAs('quux', statusId) diff --git a/tests/spec/120-status-aria-label.js b/tests/spec/120-status-aria-label.js index f4c03f3e..8b93a8ed 100644 --- a/tests/spec/120-status-aria-label.js +++ b/tests/spec/120-status-aria-label.js @@ -16,11 +16,11 @@ test('aria-labels for statuses with no content text', async t => { }) test('aria-labels with links', async t => { - let content = 'Text here\n\nMore text\n\n' + + const content = 'Text here\n\nMore text\n\n' + 'https://example.com/long/url/here/very/long/yes/so/long\n\n' + '#woot #yolo' - let expected = 'admin, Text here More text ' + + const expected = 'admin, Text here More text ' + 'https://example.com/long/url/here/very/long/yes/so/long #woot #yolo,' await postAs('admin', content) diff --git a/tests/spec/121-delete-and-redraft.js b/tests/spec/121-delete-and-redraft.js index 1bb8db4f..8d288399 100644 --- a/tests/spec/121-delete-and-redraft.js +++ b/tests/spec/121-delete-and-redraft.js @@ -175,7 +175,7 @@ test('delete and redraft reply within thread', async t => { }) test('multiple paragraphs', async t => { - let text = 'hey ho\n\ndouble newline!\njust one newline\njust another newline\n\nanother double newline!' + const text = 'hey ho\n\ndouble newline!\njust one newline\njust another newline\n\nanother double newline!' await postAs('foobar', text) await loginAsFoobar(t) await t diff --git a/tests/spec/123-notification-mentions.js b/tests/spec/123-notification-mentions.js index 1bf8d5c5..f32ce04c 100644 --- a/tests/spec/123-notification-mentions.js +++ b/tests/spec/123-notification-mentions.js @@ -33,7 +33,7 @@ test('Handles incoming notifications that are mentions', async t => { test('Handles incoming notifications that are not mentions', async t => { const timeout = 20000 - let { id: statusId } = await postAs('foobar', 'this is a post that I hope somebody will favorite') + const { id: statusId } = await postAs('foobar', 'this is a post that I hope somebody will favorite') await sleep(2000) await loginAsFoobar(t) await t diff --git a/tests/spec/124-home-timeline-filters.js b/tests/spec/124-home-timeline-filters.js index 63234d12..103588a3 100644 --- a/tests/spec/124-home-timeline-filters.js +++ b/tests/spec/124-home-timeline-filters.js @@ -11,7 +11,7 @@ fixture`124-home-timeline-filters.js` test('Filters favs from home timeline', async t => { await postAs('foobar', 'Nobody should boost this') await sleep(1000) - let { id: statusId } = await postAs('quux', 'I hope someone cool boosts this') + const { id: statusId } = await postAs('quux', 'I hope someone cool boosts this') await reblogStatusAs('admin', statusId) await sleep(2000) await loginAsFoobar(t) diff --git a/tests/spec/125-notification-timeline-filters.js b/tests/spec/125-notification-timeline-filters.js index fe9eba6f..567a40f9 100644 --- a/tests/spec/125-notification-timeline-filters.js +++ b/tests/spec/125-notification-timeline-filters.js @@ -18,8 +18,8 @@ fixture`125-notification-timeline-filters.js` .page`http://localhost:4002` test('Notification timeline filters correctly affect counts - boosts', async t => { - let timeout = 20000 - let { id: statusId } = await postAs('foobar', 'I do not care if you boost this') + const timeout = 20000 + const { id: statusId } = await postAs('foobar', 'I do not care if you boost this') await loginAsFoobar(t) await t .expect(getNthStatusContent(1).innerText).contains('I do not care if you boost this') @@ -38,8 +38,8 @@ test('Notification timeline filters correctly affect counts - boosts', async t = }) test('Notification timeline filters correctly affect counts - favs', async t => { - let timeout = 20000 - let { id: statusId } = await postAs('foobar', 'I do not care if you fav this') + const timeout = 20000 + const { id: statusId } = await postAs('foobar', 'I do not care if you fav this') await loginAsFoobar(t) await t .expect(getNthStatusContent(1).innerText).contains('I do not care if you fav this') @@ -58,7 +58,7 @@ test('Notification timeline filters correctly affect counts - favs', async t => }) test('Notification timeline filters correctly affect counts - favs', async t => { - let timeout = 20000 + const timeout = 20000 await loginAsFoobar(t) await t .expect(getNthStatusContent(1).exists).ok() @@ -77,7 +77,7 @@ test('Notification timeline filters correctly affect counts - favs', async t => }) test('Notification timeline filters correctly affect counts - follows', async t => { - let timeout = 20000 + const timeout = 20000 await loginAsFoobar(t) await t .expect(getNthStatusContent(1).exists).ok() diff --git a/tests/submitMedia.js b/tests/submitMedia.js index 4f4ea5b6..31467085 100644 --- a/tests/submitMedia.js +++ b/tests/submitMedia.js @@ -4,7 +4,7 @@ import path from 'path' import { auth } from '../src/routes/_api/utils' export async function submitMedia (accessToken, filename, alt) { - let form = new FormData() + const form = new FormData() form.append('file', fs.createReadStream(path.join(__dirname, 'images', filename))) form.append('description', alt) return new Promise((resolve, reject) => { diff --git a/tests/unit/test-database.js b/tests/unit/test-database.js index 0569ac7e..66da85ec 100644 --- a/tests/unit/test-database.js +++ b/tests/unit/test-database.js @@ -15,11 +15,11 @@ import { cleanup, TIME_AGO } from '../../src/routes/_database/cleanup' const INSTANCE_NAME = 'localhost:3000' const INSTANCE_INFO = { - 'uri': 'localhost:3000', - 'title': 'lolcathost', - 'description': 'blah', - 'foo': { - 'bar': true + uri: 'localhost:3000', + title: 'lolcathost', + description: 'blah', + foo: { + bar: true } } @@ -33,7 +33,7 @@ const createStatus = i => ({ }) const stripDBFields = item => { - let res = cloneDeep(item) + const res = cloneDeep(item) delete res[TIMESTAMP] delete res[ACCOUNT_ID] delete res[STATUS_ID] @@ -75,7 +75,7 @@ describe('test-database.js', function () { }) it('stores and sorts some statuses', async () => { - let allStatuses = times(40, createStatus) + const allStatuses = times(40, createStatus) await dbApi.insertTimelineItems(INSTANCE_NAME, 'local', allStatuses) let statuses = await dbApi.getTimeline(INSTANCE_NAME, 'local', null, 20) let expected = allStatuses.slice().reverse().slice(0, 20) @@ -91,9 +91,9 @@ describe('test-database.js', function () { // set a timestamp based on the *current* date when the status is inserted, // not the date that the status was composed. - let longAgo = Date.now() - (TIME_AGO * 2) + const longAgo = Date.now() - (TIME_AGO * 2) - let oldStatus = { + const oldStatus = { id: '1', created_at: new Date(longAgo).toISOString(), content: 'This is old', @@ -102,14 +102,14 @@ describe('test-database.js', function () { } } - let previousNow = CURRENT_TIME.now + const previousNow = CURRENT_TIME.now CURRENT_TIME.now = () => longAgo await dbApi.insertTimelineItems(INSTANCE_NAME, 'local', [oldStatus]) CURRENT_TIME.now = previousNow - let newStatus = { + const newStatus = { id: '2', created_at: new Date().toISOString(), content: 'This is new', @@ -159,7 +159,7 @@ describe('test-database.js', function () { await getDatabase(INSTANCE_NAME) // insert some statuses - let allStatuses = times(40, createStatus) + const allStatuses = times(40, createStatus) await dbApi.insertTimelineItems(INSTANCE_NAME, 'local', allStatuses) let statuses = await dbApi.getTimeline(INSTANCE_NAME, 'local', null, 1000) @@ -179,7 +179,7 @@ describe('test-database.js', function () { assert.deepStrictEqual(statuses.map(stripDBFields), expected) // insert some more statuses for good measure - let moreStatuses = times(20, i => 40 + i).map(createStatus) + const moreStatuses = times(20, i => 40 + i).map(createStatus) await dbApi.insertTimelineItems(INSTANCE_NAME, 'local', moreStatuses) diff --git a/tests/unit/test-emoji.js b/tests/unit/test-emoji.js index 2da8754b..637db5a4 100644 --- a/tests/unit/test-emoji.js +++ b/tests/unit/test-emoji.js @@ -9,7 +9,7 @@ const womanBowing = [0x1f647, 0x200d, 0x2640, 0xfe0f].map(_ => String.fromCodePo describe('test-emoji.js', function () { it('does emoji replacement correctly', function () { - let replacer = _ => `
${_}
` + const replacer = _ => `
${_}
` assert.strictEqual( replaceEmoji('hello world', replacer), 'hello world' @@ -37,7 +37,7 @@ describe('test-emoji.js', function () { }) it('handles multi-code emoji', function () { - let replacer = _ => `
${_}
` + const replacer = _ => `
${_}
` assert.strictEqual( replaceEmoji(`hello ${womanBowing}`, replacer), `hello
${womanBowing}
` @@ -45,7 +45,7 @@ describe('test-emoji.js', function () { }) it('handles emoji mixed with custom emoji', function () { - let replacer = _ => `
${_}
` + const replacer = _ => `
${_}
` assert.strictEqual( replaceEmoji(`hello ${womanBowing} and :blobpats: and ${elephant}`, replacer), `hello
${womanBowing}
and :blobpats: and
${elephant}
` @@ -53,7 +53,7 @@ describe('test-emoji.js', function () { }) it('handles sequential emoji', function () { - let replacer = _ => `
${_}
` + const replacer = _ => `
${_}
` assert.strictEqual( replaceEmoji(`${elephant}${elephant}${womanBowing}${mindBlown}`, replacer), `
${elephant}
${elephant}
${womanBowing}
${mindBlown}
` @@ -61,7 +61,7 @@ describe('test-emoji.js', function () { }) it('does not replace non-emoji characters', function () { - let replacer = _ => `
${_}
` + const replacer = _ => `
${_}
` assert.strictEqual( replaceEmoji(`it's over #9000`, replacer), `it's over #9000` @@ -84,7 +84,7 @@ describe('test-emoji.js', function () { }) it('does not replace emoji inside HTML tags', function () { - let replacer = _ => `
${_}
` + const replacer = _ => `
${_}
` assert.strictEqual( replaceEmoji(`check this cool link: link`, replacer), `check this cool link: link` @@ -115,7 +115,7 @@ describe('test-emoji.js', function () { }) it('removes emoji', function () { - let replacer = _ => '' + const replacer = _ => '' assert.strictEqual( replaceEmoji(`woot ${mindBlown}`, replacer), `woot ` @@ -135,7 +135,7 @@ describe('test-emoji.js', function () { }) it('can handle a dangling left angle bracket for some reason', function () { - let replacer = _ => `
${_}
` + const replacer = _ => `
${_}
` assert.strictEqual( replaceEmoji(`woot ${mindBlown} <`, replacer), `woot
${mindBlown}
<` diff --git a/tests/unit/test-id-sorting.js b/tests/unit/test-id-sorting.js index 00b1de13..172445f7 100644 --- a/tests/unit/test-id-sorting.js +++ b/tests/unit/test-id-sorting.js @@ -23,11 +23,11 @@ describe('test-id-sorting.js', () => { }) it('can sort mastodon IDs correctly', () => { - let id1 = '1' - let id2 = '2' - let id3 = '101687554574502736' - let id4 = '101688993168288745' - let id5 = '101689076270570796' + const id1 = '1' + const id2 = '2' + const id3 = '101687554574502736' + const id4 = '101688993168288745' + const id5 = '101689076270570796' lt(toPaddedBigInt(id1), toPaddedBigInt(id2)) lt(toPaddedBigInt(id2), toPaddedBigInt(id3)) @@ -53,22 +53,22 @@ describe('test-id-sorting.js', () => { }) it('can sort mastodon IDs correctly - more examples', () => { - let ids = times(1000, i => i.toString()) + const ids = times(1000, i => i.toString()) for (let i = 1; i < ids.length; i++) { - let prev = ids[i - 1] - let next = ids[i] + const prev = ids[i - 1] + const next = ids[i] lt(toPaddedBigInt(prev), toPaddedBigInt(next)) gt(toReversePaddedBigInt(prev), toReversePaddedBigInt(next)) } }) it('can sort base62 IDs correctly', () => { - let id1 = '0' - let id2 = 'A' - let id3 = 'Z' - let id4 = 'a' - let id5 = 't' + const id1 = '0' + const id2 = 'A' + const id3 = 'Z' + const id4 = 'a' + const id5 = 't' lt(toPaddedBigInt(id1), toPaddedBigInt(id2)) lt(toPaddedBigInt(id2), toPaddedBigInt(id3)) @@ -104,11 +104,11 @@ describe('test-id-sorting.js', () => { }) it('can sort base62 IDs correctly 2', () => { - let id1 = '0' - let id2 = 'A' - let id3 = 'T' - let id4 = 'a' - let id5 = 'z' + const id1 = '0' + const id2 = 'A' + const id3 = 'T' + const id4 = 'a' + const id5 = 'z' lt(toPaddedBigInt(id1), toPaddedBigInt(id2)) lt(toPaddedBigInt(id2), toPaddedBigInt(id3)) @@ -144,11 +144,11 @@ describe('test-id-sorting.js', () => { }) it('can sort base62 IDs correctly 3', () => { - let id1 = 'a' - let id2 = 'z' - let id3 = 'a0' - let id4 = 'xx0' - let id5 = 'a000' + const id1 = 'a' + const id2 = 'z' + const id3 = 'a0' + const id4 = 'xx0' + const id5 = 'a000' lt(toPaddedBigInt(id1), toPaddedBigInt(id2)) lt(toPaddedBigInt(id2), toPaddedBigInt(id3)) @@ -173,7 +173,7 @@ describe('test-id-sorting.js', () => { it('can sort pleroma ids', () => { // these are already in base62 sorted order - let ids = [ + const ids = [ '9gP7cpqqJWyp93GxRw', '9gP7p4Ng7RdTgOSsro', '9gP8XTjVDpsT3Iqgb2', @@ -197,15 +197,15 @@ describe('test-id-sorting.js', () => { ] for (let i = 1; i < ids.length; i++) { - let prev = ids[i - 1] - let next = ids[i] + const prev = ids[i - 1] + const next = ids[i] lt(toPaddedBigInt(prev), toPaddedBigInt(next)) gt(toReversePaddedBigInt(prev), toReversePaddedBigInt(next)) } }) it('can sort pleroma ids 2', () => { - let ids = [ + const ids = [ '9gTv5mTEiXL6ZpqYHg', '9gTv5mK1Gny07FXBuy', '9gTv5kXlshmKbJx94i', @@ -229,15 +229,15 @@ describe('test-id-sorting.js', () => { ].reverse() for (let i = 1; i < ids.length; i++) { - let prev = ids[i - 1] - let next = ids[i] + const prev = ids[i - 1] + const next = ids[i] lt(toPaddedBigInt(prev), toPaddedBigInt(next)) gt(toReversePaddedBigInt(prev), toReversePaddedBigInt(next)) } }) it('can sort pleroma ids - 3', () => { - let ids = [ + const ids = [ '9gTCUO2xe7vfkLbHRA', '9gT35b559J1tLPhGj2', '9gRax4YxAwDuIdr83U', @@ -281,8 +281,8 @@ describe('test-id-sorting.js', () => { ].reverse() for (let i = 1; i < ids.length; i++) { - let prev = ids[i - 1] - let next = ids[i] + const prev = ids[i - 1] + const next = ids[i] lt(toPaddedBigInt(prev), toPaddedBigInt(next)) gt(toReversePaddedBigInt(prev), toReversePaddedBigInt(next)) } diff --git a/tests/unit/test-shortcuts.js b/tests/unit/test-shortcuts.js index 03710d4c..932613d2 100644 --- a/tests/unit/test-shortcuts.js +++ b/tests/unit/test-shortcuts.js @@ -59,7 +59,7 @@ describe('test-shortcuts.js', function () { }) it('sets and unsets event listener', function () { - let component = new Component() + const component = new Component() addToShortcutScope('global', 'k', component) assert(eventListener != null, 'event listener not set') @@ -68,21 +68,21 @@ describe('test-shortcuts.js', function () { }) it('forwards the right global key event', function () { - let component = new Component() + const component = new Component() addToShortcutScope('global', 'k', component) eventListener(new KeyDownEvent('l')) assert.ok(component.notPressed()) - let kEvent = new KeyDownEvent('k') + const kEvent = new KeyDownEvent('k') eventListener(kEvent) assert.ok(component.pressed()) assert.strictEqual(component.lastEvent, kEvent) }) it('register multiple keys', function () { - let lmn = new Component() + const lmn = new Component() addToShortcutScope('global', 'l|m|n', lmn) @@ -97,7 +97,7 @@ describe('test-shortcuts.js', function () { }) it('skips events with modifiers', function () { - let component = new Component() + const component = new Component() addToShortcutScope('global', 'k', component) @@ -118,31 +118,31 @@ describe('test-shortcuts.js', function () { }) it('does not skip events for ?', function () { - let component = new Component() + const component = new Component() addToShortcutScope('global', '?', component) - let qEvent = new KeyDownEvent('?') + const qEvent = new KeyDownEvent('?') qEvent.shiftKey = true eventListener(qEvent) assert.ok(component.pressed()) }) it('skips events for editable elements', function () { - let component = new Component() + const component = new Component() addToShortcutScope('global', 'k', component) - let kEvent = new KeyDownEvent('k') + const kEvent = new KeyDownEvent('k') kEvent.target = { isContentEditable: true } eventListener(kEvent) assert.ok(component.notPressed()) }) it('handles multi-key events', function () { - let a = new Component() - let ga = new Component() - let gb = new Component() + const a = new Component() + const ga = new Component() + const gb = new Component() addToShortcutScope('global', 'a', a) addToShortcutScope('global', 'g a', ga) @@ -156,8 +156,8 @@ describe('test-shortcuts.js', function () { }) it('falls back to single-key events if no sequence matches', function () { - let b = new Component() - let ga = new Component() + const b = new Component() + const ga = new Component() addToShortcutScope('global', 'b', b) addToShortcutScope('global', 'g a', ga) @@ -169,7 +169,7 @@ describe('test-shortcuts.js', function () { }) it('sends unhandled events to fallback', function () { - let fallback = new Component() + const fallback = new Component() addToShortcutScope('global', 'b', new Component()) addShortcutFallback('global', fallback) @@ -179,8 +179,8 @@ describe('test-shortcuts.js', function () { }) it('directs events to appropriate component in arbitrary scope', function () { - let globalB = new Component() - let inScopeB = new Component() + const globalB = new Component() + const inScopeB = new Component() addToShortcutScope('global', 'b', globalB) addToShortcutScope('inscope', 'b', inScopeB) @@ -191,10 +191,10 @@ describe('test-shortcuts.js', function () { }) it('makes shortcuts modal', function () { - let globalA = new Component() - let globalB = new Component() - let modal1A = new Component() - let modal2A = new Component() + const globalA = new Component() + const globalB = new Component() + const modal1A = new Component() + const modal2A = new Component() addToShortcutScope('global', 'a', globalA) addToShortcutScope('global', 'b', globalB) @@ -225,11 +225,11 @@ describe('test-shortcuts.js', function () { }) it('ignores alt key', function () { - let component = new Component() + const component = new Component() addToShortcutScope('global', '1', component) - let event = new KeyDownEvent('1') + const event = new KeyDownEvent('1') event.altKey = true eventListener(event) assert.ok(component.notPressed()) diff --git a/tests/utils.js b/tests/utils.js index 9cca6ac0..a76ecb81 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -165,7 +165,7 @@ export const getOpacity = selector => exec(() => window.getComputedStyle(documen }) export const getCurrentTheme = exec(() => { - let themeLink = document.head.querySelector('link[rel=stylesheet][href^="/theme-"]') + const themeLink = document.head.querySelector('link[rel=stylesheet][href^="/theme-"]') if (themeLink) { return themeLink.getAttribute('href').match(/^\/theme-(.*)\.css$/, '')[1] } @@ -173,11 +173,11 @@ export const getCurrentTheme = exec(() => { }) export const uploadKittenImage = i => (exec(() => { - let image = images[`kitten${i}`] - let blob = blobUtils.base64StringToBlob(image.data, 'image/png') + const image = images[`kitten${i}`] + const blob = blobUtils.base64StringToBlob(image.data, 'image/png') blob.name = image.name - let fileDrop = document.querySelector('file-drop') - let event = new Event('filedrop', { bubbles: false }) + const fileDrop = document.querySelector('file-drop') + const event = new Event('filedrop', { bubbles: false }) event.files = [blob] fileDrop.dispatchEvent(event) }, { @@ -204,7 +204,7 @@ export const isNthStatusActive = (idx) => (exec(() => { })) export const isActiveStatusPinned = exec(() => { - let el = document.activeElement + const el = document.activeElement return el && ( (el.parentElement.getAttribute('class') || '').includes('pinned') || @@ -427,7 +427,7 @@ export function getNthPinnedStatusFavoriteButton (n) { export async function validateTimeline (t, timeline) { const timeout = 30000 for (let i = 0; i < timeline.length; i++) { - let status = timeline[i] + const status = timeline[i] // hovering forces TestCafé to scroll to that element: https://git.io/vABV2 await t.hover(getNthStatus(1 + i)) if (status.content) { @@ -458,7 +458,7 @@ export async function scrollToStatus (t, n) { } export async function scrollFromStatusToStatus (t, start, end) { - let timeout = 20000 + const timeout = 20000 for (let i = start; i < end; i++) { await t.expect(getNthStatus(i).exists).ok({ timeout }) .hover(getNthStatus(i)) @@ -480,7 +480,7 @@ export async function clickToNotificationsAndBackHome (t) { // like lodash.times but I don't want to try to figure out esm // just to import lodash-es export function times (n, cb) { - let arr = [] + const arr = [] for (let i = 0; i < n; i++) { arr.push(cb(i)) } diff --git a/webpack/shared.config.js b/webpack/shared.config.js index b5231301..a4519831 100644 --- a/webpack/shared.config.js +++ b/webpack/shared.config.js @@ -8,7 +8,7 @@ const resolve = { extensions: ['.js', '.json', '.html'], mainFields: ['svelte', 'module', 'browser', 'main'], alias: { - 'react': 'preact/compat/dist/compat.module.js', + react: 'preact/compat/dist/compat.module.js', 'react-dom': 'preact/compat/dist/compat.module.js' } } diff --git a/yarn.lock b/yarn.lock index fc690075..6c71129d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -459,7 +459,7 @@ acorn-walk@^6.1.1: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== -acorn@^6.0.2, acorn@^6.0.7, acorn@^6.2.0: +acorn@^6.0.7, acorn@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3" integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw== @@ -482,12 +482,12 @@ ajv-errors@^1.0.0: resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" integrity sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ== -ajv-keywords@^3.0.0, ajv-keywords@^3.1.0, ajv-keywords@^3.4.1: +ajv-keywords@^3.1.0, ajv-keywords@^3.4.1: version "3.4.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.4.1.tgz#ef916e271c64ac12171fd8384eaae6b2345854da" integrity sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ== -ajv@^6.0.1, ajv@^6.1.0, ajv@^6.10.2, ajv@^6.5.0, ajv@^6.5.5: +ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: version "6.10.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== @@ -512,7 +512,7 @@ ansi-escapes@^2.0.0: resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-2.0.0.tgz#5bae52be424878dd9783e8910e3fc2922e83c81b" integrity sha1-W65SvkJIeN2Xg+iRDj/Cki6DyBs= -ansi-escapes@^3.0.0: +ansi-escapes@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== @@ -537,7 +537,7 @@ ansi-styles@^2.2.1: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= -ansi-styles@^3.2.1: +ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== @@ -699,6 +699,11 @@ assign-symbols@^1.0.0: resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== + async-each@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" @@ -1740,13 +1745,6 @@ call-me-maybe@^1.0.1: resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" integrity sha1-JtII6onje1y95gJQoV8DHBak1ms= -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" - integrity sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8= - dependencies: - callsites "^0.2.0" - callsite-record@^4.0.0: version "4.1.3" resolved "https://registry.yarnpkg.com/callsite-record/-/callsite-record-4.1.3.tgz#3041d2a1c72aff86b00b151e47d25566520c4207" @@ -1766,10 +1764,10 @@ callsite@^1.0.0: resolved "https://registry.yarnpkg.com/callsite/-/callsite-1.0.0.tgz#280398e5d664bd74038b6f0905153e6e8af1bc20" integrity sha1-KAOY5dZkvXQDi28JBRU+borxvCA= -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" - integrity sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo= +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== camel-case@3.0.x: version "3.0.0" @@ -1853,10 +1851,10 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.0, chalk@^2.4.1, chalk@^2.4 escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chardet@^0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" - integrity sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I= +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== check-error@^1.0.2: version "1.0.2" @@ -1966,11 +1964,6 @@ circular-dependency-plugin@^5.0.2: resolved "https://registry.yarnpkg.com/circular-dependency-plugin/-/circular-dependency-plugin-5.0.2.tgz#da168c0b37e7b43563fb9f912c1c007c213389ef" integrity sha512-oC7/DVAyfcY3UWKm0sN/oVoDedQDQiw/vIiAnuTWTpE5s0zWf7l3WY417Xw/Fbi/QbAjctAkxgMiS9P0s3zkmA== -circular-json@^0.3.1: - version "0.3.3" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" - integrity sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A== - class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" @@ -2445,14 +2438,14 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: dependencies: ms "2.0.0" -debug@3.2.6, debug@^3.1.0, debug@^3.2.6: +debug@3.2.6, debug@^3.2.6: version "3.2.6" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== dependencies: ms "^2.1.1" -debug@^4.1.0: +debug@^4.0.1, debug@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== @@ -2532,14 +2525,14 @@ define-property@^2.0.2: is-descriptor "^1.0.2" isobject "^3.0.1" -deglob@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/deglob/-/deglob-2.1.1.tgz#d268e168727799862e8eac07042e165957c1f3be" - integrity sha512-2kjwuGGonL7gWE1XU4Fv79+vVzpoQCl0V+boMwWtOQJV2AGDabCwez++nB1Nli/8BabAfZQ/UuHPlp6AymKdWw== +deglob@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/deglob/-/deglob-3.1.0.tgz#1868193193d3432a5326e8fb2052b439a43a454e" + integrity sha512-al10l5QAYaM/PeuXkAr1Y9AQz0LCtWsnJG23pIgh44hDxHFOj36l6qvhfjnIWBYwZOqM1fXUFV9tkjL7JPdGvw== dependencies: find-root "^1.0.0" glob "^7.0.5" - ignore "^3.0.9" + ignore "^5.0.0" pkg-config "^1.1.0" run-parallel "^1.1.2" uniq "^1.0.1" @@ -2632,6 +2625,13 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + dom-serializer@0, dom-serializer@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.1.tgz#1ec4059e284babed36eec2941d4a970a189ce7c0" @@ -2830,7 +2830,7 @@ error-stack-parser@^1.3.3, error-stack-parser@^1.3.6: dependencies: stackframe "^0.3.1" -es-abstract@^1.12.0, es-abstract@^1.4.3, es-abstract@^1.5.1, es-abstract@^1.7.0: +es-abstract@^1.11.0, es-abstract@^1.12.0, es-abstract@^1.4.3, es-abstract@^1.5.1, es-abstract@^1.7.0: version "1.13.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== @@ -2866,17 +2866,17 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -eslint-config-standard-jsx@6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/eslint-config-standard-jsx/-/eslint-config-standard-jsx-6.0.2.tgz#90c9aa16ac2c4f8970c13fc7efc608bacd02da70" - integrity sha512-D+YWAoXw+2GIdbMBRAzWwr1ZtvnSf4n4yL0gKGg7ShUOGXkSOLerI17K4F6LdQMJPNMoWYqepzQD/fKY+tXNSg== +eslint-config-standard-jsx@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-standard-jsx/-/eslint-config-standard-jsx-7.0.0.tgz#05c737d9eab524860fe6853cfd535045c3e07e5b" + integrity sha512-OiKOF3MFVmWOCVfsi8GHlVorOEiBsPzAnUhM3c6HML94O2krbdQ/eMABySHgHHOIBYRls9sR9I3lo6O0vXhVEg== -eslint-config-standard@12.0.0: - version "12.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz#638b4c65db0bd5a41319f96bba1f15ddad2107d9" - integrity sha512-COUz8FnXhqFitYj4DTqHzidjIL/t4mumGZto5c7DrBpvWoie+Sn3P4sLEzUGeYhRElWuFEf8K1S1EfvD1vixCQ== +eslint-config-standard@13.0.1: + version "13.0.1" + resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-13.0.1.tgz#c9c6ffe0cfb8a51535bc5c7ec9f70eafb8c6b2c0" + integrity sha512-zLKp4QOgq6JFgRm1dDCVv1Iu0P5uZ4v5Wa4DTOkg2RFMxdCX/9Qf7lz9ezRj2dBRa955cWQF/O/LWEiYWAHbTw== -eslint-import-resolver-node@^0.3.1: +eslint-import-resolver-node@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" integrity sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q== @@ -2884,15 +2884,15 @@ eslint-import-resolver-node@^0.3.1: debug "^2.6.9" resolve "^1.5.0" -eslint-module-utils@^2.2.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.0.tgz#8b93499e9b00eab80ccb6614e69f03678e84e09a" - integrity sha512-14tltLm38Eu3zS+mt0KvILC3q8jyIAH518MlG+HO0p+yK885Lb1UHTY/UgR91eOyGdmxAPb+OLoW4znqIT6Ndw== +eslint-module-utils@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.1.tgz#7b4675875bf96b0dbf1b21977456e5bb1f5e018c" + integrity sha512-H6DOj+ejw7Tesdgbfs4jeS4YMFrT8uI8xwd1gtQqXssaR0EQ26L+2O/w6wkYFy2MymON0fTwHmXBvvfLNZVZEw== dependencies: debug "^2.6.8" pkg-dir "^2.0.0" -eslint-plugin-es@^1.3.1: +eslint-plugin-es@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-1.4.0.tgz#475f65bb20c993fc10e8c8fe77d1d60068072da6" integrity sha512-XfFmgFdIUDgvaRAlaXUkxrRg5JSADoRC8IkKLc/cISeR3yHVMefFHQZpcyXXEUUPHfy5DwviBcrfqlyqEwlQVw== @@ -2907,56 +2907,61 @@ eslint-plugin-html@^6.0.0: dependencies: htmlparser2 "^3.10.1" -eslint-plugin-import@~2.14.0: - version "2.14.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz#6b17626d2e3e6ad52cfce8807a845d15e22111a8" - integrity sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g== +eslint-plugin-import@~2.18.0: + version "2.18.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz#02f1180b90b077b33d447a17a2326ceb400aceb6" + integrity sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ== dependencies: + array-includes "^3.0.3" contains-path "^0.1.0" - debug "^2.6.8" + debug "^2.6.9" doctrine "1.5.0" - eslint-import-resolver-node "^0.3.1" - eslint-module-utils "^2.2.0" - has "^1.0.1" - lodash "^4.17.4" - minimatch "^3.0.3" - read-pkg-up "^2.0.0" - resolve "^1.6.0" - -eslint-plugin-node@~7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-7.0.1.tgz#a6e054e50199b2edd85518b89b4e7b323c9f36db" - integrity sha512-lfVw3TEqThwq0j2Ba/Ckn2ABdwmL5dkOgAux1rvOk6CO7A6yGyPI2+zIxN6FyNkp1X1X/BSvKOceD6mBWSj4Yw== - dependencies: - eslint-plugin-es "^1.3.1" - eslint-utils "^1.3.1" - ignore "^4.0.2" + eslint-import-resolver-node "^0.3.2" + eslint-module-utils "^2.4.0" + has "^1.0.3" minimatch "^3.0.4" - resolve "^1.8.1" - semver "^5.5.0" + object.values "^1.1.0" + read-pkg-up "^2.0.0" + resolve "^1.11.0" -eslint-plugin-promise@~4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.0.1.tgz#2d074b653f35a23d1ba89d8e976a985117d1c6a2" - integrity sha512-Si16O0+Hqz1gDHsys6RtFRrW7cCTB6P7p3OJmKp3Y3dxpQE2qwOA7d3xnV+0mBmrPoi0RBnxlCKvqu70te6wjg== +eslint-plugin-node@~9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-9.1.0.tgz#f2fd88509a31ec69db6e9606d76dabc5adc1b91a" + integrity sha512-ZwQYGm6EoV2cfLpE1wxJWsfnKUIXfM/KM09/TlorkukgCAwmkgajEJnPCmyzoFPQQkmvo5DrW/nyKutNIw36Mw== + dependencies: + eslint-plugin-es "^1.4.0" + eslint-utils "^1.3.1" + ignore "^5.1.1" + minimatch "^3.0.4" + resolve "^1.10.1" + semver "^6.1.0" -eslint-plugin-react@~7.11.1: - version "7.11.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz#c01a7af6f17519457d6116aa94fc6d2ccad5443c" - integrity sha512-cVVyMadRyW7qsIUh3FHp3u6QHNhOgVrLQYdQEB1bPWBsgbNCHdFAeNMquBMCcZJu59eNthX053L70l7gRt4SCw== +eslint-plugin-promise@~4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz#845fd8b2260ad8f82564c1222fce44ad71d9418a" + integrity sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw== + +eslint-plugin-react@~7.14.2: + version "7.14.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz#911030dd7e98ba49e1b2208599571846a66bdf13" + integrity sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA== dependencies: array-includes "^3.0.3" doctrine "^2.1.0" has "^1.0.3" - jsx-ast-utils "^2.0.1" - prop-types "^15.6.2" + jsx-ast-utils "^2.1.0" + object.entries "^1.1.0" + object.fromentries "^2.0.0" + object.values "^1.1.0" + prop-types "^15.7.2" + resolve "^1.10.1" eslint-plugin-standard@~4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-4.0.0.tgz#f845b45109c99cd90e77796940a344546c8f6b5c" integrity sha512-OwxJkR6TQiYMmt1EsNRMe5qG3GsbjlcOhbGUBY4LtavF9DsLaTcoR+j2Tdjqi23oUwKNUqX7qcn5fPStafMdlA== -eslint-scope@^4.0.0, eslint-scope@^4.0.3: +eslint-scope@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== @@ -2964,6 +2969,14 @@ eslint-scope@^4.0.0, eslint-scope@^4.0.3: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + eslint-utils@^1.3.0, eslint-utils@^1.3.1: version "1.4.0" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.0.tgz#e2c3c8dba768425f897cf0f9e51fe2e241485d4c" @@ -2976,49 +2989,48 @@ eslint-visitor-keys@^1.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== -eslint@~5.4.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.4.0.tgz#d068ec03006bb9e06b429dc85f7e46c1b69fac62" - integrity sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg== +eslint@~6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.1.0.tgz#06438a4a278b1d84fb107d24eaaa35471986e646" + integrity sha512-QhrbdRD7ofuV09IuE2ySWBz0FyXCq0rriLTZXZqaWSI79CVtHVRdkFuFTViiqzZhkCgfOh9USpriuGN2gIpZDQ== dependencies: - ajv "^6.5.0" - babel-code-frame "^6.26.0" + "@babel/code-frame" "^7.0.0" + ajv "^6.10.0" chalk "^2.1.0" cross-spawn "^6.0.5" - debug "^3.1.0" - doctrine "^2.1.0" - eslint-scope "^4.0.0" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^5.0.0" eslint-utils "^1.3.1" eslint-visitor-keys "^1.0.0" - espree "^4.0.0" + espree "^6.0.0" esquery "^1.0.1" esutils "^2.0.2" - file-entry-cache "^2.0.0" + file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" - glob "^7.1.2" + glob-parent "^5.0.0" globals "^11.7.0" - ignore "^4.0.2" + ignore "^4.0.6" + import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^5.2.0" - is-resolvable "^1.1.0" - js-yaml "^3.11.0" + inquirer "^6.4.1" + is-glob "^4.0.0" + js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.5" + lodash "^4.17.14" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" progress "^2.0.0" - regexpp "^2.0.0" - require-uncached "^1.0.3" - semver "^5.5.0" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" - table "^4.0.3" + regexpp "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" + table "^5.2.3" text-table "^0.2.0" + v8-compile-cache "^2.0.3" esm@^3.2.25: version "3.2.25" @@ -3032,12 +3044,12 @@ esotope-hammerhead@^0.2.1: dependencies: "@types/estree" "^0.0.39" -espree@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-4.1.0.tgz#728d5451e0fd156c04384a7ad89ed51ff54eb25f" - integrity sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w== +espree@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.0.0.tgz#716fc1f5a245ef5b9a7fdb1d7b0d3f02322e75f6" + integrity sha512-lJvCS6YbCn3ImT3yKkPe0+tJ+mH6ljhGNjHQH9mRtiO6gjhVAOhVXW1yjnwqGwTkK3bGbye+hb00nFNmu0l/1Q== dependencies: - acorn "^6.0.2" + acorn "^6.0.7" acorn-jsx "^5.0.0" eslint-visitor-keys "^1.0.0" @@ -3182,13 +3194,13 @@ extend@~3.0.2: resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== -external-editor@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" - integrity sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A== +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== dependencies: - chardet "^0.4.0" - iconv-lite "^0.4.17" + chardet "^0.7.0" + iconv-lite "^0.4.24" tmp "^0.0.33" extglob@^2.0.4: @@ -3282,13 +3294,12 @@ file-drop-element@0.2.0: resolved "https://registry.yarnpkg.com/file-drop-element/-/file-drop-element-0.2.0.tgz#c9214515b9d6b11f32c7fcee299f3a671939409e" integrity sha512-BGDdaJ4U2Cz0qhv6YGLnuhVtKcN8fp7F/4dS7lGSL1Fbe8m4cbGk+8awwHW0xcFqutMojxGchMVuWYQpEpP/Qg== -file-entry-cache@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" - integrity sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E= +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== dependencies: - flat-cache "^1.2.1" - object-assign "^4.0.1" + flat-cache "^2.0.1" "file-error@>= 0.10.0": version "0.10.2" @@ -3371,15 +3382,14 @@ find-up@^2.0.0, find-up@^2.1.0: dependencies: locate-path "^2.0.0" -flat-cache@^1.2.1: - version "1.3.4" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.4.tgz#2c2ef77525cc2929007dfffa1dd314aa9c9dee6f" - integrity sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg== +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== dependencies: - circular-json "^0.3.1" - graceful-fs "^4.1.2" - rimraf "~2.6.2" - write "^0.2.1" + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" flat@^4.1.0: version "4.1.0" @@ -3388,6 +3398,11 @@ flat@^4.1.0: dependencies: is-buffer "~2.0.3" +flatted@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" + integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== + flush-write-stream@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8" @@ -3562,10 +3577,10 @@ get-stdin@^4.0.1: resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" integrity sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4= -get-stdin@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" - integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== +get-stdin@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-7.0.0.tgz#8d5de98f15171a125c5e516643c7a6d0ea8a96f6" + integrity sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ== get-stream@^4.0.0: version "4.1.0" @@ -3900,7 +3915,7 @@ iconv-lite@0.4.11: resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.11.tgz#2ecb42fd294744922209a2e7c404dac8793d8ade" integrity sha1-LstC/SlHRJIiCaLnxATayHk9it4= -iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -3931,16 +3946,24 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" -ignore@^3.0.9: - version "3.3.10" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" - integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== - -ignore@^4.0.2, ignore@^4.0.3: +ignore@^4.0.3, ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== +ignore@^5.0.0, ignore@^5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.2.tgz#e28e584d43ad7e92f96995019cc43b9e1ac49558" + integrity sha512-vdqWBp7MyzdmHkkRWV5nY+PfGRbYbahfuvsBCh277tq+w9zyNi7h5CYJCK0kmzti9kU+O/cB7sE8HvKv6aXAKQ== + +import-fresh@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.1.0.tgz#6d33fa1dcef6df930fae003446f33415af905118" + integrity sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + import-lazy@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-3.1.0.tgz#891279202c8a2280fdbd6674dbd8da1a1dfc67cc" @@ -4020,23 +4043,23 @@ ini@~1.3.0: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== -inquirer@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-5.2.0.tgz#db350c2b73daca77ff1243962e9f22f099685726" - integrity sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ== +inquirer@^6.4.1: + version "6.5.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.0.tgz#2303317efc9a4ea7ec2e2df6f86569b734accf42" + integrity sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA== dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" + ansi-escapes "^3.2.0" + chalk "^2.4.2" cli-cursor "^2.1.0" cli-width "^2.0.0" - external-editor "^2.1.0" + external-editor "^3.0.3" figures "^2.0.0" - lodash "^4.3.0" + lodash "^4.17.12" mute-stream "0.0.7" run-async "^2.2.0" - rxjs "^5.5.2" + rxjs "^6.4.0" string-width "^2.1.0" - strip-ansi "^4.0.0" + strip-ansi "^5.1.0" through "^2.3.6" intersection-observer@^0.7.0: @@ -4307,11 +4330,6 @@ is-regex@^1.0.4: dependencies: has "^1.0.1" -is-resolvable@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" - integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg== - is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -4394,7 +4412,7 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@3.13.1, js-yaml@^3.11.0, js-yaml@^3.13.1: +js-yaml@3.13.1, js-yaml@^3.13.1: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -4481,7 +4499,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^2.0.1: +jsx-ast-utils@^2.1.0: version "2.2.1" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.2.1.tgz#4d4973ebf8b9d2837ee91a8208cc66f3a2776cfb" integrity sha512-v3FxCcAf20DayI+uxnCuw795+oOIkVu6EnJ1+kSzhqqTZHNkTZ7B66ZgLp4oLJ/gbA64cI0B7WRoHZMSRdyVRQ== @@ -4573,6 +4591,17 @@ load-json-file@^4.0.0: pify "^3.0.0" strip-bom "^3.0.0" +load-json-file@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-5.3.0.tgz#4d3c1e01fa1c03ea78a60ac7af932c9ce53403f3" + integrity sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw== + dependencies: + graceful-fs "^4.1.15" + parse-json "^4.0.0" + pify "^4.0.1" + strip-bom "^3.0.0" + type-fest "^0.3.0" + loader-runner@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" @@ -4625,11 +4654,16 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -"lodash@4.6.1 || ^4.16.1", lodash@^4.0.0, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.3.0, lodash@~4.17.10: +"lodash@4.6.1 || ^4.16.1", lodash@^4.0.0, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.4, lodash@^4.17.5, lodash@~4.17.10: version "4.17.14" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== +lodash@^4.17.12, lodash@^4.17.14: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + log-symbols@2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" @@ -4908,7 +4942,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -minimatch@3.0.4, minimatch@^3.0.3, minimatch@^3.0.4, minimatch@~3.0.2: +minimatch@3.0.4, minimatch@^3.0.4, minimatch@~3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -5379,6 +5413,16 @@ object.entries@^1.1.0: function-bind "^1.1.1" has "^1.0.3" +object.fromentries@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.0.tgz#49a543d92151f8277b3ac9600f1e930b189d30ab" + integrity sha512-9iLiI6H083uiqUuvzyY6qrlmc/Gz8hLQFOcb/Ri/0xXFkSNS3ctV+CbE6yM2+AnkYfOB3dGjdzC0wrMLIhQICA== + dependencies: + define-properties "^1.1.2" + es-abstract "^1.11.0" + function-bind "^1.1.1" + has "^1.0.1" + object.getownpropertydescriptors@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz#8758c846f5b407adab0f236e0986f14b051caa16" @@ -5597,6 +5641,13 @@ param-case@2.1.x: dependencies: no-case "^2.2.0" +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + parse-asn1@^5.0.0: version "5.1.4" resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.4.tgz#37f6628f823fbdeb2273b4d540434a22f3ef1fcc" @@ -5678,7 +5729,7 @@ path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-is-inside@^1.0.1, path-is-inside@^1.0.2: +path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= @@ -5798,13 +5849,13 @@ pinkie@^2.0.0, pinkie@^2.0.1, pinkie@^2.0.4: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= -pkg-conf@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/pkg-conf/-/pkg-conf-2.1.0.tgz#2126514ca6f2abfebd168596df18ba57867f0058" - integrity sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg= +pkg-conf@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/pkg-conf/-/pkg-conf-3.1.0.tgz#d9f9c75ea1bae0e77938cde045b276dac7cc69ae" + integrity sha512-m0OTbR/5VPNPqO1ph6Fqbj7Hv6QU7gR/tQW40ZqrL1rjgCU85W6C1bJn0BItuJqnR98PWzw7Z8hHeChD1WrgdQ== dependencies: - find-up "^2.0.0" - load-json-file "^4.0.0" + find-up "^3.0.0" + load-json-file "^5.2.0" pkg-config@^1.1.0: version "1.1.1" @@ -5829,11 +5880,6 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" -pluralize@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" - integrity sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow== - pngjs@^3.3.1: version "3.4.0" resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f" @@ -5952,7 +5998,7 @@ promisify-event@^1.0.0: dependencies: pinkie-promise "^2.0.0" -prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2: +prop-types@^15.6.0, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== @@ -6254,7 +6300,7 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexpp@^2.0.0, regexpp@^2.0.1: +regexpp@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== @@ -6378,14 +6424,6 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== -require-uncached@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" - resolve-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-1.0.0.tgz#4eaeea41ed040d1702457df64a42b2b07d246f9f" @@ -6393,11 +6431,6 @@ resolve-cwd@^1.0.0: dependencies: resolve-from "^2.0.0" -resolve-from@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" - integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY= - resolve-from@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" @@ -6413,13 +6446,20 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.10.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.6.0, resolve@^1.8.1: +resolve@^1.10.0, resolve@^1.3.2, resolve@^1.5.0: version "1.11.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw== dependencies: path-parse "^1.0.6" +resolve@^1.10.1, resolve@^1.11.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" + integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + dependencies: + path-parse "^1.0.6" + restore-cursor@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" @@ -6433,7 +6473,7 @@ ret@~0.1.10: resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3, rimraf@~2.6.2: +rimraf@2, rimraf@2.6.3, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -6502,12 +6542,12 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rxjs@^5.5.2: - version "5.5.12" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.12.tgz#6fa61b8a77c3d793dbaf270bee2f43f652d741cc" - integrity sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw== +rxjs@^6.4.0: + version "6.5.2" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" + integrity sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg== dependencies: - symbol-observable "1.0.1" + tslib "^1.9.0" safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" @@ -6592,6 +6632,11 @@ semver@5.5.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" integrity sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA== +semver@^6.1.0, semver@^6.1.2: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -6706,11 +6751,13 @@ slash@^2.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== -slice-ansi@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" - integrity sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg== +slice-ansi@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" + integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== dependencies: + ansi-styles "^3.2.0" + astral-regex "^1.0.0" is-fullwidth-code-point "^2.0.0" snapdragon-node@^2.0.1: @@ -6878,30 +6925,30 @@ stackframe@^0.3.1: resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-0.3.1.tgz#33aa84f1177a5548c8935533cbfeb3420975f5a4" integrity sha1-M6qE8Rd6VUjIk1Uzy/6zQgl19aQ= -standard-engine@~9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/standard-engine/-/standard-engine-9.0.0.tgz#d3a3d74c4c1b91f51a1e66362465261ca7610316" - integrity sha512-ZfNfCWZ2Xq67VNvKMPiVMKHnMdvxYzvZkf1AH8/cw2NLDBm5LRsxMqvEJpsjLI/dUosZ3Z1d6JlHDp5rAvvk2w== +standard-engine@~11.0.1: + version "11.0.1" + resolved "https://registry.yarnpkg.com/standard-engine/-/standard-engine-11.0.1.tgz#943d710be54537dbedaf8a90367d271f4023fe7c" + integrity sha512-WZQ5PpEDfRzPFk+H9xvKVQPQIxKnAQB2cb2Au4NyTCtdw5R0pyMBUZLbPXyFjnlhe8Ae+zfNrWU4m6H5b7cEAg== dependencies: - deglob "^2.1.0" - get-stdin "^6.0.0" + deglob "^3.0.0" + get-stdin "^7.0.0" minimist "^1.1.0" - pkg-conf "^2.0.0" + pkg-conf "^3.1.0" -standard@^12.0.1: - version "12.0.1" - resolved "https://registry.yarnpkg.com/standard/-/standard-12.0.1.tgz#0fc5a8aa6c34c546c5562aae644242b24dae2e61" - integrity sha512-UqdHjh87OG2gUrNCSM4QRLF5n9h3TFPwrCNyVlkqu31Hej0L/rc8hzKqVvkb2W3x0WMq7PzZdkLfEcBhVOR6lg== +standard@^13.1.0: + version "13.1.0" + resolved "https://registry.yarnpkg.com/standard/-/standard-13.1.0.tgz#3de68ac1248d563a445edc806504987a11ea7496" + integrity sha512-h3NaMzsa88+/xtjXCMvdn6EWWdlodsI/HvtsQF+EGwrF9kVNwNha9TkFABU6bSBoNfC79YDyIAq9ekxOMBFkuw== dependencies: - eslint "~5.4.0" - eslint-config-standard "12.0.0" - eslint-config-standard-jsx "6.0.2" - eslint-plugin-import "~2.14.0" - eslint-plugin-node "~7.0.1" - eslint-plugin-promise "~4.0.0" - eslint-plugin-react "~7.11.1" + eslint "~6.1.0" + eslint-config-standard "13.0.1" + eslint-config-standard-jsx "7.0.0" + eslint-plugin-import "~2.18.0" + eslint-plugin-node "~9.1.0" + eslint-plugin-promise "~4.2.1" + eslint-plugin-react "~7.14.2" eslint-plugin-standard "~4.0.0" - standard-engine "~9.0.0" + standard-engine "~11.0.1" static-extend@^0.1.1: version "0.1.2" @@ -7030,7 +7077,7 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.1.0: +strip-ansi@^5.1.0, strip-ansi@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== @@ -7061,11 +7108,16 @@ strip-indent@^1.0.1: dependencies: get-stdin "^4.0.1" -strip-json-comments@2.0.1, strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: +strip-json-comments@2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= +strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + supports-color@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-6.0.0.tgz#76cfe742cf1f41bb9b1c29ad03068c05b4c0e40a" @@ -7170,22 +7222,15 @@ svgo@^1.2.2: unquote "~1.1.1" util.promisify "~1.0.0" -symbol-observable@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.1.tgz#8340fc4702c3122df5d22288f88283f513d3fdd4" - integrity sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ= - -table@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" - integrity sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg== +table@^5.2.3: + version "5.4.5" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.5.tgz#c8f4ea2d8fee08c0027fac27b0ec0a4fe01dfa42" + integrity sha512-oGa2Hl7CQjfoaogtrOHEJroOcYILTx7BZWLGsJIlzoWmB2zmguhNfPJZsWPKYek/MgCxfco54gEi31d1uN2hFA== dependencies: - ajv "^6.0.1" - ajv-keywords "^3.0.0" - chalk "^2.1.0" - lodash "^4.17.4" - slice-ansi "1.0.0" - string-width "^2.1.1" + ajv "^6.10.2" + lodash "^4.17.14" + slice-ansi "^2.1.0" + string-width "^3.0.0" tapable@^1.0.0, tapable@^1.1.3: version "1.1.3" @@ -7835,6 +7880,11 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== +v8-compile-cache@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz#00f7494d2ae2b688cfe2899df6ed2c54bef91dbe" + integrity sha512-CNmdbwQMBjwr9Gsmohvm0pbL954tJrNzf6gWL3K+QMQf00PF7ERGrEiLgjuU3mKreLC2MeGhUsNV9ybTbLgd3w== + validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -8012,10 +8062,10 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" - integrity sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== dependencies: mkdirp "^0.5.1"