diff --git a/.eslintrc.js b/.eslintrc.js
index a694c834..0d87945d 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -6,6 +6,7 @@ module.exports = {
],
rules: {
indent: ['error', 2, { MemberExpression: 'off' }],
- "no-undef": ["error"]
+ "no-undef": ["error"],
+ 'operator-linebreak': ["error", "before"]
}
}
diff --git a/packages/@vuepress/core/lib/app/app.js b/packages/@vuepress/core/lib/app/app.js
index 9adb77c0..1adc33e3 100644
--- a/packages/@vuepress/core/lib/app/app.js
+++ b/packages/@vuepress/core/lib/app/app.js
@@ -21,8 +21,8 @@ if (module.hot) {
module.hot.accept(VUEPRESS_TEMP_PATH + '/internal/siteData.js', () => {
if (siteData.base !== prevBase) {
window.alert(
- `[vuepress] Site base has changed. ` +
- `Please restart dev server to ensure correct asset paths.`
+ `[vuepress] Site base has changed. `
+ + `Please restart dev server to ensure correct asset paths.`
)
}
})
diff --git a/packages/@vuepress/core/lib/dev.js b/packages/@vuepress/core/lib/dev.js
index 6c683815..c8051d39 100644
--- a/packages/@vuepress/core/lib/dev.js
+++ b/packages/@vuepress/core/lib/dev.js
@@ -101,8 +101,8 @@ async function prepareServer (sourceDir, cliOptions = {}, context) {
const { host, displayHost } = await resolveHost(cliOptions.host || ctx.siteConfig.host)
// debug in a running dev process.
- process.stdin &&
- process.stdin.on('data', chunk => {
+ process.stdin
+ && process.stdin.on('data', chunk => {
const parsed = chunk.toString('utf-8').trim()
if (parsed === '*') {
console.log(Object.keys(ctx))
diff --git a/packages/@vuepress/core/lib/internal-plugins/frontmatterBlock/loader.js b/packages/@vuepress/core/lib/internal-plugins/frontmatterBlock/loader.js
index bb29bece..c36c6fd3 100644
--- a/packages/@vuepress/core/lib/internal-plugins/frontmatterBlock/loader.js
+++ b/packages/@vuepress/core/lib/internal-plugins/frontmatterBlock/loader.js
@@ -12,11 +12,11 @@ module.exports = function (source, map) {
const cached = cache.get(file)
const parsed = parseStrippedFrontmatter(source)
- if (cached &&
- cached.data &&
- parsed &&
- parsed.data &&
- JSON.stringify(cached.data) !== JSON.stringify(parsed.data)
+ if (cached
+ && cached.data
+ && parsed
+ && parsed.data
+ && JSON.stringify(cached.data) !== JSON.stringify(parsed.data)
) {
frontmatterEmitter.emit('update')
}
diff --git a/packages/@vuepress/core/lib/plugin-api/index.js b/packages/@vuepress/core/lib/plugin-api/index.js
index 69649f80..83639fb5 100644
--- a/packages/@vuepress/core/lib/plugin-api/index.js
+++ b/packages/@vuepress/core/lib/plugin-api/index.js
@@ -169,8 +169,8 @@ module.exports = class PluginAPI {
this.options[option.name].add(pluginName, value)
} else if (value !== undefined) {
logger.warn(
- `${chalk.gray(pluginName)} ` +
- `Invalid value for "option" ${chalk.cyan(option.name)}: ${warnMsg}`
+ `${chalk.gray(pluginName)} `
+ + `Invalid value for "option" ${chalk.cyan(option.name)}: ${warnMsg}`
)
}
return this
diff --git a/packages/@vuepress/core/lib/plugin-api/override/EnhanceAppFilesOption.js b/packages/@vuepress/core/lib/plugin-api/override/EnhanceAppFilesOption.js
index d9446d5c..c109c130 100644
--- a/packages/@vuepress/core/lib/plugin-api/override/EnhanceAppFilesOption.js
+++ b/packages/@vuepress/core/lib/plugin-api/override/EnhanceAppFilesOption.js
@@ -67,8 +67,8 @@ module.exports = class EnhanceAppFilesOption extends AsyncOption {
}
} else {
logger.developer(
- chalk.gray(`[${pluginName}] `) +
- `${chalk.cyan(enhanceAppFile)} Not Found.`
+ chalk.gray(`[${pluginName}] `)
+ + `${chalk.cyan(enhanceAppFile)} Not Found.`
)
}
}
diff --git a/packages/@vuepress/core/lib/plugin-api/util.js b/packages/@vuepress/core/lib/plugin-api/util.js
index bf40a15c..706da428 100644
--- a/packages/@vuepress/core/lib/plugin-api/util.js
+++ b/packages/@vuepress/core/lib/plugin-api/util.js
@@ -26,8 +26,8 @@ exports.flattenPlugin = function (
if (!valid) {
if (pluginOptions !== undefined) {
logger.warn(
- `[${chalk.gray(shortcut)}] ` +
- `Invalid value for "pluginOptions" ${chalk.cyan(name)}: ${warnMsg}`
+ `[${chalk.gray(shortcut)}] `
+ + `Invalid value for "pluginOptions" ${chalk.cyan(name)}: ${warnMsg}`
)
}
pluginOptions = {}
@@ -69,8 +69,8 @@ exports.normalizePluginsConfig = function (pluginsConfig) {
if (!valid) {
if (pluginsConfig !== undefined) {
logger.warn(
- `[${chalk.gray('config')}] ` +
- `Invalid value for "plugin" field : ${warnMsg}`
+ `[${chalk.gray('config')}] `
+ + `Invalid value for "plugin" field : ${warnMsg}`
)
}
pluginsConfig = []
diff --git a/packages/@vuepress/core/lib/prepare/AppContext.js b/packages/@vuepress/core/lib/prepare/AppContext.js
index c1176a15..09aee105 100644
--- a/packages/@vuepress/core/lib/prepare/AppContext.js
+++ b/packages/@vuepress/core/lib/prepare/AppContext.js
@@ -130,8 +130,8 @@ module.exports = class AppContext {
const siteConfig = this.siteConfig
const shouldUseLastUpdated = (
- themeConfig.lastUpdated ||
- Object.keys(siteConfig.locales && themeConfig.locales || {})
+ themeConfig.lastUpdated
+ || Object.keys(siteConfig.locales && themeConfig.locales || {})
.some(base => themeConfig.locales[base].lastUpdated)
)
diff --git a/packages/@vuepress/core/lib/prepare/CacheLoader.js b/packages/@vuepress/core/lib/prepare/CacheLoader.js
index 7b611a3a..7d102914 100644
--- a/packages/@vuepress/core/lib/prepare/CacheLoader.js
+++ b/packages/@vuepress/core/lib/prepare/CacheLoader.js
@@ -38,19 +38,19 @@ exports.getCacheLoaderOptions = function (siteConfig, cliOptions, cwd, isProd) {
siteConfig.markdown
? JSON.stringify(siteConfig.markdown)
: ''
- ) +
- (
+ )
+ + (
siteConfig.markdown && siteConfig.markdown.extendMarkdown
? siteConfig.markdown.extendMarkdown.toString()
: ''
- ) +
- (
+ )
+ + (
siteConfig.extendMarkdown
? siteConfig.extendMarkdown.toString()
: ''
- ) +
- (siteConfig.chainWebpack || '').toString() +
- (siteConfig.configureWebpack || '').toString()
+ )
+ + (siteConfig.chainWebpack || '').toString()
+ + (siteConfig.configureWebpack || '').toString()
)
})
diff --git a/packages/@vuepress/core/lib/prepare/ClientComputedMixin.js b/packages/@vuepress/core/lib/prepare/ClientComputedMixin.js
index 2e99ba4c..dbe8a3f7 100644
--- a/packages/@vuepress/core/lib/prepare/ClientComputedMixin.js
+++ b/packages/@vuepress/core/lib/prepare/ClientComputedMixin.js
@@ -74,8 +74,8 @@ module.exports = siteData => {
const siteTitle = this.$siteTitle
const selfTitle = page.frontmatter.home ? null : (
- page.frontmatter.title || // explicit title
- page.title // inferred title
+ page.frontmatter.title // explicit title
+ || page.title // inferred title
)
return siteTitle
? selfTitle
diff --git a/packages/@vuepress/core/lib/prepare/loadTheme.js b/packages/@vuepress/core/lib/prepare/loadTheme.js
index dcede9eb..43056f73 100644
--- a/packages/@vuepress/core/lib/prepare/loadTheme.js
+++ b/packages/@vuepress/core/lib/prepare/loadTheme.js
@@ -34,10 +34,10 @@ module.exports = async function loadTheme (ctx) {
const themeResolver = getThemeResolver()
const localThemePath = path.resolve(vuepressDir, 'theme')
- const useLocalTheme =
- !fs.existsSync(theme) &&
- fs.existsSync(localThemePath) &&
- (fs.readdirSync(localThemePath)).length > 0
+ const useLocalTheme
+ = !fs.existsSync(theme)
+ && fs.existsSync(localThemePath)
+ && (fs.readdirSync(localThemePath)).length > 0
let themePath = null // Mandatory
let themeEntryFile = null // Optional
@@ -119,8 +119,8 @@ module.exports = async function loadTheme (ctx) {
const readdirSync = dir => fs.existsSync(dir) && fs.readdirSync(dir) || []
// built-in named layout or not.
- const isInternal = componentName => componentName === 'Layout' ||
- componentName === 'NotFound'
+ const isInternal = componentName => componentName === 'Layout'
+ || componentName === 'NotFound'
const layoutComponentMap = layoutDirs
.map(
diff --git a/packages/@vuepress/core/lib/webpack/DevLogPlugin.js b/packages/@vuepress/core/lib/webpack/DevLogPlugin.js
index 15a610d2..b51927e6 100644
--- a/packages/@vuepress/core/lib/webpack/DevLogPlugin.js
+++ b/packages/@vuepress/core/lib/webpack/DevLogPlugin.js
@@ -25,9 +25,9 @@ module.exports = class DevLogPlugin {
const displayUrl = `http://${displayHost}:${port}${publicPath}`
logger.success(
- `${chalk.gray(`[${time}]`)} Build ${chalk.italic(stats.hash.slice(0, 6))} ` +
- `finished in ${stats.endTime - stats.startTime} ms! ` +
- (
+ `${chalk.gray(`[${time}]`)} Build ${chalk.italic(stats.hash.slice(0, 6))} `
+ + `finished in ${stats.endTime - stats.startTime} ms! `
+ + (
isFirst
? ''
: `${chalk.gray(`(${displayUrl})`)}`
diff --git a/packages/@vuepress/markdown-loader/index.js b/packages/@vuepress/markdown-loader/index.js
index 2043fc9d..8e53a7e2 100644
--- a/packages/@vuepress/markdown-loader/index.js
+++ b/packages/@vuepress/markdown-loader/index.js
@@ -49,9 +49,9 @@ module.exports = function (src) {
// returned component, changes in frontmatter do not trigger proper updates
const cachedData = devCache.get(file)
if (cachedData && (
- cachedData.inferredTitle !== inferredTitle ||
- JSON.stringify(cachedData.frontmatterData) !== JSON.stringify(frontmatter.data) ||
- headersChanged(cachedData.headers, headers)
+ cachedData.inferredTitle !== inferredTitle
+ || JSON.stringify(cachedData.frontmatterData) !== JSON.stringify(frontmatter.data)
+ || headersChanged(cachedData.headers, headers)
)) {
// frontmatter changed... need to do a full reload
module.exports.frontmatterEmitter.emit('update')
@@ -91,19 +91,19 @@ module.exports = function (src) {
if (!fs.existsSync(file) && (!altfile || !fs.existsSync(altfile))) {
this.emitWarning(
new Error(
- `\nFile for relative link "${link}" does not exist.\n` +
- `(Resolved file: ${file})\n`
+ `\nFile for relative link "${link}" does not exist.\n`
+ + `(Resolved file: ${file})\n`
)
)
}
})
const res = (
- `\n` +
- `${html}\n` +
- `\n` +
- (hoistedTags || []).join('\n') +
- `\n${dataBlockString}\n`
+ `\n`
+ + `${html}\n`
+ + `\n`
+ + (hoistedTags || []).join('\n')
+ + `\n${dataBlockString}\n`
)
cache.set(key, res)
return res
@@ -112,8 +112,8 @@ module.exports = function (src) {
function headersChanged (a, b) {
if (a.length !== b.length) return true
return a.some((h, i) => (
- h.title !== b[i].title ||
- h.level !== b[i].level
+ h.title !== b[i].title
+ || h.level !== b[i].level
))
}
diff --git a/packages/@vuepress/markdown/lib/highlightLines.js b/packages/@vuepress/markdown/lib/highlightLines.js
index dd833432..c98dcc8e 100644
--- a/packages/@vuepress/markdown/lib/highlightLines.js
+++ b/packages/@vuepress/markdown/lib/highlightLines.js
@@ -41,8 +41,8 @@ module.exports = md => {
return '
'
}).join('')
- const highlightLinesWrapperCode =
- `
${highlightLinesCode}
`
+ const highlightLinesWrapperCode
+ = `${highlightLinesCode}
`
return highlightLinesWrapperCode + code
}
diff --git a/packages/@vuepress/markdown/lib/lineNumbers.js b/packages/@vuepress/markdown/lib/lineNumbers.js
index bc95d2b0..6ee2f431 100644
--- a/packages/@vuepress/markdown/lib/lineNumbers.js
+++ b/packages/@vuepress/markdown/lib/lineNumbers.js
@@ -14,8 +14,8 @@ module.exports = md => {
const lineNumbersCode = [...Array(lines.length - 1)]
.map((line, index) => `${index + 1}
`).join('')
- const lineNumbersWrapperCode =
- `${lineNumbersCode}
`
+ const lineNumbersWrapperCode
+ = `${lineNumbersCode}
`
const finalCode = rawCode
.replace('', `${lineNumbersWrapperCode}`)
diff --git a/packages/@vuepress/markdown/lib/preWrapper.js b/packages/@vuepress/markdown/lib/preWrapper.js
index 8f1b1d73..35f7ed77 100644
--- a/packages/@vuepress/markdown/lib/preWrapper.js
+++ b/packages/@vuepress/markdown/lib/preWrapper.js
@@ -13,7 +13,7 @@ module.exports = md => {
const [tokens, idx] = args
const token = tokens[idx]
const rawCode = fence(...args)
- return ``
+ return ``
}
}
diff --git a/packages/@vuepress/plugin-active-header-links/clientRootMixin.js b/packages/@vuepress/plugin-active-header-links/clientRootMixin.js
index 7c6ec7b8..20ec55e6 100644
--- a/packages/@vuepress/plugin-active-header-links/clientRootMixin.js
+++ b/packages/@vuepress/plugin-active-header-links/clientRootMixin.js
@@ -27,9 +27,9 @@ export default {
const anchor = anchors[i]
const nextAnchor = anchors[i + 1]
- const isActive = i === 0 && scrollTop === 0 ||
- (scrollTop >= anchor.parentElement.offsetTop + 10 &&
- (!nextAnchor || scrollTop < nextAnchor.parentElement.offsetTop - 10))
+ const isActive = i === 0 && scrollTop === 0
+ || (scrollTop >= anchor.parentElement.offsetTop + 10
+ && (!nextAnchor || scrollTop < nextAnchor.parentElement.offsetTop - 10))
if (isActive && decodeURIComponent(this.$route.hash) !== decodeURIComponent(anchor.hash)) {
this.$vuepress.$set('disableScrollBehavior', true)
diff --git a/packages/@vuepress/plugin-back-to-top/BackToTop.vue b/packages/@vuepress/plugin-back-to-top/BackToTop.vue
index ff7a7577..2ec371de 100644
--- a/packages/@vuepress/plugin-back-to-top/BackToTop.vue
+++ b/packages/@vuepress/plugin-back-to-top/BackToTop.vue
@@ -40,9 +40,9 @@ export default {
methods: {
getScrollTop () {
- return window.pageYOffset ||
- document.documentElement.scrollTop ||
- document.body.scrollTop || 0
+ return window.pageYOffset
+ || document.documentElement.scrollTop
+ || document.body.scrollTop || 0
},
scrollToTop () {
diff --git a/packages/@vuepress/plugin-pwa/lib/enhanceAppFile.js b/packages/@vuepress/plugin-pwa/lib/enhanceAppFile.js
index 44e0f98f..3054f3d1 100644
--- a/packages/@vuepress/plugin-pwa/lib/enhanceAppFile.js
+++ b/packages/@vuepress/plugin-pwa/lib/enhanceAppFile.js
@@ -12,9 +12,9 @@ if (SW_UPDATE_POPUP) {
export default ({ router, isServer }) => {
// Register service worker
router.onReady(() => {
- if (process.env.NODE_ENV === 'production' &&
- !isServer &&
- SW_ENABLED) {
+ if (process.env.NODE_ENV === 'production'
+ && !isServer
+ && SW_ENABLED) {
register(`${SW_BASE_URL}service-worker.js`, {
ready () {
console.log('[vuepress:sw] Service worker is active.')
diff --git a/packages/@vuepress/plugin-search/SearchBox.vue b/packages/@vuepress/plugin-search/SearchBox.vue
index 74e69610..6fbbd70b 100644
--- a/packages/@vuepress/plugin-search/SearchBox.vue
+++ b/packages/@vuepress/plugin-search/SearchBox.vue
@@ -49,9 +49,9 @@ export default {
computed: {
showSuggestions () {
return (
- this.focused &&
- this.suggestions &&
- this.suggestions.length
+ this.focused
+ && this.suggestions
+ && this.suggestions.length
)
},
@@ -65,8 +65,8 @@ export default {
const max = SEARCH_MAX_SUGGESTIONS
const localePath = this.$localePath
const matches = item => (
- item.title &&
- item.title.toLowerCase().indexOf(query) > -1
+ item.title
+ && item.title.toLowerCase().indexOf(query) > -1
)
const res = []
for (let i = 0; i < pages.length; i++) {
diff --git a/packages/@vuepress/shared-utils/scripts/update-index.js b/packages/@vuepress/shared-utils/scripts/update-index.js
index 03d23c8c..a5558b43 100644
--- a/packages/@vuepress/shared-utils/scripts/update-index.js
+++ b/packages/@vuepress/shared-utils/scripts/update-index.js
@@ -18,17 +18,17 @@ const EXPORTED_MODULES = [
['hash-sum', 'hash']
]
-const code =
- [
+const code
+ = [
...modules.map(v => getImport(v, `./${v}`)),
...EXPORTED_MODULES.map(v => Array.isArray(v) ? getImport(v[1], v[0]) : getImport(v, v))
- ].join('\n') +
- `\n\nexport {\n` +
- [
+ ].join('\n')
+ + `\n\nexport {\n`
+ + [
...modules,
...EXPORTED_MODULES.map(v => Array.isArray(v) ? v[1] : v)
- ].map(v => ` ${v},`).join('\n') +
- '\n}'
+ ].map(v => ` ${v},`).join('\n')
+ + '\n}'
fs.writeFileSync(target, code, 'utf-8')
diff --git a/packages/@vuepress/theme-default/components/Navbar.vue b/packages/@vuepress/theme-default/components/Navbar.vue
index 8298d76c..86565a03 100644
--- a/packages/@vuepress/theme-default/components/Navbar.vue
+++ b/packages/@vuepress/theme-default/components/Navbar.vue
@@ -58,8 +58,8 @@ export default {
if (document.documentElement.clientWidth < MOBILE_DESKTOP_BREAKPOINT) {
this.linksWrapMaxWidth = null
} else {
- this.linksWrapMaxWidth = this.$el.offsetWidth - NAVBAR_VERTICAL_PADDING -
- (this.$refs.siteName && this.$refs.siteName.offsetWidth || 0)
+ this.linksWrapMaxWidth = this.$el.offsetWidth - NAVBAR_VERTICAL_PADDING
+ - (this.$refs.siteName && this.$refs.siteName.offsetWidth || 0)
}
}
handleLinksWrapWidth()
diff --git a/packages/@vuepress/theme-default/components/Page.vue b/packages/@vuepress/theme-default/components/Page.vue
index d1d0649e..55710db3 100644
--- a/packages/@vuepress/theme-default/components/Page.vue
+++ b/packages/@vuepress/theme-default/components/Page.vue
@@ -129,9 +129,9 @@ export default {
editLinkText () {
return (
- this.$themeLocaleConfig.editLinkText ||
- this.$site.themeConfig.editLinkText ||
- `Edit this page`
+ this.$themeLocaleConfig.editLinkText
+ || this.$site.themeConfig.editLinkText
+ || `Edit this page`
)
}
},
@@ -144,12 +144,12 @@ export default {
? docsRepo
: repo
return (
- base.replace(endingSlashRE, '') +
- `/src` +
- `/${docsBranch}` +
- (docsDir ? '/' + docsDir.replace(endingSlashRE, '') : '') +
- path +
- `?mode=edit&spa=0&at=${docsBranch}&fileviewer=file-view-default`
+ base.replace(endingSlashRE, '')
+ + `/src`
+ + `/${docsBranch}`
+ + (docsDir ? '/' + docsDir.replace(endingSlashRE, '') : '')
+ + path
+ + `?mode=edit&spa=0&at=${docsBranch}&fileviewer=file-view-default`
)
}
@@ -158,10 +158,10 @@ export default {
: `https://github.com/${docsRepo}`
return (
- base.replace(endingSlashRE, '') +
- `/edit/${docsBranch}` +
- (docsDir ? '/' + docsDir.replace(endingSlashRE, '') : '') +
- path
+ base.replace(endingSlashRE, '')
+ + `/edit/${docsBranch}`
+ + (docsDir ? '/' + docsDir.replace(endingSlashRE, '') : '')
+ + path
)
}
}
diff --git a/packages/@vuepress/theme-default/components/SidebarLink.vue b/packages/@vuepress/theme-default/components/SidebarLink.vue
index 6a45295c..7d128b4a 100644
--- a/packages/@vuepress/theme-default/components/SidebarLink.vue
+++ b/packages/@vuepress/theme-default/components/SidebarLink.vue
@@ -30,15 +30,15 @@ export default {
: selfActive
const link = renderLink(h, item.path, item.title || item.path, active)
- const configDepth = $page.frontmatter.sidebarDepth ||
- sidebarDepth ||
- $themeLocaleConfig.sidebarDepth ||
- $themeConfig.sidebarDepth
+ const configDepth = $page.frontmatter.sidebarDepth
+ || sidebarDepth
+ || $themeLocaleConfig.sidebarDepth
+ || $themeConfig.sidebarDepth
const maxDepth = configDepth == null ? 1 : configDepth
- const displayAllHeaders = $themeLocaleConfig.displayAllHeaders ||
- $themeConfig.displayAllHeaders
+ const displayAllHeaders = $themeLocaleConfig.displayAllHeaders
+ || $themeConfig.displayAllHeaders
if (item.type === 'auto') {
return [link, renderChildren(h, item.children, item.basePath, $route, maxDepth)]
diff --git a/packages/@vuepress/theme-default/index.js b/packages/@vuepress/theme-default/index.js
index dd28d69b..3cafe568 100644
--- a/packages/@vuepress/theme-default/index.js
+++ b/packages/@vuepress/theme-default/index.js
@@ -6,8 +6,8 @@ module.exports = (options, ctx) => ({
const { themeConfig, siteConfig } = ctx
// resolve algolia
const isAlgoliaSearch = (
- themeConfig.algolia ||
- Object.keys(siteConfig.locales && themeConfig.locales || {})
+ themeConfig.algolia
+ || Object.keys(siteConfig.locales && themeConfig.locales || {})
.some(base => themeConfig.locales[base].algolia)
)
return {
diff --git a/packages/@vuepress/theme-default/layouts/Layout.vue b/packages/@vuepress/theme-default/layouts/Layout.vue
index de6a0f60..4803dfd7 100644
--- a/packages/@vuepress/theme-default/layouts/Layout.vue
+++ b/packages/@vuepress/theme-default/layouts/Layout.vue
@@ -68,25 +68,25 @@ export default {
const { themeConfig } = this.$site
const { frontmatter } = this.$page
if (
- frontmatter.navbar === false ||
- themeConfig.navbar === false) {
+ frontmatter.navbar === false
+ || themeConfig.navbar === false) {
return false
}
return (
- this.$title ||
- themeConfig.logo ||
- themeConfig.repo ||
- themeConfig.nav ||
- this.$themeLocaleConfig.nav
+ this.$title
+ || themeConfig.logo
+ || themeConfig.repo
+ || themeConfig.nav
+ || this.$themeLocaleConfig.nav
)
},
shouldShowSidebar () {
const { frontmatter } = this.$page
return (
- !frontmatter.home &&
- frontmatter.sidebar !== false &&
- this.sidebarItems.length
+ !frontmatter.home
+ && frontmatter.sidebar !== false
+ && this.sidebarItems.length
)
},
diff --git a/packages/@vuepress/theme-vue/components/CarbonAds.vue b/packages/@vuepress/theme-vue/components/CarbonAds.vue
index 9f413705..886e857a 100644
--- a/packages/@vuepress/theme-vue/components/CarbonAds.vue
+++ b/packages/@vuepress/theme-vue/components/CarbonAds.vue
@@ -9,11 +9,11 @@ export default {
watch: {
'$route' (to, from) {
if (
- to.path !== from.path &&
+ to.path !== from.path
// Only reload if the ad has been loaded
// otherwise it's possible that the script is appended but
// the ads are not loaded yet. This would result in duplicated ads.
- this.$el.querySelector('#carbonads')
+ && this.$el.querySelector('#carbonads')
) {
this.$el.innerHTML = ''
this.load()
diff --git a/packages/vuepress/lib/checkEnv.js b/packages/vuepress/lib/checkEnv.js
index 59020ae2..04a57d19 100644
--- a/packages/vuepress/lib/checkEnv.js
+++ b/packages/vuepress/lib/checkEnv.js
@@ -15,9 +15,9 @@ module.exports = function checkEnv (pkg) {
if (!semver.satisfies(process.version, requiredVersion)) {
console.log(chalk.red(
- `\n[vuepress] minimum Node version not met:` +
- `\nYou are using Node ${process.version}, but VuePress ` +
- `requires Node ${requiredVersion}.\nPlease upgrade your Node version.\n`
+ `\n[vuepress] minimum Node version not met:`
+ + `\nYou are using Node ${process.version}, but VuePress `
+ + `requires Node ${requiredVersion}.\nPlease upgrade your Node version.\n`
))
process.exit(1)
}
diff --git a/packages/vuepress/lib/handleUnknownCommand.js b/packages/vuepress/lib/handleUnknownCommand.js
index 6a127880..937f70dd 100644
--- a/packages/vuepress/lib/handleUnknownCommand.js
+++ b/packages/vuepress/lib/handleUnknownCommand.js
@@ -20,8 +20,8 @@ module.exports = async function (cli, options) {
const inferredUserDocsDirectory = await inferUserDocsDirectory(pwd)
logger.developer('inferredUserDocsDirectory', inferredUserDocsDirectory)
- const needPrepareBeforeLaunchCLI = inferredUserDocsDirectory &&
- (isHelpFlag(argv[0]) || isUnknownCommandHelp(argv))
+ const needPrepareBeforeLaunchCLI = inferredUserDocsDirectory
+ && (isHelpFlag(argv[0]) || isUnknownCommandHelp(argv))
logger.developer('needPrepareBeforeLaunchCLI', needPrepareBeforeLaunchCLI)