Skip to content

Commit

Permalink
Add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
doabit committed Aug 7, 2016
1 parent 77bf914 commit 5972ea0
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 7 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/*.js
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: 'standard',
// required to lint *.vue files
plugins: [
'html'
],
// add your custom rules here
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
}
}
21 changes: 19 additions & 2 deletions build/webpack.base.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path')

const projectRoot = path.resolve(__dirname, '../')
module.exports = {
devtool: '#source-map',
entry: {
Expand All @@ -15,6 +15,20 @@ module.exports = {
root: path.join(__dirname, '../node_modules'),
},
module: {
preLoaders: [
{
test: /\.vue$/,
loader: 'eslint',
include: projectRoot,
exclude: /node_modules/
},
{
test: /\.js$/,
loader: 'eslint',
include: projectRoot,
exclude: /node_modules/
}
],
loaders: [
{
test: /\.vue$/,
Expand All @@ -32,6 +46,9 @@ module.exports = {
name: '[name].[ext]?[hash]'
}
}
]
],
eslint: {
formatter: require('eslint-friendly-formatter')
}
}
}
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,18 @@
},
"devDependencies": {
"babel-core": "^6.13.2",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.0.0",
"babel-preset-es2015": "^6.13.2",
"babel-preset-stage-2": "^6.13.0",
"css-loader": "^0.23.1",
"eslint": "^3.2.2",
"eslint-config-standard": "^6.0.0-beta.2",
"eslint-friendly-formatter": "^2.0.6",
"eslint-loader": "^1.5.0",
"eslint-plugin-html": "^1.5.2",
"eslint-plugin-promise": "^2.0.1",
"eslint-plugin-standard": "^2.0.0",
"extract-text-webpack-plugin": "^2.0.0-beta.3",
"file-loader": "^0.8.4",
"vue-loader": "^9.2.2",
Expand Down
2 changes: 1 addition & 1 deletion src/client-entry.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { app } from './app'

app.$mount('#app')
app.$mount('#app')
2 changes: 1 addition & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ const router = new VueRouter({
]
})

export default router
export default router
2 changes: 1 addition & 1 deletion src/vuex/actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import request from 'axios'

request.defaults.baseURL = 'https://cnodejs.org/api/v1/';
request.defaults.baseURL = 'https://cnodejs.org/api/v1/'

export const getTopics = ({ commit, state }) => {
return request.get('topics').then((response) => {
Expand Down
4 changes: 2 additions & 2 deletions src/vuex/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const mutations = {
state.topics = topics
},

INCREMENT: (state) => {
INCREMENT: (state) => {
state.count++
},

DECREMENT: (state) => {
DECREMENT: (state) => {
state.count--
}
}
Expand Down

0 comments on commit 5972ea0

Please sign in to comment.