Implement vue/recommended linter

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-07-14 18:00:47 +02:00
parent 842bb074d8
commit 7f72d1a423
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 81 additions and 47 deletions

View file

@ -14,7 +14,7 @@ module.exports = {
* https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention * https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
* consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules. * consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
*/ */
'plugin:vue/essential', 'plugin:vue/recommended',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md // https://github.com/standard/standard/blob/master/docs/RULES-en.md
'eslint:recommended', 'eslint:recommended',
], ],

View file

@ -1,73 +1,109 @@
<template> <template>
<div id="app"> <div id="app">
<b-navbar toggleable="lg" type="dark" variant="primary"> <b-navbar
<b-navbar-brand href="#" @click="newSecret"> toggleable="lg"
<i class="fas fa-user-secret"></i> OTS - One Time Secrets type="dark"
variant="primary"
>
<b-navbar-brand
href="#"
@click="newSecret"
>
<i class="fas fa-user-secret" /> OTS - One Time Secrets
</b-navbar-brand> </b-navbar-brand>
<b-navbar-toggle target="nav-collapse"></b-navbar-toggle> <b-navbar-toggle target="nav-collapse" />
<b-collapse id="nav-collapse" is-nav> <b-collapse
id="nav-collapse"
is-nav
>
<b-navbar-nav class="ml-auto"> <b-navbar-nav class="ml-auto">
<b-nav-item @click="newSecret"><i class="fas fa-plus"></i> {{ $t('btn-new-secret') }}</b-nav-item> <b-nav-item @click="newSecret">
<i class="fas fa-plus" /> {{ $t('btn-new-secret') }}
</b-nav-item>
</b-navbar-nav> </b-navbar-nav>
</b-collapse> </b-collapse>
</b-navbar> </b-navbar>
<b-container class="mt-4"> <b-container class="mt-4">
<b-row class="justify-content-center"> <b-row class="justify-content-center">
<b-col md="8"> <b-col md="8">
<b-alert v-model="showError" variant="danger" dismissible v-html="error"></b-alert> <b-alert
v-model="showError"
variant="danger"
dismissible
v-html="error"
/>
</b-col> </b-col>
</b-row> </b-row>
<b-row> <b-row>
<b-col> <b-col>
<b-card <b-card
v-if="mode == 'create' && !secretId"
border-variant="primary" border-variant="primary"
header-bg-variant="primary" header-bg-variant="primary"
header-text-variant="white" header-text-variant="white"
v-if="mode == 'create' && !secretId" >
> <span
<span slot="header" v-html="$t('title-new-secret')"></span> slot="header"
v-html="$t('title-new-secret')"
/>
<b-form-group :label="$t('label-secret-data')"> <b-form-group :label="$t('label-secret-data')">
<b-form-textarea <b-form-textarea
id="secret" id="secret"
v-model="secret"
max-rows="25" max-rows="25"
rows="5" rows="5"
v-model="secret" />
>
</b-form-textarea>
</b-form-group> </b-form-group>
<b-button variant="success" @click="createSecret">{{ $t('btn-create-secret') }}</b-button> <b-button
variant="success"
@click="createSecret"
>
{{ $t('btn-create-secret') }}
</b-button>
</b-card> </b-card>
<b-card <b-card
v-if="mode == 'create' && secretId"
border-variant="success" border-variant="success"
header-bg-variant="success" header-bg-variant="success"
header-text-variant="white" header-text-variant="white"
v-if="mode == 'create' && secretId" >
> <span
<span slot="header" v-html="$t('title-secret-created')"></span> slot="header"
<p v-html="$t('text-pre-url')"></p> v-html="$t('title-secret-created')"
/>
<p v-html="$t('text-pre-url')" />
<b-form-group> <b-form-group>
<b-form-input :value="secretUrl" readonly></b-form-input> <b-form-input
:value="secretUrl"
readonly
/>
</b-form-group> </b-form-group>
<p v-html="$t('text-burn-hint')"></p> <p v-html="$t('text-burn-hint')" />
</b-card> </b-card>
<b-card <b-card
v-if="mode == 'view'"
border-variant="primary" border-variant="primary"
header-bg-variant="primary" header-bg-variant="primary"
header-text-variant="white" header-text-variant="white"
v-if="mode == 'view'" >
> <span
<span slot="header" v-html="$t('title-reading-secret')"></span> slot="header"
v-html="$t('title-reading-secret')"
/>
<template v-if="!secret"> <template v-if="!secret">
<p v-html="$t('text-pre-reveal-hint')"></p> <p v-html="$t('text-pre-reveal-hint')" />
<b-button variant="success" @click=requestSecret>{{ $t('btn-reveal-secret') }}</b-button> <b-button
variant="success"
@click="requestSecret"
>
{{ $t('btn-reveal-secret') }}
</b-button>
</template> </template>
<template v-else> <template v-else>
<b-form-group> <b-form-group>
@ -76,19 +112,17 @@
readonly readonly
rows="5" rows="5"
:value="secret" :value="secret"
> />
</b-form-textarea>
</b-form-group> </b-form-group>
<p v-html="$t('text-hint-burned')"></p> <p v-html="$t('text-hint-burned')" />
</template> </template>
</b-card> </b-card>
</b-col> </b-col>
</b-row> </b-row>
<b-row class="mt-5"> <b-row class="mt-5">
<b-col class="footer"> <b-col class="footer">
{{ $t('text-powered-by') }} <a href="https://github.com/Luzifer/ots"><i class="fab fa-github"></i> Luzifer/OTS</a> {{ $root.version }} {{ $t('text-powered-by') }} <a href="https://github.com/Luzifer/ots"><i class="fab fa-github" /> Luzifer/OTS</a> {{ $root.version }}
</b-col> </b-col>
</b-row> </b-row>
</b-container> </b-container>
@ -100,13 +134,7 @@ import axios from 'axios'
import AES from 'gibberish-aes/src/gibberish-aes' import AES from 'gibberish-aes/src/gibberish-aes'
export default { export default {
name: 'app', name: 'App',
computed: {
secretUrl() {
return `${window.location.href}#${this.secretId}|${this.securePassword}`
},
},
data() { data() {
return { return {
@ -119,6 +147,18 @@ export default {
} }
}, },
computed: {
secretUrl() {
return `${window.location.href}#${this.secretId}|${this.securePassword}`
},
},
// Trigger initialization functions
mounted() {
window.onhashchange = this.hashLoad
this.hashLoad()
},
methods: { methods: {
// createSecret executes the secret creation after encrypting the secret // createSecret executes the secret creation after encrypting the secret
createSecret() { createSecret() {
@ -190,12 +230,6 @@ export default {
}, },
}, },
// Trigger initialization functions
mounted() {
window.onhashchange = this.hashLoad
this.hashLoad()
},
} }
</script> </script>

View file

@ -20,9 +20,9 @@ const i18n = new VueI18n({
}) })
new Vue({ new Vue({
el: '#app',
components: { app }, components: { app },
data: { version }, data: { version },
el: '#app',
i18n, i18n,
render: createElement => createElement('app'), render: createElement => createElement('app'),
}) })