Skip to content

Commit 70314c5

Browse files
chore: Bump eslint version (#977)
1 parent 24ee648 commit 70314c5

35 files changed

+46
-63
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import appiumConfig from '@appium/eslint-config-appium-ts';
2+
3+
export default [
4+
...appiumConfig,
5+
];

lib/commands/app-management.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export async function terminateApp(appId, options = {}) {
165165
waitMs: timeout,
166166
intervalMs: 100,
167167
});
168-
} catch (e) {
168+
} catch {
169169
if (!_.isEmpty(currentPids) && !_.isEmpty(_.difference(pids, currentPids))) {
170170
this.log.warn(
171171
`Some of processes belonging to the '${appId}' applcation are still running ` +
@@ -283,7 +283,7 @@ export async function background(seconds) {
283283
this.log.debug(`Activating app '${appPackage}' in order to restore it`);
284284
await this.adb.activateApp(/** @type {string} */ (appPackage));
285285
return true;
286-
} catch (ign) {}
286+
} catch {}
287287
args =
288288
(appPackage === this.opts.appPackage && appActivity === this.opts.appActivity) ||
289289
(appPackage === this.opts.appWaitPackage &&
@@ -344,7 +344,7 @@ export async function resetAUT(opts = null) {
344344
if (isInstalled) {
345345
try {
346346
await this.adb.forceStop(appPackage);
347-
} catch (ign) {}
347+
} catch {}
348348
// fullReset has priority over fastReset
349349
if (!fullReset && fastReset) {
350350
const output = await this.adb.clear(appPackage);

lib/commands/context/exports.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/* eslint-disable require-await */
21
import {util} from '@appium/support';
3-
import Chromedriver from 'appium-chromedriver';
2+
import {Chromedriver} from 'appium-chromedriver';
43
import {errors, PROTOCOLS} from 'appium/driver';
54
import _ from 'lodash';
65
import {

lib/commands/context/helpers.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import B from 'bluebird';
88
import os from 'node:os';
99
import path from 'node:path';
1010
import http from 'node:http';
11-
import Chromedriver from 'appium-chromedriver';
11+
import {Chromedriver} from 'appium-chromedriver';
1212
import {toDetailsCacheKey, getWebviewDetails, WEBVIEWS_DETAILS_CACHE} from './cache';
1313
import dns from 'node:dns/promises';
1414

@@ -317,7 +317,7 @@ async function allocateDevtoolsChannel(socketName, webviewDevtoolsPort = null) {
317317
let localPort;
318318
try {
319319
localPort = await findAPortNotInUse(startPort, endPort);
320-
} catch (e) {
320+
} catch {
321321
throw new Error(
322322
`Cannot find any free port to forward the Devtools socket ` +
323323
`in range ${startPort}..${endPort}. You could set the starting port number ` +
@@ -649,7 +649,7 @@ async function getChromedriverPort(portSpec) {
649649
try {
650650
foundPort = await findAPortNotInUse(port, stopPort);
651651
break;
652-
} catch (e) {
652+
} catch {
653653
this.log.debug(`Nothing in port range ${port}:${stopPort} was available`);
654654
}
655655
}
@@ -715,7 +715,6 @@ export async function setupNewChromedriver(opts, curDeviceId, context) {
715715
const chromedriver = new Chromedriver({
716716
port: String(opts.chromedriverPort),
717717
executable: opts.chromedriverExecutable,
718-
// eslint-disable-next-line object-shorthand
719718
adb: /** @type {any} */ (this.adb),
720719
cmdArgs: /** @type {string[]} */ (opts.chromedriverArgs),
721720
verbose: !!opts.showChromedriverLog,

lib/commands/device/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import semver from 'semver';
1+
import * as semver from 'semver';
22
import _ from 'lodash';
33
import B from 'bluebird';
44
import path from 'node:path';

lib/commands/device/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _ from 'lodash';
22
import {util} from '@appium/support';
3-
import ADB from 'appium-adb';
3+
import {ADB} from 'appium-adb';
44
import {retryInterval} from 'asyncbox';
55
import {
66
path as SETTINGS_APK_PATH,

lib/commands/file-actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ function createFSTests(adb) {
339339
const fullCmd = runAs ? `run-as ${runAs} ${checkCmd}` : checkCmd;
340340
try {
341341
return _.includes(await adb.shell([fullCmd]), passFlag);
342-
} catch (ign) {
342+
} catch {
343343
return false;
344344
}
345345
};

lib/commands/geolocation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export async function setMockLocationApp(appId) {
137137
if (await this.adb.fileExists(MOCK_APP_IDS_STORE)) {
138138
try {
139139
pkgIds = JSON.parse(await this.adb.shell(['cat', MOCK_APP_IDS_STORE]));
140-
} catch (ign) {}
140+
} catch {}
141141
}
142142
if (pkgIds.includes(appId)) {
143143
return;
@@ -172,7 +172,7 @@ async function resetMockLocation() {
172172
if (await this.adb.fileExists(MOCK_APP_IDS_STORE)) {
173173
try {
174174
pkgIds = JSON.parse(await this.adb.shell(['cat', MOCK_APP_IDS_STORE]));
175-
} catch (ign) {}
175+
} catch {}
176176
}
177177
const thirdPartyPkgIds = await thirdPartyPkgIdsPromise;
178178
// Only include currently installed packages
@@ -194,7 +194,7 @@ async function resetMockLocation() {
194194
(async () => {
195195
try {
196196
await this.adb.shell(['appops', 'set', pkgId, 'android:mock_location', 'deny']);
197-
} catch (ign) {}
197+
} catch {}
198198
})(),
199199
),
200200
);

lib/commands/ime.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {errors} from 'appium/driver';
55
* @returns {Promise<boolean>}
66
*/
77
export async function isIMEActivated() {
8-
// eslint-disable-line require-await
98
// IME is always activated on Android devices
109
return true;
1110
}

lib/commands/legacy.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,20 @@ const ISSUE_URL = 'https://github.com/appium/appium/issues/15807';
55
/**
66
* @this {AndroidDriver}
77
*/
8-
// eslint-disable-next-line require-await
98
export async function launchApp () {
109
throw new errors.UnsupportedOperationError(`This API is not supported anymore. See ${ISSUE_URL}`);
1110
}
1211

1312
/**
1413
* @this {AndroidDriver}
1514
*/
16-
// eslint-disable-next-line require-await
1715
export async function closeApp () {
1816
throw new errors.UnsupportedOperationError(`This API is not supported anymore. See ${ISSUE_URL}`);
1917
}
2018

2119
/**
2220
* @this {AndroidDriver}
2321
*/
24-
// eslint-disable-next-line require-await
2522
export async function reset () {
2623
throw new errors.UnsupportedOperationError(`This API is not supported anymore. See ${ISSUE_URL}`);
2724
}

lib/commands/lock/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export async function pinUnlock(capabilities) {
195195
let el;
196196
try {
197197
el = await this.findElOrEls('id', `com.android.keyguard:id/key${pin}`, false);
198-
} catch (ign) {
198+
} catch {
199199
return await pinUnlockWithKeyEvent.bind(this)(capabilities);
200200
}
201201
await this.click(util.unwrapElement(el));
@@ -347,7 +347,7 @@ export async function verifyUnlock(timeoutMs = null) {
347347
waitMs: timeoutMs ?? 2000,
348348
intervalMs: 500,
349349
});
350-
} catch (ign) {
350+
} catch {
351351
throw new Error('The device has failed to be unlocked');
352352
}
353353
this.log.info('The device has been successfully unlocked');

lib/commands/log.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export async function mobileStartLogsBroadcast() {
9898
if (!_.isEmpty(this._logcatWebsocketListener)) {
9999
try {
100100
this.adb.removeLogcatListener(this._logcatWebsocketListener);
101-
} catch (ign) {}
101+
} catch {}
102102
this._logcatWebsocketListener = undefined;
103103
}
104104

lib/commands/recordscreen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export async function stopRecordingScreen(options = {}) {
114114
'SIGINT',
115115
PROCESS_SHUTDOWN_TIMEOUT,
116116
);
117-
} catch (e) {
117+
} catch {
118118
throw this.log.errorWithException(
119119
`Unable to stop screen recording within ${PROCESS_SHUTDOWN_TIMEOUT}ms`,
120120
);
@@ -277,7 +277,7 @@ async function scheduleScreenRecord(recordingProperties) {
277277
waitMs: RETRY_TIMEOUT,
278278
intervalMs: RETRY_PAUSE,
279279
});
280-
} catch (e) {
280+
} catch {
281281
throw new Error(
282282
`The expected screen record file '${pathOnDevice}' does not exist after ${RETRY_TIMEOUT}ms. ` +
283283
`Is ${SCREENRECORD_BINARY} utility available and operational on the device under test?`,
@@ -297,7 +297,7 @@ async function scheduleScreenRecord(recordingProperties) {
297297
async function mergeScreenRecords(mediaFiles) {
298298
try {
299299
await fs.which(FFMPEG_BINARY);
300-
} catch (e) {
300+
} catch {
301301
throw new Error(
302302
`${FFMPEG_BINARY} utility is not available in PATH. Please install it from https://www.ffmpeg.org/`,
303303
);

lib/commands/streamscreen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ async function verifyStreamingRequirements(adb) {
261261
(async () => {
262262
try {
263263
await fs.which(binaryName);
264-
} catch (e) {
264+
} catch {
265265
throw new Error(
266266
`The '${binaryName}' binary is not available in the PATH on the host system. ` +
267267
`See ${GST_TUTORIAL_URL} for more details on how to install it.`,
@@ -472,7 +472,7 @@ async function initGstreamerPipeline(deviceStreamingProc, deviceInfo, log, opts)
472472
async () => {
473473
try {
474474
return (await checkPortStatus(tcpPort, TCP_HOST)) === 'open';
475-
} catch (ign) {
475+
} catch {
476476
return false;
477477
}
478478
},

lib/doctor/checks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export class AndroidSdkCheck {
137137
for (const binary of this.TOOL_NAMES) {
138138
try {
139139
this.log.info(` '${binary}' exists in ${await getAndroidBinaryPath(binary)}`);
140-
} catch (e) {
140+
} catch {
141141
missingBinaries.push(binary);
142142
}
143143
}

lib/doctor/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export async function resolveExecutablePath(cmd) {
1212
if (executablePath && (await fs.exists(executablePath))) {
1313
return executablePath;
1414
}
15-
} catch (err) {}
15+
} catch {}
1616
return null;
1717
}

lib/driver.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
2-
31
import type {
42
DriverCaps,
53
DriverOpts,
@@ -10,11 +8,11 @@ import type {
108
W3CDriverCaps,
119
} from '@appium/types';
1210
import _ from 'lodash';
13-
import ADB from 'appium-adb';
11+
import {ADB} from 'appium-adb';
1412
import type {LogcatListener} from 'appium-adb';
1513
import type {default as AppiumChromedriver} from 'appium-chromedriver';
1614
import {BaseDriver} from 'appium/driver';
17-
import ANDROID_DRIVER_CONSTRAINTS, {AndroidDriverConstraints} from './constraints';
15+
import {ANDROID_DRIVER_CONSTRAINTS, AndroidDriverConstraints} from './constraints';
1816
import {newMethodMap} from './method-map';
1917
import {SettingsApp} from 'io.appium.settings';
2018
import {parseArray, removeAllSessionWebSocketHandlers} from './utils';

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function parseArray(cap) {
3131
try {
3232
// @ts-ignore this is fine
3333
parsedCaps = JSON.parse(cap);
34-
} catch (ign) {}
34+
} catch {}
3535

3636
if (_.isArray(parsedCaps)) {
3737
return parsedCaps;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"ws": "^8.0.0"
6969
},
7070
"devDependencies": {
71-
"@appium/eslint-config-appium-ts": "^0.x",
71+
"@appium/eslint-config-appium-ts": "^1.0.0",
7272
"@appium/test-support": "^3.0.20",
7373
"@appium/tsconfig": "^0.x",
7474
"@appium/types": "^0.x",

test/unit/commands/app-management-specs.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import sinon from 'sinon';
22
import {AndroidDriver} from '../../../lib/driver';
33
import {fs} from '@appium/support';
44
import B from 'bluebird';
5-
import ADB from 'appium-adb';
5+
import {ADB} from 'appium-adb';
66
import { errors } from 'appium/driver';
77

88
/** @type {AndroidDriver} */
@@ -163,7 +163,6 @@ describe('App Management', function () {
163163
driver.adb.activateApp.notCalled.should.be.true;
164164
});
165165
it('should bring app to background and back if waiting for other pkg / activity', async function () {
166-
//eslint-disable-line
167166
const appPackage = 'somepkg';
168167
const appActivity = 'someacv';
169168
const appWaitPackage = 'somewaitpkg';

test/unit/commands/context-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
setupNewChromedriver,
99
} from '../../../lib/commands/context/helpers';
1010
import {AndroidDriver} from '../../../lib/driver';
11-
import Chromedriver from 'appium-chromedriver';
11+
import {Chromedriver} from 'appium-chromedriver';
1212
import {errors} from 'appium/driver';
1313

1414
/** @type {AndroidDriver} */

test/unit/commands/device-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sinon from 'sinon';
2-
import ADB from 'appium-adb';
2+
import {ADB} from 'appium-adb';
33
import _ from 'lodash';
44
import {AndroidDriver} from '../../../lib/driver';
55
import {prepareAvdArgs, prepareEmulator} from '../../../lib/commands/device/utils';

test/unit/commands/file-actions-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sinon from 'sinon';
22
import {AndroidDriver} from '../../../lib/driver';
33
import * as support from '@appium/support';
4-
import ADB from 'appium-adb';
4+
import {ADB} from 'appium-adb';
55

66
/** @type {AndroidDriver} */
77
let driver;

test/unit/commands/geolocation-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sinon from 'sinon';
2-
import ADB from 'appium-adb';
2+
import {ADB} from 'appium-adb';
33
import { AndroidDriver } from '../../../lib/driver';
44
import { setMockLocationApp } from '../../../lib/commands/geolocation';
55

test/unit/commands/ime-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sinon from 'sinon';
22
import {AndroidDriver} from '../../../lib/driver';
3-
import ADB from 'appium-adb';
3+
import {ADB} from 'appium-adb';
44
import {errors} from 'appium/driver';
55

66
describe('IME', function () {

test/unit/commands/keyboard-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sinon from 'sinon';
22
import {AndroidDriver} from '../../../lib/driver';
3-
import ADB from 'appium-adb';
3+
import {ADB} from 'appium-adb';
44

55
/** @type {AndroidDriver} */
66
let driver;

test/unit/commands/lock-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sinon from 'sinon';
2-
import ADB from 'appium-adb';
2+
import {ADB} from 'appium-adb';
33
import { AndroidDriver } from '../../../lib/driver';
44
import {
55
validateUnlockCapabilities,

test/unit/commands/log-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _ from 'lodash';
22
import sinon from 'sinon';
3-
import ADB from 'appium-adb';
3+
import {ADB} from 'appium-adb';
44
import os from 'os';
55
import {AndroidDriver} from '../../../lib/driver';
66

test/unit/commands/misc-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sinon from 'sinon';
22
import {AndroidDriver} from '../../../lib/driver';
3-
import ADB from 'appium-adb';
3+
import {ADB} from 'appium-adb';
44

55
/** @type {AndroidDriver} */
66
let driver;

test/unit/commands/network-specs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sinon from 'sinon';
2-
import ADB from 'appium-adb';
2+
import {ADB} from 'appium-adb';
33
import {AndroidDriver} from '../../../lib/driver';
44
import B from 'bluebird';
55
import { SettingsApp } from 'io.appium.settings';

0 commit comments

Comments
 (0)