all the manual fixes

This commit is contained in:
Henry Jameson 2019-07-07 00:54:17 +03:00
parent 1ec4caa0bb
commit 020c6d1bcf
31 changed files with 74 additions and 57 deletions

View file

@ -21,26 +21,6 @@ module.exports = {
'generator-star-spacing': 0, 'generator-star-spacing': 0,
// allow debugger during development // allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
// Webpack 4 update commit, most of these probably should be fixed and removed in a separate MR 'vue/require-prop-types': 0
// A lot of errors come from .vue files that are now properly linted
'vue/valid-v-if': 1,
'vue/use-v-on-exact': 1,
'vue/no-parsing-error': 1,
'vue/require-v-for-key': 1,
'vue/valid-v-for': 1,
'vue/require-prop-types': 1,
'vue/no-use-v-if-with-v-for': 1,
'indent': 1,
'import/first': 1,
'object-curly-spacing': 1,
'prefer-promise-reject-errors': 1,
'eol-last': 1,
'no-return-await': 1,
'no-multi-spaces': 1,
'no-trailing-spaces': 1,
'no-unused-expressions': 1,
'no-mixed-operators': 1,
'camelcase': 1,
'no-multiple-empty-lines': 1
} }
} }

View file

@ -97,8 +97,10 @@
<img :src="attachment.thumb_url"> <img :src="attachment.thumb_url">
</div> </div>
<div class="text"> <div class="text">
<!-- eslint-disable vue/no-v-html -->
<h1><a :href="attachment.url">{{ attachment.oembed.title }}</a></h1> <h1><a :href="attachment.url">{{ attachment.oembed.title }}</a></h1>
<div v-html="attachment.oembed.oembedHTML" /> <div v-html="attachment.oembed.oembedHTML" />
<!-- eslint-enabled vue/no-v-html -->
</div> </div>
</div> </div>
</div> </div>

View file

@ -25,11 +25,13 @@
:title="user.name" :title="user.name"
class="basic-user-card-user-name" class="basic-user-card-user-name"
> >
<!-- eslint-disable vue/no-v-html -->
<span <span
v-if="user.name_html" v-if="user.name_html"
class="basic-user-card-user-name-value" class="basic-user-card-user-name-value"
v-html="user.name_html" v-html="user.name_html"
/> />
<!-- eslint-enable vue/no-v-html -->
<span <span
v-else v-else
class="basic-user-card-user-name-value" class="basic-user-card-user-name-value"

View file

@ -1,6 +1,6 @@
<template> <template>
<div <div
v-if="!this.collapsed || !this.floating" v-if="!collapsed || !floating"
class="chat-panel" class="chat-panel"
> >
<div class="panel panel-default"> <div class="panel panel-default">

View file

@ -86,6 +86,7 @@ const conversation = {
}, },
replies () { replies () {
let i = 1 let i = 1
// eslint-disable-next-line camelcase
return reduce(this.conversation, (result, { id, in_reply_to_status_id }) => { return reduce(this.conversation, (result, { id, in_reply_to_status_id }) => {
/* eslint-disable camelcase */ /* eslint-disable camelcase */
const irid = in_reply_to_status_id const irid = in_reply_to_status_id

View file

@ -35,6 +35,7 @@
> >
<option <option
v-for="option in availableOptions" v-for="option in availableOptions"
:key="option"
:value="option" :value="option"
> >
{{ option === 'custom' ? $t('settings.style.fonts.custom') : option }} {{ option === 'custom' ? $t('settings.style.fonts.custom') : option }}

View file

@ -4,7 +4,8 @@
style="width: 100%;" style="width: 100%;"
> >
<div <div
v-for="row in rows" v-for="(row, index) in rows"
:key="index"
class="gallery-row" class="gallery-row"
:style="rowHeight(row.length)" :style="rowHeight(row.length)"
:class="{ 'contain-fit': useContainFit, 'cover-fit': !useContainFit }" :class="{ 'contain-fit': useContainFit, 'cover-fit': !useContainFit }"

View file

@ -5,7 +5,9 @@
> >
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">
<!-- eslint-disable vue/no-v-html -->
<div v-html="instanceSpecificPanelContent" /> <div v-html="instanceSpecificPanelContent" />
<!-- eslint-enable vue/no-v-html -->
</div> </div>
</div> </div>
</div> </div>

View file

@ -13,6 +13,7 @@
> >
<option <option
v-for="(langCode, i) in languageCodes" v-for="(langCode, i) in languageCodes"
:key="langCode"
:value="langCode" :value="langCode"
> >
{{ languageNames[i] }} {{ languageNames[i] }}

View file

@ -11,7 +11,7 @@
class="card-image" class="card-image"
:class="{ 'small-image': size === 'small' }" :class="{ 'small-image': size === 'small' }"
> >
<img :src="card.image"></img> <img :src="card.image">
</div> </div>
<div class="card-content"> <div class="card-content">
<span class="card-host faint">{{ card.provider_name }}</span> <span class="card-host faint">{{ card.provider_name }}</span>

View file

@ -8,7 +8,7 @@
v-if="type === 'image'" v-if="type === 'image'"
class="modal-image" class="modal-image"
:src="currentMedia.url" :src="currentMedia.url"
></img> >
<VideoAttachment <VideoAttachment
v-if="type === 'video'" v-if="type === 'video'"
class="modal-image" class="modal-image"

View file

@ -23,7 +23,7 @@
style="position: fixed; top: -100em" style="position: fixed; top: -100em"
multiple="true" multiple="true"
@change="change" @change="change"
></input> >
</label> </label>
</div> </div>
</template> </template>

View file

@ -30,12 +30,14 @@
/> />
<span class="notification-details"> <span class="notification-details">
<div class="name-and-action"> <div class="name-and-action">
<!-- eslint-disable vue/no-v-html -->
<span <span
v-if="!!notification.from_profile.name_html" v-if="!!notification.from_profile.name_html"
class="username" class="username"
:title="'@'+notification.from_profile.screen_name" :title="'@'+notification.from_profile.screen_name"
v-html="notification.from_profile.name_html" v-html="notification.from_profile.name_html"
/> />
<!-- eslint-enable vue/no-v-html -->
<span <span
v-else v-else
class="username" class="username"

View file

@ -60,7 +60,7 @@
</div> </div>
<i18n :path="expired ? 'polls.expired' : 'polls.expires_in'"> <i18n :path="expired ? 'polls.expired' : 'polls.expires_in'">
<Timeago <Timeago
:time="this.expiresAt" :time="expiresAt"
:auto-update="60" :auto-update="60"
:now-threshold="0" :now-threshold="0"
/> />

View file

@ -77,6 +77,7 @@
> >
<option <option
v-for="unit in expiryUnits" v-for="unit in expiryUnits"
:key="unit"
:value="unit" :value="unit"
> >
{{ $t(`time.${unit}_short`, ['']) }} {{ $t(`time.${unit}_short`, ['']) }}

View file

@ -206,6 +206,7 @@
<div class="attachments"> <div class="attachments">
<div <div
v-for="file in newStatus.files" v-for="file in newStatus.files"
:key="file.url"
class="media-upload-wrapper" class="media-upload-wrapper"
> >
<i <i
@ -217,7 +218,7 @@
v-if="type(file) === 'image'" v-if="type(file) === 'image'"
class="thumbnail media-upload" class="thumbnail media-upload"
:src="file.url" :src="file.url"
></img> >
<video <video
v-if="type(file) === 'video'" v-if="type(file) === 'video'"
:src="file.url" :src="file.url"

View file

@ -215,17 +215,22 @@
</div> </div>
</div> </div>
<!-- eslint-disable vue/no-v-html -->
<div <div
class="terms-of-service" class="terms-of-service"
v-html="termsOfService" v-html="termsOfService"
/> />
<!-- eslint-enable vue/no-v-html -->
</div> </div>
<div <div
v-if="serverValidationErrors.length" v-if="serverValidationErrors.length"
class="form-group" class="form-group"
> >
<div class="alert error"> <div class="alert error">
<span v-for="error in serverValidationErrors">{{ error }}</span> <span
v-for="error in serverValidationErrors"
:key="error"
>{{ error }}</span>
</div> </div>
</div> </div>
</form> </form>

View file

@ -72,6 +72,7 @@
> >
<option <option
v-for="(shadow, index) in cValue" v-for="(shadow, index) in cValue"
:key="index"
:value="index" :value="index"
> >
{{ $t('settings.style.shadows.shadow_id', { value: index }) }} {{ $t('settings.style.shadows.shadow_id', { value: index }) }}

View file

@ -221,7 +221,7 @@ const Status = {
? this.$store.state.instance.subjectLineBehavior ? this.$store.state.instance.subjectLineBehavior
: this.$store.state.config.subjectLineBehavior : this.$store.state.config.subjectLineBehavior
const startsWithRe = decodedSummary.match(/^re[: ]/i) const startsWithRe = decodedSummary.match(/^re[: ]/i)
if (behavior !== 'noop' && startsWithRe || behavior === 'masto') { if ((behavior !== 'noop' && startsWithRe) || behavior === 'masto') {
return decodedSummary return decodedSummary
} else if (behavior === 'email') { } else if (behavior === 'email') {
return 're: '.concat(decodedSummary) return 're: '.concat(decodedSummary)

View file

@ -1,4 +1,5 @@
<template> <template>
<!-- eslint-disable vue/no-v-html -->
<div <div
v-if="!hideStatus" v-if="!hideStatus"
class="status-el" class="status-el"
@ -205,18 +206,20 @@
v-if="replies && replies.length" v-if="replies && replies.length"
class="faint" class="faint"
>{{ $t('status.replies_list') }}</span> >{{ $t('status.replies_list') }}</span>
<span <template v-if="replies">
v-for="reply in replies" <span
v-if="replies" v-for="reply in replies"
class="reply-link faint" :key="reply.id"
> class="reply-link faint"
<a >
href="#" <a
@click.prevent="gotoOriginal(reply.id)" href="#"
@mouseenter="replyEnter(reply.id, $event)" @click.prevent="gotoOriginal(reply.id)"
@mouseout="replyLeave()" @mouseenter="replyEnter(reply.id, $event)"
>{{ reply.name }}</a> @mouseout="replyLeave()"
</span> >{{ reply.name }}</a>
</span>
</template>
</div> </div>
</div> </div>
</div> </div>
@ -422,6 +425,7 @@
</div> </div>
</template> </template>
</div> </div>
<!-- eslint-enable vue/no-v-html -->
</template> </template>
<script src="./status.js" ></script> <script src="./status.js" ></script>

View file

@ -24,6 +24,7 @@
> >
<option <option
v-for="style in availableStyles" v-for="style in availableStyles"
:key="style.name"
:value="style" :value="style"
:style="{ :style="{
backgroundColor: style[1] || style.theme.colors.bg, backgroundColor: style[1] || style.theme.colors.bg,
@ -463,6 +464,7 @@
> >
<option <option
v-for="shadow in shadowsAvailable" v-for="shadow in shadowsAvailable"
:key="shadow"
:value="shadow" :value="shadow"
> >
{{ $t('settings.style.shadows.components.' + shadow) }} {{ $t('settings.style.shadows.components.' + shadow) }}

View file

@ -2,10 +2,12 @@
<div> <div>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">
<!-- eslint-disable vue/no-v-html -->
<div <div
class="tos-content" class="tos-content"
v-html="content" v-html="content"
/> />
<!-- eslint-enable vue/no-v-html -->
</div> </div>
</div> </div>
</div> </div>

View file

@ -73,12 +73,12 @@ export default {
userHighlightType: { userHighlightType: {
get () { get () {
const data = this.$store.state.config.highlight[this.user.screen_name] const data = this.$store.state.config.highlight[this.user.screen_name]
return data && data.type || 'disabled' return (data && data.type) || 'disabled'
}, },
set (type) { set (type) {
const data = this.$store.state.config.highlight[this.user.screen_name] const data = this.$store.state.config.highlight[this.user.screen_name]
if (type !== 'disabled') { if (type !== 'disabled') {
this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: data && data.color || '#FFFFFF', type }) this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: (data && data.color) || '#FFFFFF', type })
} else { } else {
this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: undefined }) this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: undefined })
} }

View file

@ -15,12 +15,14 @@
</router-link> </router-link>
<div class="user-summary"> <div class="user-summary">
<div class="top-line"> <div class="top-line">
<!-- eslint-disable vue/no-v-html -->
<div <div
v-if="user.name_html" v-if="user.name_html"
:title="user.name" :title="user.name"
class="user-name" class="user-name"
v-html="user.name_html" v-html="user.name_html"
/> />
<!-- eslint-enable vue/no-v-html -->
<div <div
v-else v-else
:title="user.name" :title="user.name"
@ -237,12 +239,14 @@
<span>{{ user.followers_count }}</span> <span>{{ user.followers_count }}</span>
</div> </div>
</div> </div>
<!-- eslint-disable vue/no-v-html -->
<p <p
v-if="!hideBio && user.description_html" v-if="!hideBio && user.description_html"
class="user-card-bio" class="user-card-bio"
@click.prevent="linkClicked" @click.prevent="linkClicked"
v-html="user.description_html" v-html="user.description_html"
/> />
<!-- eslint-enable vue/no-v-html -->
<p <p
v-else-if="!hideBio" v-else-if="!hideBio"
class="user-card-bio" class="user-card-bio"

View file

@ -9,7 +9,10 @@
{{ $t('settings.mfa.recovery_codes_warning') }} {{ $t('settings.mfa.recovery_codes_warning') }}
</p> </p>
<ul class="backup-codes"> <ul class="backup-codes">
<li v-for="code in backupCodes.codes"> <li
v-for="code in backupCodes.codes"
:key="code"
>
{{ code }} {{ code }}
</li> </li>
</ul> </ul>

View file

@ -9,6 +9,7 @@
<div class="who-to-follow"> <div class="who-to-follow">
<p <p
v-for="user in usersToFollow" v-for="user in usersToFollow"
:key="user.id"
class="who-to-follow-items" class="who-to-follow-items"
> >
<img :src="user.img"> <img :src="user.img">

View file

@ -73,6 +73,7 @@ const mutations = {
// actions // actions
const actions = { const actions = {
// eslint-disable-next-line camelcase
async login ({ state, dispatch, commit }, { access_token }) { async login ({ state, dispatch, commit }, { access_token }) {
commit('setToken', access_token, { root: true }) commit('setToken', access_token, { root: true })
await dispatch('loginUser', access_token, { root: true }) await dispatch('loginUser', access_token, { root: true })

View file

@ -393,7 +393,7 @@ const users = {
} }
}, },
async getCaptcha (store) { async getCaptcha (store) {
return await store.rootState.api.backendInteractor.getCaptcha() return store.rootState.api.backendInteractor.getCaptcha()
}, },
logout (store) { logout (store) {
@ -451,9 +451,9 @@ const users = {
// Authentication failed // Authentication failed
commit('endLogin') commit('endLogin')
if (response.status === 401) { if (response.status === 401) {
reject('Wrong username or password') reject(new Error('Wrong username or password'))
} else { } else {
reject('An error occurred, please try again') reject(new Error('An error occurred, please try again'))
} }
} }
commit('endLogin') commit('endLogin')
@ -462,7 +462,7 @@ const users = {
.catch((error) => { .catch((error) => {
console.log(error) console.log(error)
commit('endLogin') commit('endLogin')
reject('Failed to connect to server, try again') reject(new Error('Failed to connect to server, try again'))
}) })
}) })
} }

View file

@ -63,26 +63,32 @@ const backendInteractorService = credentials => {
return notificationsFetcher.startFetching({ store, credentials }) return notificationsFetcher.startFetching({ store, credentials })
} }
// eslint-disable-next-line camelcase
const tagUser = ({ screen_name }, tag) => { const tagUser = ({ screen_name }, tag) => {
return apiService.tagUser({ screen_name, tag, credentials }) return apiService.tagUser({ screen_name, tag, credentials })
} }
// eslint-disable-next-line camelcase
const untagUser = ({ screen_name }, tag) => { const untagUser = ({ screen_name }, tag) => {
return apiService.untagUser({ screen_name, tag, credentials }) return apiService.untagUser({ screen_name, tag, credentials })
} }
// eslint-disable-next-line camelcase
const addRight = ({ screen_name }, right) => { const addRight = ({ screen_name }, right) => {
return apiService.addRight({ screen_name, right, credentials }) return apiService.addRight({ screen_name, right, credentials })
} }
// eslint-disable-next-line camelcase
const deleteRight = ({ screen_name }, right) => { const deleteRight = ({ screen_name }, right) => {
return apiService.deleteRight({ screen_name, right, credentials }) return apiService.deleteRight({ screen_name, right, credentials })
} }
// eslint-disable-next-line camelcase
const setActivationStatus = ({ screen_name }, status) => { const setActivationStatus = ({ screen_name }, status) => {
return apiService.setActivationStatus({ screen_name, status, credentials }) return apiService.setActivationStatus({ screen_name, status, credentials })
} }
// eslint-disable-next-line camelcase
const deleteUser = ({ screen_name }) => { const deleteUser = ({ screen_name }) => {
return apiService.deleteUser({ screen_name, credentials }) return apiService.deleteUser({ screen_name, credentials })
} }

View file

@ -3,12 +3,12 @@
// we are also using it with karma-webpack // we are also using it with karma-webpack
// https://github.com/webpack/karma-webpack // https://github.com/webpack/karma-webpack
var path = require('path') // var path = require('path')
var merge = require('webpack-merge') var merge = require('webpack-merge')
var baseConfig = require('../../build/webpack.base.conf') var baseConfig = require('../../build/webpack.base.conf')
var utils = require('../../build/utils') var utils = require('../../build/utils')
var webpack = require('webpack') var webpack = require('webpack')
var projectRoot = path.resolve(__dirname, '../../') // var projectRoot = path.resolve(__dirname, '../../')
var webpackConfig = merge(baseConfig, { var webpackConfig = merge(baseConfig, {
// use inline sourcemap for karma-sourcemap-loader // use inline sourcemap for karma-sourcemap-loader

View file

@ -163,12 +163,6 @@ const makeMockEmojiMasto = (overrides = [{}]) => {
] ]
} }
parseNotification
parseUser
parseStatus
makeMockStatusQvitter
makeMockUserQvitter
describe('API Entities normalizer', () => { describe('API Entities normalizer', () => {
describe('parseStatus', () => { describe('parseStatus', () => {
describe('QVitter preprocessing', () => { describe('QVitter preprocessing', () => {