🚨 🎨 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 // add your custom rules here
rules: { rules: {
'semi': [2, 'never'], 'semi': ['error', 'never'],
'no-console': 'off', 'no-console': 'off',
'vue/max-attributes-per-line': '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> <script>
export default { export default {
props: ['resource', 'isActive', 'createCopyUrl'], props: {
resource: Object,
isActive: Boolean,
createCopyUrl: Function,
},
} }
</script> </script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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