Skip to content

Commit 04fa8c8

Browse files
author
Glen Mailer
committed
Apply prettier formatting updates
1 parent b81cfd5 commit 04fa8c8

17 files changed

+215
-210
lines changed

.eslintrc

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
{
2-
"extends": "eslint:recommended",
3-
"env": {
4-
"node": true
5-
},
6-
"plugins": [
7-
"prettier"
8-
],
9-
"rules": {
10-
"no-console": "off",
11-
"prettier/prettier": [
12-
"error"
13-
]
14-
}
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"node": true
5+
},
6+
"plugins": ["prettier"],
7+
"rules": {
8+
"no-console": "off",
9+
"prettier/prettier": ["error"]
10+
}
1511
}

.mocharc.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"reporter": "spec",
3-
"exit": true
4-
}
2+
"reporter": "spec",
3+
"exit": true
4+
}

client-overlay.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var entities = new Entities();
4040

4141
function showProblems(type, lines) {
4242
clientOverlay.innerHTML = '';
43-
lines.forEach(function(msg) {
43+
lines.forEach(function (msg) {
4444
msg = ansiHTML(entities.encode(msg));
4545
var div = document.createElement('div');
4646
div.style.marginBottom = '26px';
@@ -73,7 +73,7 @@ function problemType(type) {
7373
);
7474
}
7575

76-
module.exports = function(options) {
76+
module.exports = function (options) {
7777
for (var color in options.ansiColors) {
7878
if (color in colors) {
7979
colors[color] = options.ansiColors[color];

client.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function EventSourceWrapper() {
7878
var listeners = [];
7979

8080
init();
81-
var timer = setInterval(function() {
81+
var timer = setInterval(function () {
8282
if (new Date() - lastActivity > options.timeout) {
8383
handleDisconnect();
8484
}
@@ -110,7 +110,7 @@ function EventSourceWrapper() {
110110
}
111111

112112
return {
113-
addMessageListener: function(fn) {
113+
addMessageListener: function (fn) {
114114
listeners.push(fn);
115115
},
116116
};
@@ -176,7 +176,7 @@ function createReporter() {
176176
var previousProblems = null;
177177
function log(type, obj) {
178178
var newProblems = obj[type]
179-
.map(function(msg) {
179+
.map(function (msg) {
180180
return strip(msg);
181181
})
182182
.join('\n');
@@ -205,10 +205,10 @@ function createReporter() {
205205
}
206206

207207
return {
208-
cleanProblemsCache: function() {
208+
cleanProblemsCache: function () {
209209
previousProblems = null;
210210
},
211-
problems: function(type, obj) {
211+
problems: function (type, obj) {
212212
if (options.warn) {
213213
log(type, obj);
214214
}
@@ -221,10 +221,10 @@ function createReporter() {
221221
}
222222
return true;
223223
},
224-
success: function() {
224+
success: function () {
225225
if (overlay) overlay.clear();
226226
},
227-
useCustomOverlay: function(customOverlay) {
227+
useCustomOverlay: function (customOverlay) {
228228
overlay = customOverlay;
229229
},
230230
};

example/client.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var time = document.getElementById('time');
55
var timer = setInterval(updateClock, 1000);
66

77
function updateClock() {
8-
time.innerHTML = (new Date()).toString();
8+
time.innerHTML = new Date().toString();
99
}
1010

1111
// Edit these styles to see them take effect immediately
@@ -28,7 +28,7 @@ require('assert');
2828

2929
if (module.hot) {
3030
module.hot.accept();
31-
module.hot.dispose(function() {
31+
module.hot.dispose(function () {
3232
clearInterval(timer);
3333
});
3434
}

example/index-multientry.html

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<meta charset="utf-8">
5-
<meta name=viewport content="width=device-width, initial-scale=1">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
66
<title>Webpack Hot Middleware Multiple Entry Point Example</title>
7-
</head>
8-
<body>
9-
<div id="app">
10-
<p id="time">Date</p>
11-
<input
12-
type="text" size="40" style="text-align: center"
7+
</head>
8+
<body>
9+
<div id="app">
10+
<p id="time">Date</p>
11+
<input
12+
type="text"
13+
size="40"
14+
style="text-align: center"
1315
placeholder="Type something in here to prove state isn't lost"
14-
/>
15-
</div>
16-
<script src="/client.js"></script>
17-
<script src="/extra.js"></script>
18-
</body>
16+
/>
17+
</div>
18+
<script src="/client.js"></script>
19+
<script src="/extra.js"></script>
20+
</body>
1921
</html>

example/index.html

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<meta charset="utf-8">
5-
<meta name=viewport content="width=device-width, initial-scale=1">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
66
<title>Webpack Hot Middleware Example</title>
7-
</head>
8-
<body>
9-
<div id="app">
10-
<p id="time">Date</p>
11-
<input
12-
type="text" size="40" style="text-align: center"
7+
</head>
8+
<body>
9+
<div id="app">
10+
<p id="time">Date</p>
11+
<input
12+
type="text"
13+
size="40"
14+
style="text-align: center"
1315
placeholder="Type something in here to prove state isn't lost"
14-
/>
15-
</div>
16-
<script src="/bundle.js"></script>
17-
</body>
16+
/>
17+
</div>
18+
<script src="/bundle.js"></script>
19+
</body>
1820
</html>

example/server.js

+22-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var http = require('http');
22

33
var express = require('express');
44

5-
require('console-stamp')(console, "HH:MM:ss.l");
5+
require('console-stamp')(console, 'HH:MM:ss.l');
66

77
var app = express();
88

@@ -11,36 +11,44 @@ app.use(require('morgan')('short'));
1111
// ************************************
1212
// This is the real meat of the example
1313
// ************************************
14-
(function() {
15-
14+
(function () {
1615
// Step 1: Create & configure a webpack compiler
1716
var webpack = require('webpack');
18-
var webpackConfig = require(process.env.WEBPACK_CONFIG ? process.env.WEBPACK_CONFIG : './webpack.config');
17+
var webpackConfig = require(process.env.WEBPACK_CONFIG
18+
? process.env.WEBPACK_CONFIG
19+
: './webpack.config');
1920
var compiler = webpack(webpackConfig);
2021

2122
// Step 2: Attach the dev middleware to the compiler & the server
22-
app.use(require("webpack-dev-middleware")(compiler, {
23-
logLevel: 'warn', publicPath: webpackConfig.output.publicPath
24-
}));
23+
app.use(
24+
require('webpack-dev-middleware')(compiler, {
25+
logLevel: 'warn',
26+
publicPath: webpackConfig.output.publicPath,
27+
})
28+
);
2529

2630
// Step 3: Attach the hot middleware to the compiler & the server
27-
app.use(require("webpack-hot-middleware")(compiler, {
28-
log: console.log, path: '/__webpack_hmr', heartbeat: 10 * 1000
29-
}));
31+
app.use(
32+
require('webpack-hot-middleware')(compiler, {
33+
log: console.log,
34+
path: '/__webpack_hmr',
35+
heartbeat: 10 * 1000,
36+
})
37+
);
3038
})();
3139

3240
// Do anything you like with the rest of your express application.
3341

34-
app.get("/", function(req, res) {
42+
app.get('/', function (req, res) {
3543
res.sendFile(__dirname + '/index.html');
3644
});
37-
app.get("/multientry", function(req, res) {
45+
app.get('/multientry', function (req, res) {
3846
res.sendFile(__dirname + '/index-multientry.html');
3947
});
4048

4149
if (require.main === module) {
4250
var server = http.createServer(app);
43-
server.listen(process.env.PORT || 1616, function() {
44-
console.log("Listening on %j", server.address());
51+
server.listen(process.env.PORT || 1616, function () {
52+
console.log('Listening on %j', server.address());
4553
});
4654
}

example/webpack.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ module.exports = {
99
// useful if you run your app from another point like django
1010
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000',
1111
// And then the actual application
12-
'./client.js'
12+
'./client.js',
1313
],
1414
output: {
1515
path: __dirname,
1616
publicPath: '/',
17-
filename: 'bundle.js'
17+
filename: 'bundle.js',
1818
},
1919
devtool: '#source-map',
2020
plugins: [
2121
new webpack.HotModuleReplacementPlugin(),
22-
new webpack.NoEmitOnErrorsPlugin()
22+
new webpack.NoEmitOnErrorsPlugin(),
2323
],
2424
};

example/webpack.config.multientry.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var webpack = require('webpack');
2-
var hotMiddlewareScript = 'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true';
2+
var hotMiddlewareScript =
3+
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true';
34

45
module.exports = {
56
mode: 'development',
@@ -8,17 +9,17 @@ module.exports = {
89
entry: {
910
// Add the client which connects to our middleware
1011
client: ['./client.js', hotMiddlewareScript],
11-
extra: ['./extra.js', hotMiddlewareScript]
12+
extra: ['./extra.js', hotMiddlewareScript],
1213
},
1314
output: {
1415
path: __dirname,
1516
publicPath: '/',
16-
filename: '[name].js'
17+
filename: '[name].js',
1718
},
1819
devtool: '#source-map',
1920
plugins: [
2021
new webpack.optimize.OccurrenceOrderPlugin(),
2122
new webpack.HotModuleReplacementPlugin(),
22-
new webpack.NoEmitOnErrorsPlugin()
23+
new webpack.NoEmitOnErrorsPlugin(),
2324
],
2425
};

helpers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var parse = require('url').parse;
22

3-
exports.pathMatch = function(url, path) {
3+
exports.pathMatch = function (url, path) {
44
try {
55
return parse(url).pathname === path;
66
} catch (e) {

0 commit comments

Comments
 (0)