diff --git a/.eslintrc.js b/.eslintrc.js
index 348682e98d..86ec975d87 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -100,6 +100,7 @@ module.exports = {
'prefer-promise-reject-errors': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
+ 'no-else-return': 'error',
},
settings: {
react: {
diff --git a/src/actions/zipped-profiles.js b/src/actions/zipped-profiles.js
index 3978188ff2..ee74ea211b 100644
--- a/src/actions/zipped-profiles.js
+++ b/src/actions/zipped-profiles.js
@@ -91,9 +91,8 @@ export function viewProfileFromPathInZipFile(
if (zipFileIndex === -1) {
dispatch(showErrorForNoFileInZip(pathInZipFile));
return Promise.resolve();
- } else {
- return dispatch(viewProfileFromZip(zipFileIndex));
}
+ return dispatch(viewProfileFromZip(zipFileIndex));
};
}
diff --git a/src/components/shared/MarkerTooltipContents.js b/src/components/shared/MarkerTooltipContents.js
index 393e8d7103..21f791b0de 100644
--- a/src/components/shared/MarkerTooltipContents.js
+++ b/src/components/shared/MarkerTooltipContents.js
@@ -629,61 +629,56 @@ function getMarkerDetails(
)}
);
- } else {
- return (
-
- {_markerDetail('status', 'Status', data.status)}
- {_markerDetailNullable('url', 'URL', data.URI)}
- {_markerDetailNullable(
- 'redirect_url',
- 'Redirect URL',
- data.RedirectURI
- )}
- {_markerDetail('pri', 'Priority', data.pri)}
- {_markerDetailBytesNullable(
- 'count',
- 'Requested bytes',
- data.count
- )}
- {_markerDetailDeltaTimeNullable(
- 'domainLookup',
- 'Domain lookup in total',
- data.domainLookupEnd,
- data.domainLookupStart
- )}
- {_markerDetailDeltaTimeNullable(
- 'connect',
- 'Connection in total',
- data.connectEnd,
- data.connectStart
- )}
- {_markerDetailDeltaTimeNullable(
- 'tcpConnect',
- 'TCP connection in total',
- data.tcpConnectEnd,
- data.connectStart
- )}
- {_markerDetailDeltaTimeNullable(
- 'secureConnectionStart',
- 'Start of secure connection at',
- data.secureConnectionStart,
- data.tcpConnectEnd
- )}
- {_markerDetailDeltaTimeNullable(
- 'requestStart',
- 'Start of request at',
- data.requestStart,
- data.connectStart
- )}
- {_markerDetailDeltaTimeNullable(
- 'response',
- 'Response time',
- data.responseEnd,
- data.responseStart
- )}
-
- );
}
+ return (
+
+ {_markerDetail('status', 'Status', data.status)}
+ {_markerDetailNullable('url', 'URL', data.URI)}
+ {_markerDetailNullable(
+ 'redirect_url',
+ 'Redirect URL',
+ data.RedirectURI
+ )}
+ {_markerDetail('pri', 'Priority', data.pri)}
+ {_markerDetailBytesNullable('count', 'Requested bytes', data.count)}
+ {_markerDetailDeltaTimeNullable(
+ 'domainLookup',
+ 'Domain lookup in total',
+ data.domainLookupEnd,
+ data.domainLookupStart
+ )}
+ {_markerDetailDeltaTimeNullable(
+ 'connect',
+ 'Connection in total',
+ data.connectEnd,
+ data.connectStart
+ )}
+ {_markerDetailDeltaTimeNullable(
+ 'tcpConnect',
+ 'TCP connection in total',
+ data.tcpConnectEnd,
+ data.connectStart
+ )}
+ {_markerDetailDeltaTimeNullable(
+ 'secureConnectionStart',
+ 'Start of secure connection at',
+ data.secureConnectionStart,
+ data.tcpConnectEnd
+ )}
+ {_markerDetailDeltaTimeNullable(
+ 'requestStart',
+ 'Start of request at',
+ data.requestStart,
+ data.connectStart
+ )}
+ {_markerDetailDeltaTimeNullable(
+ 'response',
+ 'Response time',
+ data.responseEnd,
+ data.responseStart
+ )}
+
+ );
}
case 'Styles': {
return [
diff --git a/src/components/timeline/TrackContextMenu.js b/src/components/timeline/TrackContextMenu.js
index a9fad96ffa..3794452db5 100644
--- a/src/components/timeline/TrackContextMenu.js
+++ b/src/components/timeline/TrackContextMenu.js
@@ -213,14 +213,13 @@ class TimelineTrackContextMenu extends PureComponent {
if (rightClickedTrack.type === 'global') {
return globalTrackNames[rightClickedTrack.trackIndex];
- } else {
- const localTrackNames = localTrackNamesByPid.get(rightClickedTrack.pid);
- if (localTrackNames === undefined) {
- console.error('Expected to find a local track name for the given pid.');
- return 'Unknown Track';
- }
- return localTrackNames[rightClickedTrack.trackIndex];
}
+ const localTrackNames = localTrackNamesByPid.get(rightClickedTrack.pid);
+ if (localTrackNames === undefined) {
+ console.error('Expected to find a local track name for the given pid.');
+ return 'Unknown Track';
+ }
+ return localTrackNames[rightClickedTrack.trackIndex];
}
renderIsolateProcess() {
diff --git a/src/profile-logic/convert-markers.js b/src/profile-logic/convert-markers.js
index 7a926d10c7..f45f203505 100644
--- a/src/profile-logic/convert-markers.js
+++ b/src/profile-logic/convert-markers.js
@@ -19,8 +19,8 @@ export function upgradeGCMinorMarker(marker8: Object): GCMinorMarkerPayload {
marker8.nursery.status = 'nursery empty';
}
return Object.assign(marker8);
- } else {
- /*
+ }
+ /*
* This is the old format for GCMinor, rename some
* properties to the more sensible names in the newer
* format and set the status.
@@ -29,23 +29,21 @@ export function upgradeGCMinorMarker(marker8: Object): GCMinorMarkerPayload {
* promotion_rate, leave them so that anyone opening the
* raw json data can still see them in converted profiles.
*/
- const marker = Object.assign(marker8, {
- nursery: Object.assign(marker8.nursery, {
- status: 'complete',
- bytes_used: marker8.nursery.nursery_bytes,
- // cur_capacity cannot be filled in.
- new_capacity: marker8.nursery.new_nursery_bytes,
- phase_times: marker8.nursery.timings,
- }),
- });
- delete marker.nursery.nursery_bytes;
- delete marker.nursery.new_nursery_bytes;
- delete marker.nursery.timings;
- return marker;
- }
- } else {
- return marker8;
+ const marker = Object.assign(marker8, {
+ nursery: Object.assign(marker8.nursery, {
+ status: 'complete',
+ bytes_used: marker8.nursery.nursery_bytes,
+ // cur_capacity cannot be filled in.
+ new_capacity: marker8.nursery.new_nursery_bytes,
+ phase_times: marker8.nursery.timings,
+ }),
+ });
+ delete marker.nursery.nursery_bytes;
+ delete marker.nursery.new_nursery_bytes;
+ delete marker.nursery.timings;
+ return marker;
}
+ return marker8;
}
/*
diff --git a/src/reducers/profile-view.js b/src/reducers/profile-view.js
index 78e2479413..3211f920e9 100644
--- a/src/reducers/profile-view.js
+++ b/src/reducers/profile-view.js
@@ -661,16 +661,15 @@ export const getRightClickedThreadIndex = createSelector(
if (rightClickedTrack.type === 'global') {
const track = globalTracks[rightClickedTrack.trackIndex];
return track.type === 'process' ? track.mainThreadIndex : null;
- } else {
- const { pid, trackIndex } = rightClickedTrack;
- const localTracks = ensureExists(
- localTracksByPid.get(pid),
- 'No local tracks found at that pid.'
- );
- const track = localTracks[trackIndex];
-
- return track.type === 'thread' ? track.threadIndex : null;
}
+ const { pid, trackIndex } = rightClickedTrack;
+ const localTracks = ensureExists(
+ localTracksByPid.get(pid),
+ 'No local tracks found at that pid.'
+ );
+ const track = localTracks[trackIndex];
+
+ return track.type === 'thread' ? track.threadIndex : null;
}
);
export const getGlobalTrackNames = createSelector(
diff --git a/src/utils/format-numbers.js b/src/utils/format-numbers.js
index 6fcc164442..59c2dfd0d0 100644
--- a/src/utils/format-numbers.js
+++ b/src/utils/format-numbers.js
@@ -60,9 +60,8 @@ export function formatBytes(bytes: number): string {
return formatNumber(bytes / 1024, 3, 2) + 'KB';
} else if (bytes < 1024 * 1024 * 1024) {
return formatNumber(bytes / (1024 * 1024), 3, 2) + 'MB';
- } else {
- return formatNumber(bytes / (1024 * 1024 * 1024), 3, 2) + 'GB';
}
+ return formatNumber(bytes / (1024 * 1024 * 1024), 3, 2) + 'GB';
}
export function formatSI(num: number): string {
@@ -73,9 +72,8 @@ export function formatSI(num: number): string {
return formatNumber(num / 1000, 3, 2) + 'K';
} else if (num < 1000 * 1000 * 1000) {
return formatNumber(num / (1000 * 1000), 3, 2) + 'M';
- } else {
- return formatNumber(num / (1000 * 1000 * 1000), 3, 2) + 'G';
}
+ return formatNumber(num / (1000 * 1000 * 1000), 3, 2) + 'G';
}
export function formatMicroseconds(