Skip to content
This repository was archived by the owner on Aug 13, 2018. It is now read-only.

Commit cb44060

Browse files
committed
ESLint all the things
1 parent 7cff755 commit cb44060

30 files changed

+1846
-1841
lines changed

chrome/content/network-content-script.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* See license.txt for terms of usage */
22

3+
"use strict";
4+
35
/**
46
* Handle new requests addition.
57
*
@@ -15,22 +17,22 @@
1517
* The icons serves also as a link to the 'Web Socket'
1618
* panel.
1719
*/
18-
window.on(EVENTS.RECEIVED_REQUEST_HEADERS, (event, from) => {
19-
var item = NetMonitorView.RequestsMenu.getItemByValue(from);
20+
window.on(EVENTS.RECEIVED_REQUEST_HEADERS, (_, from) => {
21+
let item = NetMonitorView.RequestsMenu.getItemByValue(from);
2022
if (!isWsUpgradeRequest(item)) {
2123
return;
2224
}
2325

2426
// Append WebSocket icon in the UI
25-
var hbox = item._target;
27+
let hbox = item._target;
2628

27-
var method = hbox.querySelector(".requests-menu-method");
29+
let method = hbox.querySelector(".requests-menu-method");
2830
method.classList.add("websocket");
2931

3032
// Fx 45 changed the DOM layout in the network panel and also
3133
// the WS icon isn't overlapping the original status icon now.
3234
// But, we need a little indentation for pre Fx45.
33-
var statusIconNode = hbox.querySelector(".requests-menu-status-icon");
35+
let statusIconNode = hbox.querySelector(".requests-menu-status-icon");
3436
if (!statusIconNode) {
3537
// We are in pre Fx45 world, use a little indentation.
3638
method.classList.add("websocket-indent");
@@ -60,10 +62,10 @@ window.on(EVENTS.RECEIVED_REQUEST_HEADERS, (event, from) => {
6062
* The Response tab displays a link to the WebSockets panel
6163
* for HTTP upgrade requests.
6264
*/
63-
window.on(EVENTS.RESPONSE_BODY_DISPLAYED, (event) => {
64-
var wsBox = $("#response-content-ws-box");
65+
window.on(EVENTS.RESPONSE_BODY_DISPLAYED, () => {
66+
let wsBox = $("#response-content-ws-box");
6567

66-
var item = NetMonitorView.RequestsMenu.selectedItem;
68+
let item = NetMonitorView.RequestsMenu.selectedItem;
6769
if (!isWsUpgradeRequest(item)) {
6870
if (wsBox) {
6971
$("#response-content-ws-box").hidden = true;
@@ -74,7 +76,7 @@ window.on(EVENTS.RESPONSE_BODY_DISPLAYED, (event) => {
7476
// Hide the default Response content.
7577
$("#response-content-textarea-box").hidden = true;
7678

77-
var wsBox = $("#response-content-ws-box");
79+
wsBox = $("#response-content-ws-box");
7880
if (wsBox) {
7981
$("#response-content-ws-box").hidden = false;
8082
return;
@@ -86,19 +88,19 @@ window.on(EVENTS.RESPONSE_BODY_DISPLAYED, (event) => {
8688

8789
// xxxHonza: localization
8890
wsBox.innerHTML =
89-
'<div xmlns="http://www.w3.org/1999/xhtml" class="webSocketsInfo">' +
90-
'<div class="title">Web Socket Protocol Handshake (101)</div>' +
91-
'<div class="desc">No content for this request. If you want to ' +
92-
'monitor WebSockets communication you need to switch to the ' +
93-
'<a class="link">Web Sockets</a> panel.</div>' +
94-
'</div>';
91+
"<div xmlns=\"http://www.w3.org/1999/xhtml\" class=\"webSocketsInfo\">" +
92+
"<div class=\"title\">Web Socket Protocol Handshake (101)</div>" +
93+
"<div class=\"desc\">No content for this request. If you want to " +
94+
"monitor WebSockets communication you need to switch to the " +
95+
"<a class=\"link\">Web Sockets</a> panel.</div>" +
96+
"</div>";
9597

9698
// Append into the DOM
97-
var imageBox = $("#response-content-image-box");
98-
var parentNode = imageBox.parentNode;
99+
let imageBox = $("#response-content-image-box");
100+
let parentNode = imageBox.parentNode;
99101
parentNode.appendChild(wsBox);
100102

101-
var link = parentNode.querySelector(".link");
103+
let link = parentNode.querySelector(".link");
102104
link.addEventListener("click", event => {
103105
navigateToWebSocketPanel(item._value);
104106
});
@@ -113,11 +115,11 @@ function navigateToWebSocketPanel(requestId) {
113115
}
114116

115117
function isWsUpgradeRequest(item) {
116-
var attachment = item.attachment;
117-
var requestHeaders = attachment.requestHeaders;
118+
let attachment = item.attachment;
119+
let requestHeaders = attachment.requestHeaders;
118120

119121
// Find the 'upgrade' header.
120-
var upgradeHeader = requestHeaders.headers.find(header => {
122+
let upgradeHeader = requestHeaders.headers.find(header => {
121123
return (header.name == "Upgrade");
122124
});
123125

data/actions/config.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
/* See license.txt for terms of usage */
22

3-
define(function(require, exports/*, module*/) {
4-
53
"use strict";
64

7-
const types = {
8-
UPDATE_CONFIG: "UPDATE_CONFIG",
9-
}
10-
11-
function updateConfig(key, newValue) {
12-
var data = {
13-
key,
14-
newValue
5+
define(function (require, exports) {
6+
const types = {
7+
UPDATE_CONFIG: "UPDATE_CONFIG",
158
};
169

17-
return { type: types.UPDATE_CONFIG, data };
18-
}
10+
function updateConfig(key, newValue) {
11+
const data = {
12+
key,
13+
newValue
14+
};
15+
16+
return { type: types.UPDATE_CONFIG, data };
17+
}
1918

20-
// Exports from this module
21-
exports.updateConfig = updateConfig;
22-
exports.types = types;
19+
// Exports from this module
20+
exports.updateConfig = updateConfig;
21+
exports.types = types;
2322
});
2423

data/actions/frames.js

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
11
/* See license.txt for terms of usage */
22

3-
define(function(require, exports/*, module*/) {
4-
53
"use strict";
64

7-
const types = {
8-
CLEAR: "CLEAR",
9-
ADD_FRAME: "ADD_FRAME",
10-
ADD_FRAMES: "ADD_FRAMES",
11-
FILTER_FRAMES: "FILTER_FRAMES",
12-
}
13-
14-
function clear(options) {
15-
return { type: types.CLEAR, options };
16-
}
17-
18-
function addFrame(frame) {
19-
return { type: types.ADD_FRAME, frame: frame };
20-
}
21-
22-
function addFrames(frames) {
23-
return { type: types.ADD_FRAMES, frames: frames };
24-
}
25-
26-
function filterFrames(filter) {
27-
return { type: types.FILTER_FRAMES, filter: filter };
28-
}
29-
30-
// Exports from this module
31-
exports.clear = clear;
32-
exports.addFrame = addFrame;
33-
exports.addFrames = addFrames;
34-
exports.filterFrames = filterFrames;
35-
exports.types = types;
5+
define(function (require, exports) {
6+
const types = {
7+
CLEAR: "CLEAR",
8+
ADD_FRAME: "ADD_FRAME",
9+
ADD_FRAMES: "ADD_FRAMES",
10+
FILTER_FRAMES: "FILTER_FRAMES",
11+
};
12+
13+
function clear(options) {
14+
return { type: types.CLEAR, options };
15+
}
16+
17+
function addFrame(frame) {
18+
return { type: types.ADD_FRAME, frame: frame };
19+
}
20+
21+
function addFrames(frames) {
22+
return { type: types.ADD_FRAMES, frames: frames };
23+
}
24+
25+
function filterFrames(filter) {
26+
return { type: types.FILTER_FRAMES, filter: filter };
27+
}
28+
29+
// Exports from this module
30+
exports.clear = clear;
31+
exports.addFrame = addFrame;
32+
exports.addFrames = addFrames;
33+
exports.filterFrames = filterFrames;
34+
exports.types = types;
3635
});
3736

data/actions/perspective.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
/* See license.txt for terms of usage */
22

3-
define(function(require, exports/*, module*/) {
4-
53
"use strict";
64

7-
const types = {
8-
CHANGE_VIEW: "CHANGE_VIEW",
9-
}
5+
define(function (require, exports) {
6+
const types = {
7+
CHANGE_VIEW: "CHANGE_VIEW",
8+
};
109

11-
function showTableView() {
12-
return { type: types.CHANGE_VIEW, view: "table" };
13-
}
10+
function showTableView() {
11+
return { type: types.CHANGE_VIEW, view: "table" };
12+
}
1413

15-
function showListView() {
16-
return { type: types.CHANGE_VIEW, view: "list" };
17-
}
14+
function showListView() {
15+
return { type: types.CHANGE_VIEW, view: "list" };
16+
}
1817

19-
// Exports from this module
20-
exports.showTableView = showTableView;
21-
exports.showListView = showListView;
22-
exports.types = types;
18+
// Exports from this module
19+
exports.showTableView = showTableView;
20+
exports.showListView = showListView;
21+
exports.types = types;
2322
});
2423

data/actions/selection.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
/* See license.txt for terms of usage */
22

3-
define(function(require, exports/*, module*/) {
4-
53
"use strict";
64

7-
const types = {
8-
SELECT_FRAME: "SELECT_FRAME",
9-
SELECT_NEXT_FRAME: "SELECT_NEXT_FRAME",
10-
SELECT_PREV_FRAME: "SELECT_PREV_FRAME"
11-
}
12-
13-
function selectFrame(frame) {
14-
return { type: types.SELECT_FRAME, frame: frame };
15-
}
16-
17-
function selectNextFrame() {
18-
return { type: types.SELECT_NEXT_FRAME };
19-
}
20-
21-
function selectPrevFrame() {
22-
return { type: types.SELECT_PREV_FRAME };
23-
}
24-
25-
// Exports from this module
26-
exports.selectFrame = selectFrame;
27-
exports.selectNextFrame = selectNextFrame;
28-
exports.selectPrevFrame = selectPrevFrame;
29-
exports.types = types;
5+
define(function (require, exports) {
6+
const types = {
7+
SELECT_FRAME: "SELECT_FRAME",
8+
SELECT_NEXT_FRAME: "SELECT_NEXT_FRAME",
9+
SELECT_PREV_FRAME: "SELECT_PREV_FRAME"
10+
};
11+
12+
function selectFrame(frame) {
13+
return { type: types.SELECT_FRAME, frame: frame };
14+
}
15+
16+
function selectNextFrame() {
17+
return { type: types.SELECT_NEXT_FRAME };
18+
}
19+
20+
function selectPrevFrame() {
21+
return { type: types.SELECT_PREV_FRAME };
22+
}
23+
24+
// Exports from this module
25+
exports.selectFrame = selectFrame;
26+
exports.selectNextFrame = selectNextFrame;
27+
exports.selectPrevFrame = selectPrevFrame;
28+
exports.types = types;
3029
});
3130

0 commit comments

Comments
 (0)