Skip to content

Commit

Permalink
chore: lint code with always comma-dangle
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Dec 18, 2018
1 parent 803d907 commit 88af19e
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 56 deletions.
8 changes: 5 additions & 3 deletions .eslintrc.js
Expand Up @@ -2,7 +2,9 @@ module.exports = {
root: true,
parser: 'babel-eslint',
extends: [
'standard'
]
'standard',
],
rules: {
'comma-dangle': ['error', 'always-multiline'],
},
}

30 changes: 15 additions & 15 deletions docs/.vuepress/config.js
Expand Up @@ -4,16 +4,16 @@ module.exports = {
'/': {
lang: 'en-US',
title: 'Vue Showdown',
description: 'Use showdown.js in Vue'
description: 'Use showdown.js in Vue',
},
'/zh/': {
lang: 'zh-CN',
title: 'Vue Showdown',
description: '在 Vue 中快速使用 showdown.js'
}
description: '在 Vue 中快速使用 showdown.js',
},
},
head: [
['link', { rel: 'icon', href: `/logo.png` }]
['link', { rel: 'icon', href: `/logo.png` }],
],
serviceWorker: true,
themeConfig: {
Expand All @@ -29,13 +29,13 @@ module.exports = {
nav: [
{
text: 'Guide',
link: '/guide/'
link: '/guide/',
},
{
text: 'Playground',
link: '/playground/'
}
]
link: '/playground/',
},
],
},
'/zh/': {
label: '简体中文',
Expand All @@ -45,14 +45,14 @@ module.exports = {
nav: [
{
text: '指南',
link: '/zh/guide/'
link: '/zh/guide/',
},
{
text: 'Playground',
link: '/zh/playground/'
}
]
}
}
}
link: '/zh/playground/',
},
],
},
},
},
}
6 changes: 3 additions & 3 deletions scripts/dev/index.js
Expand Up @@ -41,8 +41,8 @@ new Vue({
underline: false,
completeHTMLDocument: false,
metadata: false,
splitAdjacentBlockquotes: false
}
splitAdjacentBlockquotes: false,
},
}
}
},
})
16 changes: 8 additions & 8 deletions scripts/rollup.config.js
Expand Up @@ -8,34 +8,34 @@ const utils = require('./utils')
export default [
{
file: 'vue-showdown.js',
format: 'umd'
format: 'umd',
},
{
file: 'vue-showdown.min.js',
format: 'umd'
format: 'umd',
},
{
file: 'vue-showdown.common.js',
format: 'cjs'
format: 'cjs',
},
{
file: 'vue-showdown.esm.js',
format: 'es'
}
format: 'es',
},
].map(opts => {
const config = {
input: utils.srcPath('index.js'),
output: {
file: opts.file,
format: opts.format,
dir: utils.distPath(),
name: 'VueShowdown'
name: 'VueShowdown',
},
plugins: [
resolve(),
cjs(),
babel()
]
babel(),
],
}
if (/min\.js$/.test(opts.file)) {
config.plugins.push(uglify())
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils.js
Expand Up @@ -27,5 +27,5 @@ function distPath (...args) {
module.exports = {
rootPath,
srcPath,
distPath
distPath,
}
32 changes: 16 additions & 16 deletions scripts/webpack.config.js
Expand Up @@ -9,26 +9,26 @@ const webpackDevConfig = {
mode: 'development',
devtool: 'cheap-module-eval-source-map',
entry: {
app: './scripts/dev/index.js'
app: './scripts/dev/index.js',
},
output: {
path: utils.distPath(),
filename: '[name].js'
filename: '[name].js',
},
devServer: {
contentBase: false,
hot: true,
compress: true,
host: process.platform === 'win32' ? 'localhost' : '0.0.0.0',
port: 8000,
quiet: true
quiet: true,
},
resolve: {
extensions: ['.js', '.vue'],
alias: {
'vue-showdown': utils.srcPath(),
'vue$': 'vue/dist/vue.esm.js'
}
'vue$': 'vue/dist/vue.esm.js',
},
},
module: {
rules: [
Expand All @@ -38,25 +38,25 @@ const webpackDevConfig = {
loader: 'eslint-loader',
exclude: /node_modules/,
options: {
fix: true
}
fix: true,
},
},

{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
loader: 'babel-loader',
},
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),

new HtmlWebpackPlugin({
filename: 'index.html',
template: 'scripts/dev/index.html',
inject: true
})
inject: true,
}),
],
node: {
Buffer: false,
Expand All @@ -67,8 +67,8 @@ const webpackDevConfig = {
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
child_process: 'empty',
},
}

module.exports = new Promise((resolve, reject) => {
Expand All @@ -80,8 +80,8 @@ module.exports = new Promise((resolve, reject) => {
webpackDevConfig.devServer.port = port
webpackDevConfig.plugins.push(new FriendlyErrorsPlugin({
compilationSuccessInfo: {
messages: [`Webpack dev server is listening: http://${webpackDevConfig.devServer.host}:${port}`]
}
messages: [`Webpack dev server is listening: http://${webpackDevConfig.devServer.host}:${port}`],
},
}))
resolve(webpackDevConfig)
}
Expand Down
18 changes: 9 additions & 9 deletions src/components/vue-showdown.js
Expand Up @@ -10,7 +10,7 @@ export default {
markdown: {
type: String,
required: false,
default: null
default: null,
},

/**
Expand All @@ -19,7 +19,7 @@ export default {
tag: {
type: String,
required: false,
default: 'div'
default: 'div',
},

/**
Expand All @@ -31,7 +31,7 @@ export default {
type: String,
required: false,
default: 'vanilla',
validator: flavor => ['original', 'vanilla', 'github'].includes(flavor)
validator: flavor => ['original', 'vanilla', 'github'].includes(flavor),
},

/**
Expand Down Expand Up @@ -84,8 +84,8 @@ export default {
required: false,
default () {
return Object.create(null)
}
}
},
},
},

computed: {
Expand All @@ -97,14 +97,14 @@ export default {
},
outputHtml () {
return this.converter ? this.converter.makeHtml(this.inputMarkdown) : ''
}
},
},

render (h) {
return h(this.tag, {
domProps: {
innerHTML: this.outputHtml
}
innerHTML: this.outputHtml,
},
})
}
},
}
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -8,7 +8,7 @@ const VueShowdown = {
}
Vue.component('VueShowdown', VueShowdownComponent)
},
VueShowdown: VueShowdownComponent
VueShowdown: VueShowdownComponent,
}

export default VueShowdown
Expand Down

0 comments on commit 88af19e

Please sign in to comment.