Skip to content

Commit 0a5377a

Browse files
committed
Add linting and nicer output
1 parent 6d6b153 commit 0a5377a

File tree

6 files changed

+46
-11
lines changed

6 files changed

+46
-11
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "airbnb"
3+
}

devServer.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,22 @@ var config = require('./webpack.config.dev');
55
new WebpackDevServer(webpack(config), {
66
publicPath: config.output.publicPath,
77
historyApiFallback: true,
8-
colors: true,
9-
noInfo: true
8+
stats: {
9+
hash: false,
10+
version: false,
11+
timings: false,
12+
assets: false,
13+
chunks: false,
14+
modules: false,
15+
reasons: false,
16+
children: false,
17+
source: false,
18+
publicPath: false,
19+
colors: true,
20+
errors: true,
21+
errorDetails: true,
22+
warnings: true,
23+
}
1024
}).listen(3000, 'localhost', function (err, result) {
1125
if (err) {
1226
return console.log(err);

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
"babel-preset-react": "^6.11.1",
1717
"cross-env": "^2.0.0",
1818
"css-loader": "^0.23.1",
19+
"eslint": "^2.13.1",
20+
"eslint-config-airbnb": "^9.0.1",
21+
"eslint-loader": "^1.4.1",
22+
"eslint-plugin-import": "^1.10.3",
23+
"eslint-plugin-jsx-a11y": "^1.5.5",
24+
"eslint-plugin-react": "^5.2.2",
1925
"html-webpack-plugin": "^2.22.0",
2026
"postcss-loader": "^0.9.1",
2127
"react": "^15.2.1",

src/App.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import React, { Component } from 'react';
1+
import React from 'react';
22
import './App.css';
33

4-
export default class App extends Component {
5-
render() {
6-
return (
7-
<div className='App'>
8-
Hello!
9-
</div>
10-
);
11-
}
4+
export default function App() {
5+
return (
6+
<div className="App">
7+
Hello world!
8+
</div>
9+
);
1210
}

webpack.config.dev.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ module.exports = {
1313
publicPath: '/'
1414
},
1515
module: {
16+
preLoaders: [
17+
{
18+
test: /\.js$/,
19+
loader: 'eslint-loader',
20+
include: path.resolve(__dirname, 'src')
21+
}
22+
],
1623
loaders: [
1724
{
1825
test: /\.css$/,

webpack.config.prod.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ module.exports = {
1414
publicPath: '/'
1515
},
1616
module: {
17+
preLoaders: [
18+
{
19+
test: /\.js$/,
20+
loader: 'eslint-loader',
21+
include: path.resolve(__dirname, 'src')
22+
}
23+
],
1724
loaders: [
1825
{
1926
test: /\.css$/,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy