Skip to content

Commit 2a6fe42

Browse files
committed
lint
1 parent de457da commit 2a6fe42

File tree

9 files changed

+18
-24
lines changed

9 files changed

+18
-24
lines changed

.eslintrc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
module.exports = {
22
root: true,
3-
extends: ['plugin:vue-libs/recommended']
3+
extends: ['plugin:vue-libs/recommended'],
4+
rules: {
5+
indent: ['error', 2, { MemberExpression: 'off' }]
6+
}
47
}

lib/app/Content.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export default {
1717
const componentName = this.$page.path === '/'
1818
? 'index'
1919
: this.$page.path
20-
.replace(/^\//, '')
21-
.replace(/\.html$/, '')
22-
.replace(/\//g, '-')
20+
.replace(/^\//, '')
21+
.replace(/\.html$/, '')
22+
.replace(/\//g, '-')
2323
return h('page-' + componentName)
2424
}
2525
}
@@ -34,9 +34,7 @@ function getTitle (vm) {
3434
? selfTitle
3535
? (siteTitle + ' | ' + selfTitle)
3636
: siteTitle
37-
: selfTitle
38-
? selfTitle
39-
: 'VuePress'
37+
: selfTitle || 'VuePress'
4038
}
4139

4240
function getLang (vm) {

lib/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = async function build (sourceDir, cliOptions = {}) {
5454

5555
// if the user does not have a custom 404.md, generate the theme's default
5656
if (!options.siteData.pages.some(p => p.path === '/404.html')) {
57-
await renderPage({ path: '/404.html'})
57+
await renderPage({ path: '/404.html' })
5858
}
5959

6060
// DONE.

lib/markdown/highlight.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ module.exports = (str, lang) => {
1010
loadLanguages([lang])
1111
} catch (e) {
1212
throw new Error(`[vuepress] Syntax highlight for language "${lang}" is not supported.`)
13-
return ''
1413
}
1514
}
1615
if (prism.languages[lang]) {
17-
let res = prism.highlight(str, prism.languages[lang], lang)
16+
const res = prism.highlight(str, prism.languages[lang], lang)
1817
return `<pre class="language-${lang}"><code v-pre>${res}</code></pre>`
1918
}
2019
return ''

lib/markdown/index.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ module.exports = ({ markdown = {}}) => {
1414
typographer: true,
1515
highlight
1616
})
17-
.use(convertRouterLink)
18-
.use(anchor, Object.assign({ permalink: true, permalinkBefore: true }, markdown.anchor))
19-
.use(toc, Object.assign({ includeLevel: [2, 3] }, markdown.toc))
20-
.use(container, 'tip')
21-
.use(container, 'warning')
22-
.use(container, 'danger')
17+
.use(convertRouterLink)
18+
.use(anchor, Object.assign({ permalink: true, permalinkBefore: true }, markdown.anchor))
19+
.use(toc, Object.assign({ includeLevel: [2, 3] }, markdown.toc))
20+
.use(container, 'tip')
21+
.use(container, 'warning')
22+
.use(container, 'danger')
2323
}

lib/webpack/markdownLoader.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const frontmatter = require('yaml-front-matter')
33

44
module.exports = function (src) {
55
const { markdown } = getOptions(this)
6-
currentFile = this.resourcePath
76
const content = frontmatter.loadFront(src).__content
87
const html = markdown.render(content)
98
return `<template><div class="markdown">${html}</div></template>`

lib/webpack/serverConfig.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module.exports = function createServerConfig (options) {
33
const path = require('path')
44
const WebpackBar = require('webpackbar')
55
const createBaseConfig = require('./baseConfig')
6-
const nodeExternals = require('webpack-node-externals')
76
const VueSSRServerPlugin = require('vue-server-renderer/server-plugin')
87
const CopyPlugin = require('copy-webpack-plugin')
98

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
},
99
"scripts": {
1010
"dev": "node bin/vuepress dev docs",
11-
"build": "node bin/vuepress build docs"
11+
"build": "node bin/vuepress build docs",
12+
"lint": "eslint bin lib test"
1213
},
1314
"repository": {
1415
"type": "git",
@@ -74,7 +75,6 @@
7475
"vue-template-compiler": "^2.5.16",
7576
"webpack": "^4.4.1",
7677
"webpack-chain": "^4.5.0",
77-
"webpack-node-externals": "^1.7.2",
7878
"webpack-serve": "^0.3.1",
7979
"webpackbar": "^2.6.1",
8080
"yaml-front-matter": "^4.0.0"

yarn.lock

-4
Original file line numberDiff line numberDiff line change
@@ -5866,10 +5866,6 @@ webpack-log@^1.0.1, webpack-log@^1.1.1, webpack-log@^1.1.2:
58665866
loglevelnext "^1.0.1"
58675867
uuid "^3.1.0"
58685868

5869-
webpack-node-externals@^1.7.2:
5870-
version "1.7.2"
5871-
resolved "https://registry.yarnpkg.com/webpack-node-externals/-/webpack-node-externals-1.7.2.tgz#6e1ee79ac67c070402ba700ef033a9b8d52ac4e3"
5872-
58735869
webpack-serve@^0.3.1:
58745870
version "0.3.1"
58755871
resolved "https://registry.yarnpkg.com/webpack-serve/-/webpack-serve-0.3.1.tgz#a91a99d013a70d2c15df2d12c5d31a8842c033ba"

0 commit comments

Comments
 (0)