eslint standard rules implemented

This commit is contained in:
Moriz Wahl 2021-05-07 11:59:43 +02:00
parent 7f38c80121
commit bfb652864c
48 changed files with 181 additions and 191 deletions

View File

@ -3,29 +3,24 @@ module.exports = {
env: {
browser: true,
node: true,
jest: true
jest: true,
},
parserOptions: {
parser: 'babel-eslint'
parser: 'babel-eslint',
},
extends: [
'standard',
'plugin:vue/essential',
'plugin:prettier/recommended'
],
extends: ['standard', 'plugin:vue/essential', 'plugin:prettier/recommended'],
// required to lint *.vue files
plugins: [
'vue',
'prettier',
'jest'
],
plugins: ['vue', 'prettier', 'jest'],
// add your custom rules here
rules: {
'no-console': ['error'],
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'vue/component-name-in-template-casing': ['error', 'kebab-case'],
'prettier/prettier': ['error', {
htmlWhitespaceSensitivity: 'ignore'
}],
}
'prettier/prettier': [
'error',
{
htmlWhitespaceSensitivity: 'ignore',
},
],
},
}

View File

@ -3,7 +3,7 @@ module.exports = {
collectCoverageFrom: ['src/**/*.{js,vue}', '!**/node_modules/**', '!**/?(*.)+(spec|test).js?(x)'],
moduleFileExtensions: [
'js',
//'jsx',
// 'jsx',
'json',
'vue',
],

View File

@ -7,6 +7,7 @@ const port = process.env.PORT || 3000
// Express Server
const app = express()
// eslint-disable-next-line node/no-path-concat
app.use(serveStatic(__dirname + '/../dist'))
app.listen(port)

View File

@ -36,11 +36,6 @@ export default {
DashboardLayout,
AuthLayoutGDD,
},
data() {
return {
language: 'en',
}
},
data() {
return {
config: {

View File

@ -32,17 +32,17 @@ const apiPost = async (url, payload) => {
}
const communityAPI = {
balance: async (session_id) => {
return apiGet(CONFIG.COMMUNITY_API_URL + 'getBalance/' + session_id)
balance: async (sessionId) => {
return apiGet(CONFIG.COMMUNITY_API_URL + 'getBalance/' + sessionId)
},
transactions: async (session_id, firstPage = 1, items = 25, order = 'DESC') => {
transactions: async (sessionId, firstPage = 1, items = 25, order = 'DESC') => {
return apiGet(
`${CONFIG.COMMUNITY_API_URL}listTransactions/${firstPage}/${items}/${order}/${session_id}`,
`${CONFIG.COMMUNITY_API_URL}listTransactions/${firstPage}/${items}/${order}/${sessionId}`,
)
},
/*create: async (session_id, email, amount, memo, target_date = new Date() ) => {
/* create: async (sessionId, email, amount, memo, target_date = new Date() ) => {
const payload = {
session_id,
sessionId,
email,
amount,
target_date,
@ -50,14 +50,14 @@ const communityAPI = {
auto_sign: true,
}
return apiPost(CONFIG.COMMUNITY_API__URL + 'createCoins/', payload)
},*/
send: async (session_id, email, amount, memo, target_date) => {
}, */
send: async (sessionId, email, amount, memo, targetDate) => {
const payload = {
session_id,
session_id: sessionId,
email,
amount,
memo,
target_date,
target_date: targetDate,
auto_sign: true,
}
return apiPost(CONFIG.COMMUNITY_API_URL + 'sendCoins/', payload)

View File

@ -29,7 +29,7 @@ const apiPost = async (url, payload) => {
throw new Error('HTTP Status Error ' + result.status)
}
if (result.data.state === 'warning') {
return { success: true, result: error }
return { success: true, result: result.error }
}
if (result.data.state !== 'success') {
throw new Error(result.data.msg)
@ -48,15 +48,15 @@ const loginAPI = {
}
return apiPost(CONFIG.LOGIN_API_URL + 'unsecureLogin', payload)
},
logout: async (session_id) => {
const payload = { session_id }
logout: async (sessionId) => {
const payload = { session_id: sessionId }
return apiPost(CONFIG.LOGIN_API_URL + 'logout', payload)
},
create: async (email, first_name, last_name, password) => {
create: async (email, firstName, lastName, password) => {
const payload = {
email,
first_name,
last_name,
first_name: firstName,
last_name: lastName,
password,
emailType: EMAIL_TYPE.DEFAULT,
login_after_register: true,
@ -76,9 +76,9 @@ const loginAPI = {
CONFIG.LOGIN_API_URL + 'loginViaEmailVerificationCode?emailVerificationCode=' + optin,
)
},
changePassword: async (session_id, email, password) => {
changePassword: async (sessionId, email, password) => {
const payload = {
session_id,
session_id: sessionId,
email,
update: {
'User.password': password,

View File

@ -42,7 +42,7 @@ export default {
FadeTransition,
},
created() {
//console.log('base-alert gesetzt in =>', this.$route.path)
// console.log('base-alert gesetzt in =>', this.$route.path)
},
props: {
type: {

View File

@ -62,7 +62,7 @@ export default {
})
const slider = this.$el.noUiSlider
slider.on('slide', () => {
let value = slider.get()
const value = slider.get()
if (value !== this.value) {
this.$emit('input', value)
}

View File

@ -2,7 +2,7 @@ import { parseOptions } from '@/components/Charts/optionHelpers'
import Chart from 'chart.js'
export const Charts = {
mode: 'light', //(themeMode) ? themeMode : 'light';
mode: 'light', // (themeMode) ? themeMode : 'light';
fonts: {
base: 'Open Sans',
},
@ -34,9 +34,9 @@ export const Charts = {
}
function chartOptions() {
let { colors, mode, fonts } = Charts
const { colors, mode, fonts } = Charts
// Options
let options = {
const options = {
defaults: {
global: {
responsive: true,
@ -59,21 +59,21 @@ function chartOptions() {
elements: {
point: {
radius: 0,
backgroundColor: colors.theme['primary'],
backgroundColor: colors.theme.primary,
},
line: {
tension: 0.4,
borderWidth: 4,
borderColor: colors.theme['primary'],
borderColor: colors.theme.primary,
backgroundColor: colors.transparent,
borderCapStyle: 'rounded',
},
rectangle: {
backgroundColor: colors.theme['warning'],
backgroundColor: colors.theme.warning,
},
arc: {
backgroundColor: colors.theme['primary'],
borderColor: mode == 'dark' ? colors.gray[800] : colors.white,
backgroundColor: colors.theme.primary,
borderColor: mode === 'dark' ? colors.gray[800] : colors.white,
borderWidth: 4,
},
},
@ -94,11 +94,11 @@ function chartOptions() {
},
cutoutPercentage: 83,
legendCallback: function (chart) {
let data = chart.data
const data = chart.data
let content = ''
data.labels.forEach(function (label, index) {
let bgColor = data.datasets[0].backgroundColor[index]
const bgColor = data.datasets[0].backgroundColor[index]
content += '<span class="chart-legend-item">'
content +=
@ -172,7 +172,7 @@ export const basicOptions = {
},
responsive: true,
}
export let blueChartOptions = {
export const blueChartOptions = {
scales: {
yAxes: [
{
@ -185,7 +185,7 @@ export let blueChartOptions = {
},
}
export let lineChartOptionsBlue = {
export const lineChartOptionsBlue = {
...basicOptions,
tooltips: {
backgroundColor: '#f5f5f5',

View File

@ -1,6 +1,6 @@
// Parse global options
export function parseOptions(parent, options) {
for (let item in options) {
for (const item in options) {
if (typeof options[item] !== 'object') {
parent[item] = options[item]
} else {

View File

@ -4,13 +4,13 @@
//
import Chart from 'chart.js'
Chart.elements.Rectangle.prototype.draw = function () {
let ctx = this._chart.ctx
let vm = this._view
let left, right, top, bottom, signX, signY, borderSkipped, radius
const ctx = this._chart.ctx
const vm = this._view
let left, right, top, bottom, signX, signY, borderSkipped
let borderWidth = vm.borderWidth
// Set Radius Here
// If radius is large enough to cause drawing errors a max radius is imposed
let cornerRadius = 6
const cornerRadius = 6
if (!vm.horizontal) {
// bar
@ -36,14 +36,14 @@ Chart.elements.Rectangle.prototype.draw = function () {
// adjust the sizes to fit if we're setting a stroke on the line
if (borderWidth) {
// borderWidth shold be less than bar width and bar height.
let barSize = Math.min(Math.abs(left - right), Math.abs(top - bottom))
const barSize = Math.min(Math.abs(left - right), Math.abs(top - bottom))
borderWidth = borderWidth > barSize ? barSize : borderWidth
let halfStroke = borderWidth / 2
const halfStroke = borderWidth / 2
// Adjust borderWidth when bar top position is near vm.base(zero).
let borderLeft = left + (borderSkipped !== 'left' ? halfStroke * signX : 0)
let borderRight = right + (borderSkipped !== 'right' ? -halfStroke * signX : 0)
let borderTop = top + (borderSkipped !== 'top' ? halfStroke * signY : 0)
let borderBottom = bottom + (borderSkipped !== 'bottom' ? -halfStroke * signY : 0)
const borderLeft = left + (borderSkipped !== 'left' ? halfStroke * signX : 0)
const borderRight = right + (borderSkipped !== 'right' ? -halfStroke * signX : 0)
const borderTop = top + (borderSkipped !== 'top' ? halfStroke * signY : 0)
const borderBottom = bottom + (borderSkipped !== 'bottom' ? -halfStroke * signY : 0)
// not become a vertical line?
if (borderLeft !== borderRight) {
top = borderTop
@ -64,7 +64,7 @@ Chart.elements.Rectangle.prototype.draw = function () {
// Corner points, from bottom-left to bottom-right clockwise
// | 1 2 |
// | 0 3 |
let corners = [
const corners = [
[left, bottom],
[left, top],
[right, top],
@ -72,7 +72,7 @@ Chart.elements.Rectangle.prototype.draw = function () {
]
// Find first (starting) corner with fallback to 'bottom'
let borders = ['bottom', 'left', 'top', 'right']
const borders = ['bottom', 'left', 'top', 'right']
let startCorner = borders.indexOf(borderSkipped, 0)
if (startCorner === -1) {
startCorner = 0
@ -89,16 +89,14 @@ Chart.elements.Rectangle.prototype.draw = function () {
for (let i = 1; i < 4; i++) {
corner = cornerAt(i)
let nextCornerId = i + 1
if (nextCornerId == 4) {
if (nextCornerId === 4) {
nextCornerId = 0
}
let nextCorner = cornerAt(nextCornerId)
let width = corners[2][0] - corners[1][0]
let height = corners[0][1] - corners[1][1]
let x = corners[1][0]
let y = corners[1][1]
const width = corners[2][0] - corners[1][0]
const height = corners[0][1] - corners[1][1]
const x = corners[1][0]
const y = corners[1][1]
let radius = cornerRadius

View File

@ -6,7 +6,7 @@ const localVue = global.localVue
describe('CloseButton', () => {
let wrapper
let propsData = {
const propsData = {
target: 'Target',
expanded: false,
}

View File

@ -70,7 +70,7 @@ export default {
},
methods: {
activate() {
let wasActive = this.active
const wasActive = this.active
if (!this.multipleActive) {
this.deactivateAll()
}

View File

@ -170,7 +170,7 @@ export default {
},
methods: {
updateValue(evt) {
let value = evt.target.value
const value = evt.target.value
this.$emit('input', value)
},
onFocus(evt) {

View File

@ -60,7 +60,7 @@ export default {
type: String,
default: '',
validator(value) {
let acceptedValues = ['', 'notice', 'mini']
const acceptedValues = ['', 'notice', 'mini']
return acceptedValues.indexOf(value) !== -1
},
description: 'Modal type (notice|mini|"") ',
@ -73,7 +73,7 @@ export default {
type: String,
description: 'Modal size',
validator(value) {
let acceptedValues = ['', 'sm', 'lg']
const acceptedValues = ['', 'sm', 'lg']
return acceptedValues.indexOf(value) !== -1
},
},

View File

@ -39,7 +39,7 @@ export default {
submittedNames: [],
}
},
/*Modal*/
/* Modal */
checkFormValidity() {
const valid = this.$refs.form.checkValidity()
this.nameState = valid

View File

@ -90,8 +90,8 @@ export default {
},
computed: {
classes() {
let color = `bg-${this.type}`
let classes = [
const color = `bg-${this.type}`
const classes = [
{ 'navbar-transparent': this.transparent },
{ [`navbar-expand-${this.expand}`]: this.expand },
]

View File

@ -59,7 +59,7 @@ export default {
type: String,
default: 'top',
validator: (value) => {
let acceptedValues = ['top', 'bottom']
const acceptedValues = ['top', 'bottom']
return acceptedValues.indexOf(value) !== -1
},
description: 'Vertical alignment of notification (top|bottom)',
@ -68,7 +68,7 @@ export default {
type: String,
default: 'right',
validator: (value) => {
let acceptedValues = ['left', 'center', 'right']
const acceptedValues = ['left', 'center', 'right']
return acceptedValues.indexOf(value) !== -1
},
description: 'Horizontal alignment of notification (left|center|right)',
@ -77,7 +77,7 @@ export default {
type: String,
default: 'info',
validator: (value) => {
let acceptedValues = ['default', 'info', 'primary', 'danger', 'warning', 'success']
const acceptedValues = ['default', 'info', 'primary', 'danger', 'warning', 'success']
return acceptedValues.indexOf(value) !== -1
},
description:
@ -129,8 +129,8 @@ export default {
return `alert-${this.type}`
},
customPosition() {
let initialMargin = 20
let alertHeight = this.elmHeight + 10
const initialMargin = 20
const alertHeight = this.elmHeight + 10
let sameAlertsCount = this.$notifications.state.filter((alert) => {
return (
alert.horizontalAlign === this.horizontalAlign &&
@ -141,8 +141,8 @@ export default {
if (this.$notifications.settings.overlap) {
sameAlertsCount = 1
}
let pixels = (sameAlertsCount - 1) * alertHeight + initialMargin
let styles = {}
const pixels = (sameAlertsCount - 1) * alertHeight + initialMargin
const styles = {}
if (this.verticalAlign === 'top') {
styles.top = `${pixels}px`
} else {

View File

@ -44,7 +44,7 @@ const NotificationStore = {
const NotificationsPlugin = {
install(Vue, options) {
let app = new Vue({
const app = new Vue({
data: {
notificationStore: NotificationStore,
},

View File

@ -5,7 +5,7 @@
import VueBootstrapTypeahead from 'vue-bootstrap-typeahead'
// Global registration
//Vue.component('vue-bootstrap-typeahead', VueBootstrapTypeahead)
// Vue.component('vue-bootstrap-typeahead', VueBootstrapTypeahead)
// OR

View File

@ -110,7 +110,7 @@ export default {
},
linkPrefix() {
if (this.link.name) {
let words = this.link.name.split(' ')
const words = this.link.name.split(' ')
return words.map((word) => word.substring(0, 1)).join('')
}
return ''
@ -120,7 +120,7 @@ export default {
},
isActive() {
if (this.$route && this.$route.path) {
let matchingRoute = this.children.find((c) => this.$route.path.startsWith(c.link.path))
const matchingRoute = this.children.find((c) => this.$route.path.startsWith(c.link.path))
if (matchingRoute !== undefined) {
return true
}

View File

@ -29,7 +29,7 @@ const SidebarPlugin = {
if (options && options.sidebarLinks) {
SidebarStore.sidebarLinks = options.sidebarLinks
}
let app = new Vue({
const app = new Vue({
data: {
sidebarStore: SidebarStore,
},

View File

@ -67,7 +67,7 @@ export default {
type: String,
default: 'primary',
validator: (value) => {
let acceptedValues = ['primary', 'info', 'success', 'warning', 'danger']
const acceptedValues = ['primary', 'info', 'success', 'warning', 'danger']
return acceptedValues.indexOf(value) !== -1
},
},
@ -102,7 +102,7 @@ export default {
},
methods: {
findAndActivateTab(title) {
let tabToActivate = this.tabs.find((t) => t.title === title)
const tabToActivate = this.tabs.find((t) => t.title === title)
if (tabToActivate) {
this.activateTab(tabToActivate)
}

View File

@ -2,7 +2,7 @@ export default {
bind: function (el, binding, vnode) {
el.clickOutsideEvent = function (event) {
// here I check that click was outside the el and his childrens
if (!(el == event.target || el.contains(event.target))) {
if (!(el === event.target || el.contains(event.target))) {
// and if it did, call method provided in attribute value
vnode.context[binding.expression](event)
}

View File

@ -2,7 +2,6 @@ import Vue from 'vue'
import DashboardPlugin from './plugins/dashboard-plugin'
import App from './App.vue'
import i18n from './i18n.js'
import VeeValidate from './vee-validate.js'
// store
import { store } from './store/store'

View File

@ -3,7 +3,7 @@ import '@/polyfills'
// Notifications plugin. Used on Notifications page
import Notifications from '@/components/NotificationPlugin'
// Validation plugin used to validate forms
import { configure } from 'vee-validate'
import { configure, extend } from 'vee-validate'
// A plugin file where you could register global components used across the app
import GlobalComponents from './globalComponents'
// A plugin file where you could register global directives
@ -14,7 +14,6 @@ import SideBar from '@/components/SidebarPlugin'
// element ui language configuration
import lang from 'element-ui/lib/locale/lang/en'
import locale from 'element-ui/lib/locale'
locale.use(lang)
// vue-bootstrap
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
@ -22,7 +21,6 @@ import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
// asset imports
import '@/assets/scss/argon.scss'
import '@/assets/vendor/nucleo/css/nucleo.css'
import { extend } from 'vee-validate'
import * as rules from 'vee-validate/dist/rules'
import { messages } from 'vee-validate/dist/locale/en.json'
@ -40,6 +38,7 @@ import VueMoment from 'vue-moment'
import Loading from 'vue-loading-overlay'
// import the styles
import 'vue-loading-overlay/dist/vue-loading.css'
locale.use(lang)
Object.keys(rules).forEach((rule) => {
extend(rule, {

View File

@ -21,20 +21,20 @@ const routes = [
requiresAuth: true,
},
},
//{
// {
// path: '/profileedit',
// component: () => import('../views/Pages/UserProfileEdit.vue'),
// meta: {
// requiresAuth: true,
// },
//},
//{
// },
// {
// path: '/activity',
// component: () => import('../views/Pages/UserProfileActivity.vue'),
// meta: {
// requiresAuth: true,
// },
//},
// },
{
path: '/transactions',
component: () => import('../views/Pages/UserProfileTransactionList.vue'),

View File

@ -1,7 +1,7 @@
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)
export const mutations = {
language: (state, language) => {
@ -10,18 +10,18 @@ export const mutations = {
email: (state, email) => {
state.email = email
},
session_id: (state, session_id) => {
state.session_id = session_id
sessionId: (state, sessionId) => {
state.sessionId = sessionId
},
}
export const actions = {
login: ({ dispatch, commit }, data) => {
commit('session_id', data.session_id)
commit('sessionId', data.session_id)
commit('email', data.email)
},
logout: ({ commit, state }) => {
commit('session_id', null)
commit('sessionId', null)
commit('email', null)
sessionStorage.clear()
},
@ -34,7 +34,7 @@ export const store = new Vuex.Store({
}),
],
state: {
session_id: null,
sessionId: null,
email: '',
language: 'en',
modals: false,

View File

@ -1,6 +1,6 @@
import { mutations, actions } from './store'
const { language, email, session_id } = mutations
const { language, email, sessionId } = mutations
const { login, logout } = actions
describe('Vuex store', () => {
@ -21,11 +21,11 @@ describe('Vuex store', () => {
})
})
describe('session_id', () => {
it('sets the state of session_id', () => {
const state = { session_id: null }
session_id(state, '1234')
expect(state.session_id).toEqual('1234')
describe('sessionId', () => {
it('sets the state of sessionId', () => {
const state = { sessionId: null }
sessionId(state, '1234')
expect(state.sessionId).toEqual('1234')
})
})
})
@ -36,17 +36,17 @@ describe('Vuex store', () => {
const state = {}
it('calls two commits', () => {
login({ commit, state }, { session_id: 1234, email: 'someone@there.is' })
login({ commit, state }, { sessionId: 1234, email: 'someone@there.is' })
expect(commit).toHaveBeenCalledTimes(2)
})
it('commits session_id', () => {
login({ commit, state }, { session_id: 1234, email: 'someone@there.is' })
expect(commit).toHaveBeenNthCalledWith(1, 'session_id', 1234)
it('commits sessionId', () => {
login({ commit, state }, { sessionId: 1234, email: 'someone@there.is' })
expect(commit).toHaveBeenNthCalledWith(1, 'sessionId', 1234)
})
it('commits email', () => {
login({ commit, state }, { session_id: 1234, email: 'someone@there.is' })
login({ commit, state }, { sessionId: 1234, email: 'someone@there.is' })
expect(commit).toHaveBeenNthCalledWith(2, 'email', 'someone@there.is')
})
})
@ -60,9 +60,9 @@ describe('Vuex store', () => {
expect(commit).toHaveBeenCalledTimes(2)
})
it('commits session_id', () => {
it('commits sessionId', () => {
logout({ commit, state })
expect(commit).toHaveBeenNthCalledWith(1, 'session_id', null)
expect(commit).toHaveBeenNthCalledWith(1, 'sessionId', null)
})
it('commits email', () => {

View File

@ -7,7 +7,7 @@ const localVue = global.localVue
describe('ContentFooter', () => {
let wrapper
let mocks = {
const mocks = {
$i18n: {
locale: 'en',
},

View File

@ -20,7 +20,7 @@ const transitionStub = () => ({
describe('DashboardLayoutGdd', () => {
let wrapper
let mocks = {
const mocks = {
$i18n: {
locale: 'en',
},
@ -28,7 +28,7 @@ describe('DashboardLayoutGdd', () => {
$n: jest.fn(),
}
let state = {
const state = {
user: {
name: 'Peter Lustig',
balance: 2546,
@ -37,12 +37,12 @@ describe('DashboardLayoutGdd', () => {
email: 'peter.lustig@example.org',
}
let stubs = {
const stubs = {
RouterLink: RouterLinkStub,
FadeTransition: transitionStub(),
}
let store = new Vuex.Store({
const store = new Vuex.Store({
state,
})
@ -104,41 +104,41 @@ describe('DashboardLayoutGdd', () => {
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe('/transactions')
})
//it('has third item "My profile" in navbar', () => {
// it('has third item "My profile" in navbar', () => {
// expect(navbar.findAll('ul > li').at(2).text()).toEqual('site.navbar.my-profil')
//})
// })
//
//it.skip('has third item "My profile" linked to profile in navbar', async () => {
// it.skip('has third item "My profile" linked to profile in navbar', async () => {
// navbar.findAll('ul > li > a').at(2).trigger('click')
// await flushPromises()
// await jest.runAllTimers()
// await flushPromises()
// expect(wrapper.findComponent(RouterLinkStub).props().to).toBe('/profile')
//})
// })
//it('has fourth item "Settigs" in navbar', () => {
// it('has fourth item "Settigs" in navbar', () => {
// expect(navbar.findAll('ul > li').at(3).text()).toEqual('site.navbar.settings')
//})
// })
//
//it.skip('has fourth item "Settings" linked to profileedit in navbar', async () => {
// it.skip('has fourth item "Settings" linked to profileedit in navbar', async () => {
// navbar.findAll('ul > li > a').at(3).trigger('click')
// await flushPromises()
// await jest.runAllTimers()
// await flushPromises()
// expect(wrapper.findComponent(RouterLinkStub).props().to).toBe('/profileedit')
//})
// })
//it('has fifth item "Activity" in navbar', () => {
// it('has fifth item "Activity" in navbar', () => {
// expect(navbar.findAll('ul > li').at(4).text()).toEqual('site.navbar.activity')
//})
// })
//
//it.skip('has fourth item "Activity" linked to activity in navbar', async () => {
// it.skip('has fourth item "Activity" linked to activity in navbar', async () => {
// navbar.findAll('ul > li > a').at(4).trigger('click')
// await flushPromises()
// await jest.runAllTimers()
// await flushPromises()
// expect(wrapper.findComponent(RouterLinkStub).props().to).toBe('/activity')
//})
// })
})
})
})

View File

@ -46,12 +46,19 @@ import PerfectScrollbar from 'perfect-scrollbar'
import 'perfect-scrollbar/css/perfect-scrollbar.css'
import loginAPI from '../../apis/loginAPI'
import DashboardNavbar from './DashboardNavbar.vue'
import ContentFooter from './ContentFooter.vue'
// import DashboardContent from './Content.vue';
import { FadeTransition } from 'vue2-transitions'
import communityAPI from '../../apis/communityAPI'
function hasElement(className) {
return document.getElementsByClassName(className).length > 0
}
function initScrollbar(className) {
if (hasElement(className)) {
// eslint-disable-next-line no-new
new PerfectScrollbar(`.${className}`)
} else {
// try to init it later in case this component is loaded async
@ -61,12 +68,6 @@ function initScrollbar(className) {
}
}
import DashboardNavbar from './DashboardNavbar.vue'
import ContentFooter from './ContentFooter.vue'
// import DashboardContent from './Content.vue';
import { FadeTransition } from 'vue2-transitions'
import communityAPI from '../../apis/communityAPI'
export default {
components: {
DashboardNavbar,
@ -84,13 +85,13 @@ export default {
},
methods: {
initScrollbar() {
let isWindows = navigator.platform.startsWith('Win')
const isWindows = navigator.platform.startsWith('Win')
if (isWindows) {
initScrollbar('sidenav')
}
},
async logout() {
const result = await loginAPI.logout(this.$store.state.session_id)
await loginAPI.logout(this.$store.state.session_id)
// do we have to check success?
this.$store.dispatch('logout')
this.$router.push('/login')

View File

@ -6,7 +6,7 @@ const localVue = global.localVue
describe('AccountOverview', () => {
let wrapper
let mocks = {
const mocks = {
$t: jest.fn((t) => t),
}

View File

@ -102,7 +102,7 @@ export default {
created() {},
watch: {
$form: function () {
stunden(this.form)
this.stunden(this.form)
},
},
mounted() {},
@ -133,16 +133,16 @@ export default {
},
deleteNewMessage: function (event) {
this.form.splice(event, null)
this.messages.splice(index, 1)
this.messages.splice(this.index, 1)
this.index--
},
submitForm: function (e) {
//console.log('submitForm')
// console.log('submitForm')
this.messages = [{ DaysNumber: '', TextDecoded: '' }]
this.submitted = true
},
textFocus() {
//console.log('textFocus TODO')
// console.log('textFocus TODO')
},
newWorkForm() {
this.formular = `
@ -174,7 +174,7 @@ export default {
></textarea>
</base-input>
</b-col>
`
`
// console.log('newWorkForm TODO')
const myElement = this.$refs.mydiv

View File

@ -7,18 +7,18 @@ const localVue = global.localVue
describe('GddSend', () => {
let wrapper
let state = {
const state = {
user: {
balance: 1234,
balance_gdt: 9876,
},
}
let store = new Vuex.Store({
const store = new Vuex.Store({
state,
})
let mocks = {
const mocks = {
// $n: jest.fn((n) => n),
$t: jest.fn((t) => t),
$moment: jest.fn((m) => ({

View File

@ -240,7 +240,7 @@ export default {
this.scan = false
},
async onSubmit() {
//event.preventDefault()
// event.preventDefault()
this.ajaxCreateData.email = this.form.email
this.ajaxCreateData.amount = this.form.amount
const now = new Date(Date.now()).toISOString()

View File

@ -6,11 +6,11 @@ const localVue = global.localVue
describe('GddStatus', () => {
let wrapper
let mocks = {
const mocks = {
$n: jest.fn((n) => n),
}
let propsData = {
const propsData = {
balance: 1234,
GdtBalance: 9876,
}

View File

@ -127,7 +127,7 @@ export default {
},
methods: {
ojectToArray(obj) {
let result = new Array(Object.keys(obj).length)
const result = new Array(Object.keys(obj).length)
Object.entries(obj).forEach((entry) => {
const [key, value] = entry
result[key] = value

View File

@ -68,6 +68,7 @@ export default {
if (item.status === 'earned') return 'table-primary'
},
toogle(item) {
// eslint-disable-next-line no-unused-vars
const temp =
'<b-collapse visible v-bind:id="item.id">xxx <small class="text-muted">porta</small></b-collapse>'
},

View File

@ -9,22 +9,22 @@ const localVue = global.localVue
describe('Login', () => {
let wrapper
let mocks = {
const mocks = {
$i18n: {
locale: 'en',
},
$t: jest.fn((t) => t),
}
let state = {
const state = {
loginfail: false,
}
let store = new Vuex.Store({
const store = new Vuex.Store({
state,
})
let stubs = {
const stubs = {
RouterLink: RouterLinkStub,
}

View File

@ -112,7 +112,7 @@ export default {
},
methods: {
async onSubmit() {
let loader = this.$loading.show({
const loader = this.$loading.show({
container: this.$refs.submitButton,
})
const result = await loginAPI.login(this.model.email, this.model.password)
@ -129,7 +129,7 @@ export default {
}
},
closeAlert() {
loader.hide()
this.$loading.hide()
this.loginfail = false
},
},

View File

@ -9,22 +9,22 @@ const localVue = global.localVue
describe('Register', () => {
let wrapper
let mocks = {
const mocks = {
$i18n: {
locale: 'en',
},
$t: jest.fn((t) => t),
}
let state = {
const state = {
// loginfail: false,
}
let store = new Vuex.Store({
const store = new Vuex.Store({
state,
})
let stubs = {
const stubs = {
RouterLink: RouterLinkStub,
}

View File

@ -232,8 +232,8 @@ export default {
return this.model.email !== ''
},
passwordValidation() {
let errors = []
for (let condition of this.rules) {
const errors = []
for (const condition of this.rules) {
if (!condition.regex.test(this.password)) {
errors.push(condition.message)
}

View File

@ -11,9 +11,9 @@ const router = new VueRouter({ routes })
describe('ResetPassword', () => {
let wrapper
let emailVerification = jest.fn()
const emailVerification = jest.fn()
let mocks = {
const mocks = {
$i18n: {
locale: 'en',
},
@ -49,13 +49,13 @@ describe('ResetPassword', () => {
expect(wrapper.find('div.resetpwd-form').exists()).toBeTruthy()
})
//describe('Register header', () => {
// describe('Register header', () => {
// it('has a welcome message', () => {
// expect(wrapper.find('div.header').text()).toBe('site.signup.title site.signup.subtitle')
// })
//})
// })
//describe('links', () => {
// describe('links', () => {
// it('has a link "Back"', () => {
// expect(wrapper.findAllComponents(RouterLinkStub).at(0).text()).toEqual('back')
// })
@ -63,9 +63,9 @@ describe('ResetPassword', () => {
// it('links to /login when clicking "Back"', () => {
// expect(wrapper.findAllComponents(RouterLinkStub).at(0).props().to).toBe('/login')
// })
//})
// })
//describe('Register form', () => {
// describe('Register form', () => {
// it('has a register form', () => {
// expect(wrapper.find('form').exists()).toBeTruthy()
// })
@ -108,7 +108,7 @@ describe('ResetPassword', () => {
// })
// //TODO test different invalid password combinations
//})
// })
// TODO test submit button
})

View File

@ -141,8 +141,8 @@ export default {
return this.password !== '' && this.checkPassword !== ''
},
passwordValidation() {
let errors = []
for (let condition of this.rules) {
const errors = []
for (const condition of this.rules) {
if (!condition.regex.test(this.password)) {
errors.push(condition.message)
}

View File

@ -43,11 +43,11 @@ export default {
},
onFileChange(fieldName, file) {
const { maxSize } = this
let imageFile = file[0]
const imageFile = file[0]
//check if user actually selected a file
// check if user actually selected a file
if (file.length > 0) {
let size = imageFile.size / maxSize / maxSize
const size = imageFile.size / maxSize / maxSize
if (!imageFile.type.match('image.*')) {
// check whether the upload is an image
this.errorDialog = true
@ -58,8 +58,8 @@ export default {
this.errorText = 'Your file is too big! Please select an image under 1MB'
} else {
// Append file into FormData & turn file into image URL
let formData = new FormData()
let imageURL = URL.createObjectURL(imageFile)
const formData = new FormData()
const imageURL = URL.createObjectURL(imageFile)
formData.append(fieldName, imageFile)
// Emit FormData & image URL to the parent component
this.$emit('input', { formData, imageURL })

View File

@ -2,9 +2,9 @@ import { createLocalVue } from '@vue/test-utils'
import ElementUI from 'element-ui'
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
import Vuex from 'vuex'
import { ValidationProvider, ValidationObserver } from 'vee-validate'
import { ValidationProvider, ValidationObserver, extend } from 'vee-validate'
import * as rules from 'vee-validate/dist/rules'
import { extend } from 'vee-validate'
import { messages } from 'vee-validate/dist/locale/en.json'
import BaseInput from '@/components/Inputs/BaseInput.vue'
import BaseButton from '@/components/BaseButton.vue'

View File

@ -23,6 +23,7 @@ module.exports = {
assets: path.join(__dirname, 'src/assets'),
},
},
// eslint-disable-next-line new-cap
plugins: [new dotenv()],
},
css: {