Skip to content

Commit 8310ecd

Browse files
committed
Add extra eslint rules
1 parent e8a0353 commit 8310ecd

File tree

12 files changed

+51
-43
lines changed

12 files changed

+51
-43
lines changed

.eslintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"rules": {
77
"indent": [2, "tab", { "SwitchCase": 1 }],
88
"brace-style": ["error", "1tbs"],
9+
"quotes": ["error", "double"],
910
"no-eval": "error",
1011
"eol-last": "error",
1112
"no-redeclare": "error",
@@ -22,6 +23,8 @@
2223
"no-unused-vars": "error",
2324
"no-dupe-keys": "error",
2425
"valid-typeof": "error",
26+
"object-curly-spacing": ["error", "always"],
27+
"key-spacing": "error",
2528
"space-infix-ops": "error",
2629
"no-negated-in-lhs": "error",
2730
"no-octal": "error",
@@ -38,6 +41,7 @@
3841
"overrides": {
3942
"try": {"after": true},
4043
"else": {"after": true},
44+
"throw": {"after": true},
4145
"case": {"after": true},
4246
"return": {"after": true},
4347
"finally": {"after": true},

bin/webpack-dev-server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function processOptions(wpOpt) {
165165
options.watchOptions = firstWpOpt.watchOptions;
166166

167167
if(argv["stdin"]) {
168-
process.stdin.on('end', function() {
168+
process.stdin.on("end", function() {
169169
process.exit(0); // eslint-disable-line no-process-exit
170170
});
171171
process.stdin.resume();

client/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* global __resourceQuery */
2-
var url = require('url');
3-
var stripAnsi = require('strip-ansi');
4-
var socket = require('./socket');
2+
var url = require("url");
3+
var stripAnsi = require("strip-ansi");
4+
var socket = require("./socket");
55

66
function getCurrentScriptSource() {
77
// `document.currentScript` is the most accurate way to find the current script,
@@ -91,11 +91,11 @@ var onSocketMsg = {
9191
var hostname = urlParts.hostname;
9292
var protocol = urlParts.protocol;
9393

94-
if(urlParts.hostname === '0.0.0.0') {
94+
if(urlParts.hostname === "0.0.0.0") {
9595
// why do we need this check?
9696
// hostname n/a for file protocol (example, when using electron, ionic)
9797
// see: https://github.com/webpack/webpack-dev-server/pull/384
98-
if(window.location.hostname && !!~window.location.protocol.indexOf('http')) {
98+
if(window.location.hostname && !!~window.location.protocol.indexOf("http")) {
9999
hostname = window.location.hostname;
100100
}
101101
}
@@ -104,16 +104,16 @@ if(urlParts.hostname === '0.0.0.0') {
104104
// a protocol would result in an invalid URL.
105105
// When https is used in the app, secure websockets are always necessary
106106
// because the browser doesn't accept non-secure websockets.
107-
if(hostname && (window.location.protocol === "https:" || urlParts.hostname === '0.0.0.0')) {
107+
if(hostname && (window.location.protocol === "https:" || urlParts.hostname === "0.0.0.0")) {
108108
protocol = window.location.protocol;
109109
}
110110

111111
var socketUrl = url.format({
112112
protocol: protocol,
113113
auth: urlParts.auth,
114114
hostname: hostname,
115-
port: (urlParts.port === '0') ? window.location.port : urlParts.port,
116-
pathname: urlParts.path == null || urlParts.path === '/' ? "/sockjs-node" : urlParts.path
115+
port: (urlParts.port === "0") ? window.location.port : urlParts.port,
116+
pathname: urlParts.path == null || urlParts.path === "/" ? "/sockjs-node" : urlParts.path
117117
});
118118

119119
socket(socketUrl, onSocketMsg);

client/live.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var $ = require("jquery");
2-
var stripAnsi = require('strip-ansi');
3-
var socket = require('./socket');
2+
var stripAnsi = require("strip-ansi");
3+
var socket = require("./socket");
44
require("./style.css");
55

66
var hot = false;

client/sockjs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('sockjs-client');
1+
module.exports = require("sockjs-client");

examples/node-api-middleware/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var Webpack = require('webpack');
1+
var Webpack = require("webpack");
22
var WebpackDevServer = require("../../lib/Server");
33
var webpackConfig = require("./webpack.config");
44

examples/node-api-simple/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var Webpack = require('webpack');
1+
var Webpack = require("webpack");
22
var WebpackDevServer = require("../../lib/Server");
33
var webpackConfig = require("./webpack.config");
44

examples/proxy-advanced/webpack.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ module.exports = {
33
entry: "./app.js",
44
devServer: {
55
proxy: {
6-
'/api': {
7-
target: 'http://jsonplaceholder.typicode.com/',
6+
"/api": {
7+
target: "http://jsonplaceholder.typicode.com/",
88
changeOrigin: true,
99
pathRewrite: {
10-
'^/api': ''
10+
"^/api": ""
1111
},
1212
bypass: function(req) {
13-
if(req.url === '/api/nope') {
14-
return '/bypass.html';
13+
if(req.url === "/api/nope") {
14+
return "/bypass.html";
1515
}
1616
}
1717
}

examples/proxy-hot-reload/proxy-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**/
22
module.exports = {
3-
target: 'http://jsonplaceholder.typicode.com/',
3+
target: "http://jsonplaceholder.typicode.com/",
44
pathRewrite: {
5-
'^/api': ''
5+
"^/api": ""
66
}
77
};
88
/**/

examples/proxy-hot-reload/webpack.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
var fs = require('fs');
1+
var fs = require("fs");
22

3-
var proxyConfig = require('./proxy-config');
3+
var proxyConfig = require("./proxy-config");
44
var proxyOptions = {
5-
context: '/api',
5+
context: "/api",
66
target: proxyConfig.target,
77
pathRewrite: proxyConfig.pathRewrite,
88
changeOrigin: true
99
};
1010

11-
fs.watch('./proxy-config.js', function() {
12-
delete require.cache[require.resolve('./proxy-config')];
11+
fs.watch("./proxy-config.js", function() {
12+
delete require.cache[require.resolve("./proxy-config")];
1313
try {
14-
var newProxyConfig = require('./proxy-config');
14+
var newProxyConfig = require("./proxy-config");
1515
if(proxyOptions.target !== newProxyConfig.target) {
16-
console.log('Proxy target changed:', newProxyConfig.target);
16+
console.log("Proxy target changed:", newProxyConfig.target);
1717
proxyOptions = {
18-
context: '/api',
18+
context: "/api",
1919
target: newProxyConfig.target,
2020
pathRewrite: newProxyConfig.pathRewrite,
2121
changeOrigin: true

0 commit comments

Comments
 (0)