Skip to content

Commit 2743584

Browse files
Dharin-shahdiemol
andauthored
[js] chore: fix linter (#9639)
Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
1 parent b6851f8 commit 2743584

26 files changed

+245
-196
lines changed

javascript/node/selenium-webdriver/chrome.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,9 @@ class Driver extends chromium.Driver {
236236
*/
237237
static createSession(opt_config, opt_serviceExecutor) {
238238
let caps = opt_config || new Options()
239-
return /** @type {!Driver} */ (super.createSession(
240-
caps,
241-
opt_serviceExecutor
242-
))
239+
return /** @type {!Driver} */ (
240+
super.createSession(caps, opt_serviceExecutor)
241+
)
243242
}
244243
}
245244

javascript/node/selenium-webdriver/chromium.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -557,14 +557,13 @@ class Options extends Capabilities {
557557
* @return {!Options} A self reference.
558558
*/
559559
windowTypes(...args) {
560-
let windowTypes = (this.options_.windowTypes || []).concat(...args);
560+
let windowTypes = (this.options_.windowTypes || []).concat(...args)
561561
if (windowTypes.length) {
562-
this.options_.windowTypes = windowTypes;
562+
this.options_.windowTypes = windowTypes
563563
}
564-
return this;
564+
return this
565565
}
566566

567-
568567
/**
569568
* Converts this instance to its JSON wire protocol representation. Note this
570569
* function is an implementation not intended for general use.
@@ -581,7 +580,7 @@ class Options extends Capabilities {
581580
return extension.toString('base64')
582581
}
583582
return io
584-
.read(/** @type {string} */(extension))
583+
.read(/** @type {string} */ (extension))
585584
.then((buffer) => buffer.toString('base64'))
586585
})
587586
}
@@ -634,7 +633,7 @@ class Driver extends webdriver.WebDriver {
634633
* implementation.
635634
* @override
636635
*/
637-
setFileDetector() { }
636+
setFileDetector() {}
638637

639638
/**
640639
* Schedules a command to launch Chrome App with given ID.

javascript/node/selenium-webdriver/edge.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ class ServiceBuilder extends chromium.ServiceBuilder {
109109
let exe = opt_exe || locateSynchronously()
110110
if (!exe) {
111111
throw Error(
112-
`The WebDriver for Edge could not be found on the current PATH. Please download the `+
113-
`latest version of ${EDGEDRIVER_CHROMIUM_EXE} from `+
114-
`https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ `+
115-
`and ensure it can be found on your PATH.`
112+
`The WebDriver for Edge could not be found on the current PATH. Please download the ` +
113+
`latest version of ${EDGEDRIVER_CHROMIUM_EXE} from ` +
114+
`https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ ` +
115+
`and ensure it can be found on your PATH.`
116116
)
117117
}
118118
super(exe)
@@ -152,10 +152,9 @@ class Driver extends chromium.Driver {
152152
*/
153153
static createSession(opt_config, opt_serviceExecutor) {
154154
let caps = opt_config || new Options()
155-
return /** @type {!Driver} */ (super.createSession(
156-
caps,
157-
opt_serviceExecutor
158-
))
155+
return /** @type {!Driver} */ (
156+
super.createSession(caps, opt_serviceExecutor)
157+
)
159158
}
160159

161160
/**
@@ -175,7 +174,7 @@ function setDefaultService(service) {
175174
if (defaultService && defaultService.isRunning()) {
176175
throw Error(
177176
'The previously configured EdgeDriver service is still running. ' +
178-
'You must shut it down before you may adjust its configuration.'
177+
'You must shut it down before you may adjust its configuration.'
179178
)
180179
}
181180
defaultService = service
@@ -194,7 +193,6 @@ function getDefaultService() {
194193
return defaultService
195194
}
196195

197-
198196
/**
199197
* _Synchronously_ attempts to locate the chromedriver executable on the current
200198
* system.

javascript/node/selenium-webdriver/firefox.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ async function buildProfile(template, extensions) {
222222
dir = await io.tmpDir()
223223
if (template) {
224224
await io.copyDir(
225-
/** @type {string} */(template),
225+
/** @type {string} */ (template),
226226
dir,
227227
/(parent\.lock|lock|\.parentlock)/
228228
)
@@ -432,11 +432,11 @@ function findGeckoDriver() {
432432
if (!exe) {
433433
throw Error(
434434
'The ' +
435-
GECKO_DRIVER_EXE +
436-
' executable could not be found on the current ' +
437-
'PATH. Please download the latest version from ' +
438-
'https://github.com/mozilla/geckodriver/releases/ ' +
439-
'and ensure it can be found on your PATH.'
435+
GECKO_DRIVER_EXE +
436+
' executable could not be found on the current ' +
437+
'PATH. Please download the latest version from ' +
438+
'https://github.com/mozilla/geckodriver/releases/ ' +
439+
'and ensure it can be found on your PATH.'
440440
)
441441
}
442442
return exe
@@ -457,8 +457,8 @@ function findInProgramFiles(file) {
457457
return exists
458458
? files[0]
459459
: io.exists(files[1]).then(function (exists) {
460-
return exists ? files[1] : null
461-
})
460+
return exists ? files[1] : null
461+
})
462462
})
463463
}
464464

@@ -592,7 +592,7 @@ class Driver extends webdriver.WebDriver {
592592
* implementation.
593593
* @override
594594
*/
595-
setFileDetector() { }
595+
setFileDetector() {}
596596

597597
/**
598598
* Get the context that is currently in effect.

javascript/node/selenium-webdriver/ie.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,9 @@ class Driver extends webdriver.WebDriver {
478478
let client = service.start().then((url) => new http.HttpClient(url))
479479
let executor = new http.Executor(client)
480480

481-
return /** @type {!Driver} */ (super.createSession(executor, options, () =>
482-
service.kill()
483-
))
481+
return /** @type {!Driver} */ (
482+
super.createSession(executor, options, () => service.kill())
483+
)
484484
}
485485

486486
/**

javascript/node/selenium-webdriver/io/exec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ class Result {
7676
}
7777
}
7878

79-
const COMMAND_RESULT = /** !WeakMap<!Command, !Promise<!Result>> */ new WeakMap()
79+
const COMMAND_RESULT =
80+
/** !WeakMap<!Command, !Promise<!Result>> */ new WeakMap()
8081
const KILL_HOOK = /** !WeakMap<!Command, function(string)> */ new WeakMap()
8182

8283
/**

javascript/node/selenium-webdriver/lib/capabilities.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const Platform = {
8383
*
8484
* @record
8585
*/
86-
function Timeouts() { }
86+
function Timeouts() {}
8787

8888
/**
8989
* Defines when, in milliseconds, to interrupt a script that is being
@@ -263,7 +263,9 @@ class Capabilities {
263263
* @return {!Capabilities} A basic set of capabilities for Firefox.
264264
*/
265265
static firefox() {
266-
return new Capabilities().setBrowserName(Browser.FIREFOX).set("moz:debuggerAddress", true)
266+
return new Capabilities()
267+
.setBrowserName(Browser.FIREFOX)
268+
.set('moz:debuggerAddress', true)
267269
}
268270

269271
/**

javascript/node/selenium-webdriver/lib/http.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ function buildRequest(customCommands, w3c, command) {
490490
}
491491
}
492492

493-
const CLIENTS = /** !WeakMap<!Executor, !(Client|IThenable<!Client>)> */ new WeakMap()
493+
const CLIENTS =
494+
/** !WeakMap<!Executor, !(Client|IThenable<!Client>)> */ new WeakMap()
494495

495496
/**
496497
* A command executor that communicates with the server using JSON over HTTP.

javascript/node/selenium-webdriver/lib/input.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
* @fileoverview Defines types related to user input with the WebDriver API.
2222
*/
2323
const { Command, Name } = require('./command')
24-
const {
25-
InvalidArgumentError
26-
} = require('./error')
24+
const { InvalidArgumentError } = require('./error')
2725

2826
/**
2927
* Enumeration of the buttons used in the advanced interactions API.
@@ -499,7 +497,6 @@ class Actions {
499497
* sequence (see class description for details).
500498
*/
501499
constructor(executor, { async = false } = {}) {
502-
503500
/** @private @const */
504501
this.executor_ = executor
505502

@@ -878,13 +875,9 @@ class Actions {
878875
return Promise.resolve()
879876
}
880877

881-
try {
882-
await this.executor_.execute(
883-
new Command(Name.ACTIONS).setParameter('actions', _actions)
884-
)
885-
} catch (ex) {
886-
throw ex
887-
}
878+
await this.executor_.execute(
879+
new Command(Name.ACTIONS).setParameter('actions', _actions)
880+
)
888881
}
889882
}
890883

javascript/node/selenium-webdriver/lib/until.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,13 @@ exports.alertIsPresent = function alertIsPresent() {
137137
* @return {!Condition<boolean>} The new condition.
138138
*/
139139
exports.titleIs = function titleIs(title) {
140-
return new Condition(
141-
'for title to be ' + JSON.stringify(title),
142-
function (driver) {
143-
return driver.getTitle().then(function (t) {
144-
return t === title
145-
})
146-
}
147-
)
140+
return new Condition('for title to be ' + JSON.stringify(title), function (
141+
driver
142+
) {
143+
return driver.getTitle().then(function (t) {
144+
return t === title
145+
})
146+
})
148147
}
149148

150149
/**
@@ -189,14 +188,13 @@ exports.titleMatches = function titleMatches(regex) {
189188
* @return {!Condition<boolean>} The new condition.
190189
*/
191190
exports.urlIs = function urlIs(url) {
192-
return new Condition(
193-
'for URL to be ' + JSON.stringify(url),
194-
function (driver) {
195-
return driver.getCurrentUrl().then(function (u) {
196-
return u === url
197-
})
198-
}
199-
)
191+
return new Condition('for URL to be ' + JSON.stringify(url), function (
192+
driver
193+
) {
194+
return driver.getCurrentUrl().then(function (u) {
195+
return u === url
196+
})
197+
})
200198
}
201199

202200
/**

0 commit comments

Comments
 (0)