From 0e12d978bbe47e81d9ddaf2f7868ffa2bf0b7da5 Mon Sep 17 00:00:00 2001 From: Kevin van der Werff Date: Tue, 1 Oct 2019 14:33:26 +0200 Subject: [PATCH] :rotating_light: :art: add new rules & fix linter warnings --- .eslintrc.js | 6 ++++-- components/Card.vue | 6 +++++- components/Logo.vue | 4 ++-- components/Sidebar.vue | 10 +++++----- components/TableRow.vue | 8 ++++++-- layouts/default.vue | 4 ++-- nuxt.config.js | 16 ++++++++-------- pages/_category.vue | 4 ++-- plugins/i18n.js | 4 ++-- postcss.config.js | 4 ++-- store/Sidebar.js | 6 +++--- store/data.js | 10 +++++----- store/store.js | 4 ++-- 13 files changed, 48 insertions(+), 38 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6edb804..aab30e7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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', } } \ No newline at end of file diff --git a/components/Card.vue b/components/Card.vue index bb7de71..6194da3 100644 --- a/components/Card.vue +++ b/components/Card.vue @@ -10,7 +10,11 @@ diff --git a/components/Logo.vue b/components/Logo.vue index 85512bc..64c719b 100644 --- a/components/Logo.vue +++ b/components/Logo.vue @@ -9,8 +9,8 @@ export default { methods: { goToHome() { this.$router.push('/') - } - } + }, + }, } diff --git a/components/Sidebar.vue b/components/Sidebar.vue index 5f3667d..052b51d 100644 --- a/components/Sidebar.vue +++ b/components/Sidebar.vue @@ -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', + }), + }, } diff --git a/components/TableRow.vue b/components/TableRow.vue index 0deea3e..ff30ccf 100644 --- a/components/TableRow.vue +++ b/components/TableRow.vue @@ -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 diff --git a/layouts/default.vue b/layouts/default.vue index 52175e3..5fd5780 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -17,8 +17,8 @@ export default { Github, Logo, Search, - Sidebar - } + Sidebar, + }, } diff --git a/nuxt.config.js b/nuxt.config.js index 1bb057c..6b02e6d 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -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', - ] + ], } diff --git a/pages/_category.vue b/pages/_category.vue index b0a8434..b8c533c 100644 --- a/pages/_category.vue +++ b/pages/_category.vue @@ -46,8 +46,8 @@ export default { } catch (e) { console.error(e) } - } - } + }, + }, } diff --git a/plugins/i18n.js b/plugins/i18n.js index e4208be..49a8e2d 100644 --- a/plugins/i18n.js +++ b/plugins/i18n.js @@ -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) => { diff --git a/postcss.config.js b/postcss.config.js index 88752c6..f581565 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,5 +1,5 @@ module.exports = { plugins: [ - require('autoprefixer') - ] + require('autoprefixer'), + ], } diff --git a/store/Sidebar.js b/store/Sidebar.js index b47efa3..dfc30cc 100644 --- a/store/Sidebar.js +++ b/store/Sidebar.js @@ -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 - } + }, } diff --git a/store/data.js b/store/data.js index b54b31c..2648b74 100644 --- a/store/data.js +++ b/store/data.js @@ -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) => { diff --git a/store/store.js b/store/store.js index a48f0d9..fe39ca2 100644 --- a/store/store.js +++ b/store/store.js @@ -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 } - } + }, }