Skip to content

Commit

Permalink
add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
mingzepeng committed Dec 10, 2015
1 parent 826d2c1 commit 6da1275
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 6 deletions.
37 changes: 37 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"rules": {
"indent": [
1,
"tab"
],
"quotes": [
1,
"single"
],
"linebreak-style": [
1,
"windows"
],
"semi": [
1,
"never"
]
},
"env": {
"es6": true,
"browser": true,
"node" : true
},
"extends": "eslint:recommended",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true,
"modules": true
},
"plugins": [
"react"
],
"globals": {
"__DEBUG__": true
}
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
dist
*.sublime-project
*.sublime-workspace
*.sublime-workspace
npm-debug.log
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{
"name": "react-boilerplate",
"version": "0.1.2",
"version": "0.1.3",
"description": "a react boilerplate",
"main": "main.js",
"dependencies": {
"es5-shim": "^4.3.1",
"es6-promise": "^3.0.2",
"react": "^0.14.3",
"react-dom": "^0.14.3"
"react-dom": "^0.14.3",
"whatwg-fetch": "^0.10.1"
},
"devDependencies": {
"autoprefixer": "^6.1.1",
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"babel-preset-stage-2": "^6.1.18",
"css-loader": "^0.23.0",
"cssgrace": "^3.0.0",
"eslint": "^1.10.3",
"eslint-plugin-react": "^3.11.3",
"exports-loader": "^0.6.2",
"extract-text-webpack-plugin": "^0.9.1",
"file-loader": "^0.8.5",
Expand All @@ -36,6 +38,7 @@
},
"scripts": {
"start": "node ./server.js",
"lint": "eslint ./src",
"test": "echo \"Error: no test specified\" && exit 1",
"deploy": "webpack --config webpack.config.js"
},
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/components/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import React from 'react'

export default class App extends React.Component {
render() {
return (
<div className='app'>Hello,please enjoy it</div>
);
)
}
}
4 changes: 4 additions & 0 deletions src/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ import ReactDom from 'react-dom'
import React from 'react'
import App from './components/app'

if (__DEBUG__ === true) {
console.log('this is debug model')
};

ReactDom.render(<App/>, document.querySelector('#root'));
3 changes: 3 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ module.exports = {
new webpack.DefinePlugin({
__DEBUG__: false //true/false
}),
new webpack.ProvidePlugin({
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new webpack.optimize.CommonsChunkPlugin("commons", "commons.js"),
new ExtractTextPlugin("[name].css",{allChunks: true}),
new HtmlWebpackPlugin({
Expand Down
3 changes: 3 additions & 0 deletions webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ module.exports = {
new webpack.DefinePlugin({
__DEBUG__: true
}),
new webpack.ProvidePlugin({
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new webpack.optimize.CommonsChunkPlugin("commons", "commons.js"),
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
Expand Down

0 comments on commit 6da1275

Please sign in to comment.