🚨 🎨 add new rules & fix linter warnings

This commit is contained in:
Kevin van der Werff
2019-10-01 14:33:26 +02:00
committed by Kevin
parent 6a2e1a58d5
commit 0e12d978bb
13 changed files with 48 additions and 38 deletions

View File

@@ -20,9 +20,11 @@ module.exports = {
],
// add your custom rules here
rules: {
'semi': [2, 'never'],
'semi': ['error', 'never'],
'no-console': 'off',
'vue/max-attributes-per-line': 'off',
'quotes': [2, 'single', { 'avoidEscape': true }],
'quotes': ['error', 'single', { 'avoidEscape': true }],
'comma-dangle': ['error', 'always-multiline'],
'vue/require-default-prop': 'off',
}
}

View File

@@ -10,7 +10,11 @@
<script>
export default {
props: ['resource', 'isActive', 'createCopyUrl'],
props: {
resource: Object,
isActive: Boolean,
createCopyUrl: Function,
},
}
</script>

View File

@@ -9,8 +9,8 @@ export default {
methods: {
goToHome() {
this.$router.push('/')
}
}
},
},
}
</script>

View File

@@ -15,22 +15,22 @@ import { mapMutations } from 'vuex'
export default {
data() {
return {
categories: [{ slug: '', title: '' }]
categories: [{ slug: '', title: '' }],
}
},
computed: {
areCardsVisible() {
return this.$store.getters['Sidebar/areCardsVisible']
}
},
},
created() {
this.categories = this.$store.getters['data/resources'].map(({ title, slug }) => ({ title, slug }))
},
methods: {
...mapMutations({
toggleCardsVisible: 'Sidebar/toggleCardsVisible'
})
}
toggleCardsVisible: 'Sidebar/toggleCardsVisible',
}),
},
}
</script>

View File

@@ -5,14 +5,18 @@
td.tableRow--links
tr
td
a.tableRow--reference(@click='createCopyUrl(resource)') Copy
a.tableRow--reference(@click="createCopyUrl(resource)") Copy
td
a.tableRow--target(:href="resource.url" :target='resource.title' rel='noreferrer') Open
</template>
<script>
export default {
props: ['resource', 'isActive', 'createCopyUrl'],
props: {
resource: Object,
isActive: Boolean,
createCopyUrl: Function,
},
}
</script>

View File

@@ -17,8 +17,8 @@ export default {
Github,
Logo,
Search,
Sidebar
}
Sidebar,
},
}
</script>

View File

@@ -18,18 +18,18 @@ export default {
{ rel:'manifest', href:'/site.webmanifest' },
{ rel:'icon', type:'image/png', sizes:'16x16', href:'/favicon-16x16.png' },
{ rel:'icon', type:'image/png', sizes:'32x32', href:'/favicon-32x32.png' },
{ rel:'apple-touch-icon', sizes:'76x76', href:'/apple-touch-icon.png' }
{ rel:'apple-touch-icon', sizes:'76x76', href:'/apple-touch-icon.png' },
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
],
},
/*
** Generate dynamic routes
*/
generate: {
routes: resources.map(category => category.slug)
routes: resources.map(category => category.slug),
},
/**
@@ -42,10 +42,10 @@ export default {
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
exclude: /(node_modules)/,
})
}
}
},
},
/*
@@ -54,12 +54,12 @@ export default {
loading: { color: '#fff' },
plugins: [
'~/plugins/i18n.js'
'~/plugins/i18n.js',
],
/*
** Nuxt.js modules
*/
modules: [
'nuxt-clipboard2',
]
],
}

View File

@@ -46,8 +46,8 @@ export default {
} catch (e) {
console.error(e)
}
}
}
},
},
}
</script>

View File

@@ -11,8 +11,8 @@ export default ({ app, store }) => {
fallbackLocale: 'en',
messages: {
'en': require('~/locales/en.json'),
'fr': require('~/locales/fr.json')
}
'fr': require('~/locales/fr.json'),
},
})
app.i18n.path = (link) => {

View File

@@ -1,5 +1,5 @@
module.exports = {
plugins: [
require('autoprefixer')
]
require('autoprefixer'),
],
}

View File

@@ -1,14 +1,14 @@
export const state = () => ({
areCardsVisible: true
areCardsVisible: true,
})
export const getters = {
areCardsVisible: state => state.areCardsVisible
areCardsVisible: state => state.areCardsVisible,
}
export const mutations = {
toggleCardsVisible(state) {
if (process.browser) localStorage.setItem('areCardsVisible', !state.areCardsVisible)
state.areCardsVisible = !state.areCardsVisible
}
},
}

View File

@@ -17,7 +17,7 @@ if (!Array.prototype.flat) {
return acc
}, []) : Array.prototype.slice.call(this)
},
writable: true
writable: true,
})
}
@@ -39,14 +39,14 @@ export const state = () => ({
cleanTitle,
path: `${category.slug}?card=${cleanTitle}`,
}
})
}),
})),
// List of all tags, duplicates removed
tags: [...new Set(
resources
.map(resource => resource.resources).flat()
.map(resource => resource.tags).flat()
)]
)],
})
export const getters = {
@@ -64,9 +64,9 @@ export const getters = {
const clone = [...category.resources]
return {
...category,
resources: clone.sort(compareTitles)
resources: clone.sort(compareTitles),
}
}
},
}
const compareTitles = (x, y) => {

View File

@@ -1,6 +1,6 @@
export const state = () => ({
locales: ['en', 'fr', 'de'],
locale: 'en'
locale: 'en',
})
export const mutations = {
@@ -8,5 +8,5 @@ export const mutations = {
if (state.locales.indexOf(locale) !== -1) {
state.locale = locale
}
}
},
}