From 9041bfef62019ecb6da479d5f19e95bdf1f9482b Mon Sep 17 00:00:00 2001 From: pimlie Date: Fri, 3 Jan 2020 10:30:33 +0100 Subject: [PATCH] chore: lint --- src/client/load.js | 2 +- src/client/update.js | 1 + src/server/generators/tag.js | 2 +- src/shared/$meta.js | 14 +++++++------- test/unit/getComponentOptions.test.js | 4 ++-- test/utils/build.js | 6 +++--- test/utils/meta-info-data.js | 19 +++++++++++-------- 7 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/client/load.js b/src/client/load.js index 35f7c0c..7c14cf3 100644 --- a/src/client/load.js +++ b/src/client/load.js @@ -25,7 +25,7 @@ export function addCallback (query, callback) { query = '' } - callbacks.push([ query, callback ]) + callbacks.push([query, callback]) } export function addCallbacks ({ tagIDKeyName }, type, tags, autoAddListeners) { diff --git a/src/client/update.js b/src/client/update.js index 3e661ee..035c9b2 100644 --- a/src/client/update.js +++ b/src/client/update.js @@ -13,6 +13,7 @@ export function triggerUpdate ({ debounceWait }, rootVm, hookName) { if (rootVm[rootConfigKey].initialized && !rootVm[rootConfigKey].pausing) { // batch potential DOM updates to prevent extraneous re-rendering + // eslint-disable-next-line no-void batchUpdate(() => void rootVm.$meta().refresh(), debounceWait) } } diff --git a/src/server/generators/tag.js b/src/server/generators/tag.js index 0eab0e9..319fb56 100644 --- a/src/server/generators/tag.js +++ b/src/server/generators/tag.js @@ -50,7 +50,7 @@ export default function tagGenerator (options, type, tags, generatorOptions) { } if (attr === 'callback') { - attrs += ` onload="this.__vm_l=1"` + attrs += ' onload="this.__vm_l=1"' continue } diff --git a/src/shared/$meta.js b/src/shared/$meta.js index 26b4ea9..b237314 100644 --- a/src/shared/$meta.js +++ b/src/shared/$meta.js @@ -16,8 +16,8 @@ export default function $meta (options) { const $root = this.$root return { - 'getOptions': () => getOptions(options), - 'setOptions': (newOptions) => { + getOptions: () => getOptions(options), + setOptions: (newOptions) => { const refreshNavKey = 'refreshOnceOnNavigation' if (newOptions && newOptions[refreshNavKey]) { options.refreshOnceOnNavigation = !!newOptions[refreshNavKey] @@ -37,10 +37,10 @@ export default function $meta (options) { options.waitOnDestroyed = !!newOptions[waitOnDestroyedKey] } }, - 'refresh': () => refresh($root, options), - 'inject': () => process.server ? inject($root, options) : showWarningNotSupportedInBrowserBundle('inject'), - 'pause': () => pause($root), - 'resume': () => resume($root), - 'addApp': appId => addApp($root, appId, options) + refresh: () => refresh($root, options), + inject: () => process.server ? inject($root, options) : showWarningNotSupportedInBrowserBundle('inject'), + pause: () => pause($root), + resume: () => resume($root), + addApp: appId => addApp($root, appId, options) } } diff --git a/test/unit/getComponentOptions.test.js b/test/unit/getComponentOptions.test.js index 57816c8..d7b6c8e 100644 --- a/test/unit/getComponentOptions.test.js +++ b/test/unit/getComponentOptions.test.js @@ -109,8 +109,8 @@ describe('getComponentOption', () => { const component = localVue.component('parent', { render: h => h('div', null, [ - h('meta-child', null, [ h('nometa-child') ]), - h('nometa-child', null, [ h('meta-child') ]), + h('meta-child', null, [h('nometa-child')]), + h('nometa-child', null, [h('meta-child')]), h('nometa-child') ]) }) diff --git a/test/utils/build.js b/test/utils/build.js index 043e316..5254187 100644 --- a/test/utils/build.js +++ b/test/utils/build.js @@ -23,7 +23,7 @@ export function getVueMetaPath (browser) { } process.server = !browser - return path.resolve(__dirname, `../../src`) + return path.resolve(__dirname, '../../src') } export function webpackRun (config) { @@ -152,7 +152,7 @@ export function createWebpackConfig (config = {}) { new webpack.DefinePlugin({ 'process.env': { // make sure our simple polyfills are enabled - 'NODE_ENV': '"test"' + NODE_ENV: '"test"' } }), new CopyWebpackPlugin([ @@ -161,7 +161,7 @@ export function createWebpackConfig (config = {}) { ], resolve: { alias: { - 'vue': 'vue/dist/vue.esm.js', + vue: 'vue/dist/vue.esm.js', 'vue-meta': getVueMetaPath(true) } }, diff --git a/test/utils/meta-info-data.js b/test/utils/meta-info-data.js index 627b5f6..d2ef247 100644 --- a/test/utils/meta-info-data.js +++ b/test/utils/meta-info-data.js @@ -118,13 +118,14 @@ const metaInfoData = { { src: 'src-prepend', async: true, defer: false, pbody: true }, { src: 'src2', async: false, defer: true, body: true }, { src: 'src3', async: false, skip: true }, - { type: 'application/ld+json', + { + type: 'application/ld+json', json: { '@context': 'http://schema.org', '@type': 'Organization', - 'name': 'MyApp', - 'url': 'https://www.myurl.com', - 'logo': 'https://www.myurl.com/images/logo.png' + name: 'MyApp', + url: 'https://www.myurl.com', + logo: 'https://www.myurl.com/images/logo.png' } } ], @@ -280,10 +281,12 @@ const metaInfoData = { defaultTest() if (side === 'client') { - expect(attributeMap).toEqual({ bodyAttrs: { - foo: { ssr: 'bar' }, - fizz: { ssr: ['fuzz', 'fozz'] } - } }) + expect(attributeMap).toEqual({ + bodyAttrs: { + foo: { ssr: 'bar' }, + fizz: { ssr: ['fuzz', 'fozz'] } + } + }) } } }