From 71629d80d90a3f6f6fc9fcd9a21eaaca50ec3cb9 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Thu, 1 Dec 2016 21:30:03 -0500 Subject: [PATCH] Enforce not having parens around arguments of single argument arrow functions. --- .eslintrc.js | 1 + src/common/summarize-profile.js | 2 +- src/content/async-storage.js | 12 ++++++------ src/content/components/SummarizeLineGraph.js | 2 +- src/content/components/TreeView.js | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e45109a0d2..924eda1a44 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -84,6 +84,7 @@ module.exports = { "named": "never", "asyncArrow": "always", }], + "arrow-parens": ["error", "as-needed"], }, "settings": { "react": { diff --git a/src/common/summarize-profile.js b/src/common/summarize-profile.js index 1d0207e058..d3571e2d03 100644 --- a/src/common/summarize-profile.js +++ b/src/common/summarize-profile.js @@ -244,7 +244,7 @@ export function calculateRollingSummaries(profile, threadCategories, segmentCoun return profile.threads.map((thread, threadIndex) => { const categories = threadCategories[threadIndex]; - return times(segmentCount, (segmentIndex) => { + return times(segmentCount, segmentIndex => { let samplesInRange = 0; const samples = {}; diff --git a/src/content/async-storage.js b/src/content/async-storage.js index d2315c8ba7..7d16bcb20d 100644 --- a/src/content/async-storage.js +++ b/src/content/async-storage.js @@ -71,7 +71,7 @@ export function getStore(dbName) { function getItem(key) { return new Promise((resolve, reject) => { let req; - withStore('readonly', (store) => { + withStore('readonly', store => { store.transaction.oncomplete = function onComplete() { let value = req.result; if (value === undefined) { @@ -89,7 +89,7 @@ export function getStore(dbName) { function setItem(key, value) { return new Promise((resolve, reject) => { - withStore('readwrite', (store) => { + withStore('readwrite', store => { store.transaction.oncomplete = resolve; const req = store.put(value, key); req.onerror = function setItemOnError() { @@ -101,7 +101,7 @@ export function getStore(dbName) { function removeItem(key) { return new Promise((resolve, reject) => { - withStore('readwrite', (store) => { + withStore('readwrite', store => { store.transaction.oncomplete = resolve; const req = store.delete(key); req.onerror = function removeItemOnError() { @@ -113,7 +113,7 @@ export function getStore(dbName) { function clear() { return new Promise((resolve, reject) => { - withStore('readwrite', (store) => { + withStore('readwrite', store => { store.transaction.oncomplete = resolve; const req = store.clear(); req.onerror = function clearOnError() { @@ -126,7 +126,7 @@ export function getStore(dbName) { function length() { return new Promise((resolve, reject) => { let req; - withStore('readonly', (store) => { + withStore('readonly', store => { store.transaction.oncomplete = function onComplete() { resolve(req.result); }; @@ -146,7 +146,7 @@ export function getStore(dbName) { } let req; - withStore('readonly', (store) => { + withStore('readonly', store => { store.transaction.oncomplete = function onComplete() { const cursor = req.result; resolve(cursor ? cursor.key : null); diff --git a/src/content/components/SummarizeLineGraph.js b/src/content/components/SummarizeLineGraph.js index 544eb4419a..861cbf195d 100644 --- a/src/content/components/SummarizeLineGraph.js +++ b/src/content/components/SummarizeLineGraph.js @@ -84,7 +84,7 @@ class SummarizeLineGraph extends Component { render() { return ( -
{ this.el = el; }}> +
{ this.el = el; }}> { this.state && this.props && this.props.rollingSummary ? nodeId === selected); + const selectedRowIndex = visibleRows.findIndex(nodeId => nodeId === selected); if (selectedRowIndex === -1) { this._select(visibleRows[0]);