From bfc3c464628d21fa1e811982f0c4f9e3db417791 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Thu, 19 Apr 2018 21:38:01 -0700 Subject: [PATCH] use standard to lint HTML too (#186) --- CONTRIBUTING.md | 1 + package-lock.json | 9 ++++ package.json | 6 ++- routes/_components/AccountsListPage.html | 2 +- routes/_components/DynamicPageBanner.html | 2 +- routes/_components/IconButton.html | 2 +- routes/_components/Layout.html | 12 ++--- routes/_components/LazyImage.html | 3 +- routes/_components/LazyPage.html | 2 +- routes/_components/LoadingPage.html | 2 +- routes/_components/NavItem.html | 3 +- routes/_components/NonAutoplayGifv.html | 2 +- routes/_components/NonAutoplayImg.html | 2 +- routes/_components/TimelineHomePage.html | 2 +- routes/_components/TimelinePage.html | 2 +- routes/_components/Toast.html | 4 +- .../_components/community/PageListItem.html | 2 +- .../compose/ComposeAutosuggest.html | 11 +++-- routes/_components/compose/ComposeBox.html | 14 +++--- .../compose/ComposeContentWarning.html | 6 +-- routes/_components/compose/ComposeInput.html | 28 ++++++------ .../compose/ComposeLengthGauge.html | 2 +- .../compose/ComposeLengthIndicator.html | 2 +- .../_components/compose/ComposeMediaItem.html | 8 ++-- .../_components/compose/ComposeToolbar.html | 12 ++--- .../AccountProfileOptionsDialog.html | 16 +++---- .../dialog/components/ComposeDialog.html | 4 +- .../dialog/components/ConfirmationDialog.html | 8 ++-- .../dialog/components/EmojiDialog.html | 2 +- .../dialog/components/ModalDialog.html | 6 +-- .../dialog/components/PostPrivacyDialog.html | 2 +- .../components/StatusOptionsDialog.html | 14 +++--- .../profile/AccountProfileDetails.html | 2 +- .../profile/AccountProfileFollow.html | 2 +- .../profile/AccountProfileNote.html | 2 +- .../pseudoVirtualList/PseudoVirtualList.html | 15 +++---- .../PseudoVirtualListItem.html | 2 +- .../PseudoVirtualListLazyItem.html | 2 +- .../_components/settings/SettingsLayout.html | 4 +- .../_components/settings/SettingsNavItem.html | 6 +-- routes/_components/status/Media.html | 9 ++-- .../_components/status/MediaAttachments.html | 2 +- routes/_components/status/Notification.html | 2 +- routes/_components/status/Status.html | 16 +++---- .../_components/status/StatusComposeBox.html | 6 +-- routes/_components/status/StatusContent.html | 4 +- routes/_components/status/StatusHeader.html | 1 - .../status/StatusMediaAttachments.html | 6 +-- routes/_components/status/StatusSpoiler.html | 4 +- routes/_components/status/StatusToolbar.html | 14 +++--- routes/_components/timeline/LazyTimeline.html | 2 +- routes/_components/timeline/MoreHeader.html | 2 +- .../_components/timeline/PinnedStatuses.html | 2 +- routes/_components/timeline/Timeline.html | 44 +++++++++---------- .../_components/virtualList/VirtualList.html | 4 +- .../virtualList/VirtualListContainer.html | 18 ++++---- .../virtualList/VirtualListFooter.html | 4 +- .../virtualList/VirtualListHeader.html | 4 +- .../virtualList/VirtualListItem.html | 6 +-- .../virtualList/VirtualListLazyItem.html | 2 +- routes/_pages/accounts/[accountId].html | 2 +- routes/_pages/community/index.html | 4 +- routes/_pages/index.html | 12 ++--- routes/_pages/notifications.html | 2 +- routes/_pages/pinned.html | 2 +- routes/_pages/settings/about.html | 2 +- routes/_pages/settings/general.html | 2 +- routes/_pages/settings/index.html | 2 +- .../settings/instances/[instanceName].html | 14 +++--- routes/_pages/settings/instances/add.html | 2 +- 70 files changed, 214 insertions(+), 210 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5c913f9..28c57a0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,6 +32,7 @@ Lint: Automatically fix most linting issues: npx standard --fix + npx standard --fix --plugin html 'routes/**/*.html' ## Testing diff --git a/package-lock.json b/package-lock.json index 5710ffd..e9f379e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3084,6 +3084,15 @@ } } }, + "eslint-plugin-html": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-4.0.3.tgz", + "integrity": "sha512-ArFnlfQxwYSz/CP0zvk8Cy3MUhcDpT3o6jgO8eKD/b8ezcLVBrgkYzmMv+7S/ya+Yl9pN+Cz2tsgYp/zElkQzA==", + "dev": true, + "requires": { + "htmlparser2": "3.9.2" + } + }, "eslint-plugin-import": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.9.0.tgz", diff --git a/package.json b/package.json index e42bfe9..471e30a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "Alternative web client for Mastodon", "version": "0.2.2", "scripts": { - "lint": "standard", + "lint": "standard && standard --plugin html 'routes/**/*.html'", "dev": "run-s build-svg build-inline-script serve-dev", "serve-dev": "run-p --race build-sass-watch serve", "serve": "node server.js", @@ -83,6 +83,7 @@ "yargs": "11.0.0" }, "devDependencies": { + "eslint-plugin-html": "4.0.3", "now": "11.1.7", "standard": "11.0.1", "testcafe": "0.19.1" @@ -117,7 +118,8 @@ "atob", "btoa", "Blob", - "Element" + "Element", + "Image" ], "ignore": [ "dist", diff --git a/routes/_components/AccountsListPage.html b/routes/_components/AccountsListPage.html index 73e1f5a..3d9a784 100644 --- a/routes/_components/AccountsListPage.html +++ b/routes/_components/AccountsListPage.html @@ -33,7 +33,7 @@ import { toast } from '../_utils/toast' export default { - async oncreate() { + async oncreate () { let { accountsFetcher } = this.get() try { // TODO: paginate diff --git a/routes/_components/DynamicPageBanner.html b/routes/_components/DynamicPageBanner.html index 21f7fee..792cf61 100644 --- a/routes/_components/DynamicPageBanner.html +++ b/routes/_components/DynamicPageBanner.html @@ -61,7 +61,7 @@ \ No newline at end of file diff --git a/routes/_components/LazyImage.html b/routes/_components/LazyImage.html index 3904135..7238a9b 100644 --- a/routes/_components/LazyImage.html +++ b/routes/_components/LazyImage.html @@ -21,11 +21,10 @@ } \ No newline at end of file diff --git a/routes/_components/NonAutoplayGifv.html b/routes/_components/NonAutoplayGifv.html index 61d3d20..9cfe60d 100644 --- a/routes/_components/NonAutoplayGifv.html +++ b/routes/_components/NonAutoplayGifv.html @@ -43,7 +43,7 @@ export default { methods: { - onMouseOver(mouseOver) { + onMouseOver (mouseOver) { this.set({playing: mouseOver}) } }, diff --git a/routes/_components/NonAutoplayImg.html b/routes/_components/NonAutoplayImg.html index be8df07..6922e05 100644 --- a/routes/_components/NonAutoplayImg.html +++ b/routes/_components/NonAutoplayImg.html @@ -27,7 +27,7 @@ import { imgLoadError, mouseover } from '../_utils/events' export default { methods: { - onMouseOver(mouseOver) { + onMouseOver (mouseOver) { let { src, staticSrc } = this.get() this.refs.node.src = mouseOver ? src : staticSrc } diff --git a/routes/_components/TimelineHomePage.html b/routes/_components/TimelineHomePage.html index 2608577..ff5a2a8 100644 --- a/routes/_components/TimelineHomePage.html +++ b/routes/_components/TimelineHomePage.html @@ -42,7 +42,7 @@ }, computed: { hidePage: ($timelineInitialized, $timelinePreinitialized) => !$timelineInitialized && !$timelinePreinitialized, - hideTimeline: ($timelineInitialized) => !$timelineInitialized, + hideTimeline: ($timelineInitialized) => !$timelineInitialized }, store: () => store, components: { diff --git a/routes/_components/TimelinePage.html b/routes/_components/TimelinePage.html index de9a7f6..7a8ba1a 100644 --- a/routes/_components/TimelinePage.html +++ b/routes/_components/TimelinePage.html @@ -36,7 +36,7 @@ }, computed: { hidePage: ($timelineInitialized, $timelinePreinitialized) => !$timelineInitialized && !$timelinePreinitialized, - hideTimeline: ($timelineInitialized) => !$timelineInitialized, + hideTimeline: ($timelineInitialized) => !$timelineInitialized }, store: () => store, components: { diff --git a/routes/_components/Toast.html b/routes/_components/Toast.html index 2e27970..ad8f0f3 100644 --- a/routes/_components/Toast.html +++ b/routes/_components/Toast.html @@ -67,10 +67,10 @@ methods: { push, splice, - say(text) { + say (text) { this.push('messages', text) }, - onNewToast(text) { + onNewToast (text) { this._queue = this._queue.then(() => { this.set({ 'text': text, diff --git a/routes/_components/community/PageListItem.html b/routes/_components/community/PageListItem.html index 4bc8ad7..7107c88 100644 --- a/routes/_components/community/PageListItem.html +++ b/routes/_components/community/PageListItem.html @@ -73,7 +73,7 @@ IconButton }, methods: { - onPinClick(e) { + onPinClick (e) { e.preventDefault() let { currentInstance, pinnedPages } = this.store.get() let { href } = this.get() diff --git a/routes/_components/compose/ComposeAutosuggest.html b/routes/_components/compose/ComposeAutosuggest.html index 0dc4bf4..6041e95 100644 --- a/routes/_components/compose/ComposeAutosuggest.html +++ b/routes/_components/compose/ComposeAutosuggest.html @@ -55,7 +55,7 @@ const EMOJI_SEARCH_REGEX = new RegExp(`(?:\\s|^)(:[^:]{${MIN_PREFIX_LENGTH},})$`) export default { - oncreate() { + oncreate () { // perf improves for input responsiveness this.observe('composeSelectionStart', () => { scheduleIdleTask(() => { @@ -94,7 +94,7 @@ composeAutosuggestionSelected: 0, composeAutosuggestionSearchText: searchText, composeAutosuggestionSearchResults: results, - composeAutosuggestionType: type, + composeAutosuggestionType: type }) }) this.observe('shown', shown => { @@ -103,7 +103,7 @@ }, methods: { once: once, - onClick(item) { + onClick (item) { this.fire('autosuggestItemSelected') let { realm } = this.get() let { composeSelectionStart, composeAutosuggestionSearchText } = this.store.get() @@ -114,16 +114,15 @@ } else { /* no await */ insertEmojiAtPosition(realm, item, startIndex, endIndex) } - }, - async searchAccounts(searchText) { + async searchAccounts (searchText) { searchText = searchText.substring(1) let { currentInstance } = this.store.get() let results = await searchAccountsByUsernameInDatabase( currentInstance, searchText, DATABASE_SEARCH_RESULTS_LIMIT) return results.slice(0, SEARCH_RESULTS_LIMIT) }, - searchEmoji(searchText) { + searchEmoji (searchText) { searchText = searchText.toLowerCase().substring(1) let { currentCustomEmoji } = this.store.get() let results = currentCustomEmoji.filter(emoji => emoji.shortcode.toLowerCase().startsWith(searchText)) diff --git a/routes/_components/compose/ComposeBox.html b/routes/_components/compose/ComposeBox.html index bde904d..90e4d54 100644 --- a/routes/_components/compose/ComposeBox.html +++ b/routes/_components/compose/ComposeBox.html @@ -117,7 +117,7 @@ import { classname } from '../../_utils/classname' export default { - oncreate() { + oncreate () { let { realm } = this.get() if (realm === 'home') { this.setupStickyObserver() @@ -138,7 +138,7 @@ setReplyVisibility(realm, replyVisibility) } }, - ondestroy() { + ondestroy () { this.teardownStickyObserver() }, components: { @@ -188,7 +188,7 @@ slide }, methods: { - async onClickPostButton() { + async onClickPostButton () { let { sticky } = this.get() if (sticky) { // when the button is sticky, we're scrolled down the home timeline, @@ -197,10 +197,10 @@ dialogs.showComposeDialog() } else { // else we're actually posting a new toot - this.doPostStatus(); + this.doPostStatus() } }, - doPostStatus() { + doPostStatus () { let { text, media, @@ -224,7 +224,7 @@ sensitive, contentWarning, postPrivacyKey, mediaDescriptions, inReplyToUuid) }, - setupStickyObserver() { + setupStickyObserver () { this.__stickyObserver = new IntersectionObserver(entries => { this.set({sticky: !entries[0].isIntersecting}) }) @@ -243,7 +243,7 @@ } }, {init: false}) }, - teardownStickyObserver() { + teardownStickyObserver () { if (this.__stickyObserver) { this.__stickyObserver.disconnect() } diff --git a/routes/_components/compose/ComposeContentWarning.html b/routes/_components/compose/ComposeContentWarning.html index e2a30f6..68bd270 100644 --- a/routes/_components/compose/ComposeContentWarning.html +++ b/routes/_components/compose/ComposeContentWarning.html @@ -19,7 +19,7 @@ import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' export default { - oncreate() { + oncreate () { this.setupSyncFromStore() this.setupSyncToStore() }, @@ -28,12 +28,12 @@ rawText: '' }), methods: { - setupSyncFromStore() { + setupSyncFromStore () { this.observe('contentWarning', contentWarning => { this.set({rawText: contentWarning}) }) }, - setupSyncToStore() { + setupSyncToStore () { const saveText = debounce(() => scheduleIdleTask(() => this.store.save()), 1000) this.observe('rawText', rawText => { diff --git a/routes/_components/compose/ComposeInput.html b/routes/_components/compose/ComposeInput.html index 9df0859..b6b359c 100644 --- a/routes/_components/compose/ComposeInput.html +++ b/routes/_components/compose/ComposeInput.html @@ -37,16 +37,16 @@ import { clickSelectedAutosuggestionEmoji } from '../../_actions/emoji' export default { - oncreate() { + oncreate () { this.setupSyncFromStore() this.setupSyncToStore() this.setupAutosize() }, - ondestroy() { + ondestroy () { this.teardownAutosize() }, methods: { - setupSyncFromStore() { + setupSyncFromStore () { let textarea = this.refs.textarea let firstTime = true this.observe('text', text => { @@ -68,7 +68,7 @@ } }) }, - setupSyncToStore() { + setupSyncToStore () { const saveStore = debounce(() => scheduleIdleTask(() => this.store.save()), 1000) this.observe('rawText', rawText => { @@ -79,7 +79,7 @@ stop('observe rawText') }, {init: false}) }, - setupAutosize() { + setupAutosize () { let textarea = this.refs.textarea requestAnimationFrame(() => { mark('autosize()') @@ -87,21 +87,21 @@ stop('autosize()') }) }, - teardownAutosize() { + teardownAutosize () { mark('autosize.destroy()') autosize.destroy(this.refs.textarea) stop('autosize.destroy()') }, - onBlur() { + onBlur () { this.store.set({composeFocused: false}) }, - onFocus() { + onFocus () { this.store.set({composeFocused: true}) }, - onSelectionChange(selectionStart) { + onSelectionChange (selectionStart) { this.store.set({composeSelectionStart: selectionStart}) }, - onKeydown(e) { + onKeydown (e) { let { keyCode } = e // ctrl or cmd (on macs) was pressed; ctrl-enter means post a toot const ctrlPressed = e.getModifierState('Control') || e.getModifierState('Meta') @@ -109,7 +109,7 @@ case 9: // tab this.clickSelectedAutosuggestion(e) break - case 13: //enter + case 13: // enter const autosuggestionClicked = this.clickSelectedAutosuggestion(e) if (!autosuggestionClicked && ctrlPressed) { this.fire('postAction') @@ -127,7 +127,7 @@ default: } }, - clickSelectedAutosuggestion(event) { + clickSelectedAutosuggestion (event) { let { composeAutosuggestionShown, composeAutosuggestionType @@ -145,7 +145,7 @@ event.stopPropagation() return true }, - incrementAutosuggestSelected(increment, event) { + incrementAutosuggestSelected (increment, event) { let { composeAutosuggestionShown, composeAutosuggestionSelected, @@ -166,7 +166,7 @@ event.preventDefault() event.stopPropagation() }, - clearAutosuggestions(event) { + clearAutosuggestions (event) { let { composeAutosuggestionShown } = this.store.get() if (!composeAutosuggestionShown) { return diff --git a/routes/_components/compose/ComposeLengthGauge.html b/routes/_components/compose/ComposeLengthGauge.html index 8d8b863..d187e1e 100644 --- a/routes/_components/compose/ComposeLengthGauge.html +++ b/routes/_components/compose/ComposeLengthGauge.html @@ -24,7 +24,7 @@ import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' export default { - oncreate() { + oncreate () { let { lengthAsFraction } = this.get() this.set({lengthAsFractionDeferred: lengthAsFraction}) // perf improvement for keyboard input latency diff --git a/routes/_components/compose/ComposeLengthIndicator.html b/routes/_components/compose/ComposeLengthIndicator.html index dba6818..9b054cc 100644 --- a/routes/_components/compose/ComposeLengthIndicator.html +++ b/routes/_components/compose/ComposeLengthIndicator.html @@ -22,7 +22,7 @@ import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' export default { - oncreate() { + oncreate () { let { lengthToDisplay } = this.get() this.set({lengthToDisplayDeferred: lengthToDisplay}) // perf improvement for keyboard input latency diff --git a/routes/_components/compose/ComposeMediaItem.html b/routes/_components/compose/ComposeMediaItem.html index 37a32a2..67b7549 100644 --- a/routes/_components/compose/ComposeMediaItem.html +++ b/routes/_components/compose/ComposeMediaItem.html @@ -81,7 +81,7 @@ import { scheduleIdleTask } from '../../_utils/scheduleIdleTask' export default { - oncreate() { + oncreate () { this.setupSyncFromStore() this.setupSyncToStore() }, @@ -90,7 +90,7 @@ }), store: () => store, methods: { - setupSyncFromStore() { + setupSyncFromStore () { this.observe('mediaDescriptions', mediaDescriptions => { mediaDescriptions = mediaDescriptions || [] let { index, rawText } = this.get() @@ -100,7 +100,7 @@ } }) }, - setupSyncToStore() { + setupSyncToStore () { const saveStore = debounce(() => scheduleIdleTask(() => this.store.save()), 1000) this.observe('rawText', rawText => { @@ -118,7 +118,7 @@ saveStore() }, {init: false}) }, - onDeleteMedia() { + onDeleteMedia () { let { realm, index diff --git a/routes/_components/compose/ComposeToolbar.html b/routes/_components/compose/ComposeToolbar.html index 2059a4c..5d0b282 100644 --- a/routes/_components/compose/ComposeToolbar.html +++ b/routes/_components/compose/ComposeToolbar.html @@ -52,7 +52,7 @@ import ComposeAutosuggest from './ComposeAutosuggest.html' export default { - oncreate() { + oncreate () { if (process.env.NODE_ENV !== 'production') { window.__fakeFileInput = (file) => { this.onFileChange({ @@ -69,25 +69,25 @@ }, store: () => store, methods: { - async onEmojiClick() { + async onEmojiClick () { let dialogs = await importDialogs() let { realm } = this.get() dialogs.showEmojiDialog(realm) }, - onMediaClick() { + onMediaClick () { this.refs.input.click() }, - onFileChange(e) { + onFileChange (e) { let file = e.target.files[0] let { realm } = this.get() doMediaUpload(realm, file) }, - async onPostPrivacyClick() { + async onPostPrivacyClick () { let dialogs = await importDialogs() let { realm } = this.get() dialogs.showPostPrivacyDialog(realm) }, - onContentWarningClick() { + onContentWarningClick () { let { realm } = this.get() toggleContentWarningShown(realm) } diff --git a/routes/_components/dialog/components/AccountProfileOptionsDialog.html b/routes/_components/dialog/components/AccountProfileOptionsDialog.html index a0d3fdb..c78f769 100644 --- a/routes/_components/dialog/components/AccountProfileOptionsDialog.html +++ b/routes/_components/dialog/components/AccountProfileOptionsDialog.html @@ -55,8 +55,8 @@ export default { muteIcon: (muting) => muting ? '#fa-volume-up' : '#fa-volume-off', // end account data copypasta items: (blockLabel, blocking, blockIcon, muteLabel, muteIcon, - followLabel, followIcon, following, followRequested, - accountId, verifyCredentialsId, acct) => { + followLabel, followIcon, following, followRequested, + accountId, verifyCredentialsId, acct) => { let isUser = accountId === verifyCredentialsId return [ !isUser && { @@ -86,7 +86,7 @@ export default { methods: { show, close, - onClick(item) { + onClick (item) { switch (item.key) { case 'mention': return this.onMentionClicked() @@ -98,7 +98,7 @@ export default { return this.onMuteClicked() } }, - async onMentionClicked() { + async onMentionClicked () { let { acct } = this.get() this.store.setComposeData('dialog', { text: `@${acct} ` @@ -107,17 +107,17 @@ export default { dialogs.showComposeDialog() this.close() }, - async onFollowClicked() { + async onFollowClicked () { let { accountId, following } = this.get() this.close() await setAccountFollowed(accountId, !following, true) }, - async onBlockClicked() { + async onBlockClicked () { let { accountId, blocking } = this.get() this.close() await setAccountBlocked(accountId, !blocking, true) }, - async onMuteClicked() { + async onMuteClicked () { let { accountId, muting } = this.get() this.close() await setAccountMuted(accountId, !muting, true) @@ -126,6 +126,6 @@ export default { components: { ModalDialog, GenericDialogList - }, + } } \ No newline at end of file diff --git a/routes/_components/dialog/components/ComposeDialog.html b/routes/_components/dialog/components/ComposeDialog.html index 4b0f466..5475076 100644 --- a/routes/_components/dialog/components/ComposeDialog.html +++ b/routes/_components/dialog/components/ComposeDialog.html @@ -15,14 +15,14 @@ import { close } from '../helpers/closeDialog' export default { - oncreate() { + oncreate () { on('postedStatus', this, this.onPostedStatus) onCreateDialog.call(this) }, methods: { show, close, - onPostedStatus(realm) { + onPostedStatus (realm) { if (realm !== 'dialog') { return } diff --git a/routes/_components/dialog/components/ConfirmationDialog.html b/routes/_components/dialog/components/ConfirmationDialog.html index 8047fa2..592304c 100644 --- a/routes/_components/dialog/components/ConfirmationDialog.html +++ b/routes/_components/dialog/components/ConfirmationDialog.html @@ -40,14 +40,14 @@ import { oncreate as onCreateDialog } from '../helpers/onCreateDialog' export default { - oncreate() { + oncreate () { on('destroyDialog', this, this.onDestroyDialog) onCreateDialog.call(this) }, methods: { show, close, - onDestroyDialog(thisId) { + onDestroyDialog (thisId) { let { id, positiveResult, @@ -67,11 +67,11 @@ } } }, - onPositive() { + onPositive () { this.set({positiveResult: true}) this.close() }, - onNegative() { + onNegative () { this.close() } }, diff --git a/routes/_components/dialog/components/EmojiDialog.html b/routes/_components/dialog/components/EmojiDialog.html index 4ed61e4..9ee619f 100644 --- a/routes/_components/dialog/components/EmojiDialog.html +++ b/routes/_components/dialog/components/EmojiDialog.html @@ -81,7 +81,7 @@ methods: { show, close, - onClickEmoji(emoji) { + onClickEmoji (emoji) { let { realm } = this.get() insertEmoji(realm, emoji) this.close() diff --git a/routes/_components/dialog/components/ModalDialog.html b/routes/_components/dialog/components/ModalDialog.html index 776a99f..0932d19 100644 --- a/routes/_components/dialog/components/ModalDialog.html +++ b/routes/_components/dialog/components/ModalDialog.html @@ -127,7 +127,7 @@ import { on, emit } from '../../../_utils/eventBus' export default { - oncreate() { + oncreate () { let dialogElement = this.refs.node.parentElement this._a11yDialog = new A11yDialog(dialogElement) this._a11yDialog.on('hide', () => { @@ -162,7 +162,7 @@ } }, methods: { - showDialog(thisId) { + showDialog (thisId) { let { id } = this.get() if (id !== thisId) { return @@ -172,7 +172,7 @@ this.set({ fadedIn: true }) }) }, - closeDialog(thisId) { + closeDialog (thisId) { let { id } = this.get() if (id !== thisId) { return diff --git a/routes/_components/dialog/components/PostPrivacyDialog.html b/routes/_components/dialog/components/PostPrivacyDialog.html index 2d6a4be..2748d37 100644 --- a/routes/_components/dialog/components/PostPrivacyDialog.html +++ b/routes/_components/dialog/components/PostPrivacyDialog.html @@ -29,7 +29,7 @@ methods: { show, close, - onClick(item) { + onClick (item) { let { realm } = this.get() setPostPrivacy(realm, item.key) this.close() diff --git a/routes/_components/dialog/components/StatusOptionsDialog.html b/routes/_components/dialog/components/StatusOptionsDialog.html index 6457216..ced5002 100644 --- a/routes/_components/dialog/components/StatusOptionsDialog.html +++ b/routes/_components/dialog/components/StatusOptionsDialog.html @@ -53,8 +53,8 @@ export default { muteIcon: (muting) => muting ? '#fa-volume-up' : '#fa-volume-off', // end account data copypasta items: (blockLabel, blocking, blockIcon, muteLabel, muteIcon, - followLabel, followIcon, following, followRequested, - accountId, verifyCredentialsId) => { + followLabel, followIcon, following, followRequested, + accountId, verifyCredentialsId) => { let isUser = accountId === verifyCredentialsId return [ isUser && { @@ -89,7 +89,7 @@ export default { methods: { show, close, - onClick(item) { + onClick (item) { switch (item.key) { case 'delete': return this.onDeleteClicked() @@ -101,22 +101,22 @@ export default { return this.onMuteClicked() } }, - async onDeleteClicked() { + async onDeleteClicked () { let { statusId } = this.get() this.close() await doDeleteStatus(statusId) }, - async onFollowClicked() { + async onFollowClicked () { let { accountId, following } = this.get() this.close() await setAccountFollowed(accountId, !following, true) }, - async onBlockClicked() { + async onBlockClicked () { let { accountId, blocking } = this.get() this.close() await setAccountBlocked(accountId, !blocking, true) }, - async onMuteClicked() { + async onMuteClicked () { let { accountId, muting } = this.get() this.close() await setAccountMuted(accountId, !muting, true) diff --git a/routes/_components/profile/AccountProfileDetails.html b/routes/_components/profile/AccountProfileDetails.html index 446e8e1..db39b71 100644 --- a/routes/_components/profile/AccountProfileDetails.html +++ b/routes/_components/profile/AccountProfileDetails.html @@ -120,7 +120,7 @@ numFollowersDisplay: numFollowers => numberFormat.format(numFollowers) }, methods: { - async onMoreOptionsClick() { + async onMoreOptionsClick () { let { account, relationship, verifyCredentials } = this.get() let dialogs = await importDialogs() dialogs.showAccountProfileOptionsDialog(account, relationship, verifyCredentials) diff --git a/routes/_components/profile/AccountProfileFollow.html b/routes/_components/profile/AccountProfileFollow.html index 93947cb..d58658d 100644 --- a/routes/_components/profile/AccountProfileFollow.html +++ b/routes/_components/profile/AccountProfileFollow.html @@ -28,7 +28,7 @@ export default { methods: { - async onFollowButtonClick(e) { + async onFollowButtonClick (e) { e.preventDefault() e.stopPropagation() let { diff --git a/routes/_components/profile/AccountProfileNote.html b/routes/_components/profile/AccountProfileNote.html index eb543c5..9525385 100644 --- a/routes/_components/profile/AccountProfileNote.html +++ b/routes/_components/profile/AccountProfileNote.html @@ -39,7 +39,7 @@ note = `

${note}

` } return note - }, + } } } \ No newline at end of file diff --git a/routes/_components/pseudoVirtualList/PseudoVirtualList.html b/routes/_components/pseudoVirtualList/PseudoVirtualList.html index 1018d25..f67077a 100644 --- a/routes/_components/pseudoVirtualList/PseudoVirtualList.html +++ b/routes/_components/pseudoVirtualList/PseudoVirtualList.html @@ -19,14 +19,13 @@ } \ No newline at end of file diff --git a/routes/_components/settings/SettingsNavItem.html b/routes/_components/settings/SettingsNavItem.html index bf2886c..e99cd1f 100644 --- a/routes/_components/settings/SettingsNavItem.html +++ b/routes/_components/settings/SettingsNavItem.html @@ -13,10 +13,10 @@ \ No newline at end of file diff --git a/routes/_components/status/Status.html b/routes/_components/status/Status.html index ed7c966..f3f6e08 100644 --- a/routes/_components/status/Status.html +++ b/routes/_components/status/Status.html @@ -122,7 +122,7 @@ const isStatusArticle = node => node.classList.contains('status-article') export default { - oncreate() { + oncreate () { let { delegateKey, isStatusInOwnThread, showContent } = this.get() if (!isStatusInOwnThread) { // the whole
is clickable in this case @@ -151,7 +151,7 @@ }, store: () => store, methods: { - onClickOrKeydown(e) { + onClickOrKeydown (e) { let { type, keyCode, target } = e let isClick = type === 'click' @@ -202,18 +202,18 @@ spoilerShown: ($spoilersShown, uuid) => !!$spoilersShown[uuid], replyShown: ($repliesShown, uuid) => !!$repliesShown[uuid], showMedia: (originalStatus, isStatusInNotification) => { - return !isStatusInNotification - && originalStatus.media_attachments - && originalStatus.media_attachments.length + return !isStatusInNotification && + originalStatus.media_attachments && + originalStatus.media_attachments.length }, ariaLabel: (originalAccount, originalStatus, visibility) => { return (visibility === 'direct' ? 'Direct message' : 'Status') + ` by ${originalAccount.display_name || originalAccount.username}` }, showHeader: (notification, status, timelineType) => { - return (notification && (notification.type === 'reblog' || notification.type === 'favourite')) - || status.reblog - || timelineType === 'pinned' + return (notification && (notification.type === 'reblog' || notification.type === 'favourite')) || + status.reblog || + timelineType === 'pinned' }, className: (visibility, timelineType, isStatusInOwnThread) => { return classname( diff --git a/routes/_components/status/StatusComposeBox.html b/routes/_components/status/StatusComposeBox.html index 6a21eb3..fedfa8e 100644 --- a/routes/_components/status/StatusComposeBox.html +++ b/routes/_components/status/StatusComposeBox.html @@ -25,7 +25,7 @@ const THROTTLE_DELAY = 150 export default { - oncreate() { + oncreate () { on('postedStatus', this, this.onPostedStatus) this.setupRecalculateHeightListener() }, @@ -34,7 +34,7 @@ composeData: ($currentComposeData, originalStatusId) => $currentComposeData[originalStatusId] || {} }, methods: { - onPostedStatus(realm) { + onPostedStatus (realm) { let { originalStatusId } = this.get() if (realm !== originalStatusId) { return @@ -47,7 +47,7 @@ this.fire('recalculateHeight') }) }, - setupRecalculateHeightListener() { + setupRecalculateHeightListener () { const recalc = () => requestAnimationFrame(() => this.fire('recalculateHeight')) // debounce AND throttle due to 333ms content warning animation const debounced = debounce(recalc, DEBOUNCE_DELAY) diff --git a/routes/_components/status/StatusContent.html b/routes/_components/status/StatusContent.html index 7a45def..35a7763 100644 --- a/routes/_components/status/StatusContent.html +++ b/routes/_components/status/StatusContent.html @@ -64,7 +64,7 @@ import { emojifyText } from '../../_utils/emojifyText' export default { - oncreate() { + oncreate () { this.hydrateContent() }, store: () => store, @@ -90,7 +90,7 @@ } }, methods: { - hydrateContent() { + hydrateContent () { if (!this.refs.node) { return } diff --git a/routes/_components/status/StatusHeader.html b/routes/_components/status/StatusHeader.html index 10048a7..66a1116 100644 --- a/routes/_components/status/StatusHeader.html +++ b/routes/_components/status/StatusHeader.html @@ -81,7 +81,6 @@ } \ No newline at end of file diff --git a/routes/_components/timeline/LazyTimeline.html b/routes/_components/timeline/LazyTimeline.html index ddfe1b0..2e1b529 100644 --- a/routes/_components/timeline/LazyTimeline.html +++ b/routes/_components/timeline/LazyTimeline.html @@ -16,7 +16,7 @@ import { store } from '../../_store/store' export default { - oncreate() { + oncreate () { let { currentInstance } = this.store.get() let { timeline } = this.get() this.store.set({currentTimeline: timeline}) diff --git a/routes/_components/timeline/MoreHeader.html b/routes/_components/timeline/MoreHeader.html index 706c46f..15e6029 100644 --- a/routes/_components/timeline/MoreHeader.html +++ b/routes/_components/timeline/MoreHeader.html @@ -14,7 +14,7 @@ \ No newline at end of file diff --git a/routes/_components/virtualList/VirtualListFooter.html b/routes/_components/virtualList/VirtualListFooter.html index 8ad93a0..37c8587 100644 --- a/routes/_components/virtualList/VirtualListFooter.html +++ b/routes/_components/virtualList/VirtualListFooter.html @@ -15,13 +15,13 @@ import { AsyncLayout } from '../../_utils/AsyncLayout' export default { - oncreate() { + oncreate () { const asyncLayout = new AsyncLayout(() => '__footer__') asyncLayout.observe('__footer__', this.refs.node, (rect) => { asyncLayout.disconnect() this.store.setForRealm({footerHeight: rect.height}) }) }, - store: () => virtualListStore, + store: () => virtualListStore } \ No newline at end of file diff --git a/routes/_components/virtualList/VirtualListHeader.html b/routes/_components/virtualList/VirtualListHeader.html index f70a1a3..c9e86b9 100644 --- a/routes/_components/virtualList/VirtualListHeader.html +++ b/routes/_components/virtualList/VirtualListHeader.html @@ -26,7 +26,7 @@ import { doubleRAF } from '../../_utils/doubleRAF' export default { - oncreate() { + oncreate () { this.observe('shown', shown => { if (shown) { this.doCalculateHeight() @@ -38,7 +38,7 @@ }, store: () => virtualListStore, methods: { - doCalculateHeight() { + doCalculateHeight () { let { heightCalculated } = this.get() if (heightCalculated) { // only need to calculate once, it never changes return diff --git a/routes/_components/virtualList/VirtualListItem.html b/routes/_components/virtualList/VirtualListItem.html index 70315c8..9bece61 100644 --- a/routes/_components/virtualList/VirtualListItem.html +++ b/routes/_components/virtualList/VirtualListItem.html @@ -28,7 +28,7 @@ import { registerResizeListener, unregisterResizeListener } from '../../_utils/resize' export default { - oncreate() { + oncreate () { let asyncLayout = new AsyncLayout(node => node.getAttribute('virtual-list-key')) let { key } = this.get() asyncLayout.observe(key, this.refs.node, (rect) => { @@ -39,7 +39,7 @@ this.doRecalculateHeight = this.doRecalculateHeight.bind(this) registerResizeListener(this.doRecalculateHeight) }, - ondestroy() { + ondestroy () { unregisterResizeListener(this.doRecalculateHeight) }, store: () => virtualListStore, @@ -47,7 +47,7 @@ 'shown': ($itemHeights, key) => $itemHeights[key] > 0 }, methods: { - doRecalculateHeight() { + 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() diff --git a/routes/_components/virtualList/VirtualListLazyItem.html b/routes/_components/virtualList/VirtualListLazyItem.html index 2e863d6..751cf1b 100644 --- a/routes/_components/virtualList/VirtualListLazyItem.html +++ b/routes/_components/virtualList/VirtualListLazyItem.html @@ -11,7 +11,7 @@ import { mark, stop } from '../../_utils/marks' export default { - async oncreate() { + async oncreate () { // TODO: there appears to be a bug in {{#await}} that means we have to do this manually. // Some items may appear on top of other items because their offset is 0 and never updated. let { makeProps, key } = this.get() diff --git a/routes/_pages/accounts/[accountId].html b/routes/_pages/accounts/[accountId].html index 48bb032..12c3b4d 100644 --- a/routes/_pages/accounts/[accountId].html +++ b/routes/_pages/accounts/[accountId].html @@ -29,7 +29,7 @@ import PinnedStatuses from '../../_components/timeline/PinnedStatuses.html' export default { - oncreate() { + oncreate () { let { params } = this.get() let { accountId } = params clearProfileAndRelationship() diff --git a/routes/_pages/community/index.html b/routes/_pages/community/index.html index 292f907..1182fdc 100644 --- a/routes/_pages/community/index.html +++ b/routes/_pages/community/index.html @@ -95,7 +95,7 @@ import { updateLists } from '../../_actions/lists' export default { - async oncreate() { + async oncreate () { let { currentInstance } = this.store.get() if (currentInstance) { await updateLists() @@ -111,5 +111,5 @@ computed: { isLockedAccount: ($currentVerifyCredentials) => $currentVerifyCredentials && $currentVerifyCredentials.locked } - }; + } \ No newline at end of file diff --git a/routes/_pages/index.html b/routes/_pages/index.html index d15bfe7..76f7622 100644 --- a/routes/_pages/index.html +++ b/routes/_pages/index.html @@ -8,11 +8,11 @@ import { store } from '.././_store/store.js' import TimelineHomePage from '../_components/TimelineHomePage.html' - export default { - store: () => store, - components: { - NotLoggedInHome, + export default { + store: () => store, + components: { + NotLoggedInHome, TimelineHomePage - } - } + } + } \ No newline at end of file diff --git a/routes/_pages/notifications.html b/routes/_pages/notifications.html index ef241f9..75437c5 100644 --- a/routes/_pages/notifications.html +++ b/routes/_pages/notifications.html @@ -22,5 +22,5 @@ HiddenFromSSR, TimelinePage } - }; + } \ No newline at end of file diff --git a/routes/_pages/pinned.html b/routes/_pages/pinned.html index 65c2aaf..232fe90 100644 --- a/routes/_pages/pinned.html +++ b/routes/_pages/pinned.html @@ -37,7 +37,7 @@ import { updateVerifyCredentialsForInstance } from '.././_actions/instances' export default { - async oncreate() { + async oncreate () { try { let { currentInstance } = this.store.get() await updateVerifyCredentialsForInstance(currentInstance) diff --git a/routes/_pages/settings/about.html b/routes/_pages/settings/about.html index f9f65fa..195e642 100644 --- a/routes/_pages/settings/about.html +++ b/routes/_pages/settings/about.html @@ -27,5 +27,5 @@ data: () => ({ version }) - }; + } \ No newline at end of file diff --git a/routes/_pages/settings/general.html b/routes/_pages/settings/general.html index 5689215..c1ba3f1 100644 --- a/routes/_pages/settings/general.html +++ b/routes/_pages/settings/general.html @@ -42,5 +42,5 @@ SettingsLayout }, store: () => store - }; + } \ No newline at end of file diff --git a/routes/_pages/settings/index.html b/routes/_pages/settings/index.html index 222bd71..015373b 100644 --- a/routes/_pages/settings/index.html +++ b/routes/_pages/settings/index.html @@ -19,5 +19,5 @@ SettingsList, SettingsListItem } - }; + } \ No newline at end of file diff --git a/routes/_pages/settings/instances/[instanceName].html b/routes/_pages/settings/instances/[instanceName].html index 102a5f0..0a8d6c5 100644 --- a/routes/_pages/settings/instances/[instanceName].html +++ b/routes/_pages/settings/instances/[instanceName].html @@ -112,9 +112,9 @@ }, store: () => store, data: () => ({ - themes: themes, + themes: themes }), - async oncreate() { + async oncreate () { let { instanceName } = this.get() await updateVerifyCredentialsForInstance(instanceName) }, @@ -124,23 +124,23 @@ verifyCredentials: ($verifyCredentials, instanceName) => $verifyCredentials && $verifyCredentials[instanceName] }, methods: { - onThemeChange() { + onThemeChange () { let { newTheme, instanceName } = this.get() - changeTheme(instanceName, newTheme) + changeTheme(instanceName, newTheme) }, - onSwitchToThisInstance(e) { + onSwitchToThisInstance (e) { e.preventDefault() let { instanceName } = this.get() switchToInstance(instanceName) }, - async onLogOut(e) { + async onLogOut (e) { e.preventDefault() let { instanceName } = this.get() let dialogs = await importDialogs() dialogs.showConfirmationDialog({ text: `Log out of ${instanceName}?`, - onPositive() { + onPositive () { logOutOfInstance(instanceName) } }) diff --git a/routes/_pages/settings/instances/add.html b/routes/_pages/settings/instances/add.html index 77bb530..17f36a6 100644 --- a/routes/_pages/settings/instances/add.html +++ b/routes/_pages/settings/instances/add.html @@ -75,7 +75,7 @@ }, store: () => store, methods: { - onSubmit(event) { + onSubmit (event) { event.preventDefault() logInToInstance() }