Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Update lint style for Standard@9.0.0 - first patch #7495

Merged
merged 1 commit into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/browser/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ const api = {
return
case 'browser-forward':
win.webContents.send(messages.SHORTCUT_ACTIVE_FRAME_FORWARD)
return
}
})
win.webContents.on('crashed', (e) => {
Expand Down
13 changes: 7 additions & 6 deletions app/common/lib/ledgerExportUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,13 @@ module.exports.getTransactionCSVRows = (transactions, viewingIds, addTotalRow, s
throw new Error('ledgerExportUtil#getTransactionCSVRows does not support mixed currency data (yet)!')
}

return [pub,
pubRow.votes,
pubRow.fraction,
rowBTC,
pubRow.contribution.fiat.toFixed(2) + ' ' + pubRow.contribution.currency
].join(',')
return [
pub,
pubRow.votes,
pubRow.fraction,
rowBTC,
pubRow.contribution.fiat.toFixed(2) + ' ' + pubRow.contribution.currency
].join(',')
}))

// note: do NOT add a total row if only header row is present (no data case)
Expand Down
4 changes: 2 additions & 2 deletions app/dataFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ module.exports.init = (resourceName, startExtension, onInitDone, forceDownload)
}

module.exports.debug = (resourceName, details, shouldBlock) => {
/*
if (!shouldBlock) {
return

}
/*
console.log('-----')
console.log(`${resourceName} should block: `, shouldBlock)
console.log(details.url)
Expand Down
1 change: 0 additions & 1 deletion app/httpsEverywhere.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ function onBeforeRedirect (details, isPrivate) {
console.log('blacklisting url from HTTPS Everywhere for too many 307s',
canonicalUrl)
redirectBlacklist.push(canonicalUrl)
return
}
} else {
recent307Counter[canonicalUrl] = 1
Expand Down
67 changes: 34 additions & 33 deletions app/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ const synopsisPath = 'ledger-synopsis.json'

var bootP = false
var client
const clientOptions = { debugP: process.env.LEDGER_DEBUG,
loggingP: process.env.LEDGER_LOGGING,
verboseP: process.env.LEDGER_VERBOSE,
server: process.env.LEDGER_SERVER_URL
}
const clientOptions = {
debugP: process.env.LEDGER_DEBUG,
loggingP: process.env.LEDGER_LOGGING,
verboseP: process.env.LEDGER_VERBOSE,
server: process.env.LEDGER_SERVER_URL
}

var doneTimer

Expand All @@ -117,12 +118,12 @@ var publishers = {}
*/

const msecs = { year: 365 * 24 * 60 * 60 * 1000,
week: 7 * 24 * 60 * 60 * 1000,
day: 24 * 60 * 60 * 1000,
hour: 60 * 60 * 1000,
minute: 60 * 1000,
second: 1000
}
week: 7 * 24 * 60 * 60 * 1000,
day: 24 * 60 * 60 * 1000,
hour: 60 * 60 * 1000,
minute: 60 * 1000,
second: 1000
}

/*
* notification state globals
Expand Down Expand Up @@ -1155,13 +1156,13 @@ var cacheRuleSet = (ruleset) => {
if (rule.dom) {
if (rule.dom.publisher) {
entry.publisher = { selector: rule.dom.publisher.nodeSelector,
consequent: acorn.parse(rule.dom.publisher.consequent)
}
consequent: acorn.parse(rule.dom.publisher.consequent)
}
}
if (rule.dom.faviconURL) {
entry.faviconURL = { selector: rule.dom.faviconURL.nodeSelector,
consequent: acorn.parse(rule.dom.faviconURL.consequent)
}
consequent: acorn.parse(rule.dom.faviconURL.consequent)
}
}
}
if (!entry.publisher) entry.consequent = rule.consequent ? acorn.parse(rule.consequent) : rule.consequent
Expand Down Expand Up @@ -1385,7 +1386,7 @@ var updateLedgerInfo = () => {
if (info) {
underscore.extend(ledgerInfo,
underscore.pick(info, [ 'address', 'passphrase', 'balance', 'unconfirmed', 'satoshis', 'btc', 'amount',
'currency' ]))
'currency' ]))
if ((!info.buyURLExpires) || (info.buyURLExpires > now)) {
ledgerInfo.buyURL = info.buyURL
ledgerInfo.buyMaximumUSD = 6
Expand All @@ -1394,8 +1395,8 @@ var updateLedgerInfo = () => {
ledgerInfo.buyURLFrame = true
ledgerInfo.buyURL = process.env.ADDFUNDS_URL + '?' +
querystring.stringify({ currency: ledgerInfo.currency,
amount: getSetting(settings.PAYMENTS_CONTRIBUTION_AMOUNT),
address: ledgerInfo.address })
amount: getSetting(settings.PAYMENTS_CONTRIBUTION_AMOUNT),
address: ledgerInfo.address })
ledgerInfo.buyMaximumUSD = false
}

Expand Down Expand Up @@ -1482,9 +1483,9 @@ var callback = (err, result, delayTime) => {
entries = []
results.forEach((entry) => {
entries.push({ type: 'put',
key: entry.facet + ':' + entry.publisher,
value: JSON.stringify(underscore.omit(entry, [ 'facet', 'publisher' ]))
})
key: entry.facet + ':' + entry.publisher,
value: JSON.stringify(underscore.omit(entry, [ 'facet', 'publisher' ]))
})
})

v2RulesetDB.batch(entries, (err) => {
Expand All @@ -1500,9 +1501,9 @@ var callback = (err, result, delayTime) => {
entries = []
results.forEach((entry) => {
entries.push({ type: 'put',
key: entry.publisher,
value: JSON.stringify(underscore.omit(entry, [ 'publisher' ]))
})
key: entry.publisher,
value: JSON.stringify(underscore.omit(entry, [ 'publisher' ]))
})
if ((synopsis.publishers[entry.publisher]) &&
(synopsis.publishers[entry.publisher].options.verified !== entry.verified)) {
synopsis.publishers[entry.publisher].options.verified = entry.verified
Expand Down Expand Up @@ -1616,20 +1617,20 @@ var run = (delayTime) => {
}

line([ 'publisher',
'blockedP', 'stickyP', 'verified',
'excluded', 'eligibleP', 'visibleP',
'contribP',
'duration', 'visits'
])
'blockedP', 'stickyP', 'verified',
'excluded', 'eligibleP', 'visibleP',
'contribP',
'duration', 'visits'
])
entries = synopsis.topN() || []
entries.forEach((entry) => {
var publisher = entry.publisher

line([ publisher,
blockedP(publisher), stickyP(publisher), synopsis.publishers[publisher].options.verified === true,
synopsis.publishers[publisher].options.exclude === true, eligibleP(publisher), visibleP(publisher),
contributeP(publisher),
Math.round(synopsis.publishers[publisher].duration / 1000), synopsis.publishers[publisher].visits ])
blockedP(publisher), stickyP(publisher), synopsis.publishers[publisher].options.verified === true,
synopsis.publishers[publisher].options.exclude === true, eligibleP(publisher), visibleP(publisher),
contributeP(publisher),
Math.round(synopsis.publishers[publisher].duration / 1000), synopsis.publishers[publisher].visits ])
})
}

Expand Down
1 change: 0 additions & 1 deletion app/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,3 @@ const renderUrlToPdf = (appState, action, testingMode) => {
module.exports = {
renderUrlToPdf
}

1 change: 0 additions & 1 deletion app/renderer/components/bookmarksToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class BookmarkToolbarButton extends ImmutableComponent {
}
e.target = ReactDOM.findDOMNode(this)
this.props.showBookmarkFolderMenu(this.props.bookmark, e)
return
}
}

Expand Down
1 change: 0 additions & 1 deletion app/renderer/components/menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ class Menubar extends ImmutableComponent {

case keyCodes.UP:
e.preventDefault()

}
}
shouldComponentUpdate (nextProps, nextState) {
Expand Down
4 changes: 1 addition & 3 deletions app/renderer/components/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ class SiteSettingCheckbox extends ImmutableComponent {
}

onClick (e) {
if (this.props.disabled || !this.props.hostPattern) {
return
} else {
if (!this.props.disabled || this.props.hostPattern) {
const value = !!e.target.value
value === this.props.defaultValue
? aboutActions.removeSiteSetting(this.props.hostPattern,
Expand Down
2 changes: 0 additions & 2 deletions app/renderer/lib/suggestion.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ var virtualSite = (sites) => {
title: sites[0].host,
lastAccessedTime: (new Date()).getTime()
})
} else {
return
}
}

Expand Down
2 changes: 0 additions & 2 deletions app/telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ function deltaBetween (checkpoint1, checkpoint2) {
var ts2 = telemetry.get(checkpoint2)
if (_.isNumber(ts1) && _.isNumber(ts2)) {
return Math.abs(ts2 - ts1)
} else {
return
}
}

Expand Down
2 changes: 1 addition & 1 deletion js/about/contributionStatement.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class ContributionStatement extends ImmutableComponent {
<span className='sectionTitle smaller pull-right' data-l10n-id='contributionStatement' />
</div>
</div>
)
)
}

get contributionDate () {
Expand Down
8 changes: 4 additions & 4 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,10 @@ class Main extends ImmutableComponent {
})

ipc.on(messages.BLOCKED_PAGE, (e, blockType, details) => {
const frameProps = frameStateUtil.getFrameByTabId(self.props.windowState, details.tabId)
if (!frameProps) {
return
}
// const frameProps = frameStateUtil.getFrameByTabId(self.props.windowState, details.tabId)
// if (!frameProps) {
// return
// }
})

ipc.on(messages.HTTPSE_RULE_APPLIED, (e, ruleset, details) => {
Expand Down
1 change: 0 additions & 1 deletion js/components/modalOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var globalInstanceCounter = 0
var mountedInstances = []

class ModalOverlay extends ImmutableComponent {

componentWillMount () {
this.instanceId = globalInstanceCounter++

Expand Down
1 change: 0 additions & 1 deletion js/components/popupWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const windowActions = require('../actions/windowActions')
* Represents a popup window
*/
class PopupWindow extends ImmutableComponent {

componentWillMount () {
this.width = this.props.detail.get('width')
this.height = this.props.detail.get('height')
Expand Down
1 change: 0 additions & 1 deletion js/dispatcher/appDispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ if (typeof chrome !== 'undefined') { // eslint-disable-line
}

class AppDispatcher {

constructor () {
this.callbacks = []
this.promises = []
Expand Down
7 changes: 4 additions & 3 deletions js/lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ module.exports.request = (options, callback) => {
params = underscore.defaults(underscore.pick(options, [ 'method', 'headers' ]), { headers: {} })
params.headers['accept-encoding'] = ''
if (options.payload) {
underscore.extend(params, { payload: JSON.stringify(options.payload),
payload_content_type: params.headers['content-type'] || 'application/json; charset=utf-8'
})
underscore.extend(params, {
payload: JSON.stringify(options.payload),
payload_content_type: params.headers['content-type'] || 'application/json; charset=utf-8'
})
}

if (process.env.NODE_ENV === 'development' &&
Expand Down
9 changes: 5 additions & 4 deletions preload-httpse.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ var db = new sqlite3.Database('httpse.sqlite', function (err) {
throw new Error('FATAL: could not open db: ' + err)
}

db.exec(['DROP TABLE IF EXISTS rulesets',
'CREATE TABLE rulesets (id INTEGER PRIMARY KEY, contents TEXT)',
'DROP TABLE IF EXISTS targets',
'CREATE TABLE targets (host TEXT UNIQUE, ids TEXT)'].join('; '), function (err) {
db.exec([
'DROP TABLE IF EXISTS rulesets',
'CREATE TABLE rulesets (id INTEGER PRIMARY KEY, contents TEXT)',
'DROP TABLE IF EXISTS targets',
'CREATE TABLE targets (host TEXT UNIQUE, ids TEXT)'].join('; '), function (err) {
if (err !== null) {
throw new Error('FATAL: could not create tables: ' + err)
}
Expand Down
2 changes: 1 addition & 1 deletion test/components/contextMenuTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('ContextMenu', function () {
.getValue(this.input).should.eventually.be.equal(this.values[3])
})

it('check left/right on non sub menu item', function *() {
it('check left/right on non sub menu item', function * () {
yield this.app.client
.tabByIndex(0)
.loadUrl(this.formfill)
Expand Down
4 changes: 1 addition & 3 deletions test/components/ledgerPanelAdvancedPanelTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function setup (client) {
.waitForVisible(urlInput)
}

function* setupPaymentsTabAndOpenAdvancedSettings (client, tabAlreadyLoaded) {
function * setupPaymentsTabAndOpenAdvancedSettings (client, tabAlreadyLoaded) {
yield client
.tabByIndex(0)

Expand Down Expand Up @@ -126,8 +126,6 @@ let generateAndSaveRecoveryFile = function (recoveryFilePath, paymentId, passphr
}

fs.writeFileSync(recoveryFilePath, recoveryFileContents)

return
}

describe.skip('Advanced payment panel tests', function () {
Expand Down
4 changes: 2 additions & 2 deletions test/components/tabsToolbarTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ describe('tabs toolbar tests', function () {

describe('hamburgerMenu\'s contextMenu appearance test', function () {
Brave.beforeAll(this)
before(function* () {
before(function * () {
yield setup(this.app.client)
})

beforeEach(function* () {
beforeEach(function * () {
yield this.app.client
.click(tabsToolbar)
})
Expand Down
1 change: 0 additions & 1 deletion test/lib/brave.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const rmDir = (dirPath) => {
fs.rmdirSync(dirPath)
} catch (e) {
console.error(e)
return
}
}

Expand Down
1 change: 0 additions & 1 deletion test/unit/app/common/urlParseTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ describe('urlParse', function () {
assert.deepEqual(result1, result2)
})
})

20 changes: 10 additions & 10 deletions test/unit/lib/urlutilTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,17 @@ describe('urlutil', function () {
})
it('gets subdomain hostname patterns', function () {
assert.deepEqual(UrlUtil.getHostnamePatterns('https://bar.brave.com'),
['bar.brave.com',
'*.brave.com',
'bar.*.com',
'bar.brave.*'])
['bar.brave.com',
'*.brave.com',
'bar.*.com',
'bar.brave.*'])
assert.deepEqual(UrlUtil.getHostnamePatterns('https://foo.bar.brave.com'),
['foo.bar.brave.com',
'*.bar.brave.com',
'foo.*.brave.com',
'foo.bar.*.com',
'foo.bar.brave.*',
'*.brave.com'])
['foo.bar.brave.com',
'*.bar.brave.com',
'foo.*.brave.com',
'foo.bar.*.com',
'foo.bar.brave.*',
'*.brave.com'])
})
})

Expand Down