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

Commit 18acc2a

Browse files
chrisgavincezaraugusto
authored andcommitted
Minor fixes of problems identified by lgtm. (#9732)
* Remove an unused argument. * Remove unused assignments. * Fix an incorrect type test. * Remove repeated values from regex character class. * Remove some unnecessary conditionals. * Remove unused dependencies.
1 parent 744469f commit 18acc2a

File tree

8 files changed

+12
-14
lines changed

8 files changed

+12
-14
lines changed

app/common/lib/formatUtil.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const defaultOrderLookup = (value) => {
4747
* Accelerator reference: https://github.com/electron/electron/blob/master/docs/api/accelerator.md
4848
*/
4949
module.exports.formatAccelerator = (accelerator) => {
50-
let result = accelerator
50+
let result
5151
let splitResult = accelerator.split('+')
5252
// sort in proper order, based on OS
5353
// also, replace w/ name or symbol

app/common/state/navigationBarState.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ const api = {
253253
}
254254
if (selected) {
255255
// selection implies focus
256-
state = state = api.setFocused(state, tabId, true)
256+
state = api.setFocused(state, tabId, true)
257257
}
258258
return state.setIn(path.push('selected'), selected)
259259
},

app/renderer/components/preferences/extensionsTab.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class ExtensionsTab extends ImmutableComponent {
113113
headings={['icon', 'name', 'description', 'version', 'enabled'] /* 'exclude' */}
114114
columnClassNames={this.columnClassNames}
115115
rowClassNames={
116-
this.props.extensions.map(entry => (entry = css(styles.extensionsRow))).toJS()
116+
this.props.extensions.map(entry => css(styles.extensionsRow)).toJS()
117117
}
118118
rows={this.props.extensions.map(entry => this.getRow(entry))} />
119119
</main>

js/contextMenus.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ function onUrlBarContextMenu (e) {
12881288

12891289
function onFindBarContextMenu (e) {
12901290
e.stopPropagation()
1291-
const findBarMenu = Menu.buildFromTemplate(findBarTemplateInit(e))
1291+
const findBarMenu = Menu.buildFromTemplate(findBarTemplateInit())
12921292
findBarMenu.popup(getCurrentWindow())
12931293
}
12941294

js/lib/debounce.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ function debounce (fn, bufferInterval, ...args) {
88
let timeout
99
return (...args2) => {
1010
clearTimeout(timeout)
11-
let a = args || []
12-
if (args2 && args2.constructor === Array) {
11+
let a = args
12+
if (args2.constructor === Array) {
1313
a = a.concat(args2)
1414
}
1515
timeout = setTimeout(fn.apply.bind(fn, this, a), bufferInterval)

js/lib/urlutil.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const UrlUtil = {
109109
// - starts with "?" or "."
110110
// - contains "? "
111111
// - ends with "." (and was not preceded by a domain or /)
112-
const case2Reg = /(^\?)|(\?.+\s)|(^\.)|(^[^.+..+]*[^/]*\.$)/
112+
const case2Reg = /(^\?)|(\?.+\s)|(^\.)|(^[^.+]*[^/]*\.$)/
113113
// for cases, pure string
114114
const case3Reg = /[?./\s:]/
115115
// for cases, data:uri, view-source:uri and about

js/state/userPrefs.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ let registeredPrivateSessions = {}
1010
const setUserPrefType = (ses, path, value) => {
1111
switch (typeof value) {
1212
case 'object':
13-
ses.userPrefs.setDictionaryPref(path, value)
13+
if (Array.isArray(value)) {
14+
ses.userPrefs.setListPref(path, value)
15+
} else {
16+
ses.userPrefs.setDictionaryPref(path, value)
17+
}
1418
break
1519
case 'string':
1620
ses.userPrefs.setStringPref(path, value)
1721
break
18-
case 'array':
19-
ses.userPrefs.setListPref(path, value)
20-
break
2122
case 'number':
2223
if ((/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i).test(value.to_s())) {
2324
ses.userPrefs.setDoublePref(path, value)

package.json

-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
"lru-cache": "^1.0.0",
109109
"moment": "^2.15.1",
110110
"niceware": "^1.0.4",
111-
"normalize-url": "^1.7.0",
112111
"parse-torrent": "^5.8.1",
113112
"prettier-bytes": "^1.0.3",
114113
"prop-types": "^15.5.6",
@@ -119,8 +118,6 @@
119118
"react-dnd": "^2.1.4",
120119
"react-dnd-html5-backend": "^2.1.2",
121120
"react-dom": "^15.5.4",
122-
"string.prototype.endswith": "^0.2.0",
123-
"string.prototype.startswith": "^0.2.0",
124121
"tablesort": "5.0.0",
125122
"tldjs": "1.6.2",
126123
"tracking-protection": "1.1.x",

0 commit comments

Comments
 (0)