Skip to content

Commit

Permalink
Apply eslint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
  • Loading branch information
ChristophWurst committed Jul 8, 2022
1 parent 34a7f9f commit bd6f64e
Show file tree
Hide file tree
Showing 42 changed files with 108 additions and 82 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ module.exports = {
t: true,
__webpack_public_path__: true,
__webpack_nonce__: true,
}
},
rules: {
'jsdoc/require-jsdoc': 'off',
},
}
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default {
},
methods: {
sync() {
setTimeout(async() => {
setTimeout(async () => {
try {
await this.$store.dispatch('syncInboxes')

Expand Down
4 changes: 2 additions & 2 deletions src/ReplyBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import { html } from './util/text'
/**
* @param {Text} original original
* @param {object} from from
* @param {Number} date date
* @param {number} date date
* @param {boolean} replyOnTop put reply on top?
* @returns {Text}
* @return {Text}
*/
export const buildReplyBody = (original, from, date, replyOnTop = true) => {
const startEnd = '<p></p><p></p>'
Expand Down
2 changes: 1 addition & 1 deletion src/ckeditor/signature/InsertSignatureCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default class InsertSignatureCommand extends Command {
*
* @param {*} editor the editor instance
* @param {*} writer the writer instance
* @returns {*} the position above the quoted text; position 1 if no quote found
* @return {*} the position above the quoted text; position 1 if no quote found
*/
findPositionAboveQuote(editor, writer) {
// Create a range spanning over the entire root content:
Expand Down
2 changes: 1 addition & 1 deletion src/components/AccountForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export default {
port,
}))
})
const results = await Promise.all(imapAndSmtpHosts.map(async({ host, port }) => {
const results = await Promise.all(imapAndSmtpHosts.map(async ({ host, port }) => {
return {
host,
port,
Expand Down
15 changes: 8 additions & 7 deletions src/components/Composer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ export default {
this.mailvelope.keysMissing = recipients.filter((r) => keysValid[r] === false)
},
initBody() {
/** @var {Text} body **/
/** @member {Text} body */
let body
if (this.replyTo) {
body = buildReplyBody(
Expand Down Expand Up @@ -915,7 +915,7 @@ export default {
return uid
})
.catch(async(error) => {
.catch(async (error) => {
await matchError(error, {
[NoDraftsMailboxConfiguredError.getName()]() {
return false
Expand Down Expand Up @@ -1056,7 +1056,7 @@ export default {
.then((data) => this.send({ ...data, force }))
.then(() => logger.info('message sent'))
.then(() => (this.state = STATES.FINISHED))
.catch(async(error) => {
.catch(async (error) => {
logger.error('could not send message', { error });
[this.errorText, this.state] = await matchError(error, {
[NoSentMailboxConfiguredError.getName()]() {
Expand Down Expand Up @@ -1116,8 +1116,9 @@ export default {
},
/**
* Format aliases for the Multiselect
* @param {Object} alias the alias to format
* @returns {string}
*
* @param {object} alias the alias to format
* @return {string}
*/
formatAliases(alias) {
if (!alias.name) {
Expand All @@ -1134,7 +1135,7 @@ export default {
* Whether the date is acceptable
*
* @param {Date} date The date to compare to
* @returns {boolean}
* @return {boolean}
*/
disabledDatetimepickerDate(date) {
const minimumDate = new Date()
Expand All @@ -1149,7 +1150,7 @@ export default {
* Whether the time for date is acceptable
*
* @param {Date} date The date to compare to
* @returns {boolean}
* @return {boolean}
*/
disabledDatetimepickerTime(date) {
const now = new Date()
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default {
},
},
async mounted() {
const accountInboxes = await Promise.all(this.accounts.map(async(account) => {
const accountInboxes = await Promise.all(this.accounts.map(async (account) => {
logger.debug('account', {
account,
})
Expand All @@ -122,7 +122,7 @@ export default {
inboxes,
})

await Promise.all(inboxes.map(async(mailbox) => {
await Promise.all(inboxes.map(async (mailbox) => {
const messages = await fetchEnvelopes(mailbox.accountId, mailbox.databaseId, this.query, undefined, 10)
this.messages = this.messages !== null ? [...this.messages, ...messages] : messages
this.fetchedAccounts++
Expand Down
3 changes: 2 additions & 1 deletion src/components/Envelope.vue
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ export default {
},
/**
* Subject of envelope or "No Subject".
* @returns {string}
*
* @return {string}
*/
subjectForSubtitle() {
// We have to use || here (instead of ??) because the subject might be '', null
Expand Down
2 changes: 1 addition & 1 deletion src/components/EnvelopeList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export default {
}
}
await Promise.all(this.selectedEnvelopes.map(async(envelope) => {
await Promise.all(this.selectedEnvelopes.map(async (envelope) => {
logger.info(`deleting thread ${envelope.threadRootId}`)
await this.$store.dispatch('deleteThread', {
envelope,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Mailbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ export default {
}
} catch (error) {
await matchError(error, {
[MailboxLockedError.getName()]: async(error) => {
[MailboxLockedError.getName()]: async (error) => {
logger.info(`Mailbox ${this.mailbox.databaseId} (${this.searchQuery}) is locked`, { error })

await wait(15 * 1000)
// Keep trying
await this.loadEnvelopes()
},
[MailboxNotCachedError.getName()]: async(error) => {
[MailboxNotCachedError.getName()]: async (error) => {
logger.info(`Mailbox ${this.mailbox.databaseId} (${this.searchQuery}) not cached. Triggering initialization`, { error })
this.loadingEnvelopes = false

Expand Down
6 changes: 4 additions & 2 deletions src/components/NavigationMailbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,17 @@ export default {
methods: {
/**
* Generate unique key id for a specific mailbox
* @param {Object} mailbox the mailbox to gen id for
* @returns {string}
*
* @param {object} mailbox the mailbox to gen id for
* @return {string}
*/
genId(mailbox) {
return 'mailbox-' + mailbox.databaseId
},

/**
* On menu toggle, fetch stats
*
* @param {boolean} open menu opened state
*/
onMenuToggle(open) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Outbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default {
},
created() {
// Reload outbox contents every 60 seconds
this.refreshInterval = setInterval(async() => {
this.refreshInterval = setInterval(async () => {
await this.fetchMessages()
}, 60000)
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/OutboxMessageListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ export default {
},
/**
* Subject of message or "No Subject".
* @returns {string}
*
* @return {string}
*/
subjectForSubtitle() {
// We have to use || here (instead of ??) because the subject might be '', null
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/mailvelope.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const loadMailvelopeDynamically = () =>
window.addEventListener('mailvelope', () => resolve(window.mailvelope), false)
})

export const getMailvelope = async() => {
export const getMailvelope = async () => {
if (mailvelope) {
return mailvelope
}
Expand Down
3 changes: 2 additions & 1 deletion src/crypto/pgp.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @param {Text} message the message
* @returns {boolean|*}
* @return {boolean|*}
*/
export const isPgpgMessage = (message) =>
message.format === 'plain' && message.value.startsWith('-----BEGIN PGP MESSAGE-----')
1 change: 1 addition & 0 deletions src/errors/MailboxLockedError.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

export default class MailboxLockedError extends Error {
Expand Down
1 change: 1 addition & 0 deletions src/errors/ManyRecipientsError.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

export default class ManyRecipientsError extends Error {
Expand Down
1 change: 1 addition & 0 deletions src/errors/NoDraftsMailboxConfiguredError.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

export default class NoDraftsMailboxConfiguredError extends Error {
Expand Down
1 change: 1 addition & 0 deletions src/errors/NoSentMailboxConfiguredError.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

export default class NoSentMailboxConfiguredError extends Error {
Expand Down
1 change: 1 addition & 0 deletions src/errors/NoTrashMailboxConfiguredError.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

export default class NoTrashMailboxConfiguredError extends Error {
Expand Down
5 changes: 3 additions & 2 deletions src/errors/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

import MailboxLockedError from './MailboxLockedError'
Expand All @@ -40,8 +41,8 @@ const map = {
}

/**
* @param {Object} axiosError the axios Error
* @returns {Error}
* @param {object} axiosError the axios Error
* @return {Error}
*/
export const convertAxiosError = (axiosError) => {
if (!('response' in axiosError)) {
Expand Down
3 changes: 2 additions & 1 deletion src/errors/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @param {Error} error error
* @param {object} matches matches
*/
export const matchError = async(error, matches) => {
export const matchError = async (error, matches) => {
if (error.name in matches) {
return await Promise.resolve(matches[error.name](error))
}
Expand Down
1 change: 1 addition & 0 deletions src/html-response.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

// injected styles
Expand Down
1 change: 1 addition & 0 deletions src/main-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

import { generateFilePath } from '@nextcloud/router'
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { generateFilePath } from '@nextcloud/router'
import '@nextcloud/dialogs/styles/toast.scss'
import './directives/drag-and-drop/styles/drag-and-drop.scss'
import VueShortKey from 'vue-shortkey'
import VTooltip from 'v-tooltip'
import vToolTip from 'v-tooltip'
import VueClipboard from 'vue-clipboard2'

import App from './App'
Expand All @@ -47,7 +47,7 @@ sync(store, router)
Vue.mixin(Nextcloud)

Vue.use(VueShortKey, { prevent: ['input', 'div'] })
Vue.use(VTooltip)
Vue.use(vToolTip)
Vue.use(VueClipboard)

const getPreferenceFromPage = (key) => {
Expand Down
2 changes: 1 addition & 1 deletion src/service/AccountService.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const fetch = (id) => {
return axios.get(url).then((resp) => fixAccountId(resp.data))
}

export const fetchQuota = async(id) => {
export const fetchQuota = async (id) => {
const url = generateUrl('/apps/mail/api/accounts/{id}/quota', {
id,
})
Expand Down
Loading

0 comments on commit bd6f64e

Please sign in to comment.