Skip to content

Commit 7624cc7

Browse files
erisushazron
andauthored
chore: update eslint dev dependencies with fix (#265)
Co-authored-by: Shazron Abdullah <[email protected]>
1 parent d059137 commit 7624cc7

File tree

11 files changed

+494
-228
lines changed

11 files changed

+494
-228
lines changed

package-lock.json

Lines changed: 403 additions & 134 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@
4949
"devDependencies": {
5050
"@babel/core": "^7.5.5",
5151
"@babel/preset-env": "^7.5.5",
52-
"@babel/runtime": "^7.5.5",
5352
"@oclif/dev-cli": "^1.22.2",
5453
"@oclif/test": "^1.2.5",
5554
"acorn": "^7.0.0",
5655
"babel-jest": "^24.9.0",
56+
"@babel/runtime": "^7.5.5",
5757
"codecov": "^3.5.0",
58-
"eslint": "^5.15.1",
59-
"eslint-config-oclif": "^1",
60-
"eslint-config-standard": "^12.0.0",
61-
"eslint-plugin-import": "^2.12.0",
62-
"eslint-plugin-jest": "^22.3.0",
63-
"eslint-plugin-node": "^8.0.1",
64-
"eslint-plugin-promise": "^4.0.1",
65-
"eslint-plugin-standard": "^4.0.0",
58+
"eslint": "^6.2.2",
59+
"eslint-config-oclif": "^3.1.0",
60+
"eslint-config-standard": "^14.0.1",
61+
"eslint-plugin-import": "^2.18.2",
62+
"eslint-plugin-jest": "^22.15.2",
63+
"eslint-plugin-node": "^9.1.0",
64+
"eslint-plugin-promise": "^4.2.1",
65+
"eslint-plugin-standard": "^4.0.1",
6666
"jest": "^24.9.0",
6767
"jest-junit": "^8.0.0",
6868
"mock-fs": "^4.10.1",

src/commands/install.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ class InstallCommand extends BaseCommand {
1111
// lib.install(app_path, args.devicetypeid, args.log, args.exit)
1212
const { args, flags } = this.parse(InstallCommand)
1313

14-
let info_plist_path
15-
16-
info_plist_path = path.join(args.applicationPath, 'Info.plist')
14+
const info_plist_path = path.join(args.applicationPath, 'Info.plist')
1715
if (!fs.existsSync(info_plist_path)) {
1816
this.handleError(`${info_plist_path} file not found.`)
1917
}
@@ -25,7 +23,7 @@ class InstallCommand extends BaseCommand {
2523

2624
// get the deviceid from --devicetypeid
2725
// --devicetypeid is a string in the form "devicetype, runtime_version" (optional: runtime_version)
28-
let device = getDeviceFromDeviceTypeId(flags.devicetypeid)
26+
const device = getDeviceFromDeviceTypeId(flags.devicetypeid)
2927

3028
// so now we have the deviceid, we can proceed
3129
simctl.extensions.start(device.id)

src/commands/launch.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ class LaunchCommand extends BaseCommand {
1111
async run () {
1212
const { args, flags } = this.parse(LaunchCommand)
1313

14-
let wait_for_debugger = false
15-
let info_plist_path
14+
const wait_for_debugger = false
15+
const info_plist_path = path.join(args.applicationPath, 'Info.plist')
1616
let app_identifier
1717

18-
info_plist_path = path.join(args.applicationPath, 'Info.plist')
1918
if (!fs.existsSync(info_plist_path)) {
2019
this.handleError(`${info_plist_path} file not found.`)
2120
}
@@ -33,15 +32,15 @@ class LaunchCommand extends BaseCommand {
3332
app_identifier = obj[0].CFBundleIdentifier
3433
}
3534

36-
let flagArgs = flags.args || []
37-
let setenv = flags.setenv || []
35+
const flagArgs = flags.args || []
36+
const setenv = flags.setenv || []
3837

39-
let environmentVariables = parseEnvironmentVariables(setenv)
38+
const environmentVariables = parseEnvironmentVariables(setenv)
4039

4140
withInjectedEnvironmentVariablesToProcess(process, environmentVariables, function () {
4241
// get the deviceid from --devicetypeid
4342
// --devicetypeid is a string in the form "devicetype, runtime_version" (optional: runtime_version)
44-
let device = getDeviceFromDeviceTypeId(flags.devicetypeid)
43+
const device = getDeviceFromDeviceTypeId(flags.devicetypeid)
4544

4645
// so now we have the deviceid, we can proceed
4746
simctl.extensions.start(device.id)

src/commands/showsdks.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ const simctl = require('simctl')
33

44
class ShowSdksCommand extends BaseCommand {
55
async run () {
6-
let options = { silent: true, runtimes: true }
7-
let list = simctl.list(options).json
6+
const options = { silent: true, runtimes: true }
7+
const list = simctl.list(options).json
88

99
this.log(await this.output(list.runtimes))
1010
return list.runtimes
1111
}
1212

1313
async output (runtimes) {
1414
if (!runtimes) {
15-
let options = { silent: true, runtimes: true }
16-
let list = simctl.list(options).json
15+
const options = { silent: true, runtimes: true }
16+
const list = simctl.list(options).json
1717
runtimes = list.runtimes
1818
}
1919

src/commands/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class StartCommand extends BaseCommand {
77
async run () {
88
const { flags } = this.parse(StartCommand)
99

10-
let device = getDeviceFromDeviceTypeId(flags.devicetypeid)
10+
const device = getDeviceFromDeviceTypeId(flags.devicetypeid)
1111
simctl.extensions.start(device.id)
1212
}
1313
}

src/helpers.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const simctl = require('simctl')
22

33
function fixSimCtlList (list) {
44
// Xcode 9 `xcrun simctl list devicetypes` have obfuscated names for 2017 iPhones and Apple Watches.
5-
let deviceTypeNameMap = {
5+
const deviceTypeNameMap = {
66
'iPhone2017-A': 'iPhone 8',
77
'iPhone2017-B': 'iPhone 8 Plus',
88
'iPhone2017-C': 'iPhone X',
@@ -13,7 +13,7 @@ function fixSimCtlList (list) {
1313

1414
// `iPad Pro` in iOS 9.3 has mapped to `iPad Pro (9.7 inch)`
1515
// `Apple TV 1080p` has mapped to `Apple TV`
16-
let deviceNameMap = {
16+
const deviceNameMap = {
1717
'Apple TV 1080p': 'Apple TV',
1818
'iPad Pro': 'iPad Pro (9.7-inch)'
1919
}
@@ -25,36 +25,36 @@ function fixSimCtlList (list) {
2525
}
2626

2727
function getDeviceTypes (druntimes) {
28-
let options = { silent: true }
28+
const options = { silent: true }
2929
let list = simctl.list(options).json
3030
list = fixSimCtlList(list)
3131

3232
if (!druntimes) {
3333
druntimes = findRuntimesGroupByDeviceProperty(list, 'name', true, { lowerCase: true })
3434
}
35-
let name_id_map = {}
35+
const name_id_map = {}
3636

3737
list.devicetypes.forEach(function (device) {
38-
name_id_map[ filterDeviceName(device.name).toLowerCase() ] = device.identifier
38+
name_id_map[filterDeviceName(device.name).toLowerCase()] = device.identifier
3939
})
4040

4141
list = []
42-
let remove = function (devicename, runtime) {
42+
const remove = function (devicename, runtime) {
4343
// remove "iOS" prefix in runtime, remove prefix "com.apple.CoreSimulator.SimDeviceType." in id
44-
const deviceName = name_id_map[ devicename ].replace(/^com.apple.CoreSimulator.SimDeviceType./, '')
44+
const deviceName = name_id_map[devicename].replace(/^com.apple.CoreSimulator.SimDeviceType./, '')
4545
const runtimeName = runtime.replace(/^iOS /, '')
4646
list.push(`${deviceName}, ${runtimeName}`)
4747
}
4848

49-
let cur = function (devicename) {
49+
const cur = function (devicename) {
5050
return function (runtime) {
5151
remove(devicename, runtime)
5252
}
5353
}
5454

55-
for (let deviceName in druntimes) {
56-
let runtimes = druntimes[ deviceName ]
57-
let dname = filterDeviceName(deviceName).toLowerCase()
55+
for (const deviceName in druntimes) {
56+
const runtimes = druntimes[deviceName]
57+
const dname = filterDeviceName(deviceName).toLowerCase()
5858

5959
if (!(dname in name_id_map)) {
6060
continue
@@ -71,7 +71,7 @@ function fixNameKey (array, mapping) {
7171
}
7272

7373
return array.map(function (elem) {
74-
let name = mapping[elem.name]
74+
const name = mapping[elem.name]
7575
if (name) {
7676
elem.name = name
7777
}
@@ -101,8 +101,8 @@ function findRuntimesGroupByDeviceProperty (list, deviceProperty, availableOnly,
101101
}
102102
*/
103103

104-
let runtimes = {}
105-
let available_runtimes = {}
104+
const runtimes = {}
105+
const available_runtimes = {}
106106

107107
list.runtimes.forEach(function (runtime) {
108108
// runtime.name should already be normalized, 'identifier' key has the namespaced name
@@ -113,7 +113,7 @@ function findRuntimesGroupByDeviceProperty (list, deviceProperty, availableOnly,
113113
list.devices[deviceGroup].forEach(function (device) {
114114
// deviceGroup has not been normalized, it can either be the namespaced name, or the
115115
// human readable name. We normalize it
116-
let normalizedRuntimeName = fixRuntimeName(deviceGroup)
116+
const normalizedRuntimeName = fixRuntimeName(deviceGroup)
117117

118118
let devicePropertyValue = device[deviceProperty]
119119

@@ -143,16 +143,16 @@ function parseEnvironmentVariables (envVariables, fixsymctl) {
143143
envVariables = envVariables || []
144144
fixsymctl = typeof fixsymctl !== 'undefined' ? fixsymctl : true
145145

146-
let envMap = {}
146+
const envMap = {}
147147
envVariables.forEach(function (variable) {
148-
let envPair = variable.split('=', 2)
148+
const envPair = variable.split('=', 2)
149149
if (envPair.length === 2) {
150150
let key = envPair[0]
151-
let value = envPair[1]
151+
const value = envPair[1]
152152
if (fixsymctl) {
153153
key = 'SIMCTL_CHILD_' + key
154154
}
155-
envMap[ key ] = value
155+
envMap[key] = value
156156
}
157157
})
158158
return envMap
@@ -161,11 +161,11 @@ function parseEnvironmentVariables (envVariables, fixsymctl) {
161161
// Injects specified environment variables to the process and then runs action
162162
// returns environment variables back to original state after action completes
163163
function withInjectedEnvironmentVariablesToProcess (process, envVariables, action) {
164-
let oldVariables = Object.assign({}, process.env)
164+
const oldVariables = Object.assign({}, process.env)
165165

166166
// Inject additional environment variables to process
167-
for (let key in envVariables) {
168-
let value = envVariables[key]
167+
for (const key in envVariables) {
168+
const value = envVariables[key]
169169
process.env[key] = value
170170
}
171171

@@ -186,13 +186,13 @@ function getDeviceFromDeviceTypeId (devicetypeid) {
186186
*/
187187

188188
// the object to return
189-
let ret_obj = {
189+
const ret_obj = {
190190
name: null,
191191
id: null,
192192
runtime: null
193193
}
194194

195-
let options = { 'silent': true }
195+
const options = { silent: true }
196196
let list = simctl.list(options).json
197197
list = fixSimCtlList(list)
198198

@@ -205,7 +205,7 @@ function getDeviceFromDeviceTypeId (devicetypeid) {
205205
// --devicetypeid is a string in the form "devicetype, runtime_version" (optional: runtime_version)
206206
let devicetype = null
207207
if (arr.length < 1) {
208-
let dv = findFirstAvailableDevice(list)
208+
const dv = findFirstAvailableDevice(list)
209209
console.error(`--devicetypeid was not specified, using first available device: ${dv.name}`)
210210
return dv
211211
} else {
@@ -216,13 +216,13 @@ function getDeviceFromDeviceTypeId (devicetypeid) {
216216
}
217217

218218
// check whether devicetype has the "com.apple.CoreSimulator.SimDeviceType." prefix, if not, add it
219-
let prefix = 'com.apple.CoreSimulator.SimDeviceType.'
219+
const prefix = 'com.apple.CoreSimulator.SimDeviceType.'
220220
if (devicetype.indexOf(prefix) !== 0) {
221221
devicetype = prefix + devicetype
222222
}
223223

224224
// now find the devicename from the devicetype
225-
let devicename_found = list.devicetypes.some(function (deviceGroup) {
225+
const devicename_found = list.devicetypes.some(function (deviceGroup) {
226226
if (deviceGroup.identifier === devicetype) {
227227
ret_obj.name = deviceGroup.name
228228
return true
@@ -247,10 +247,10 @@ function getDeviceFromDeviceTypeId (devicetypeid) {
247247
}
248248

249249
// now find the deviceid (by runtime and devicename)
250-
let deviceid_found = Object.keys(list.devices).some(function (deviceGroup) {
250+
const deviceid_found = Object.keys(list.devices).some(function (deviceGroup) {
251251
// deviceGroup has not been normalized, it can either be the namespaced name, or the
252252
// human readable name. We normalize it
253-
let normalizedRuntimeName = fixRuntimeName(deviceGroup)
253+
const normalizedRuntimeName = fixRuntimeName(deviceGroup)
254254
if (normalizedRuntimeName === ret_obj.runtime) {
255255
return list.devices[deviceGroup].some(function (device) {
256256
if (filterDeviceName(device.name).toLowerCase() === filterDeviceName(ret_obj.name).toLowerCase()) {
@@ -275,9 +275,9 @@ function getDeviceFromDeviceTypeId (devicetypeid) {
275275
function findAvailableRuntime (list, devicename) {
276276
const device_name = devicename.toLowerCase()
277277

278-
let all_druntimes = findRuntimesGroupByDeviceProperty(list, 'name', true, { lowerCase: true })
279-
let druntime = all_druntimes[ filterDeviceName(device_name) ] || all_druntimes[ device_name ]
280-
let runtime_found = druntime && druntime.length > 0
278+
const all_druntimes = findRuntimesGroupByDeviceProperty(list, 'name', true, { lowerCase: true })
279+
const druntime = all_druntimes[filterDeviceName(device_name)] || all_druntimes[device_name]
280+
const runtime_found = druntime && druntime.length > 0
281281

282282
if (!runtime_found) {
283283
throw new Error(`No available runtimes could be found for "${devicename}".`)
@@ -304,7 +304,7 @@ function findFirstAvailableDevice (list) {
304304
runtime: null
305305
}
306306

307-
let available_runtimes = {}
307+
const available_runtimes = {}
308308

309309
list.runtimes.forEach(function (runtime) {
310310
// runtime.name should already be normalized, 'identifier' key has the namespaced name
@@ -315,7 +315,7 @@ function findFirstAvailableDevice (list) {
315315
return list.devices[deviceGroup].some(function (device) {
316316
// deviceGroup has not been normalized, it can either be the namespaced name, or the
317317
// human readable name. We normalize it
318-
let normalizedRuntimeName = fixRuntimeName(deviceGroup)
318+
const normalizedRuntimeName = fixRuntimeName(deviceGroup)
319319
if (available_runtimes[normalizedRuntimeName]) {
320320
ret_obj = {
321321
name: device.name,
@@ -337,7 +337,7 @@ function fixRuntimeName (runtimeName) {
337337
const match = pattern.exec(runtimeName)
338338

339339
if (match) {
340-
const [ , , os, version ] = match
340+
const [, , os, version] = match
341341
// all or nothing -- os, version will always have a value for match
342342
return `${os} ${version.replace('-', '.')}`
343343
}

src/index.legacy.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ module.exports = {
2727

2828
install: (app_path, devicetypeid, log, exit) => { // legacy for backwards compatibility
2929
deprecatedMessage('install', 'InstallCommand')
30-
let argv = [ app_path, '--devicetypeid', devicetypeid ]
30+
const argv = [app_path, '--devicetypeid', devicetypeid]
3131
if (log) {
32-
argv.push(...[ '--log', log ])
32+
argv.push(...['--log', log])
3333
}
3434
if (exit) {
3535
argv.push('--exit')
@@ -39,26 +39,26 @@ module.exports = {
3939

4040
launch: (app_path, devicetypeid, log, exit, setenv, args) => { // legacy for backwards compatibility
4141
deprecatedMessage('launch', 'LaunchCommand')
42-
let argv = [ app_path, '--devicetypeid', devicetypeid ]
42+
const argv = [app_path, '--devicetypeid', devicetypeid]
4343
if (log) {
44-
argv.push(...[ '--log', log ])
44+
argv.push(...['--log', log])
4545
}
4646
if (exit) {
4747
argv.push('--exit')
4848
}
4949
if (setenv) {
50-
argv.push(...[ '--setenv', setenv ])
50+
argv.push(...['--setenv', setenv])
5151
}
5252
if (args) {
53-
argv.push(...[ '--args', args ])
53+
argv.push(...['--args', args])
5454
}
5555

5656
return LaunchCommand.run(argv)
5757
},
5858

5959
start: (devicetypeid) => { // legacy for backwards compatibility
6060
deprecatedMessage('start', 'StartCommand')
61-
let argv = [ '--devicetypeid', devicetypeid ]
61+
const argv = ['--devicetypeid', devicetypeid]
6262

6363
return StartCommand.run(argv)
6464
}

0 commit comments

Comments
 (0)