Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Bump eslint version #977

Merged
merged 1 commit into from
Jan 3, 2025
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
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

11 changes: 0 additions & 11 deletions .eslintrc.json

This file was deleted.

5 changes: 5 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import appiumConfig from '@appium/eslint-config-appium-ts';

export default [
...appiumConfig,
];
6 changes: 3 additions & 3 deletions lib/commands/app-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export async function terminateApp(appId, options = {}) {
waitMs: timeout,
intervalMs: 100,
});
} catch (e) {
} catch {
if (!_.isEmpty(currentPids) && !_.isEmpty(_.difference(pids, currentPids))) {
this.log.warn(
`Some of processes belonging to the '${appId}' applcation are still running ` +
Expand Down Expand Up @@ -283,7 +283,7 @@ export async function background(seconds) {
this.log.debug(`Activating app '${appPackage}' in order to restore it`);
await this.adb.activateApp(/** @type {string} */ (appPackage));
return true;
} catch (ign) {}
} catch {}
args =
(appPackage === this.opts.appPackage && appActivity === this.opts.appActivity) ||
(appPackage === this.opts.appWaitPackage &&
Expand Down Expand Up @@ -344,7 +344,7 @@ export async function resetAUT(opts = null) {
if (isInstalled) {
try {
await this.adb.forceStop(appPackage);
} catch (ign) {}
} catch {}
// fullReset has priority over fastReset
if (!fullReset && fastReset) {
const output = await this.adb.clear(appPackage);
Expand Down
3 changes: 1 addition & 2 deletions lib/commands/context/exports.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable require-await */
import {util} from '@appium/support';
import Chromedriver from 'appium-chromedriver';
import {Chromedriver} from 'appium-chromedriver';
import {errors, PROTOCOLS} from 'appium/driver';
import _ from 'lodash';
import {
Expand Down
7 changes: 3 additions & 4 deletions lib/commands/context/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import B from 'bluebird';
import os from 'node:os';
import path from 'node:path';
import http from 'node:http';
import Chromedriver from 'appium-chromedriver';
import {Chromedriver} from 'appium-chromedriver';
import {toDetailsCacheKey, getWebviewDetails, WEBVIEWS_DETAILS_CACHE} from './cache';
import dns from 'node:dns/promises';

Expand Down Expand Up @@ -317,7 +317,7 @@ async function allocateDevtoolsChannel(socketName, webviewDevtoolsPort = null) {
let localPort;
try {
localPort = await findAPortNotInUse(startPort, endPort);
} catch (e) {
} catch {
throw new Error(
`Cannot find any free port to forward the Devtools socket ` +
`in range ${startPort}..${endPort}. You could set the starting port number ` +
Expand Down Expand Up @@ -649,7 +649,7 @@ async function getChromedriverPort(portSpec) {
try {
foundPort = await findAPortNotInUse(port, stopPort);
break;
} catch (e) {
} catch {
this.log.debug(`Nothing in port range ${port}:${stopPort} was available`);
}
}
Expand Down Expand Up @@ -715,7 +715,6 @@ export async function setupNewChromedriver(opts, curDeviceId, context) {
const chromedriver = new Chromedriver({
port: String(opts.chromedriverPort),
executable: opts.chromedriverExecutable,
// eslint-disable-next-line object-shorthand
adb: /** @type {any} */ (this.adb),
cmdArgs: /** @type {string[]} */ (opts.chromedriverArgs),
verbose: !!opts.showChromedriverLog,
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/device/common.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import semver from 'semver';
import * as semver from 'semver';
import _ from 'lodash';
import B from 'bluebird';
import path from 'node:path';
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/device/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';
import {util} from '@appium/support';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';
import {retryInterval} from 'asyncbox';
import {
path as SETTINGS_APK_PATH,
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/file-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ function createFSTests(adb) {
const fullCmd = runAs ? `run-as ${runAs} ${checkCmd}` : checkCmd;
try {
return _.includes(await adb.shell([fullCmd]), passFlag);
} catch (ign) {
} catch {
return false;
}
};
Expand Down
6 changes: 3 additions & 3 deletions lib/commands/geolocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export async function setMockLocationApp(appId) {
if (await this.adb.fileExists(MOCK_APP_IDS_STORE)) {
try {
pkgIds = JSON.parse(await this.adb.shell(['cat', MOCK_APP_IDS_STORE]));
} catch (ign) {}
} catch {}
}
if (pkgIds.includes(appId)) {
return;
Expand Down Expand Up @@ -172,7 +172,7 @@ async function resetMockLocation() {
if (await this.adb.fileExists(MOCK_APP_IDS_STORE)) {
try {
pkgIds = JSON.parse(await this.adb.shell(['cat', MOCK_APP_IDS_STORE]));
} catch (ign) {}
} catch {}
}
const thirdPartyPkgIds = await thirdPartyPkgIdsPromise;
// Only include currently installed packages
Expand All @@ -194,7 +194,7 @@ async function resetMockLocation() {
(async () => {
try {
await this.adb.shell(['appops', 'set', pkgId, 'android:mock_location', 'deny']);
} catch (ign) {}
} catch {}
})(),
),
);
Expand Down
1 change: 0 additions & 1 deletion lib/commands/ime.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {errors} from 'appium/driver';
* @returns {Promise<boolean>}
*/
export async function isIMEActivated() {
// eslint-disable-line require-await
// IME is always activated on Android devices
return true;
}
Expand Down
3 changes: 0 additions & 3 deletions lib/commands/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,20 @@ const ISSUE_URL = 'https://github.com/appium/appium/issues/15807';
/**
* @this {AndroidDriver}
*/
// eslint-disable-next-line require-await
export async function launchApp () {
throw new errors.UnsupportedOperationError(`This API is not supported anymore. See ${ISSUE_URL}`);
}

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

/**
* @this {AndroidDriver}
*/
// eslint-disable-next-line require-await
export async function reset () {
throw new errors.UnsupportedOperationError(`This API is not supported anymore. See ${ISSUE_URL}`);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/lock/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export async function pinUnlock(capabilities) {
let el;
try {
el = await this.findElOrEls('id', `com.android.keyguard:id/key${pin}`, false);
} catch (ign) {
} catch {
return await pinUnlockWithKeyEvent.bind(this)(capabilities);
}
await this.click(util.unwrapElement(el));
Expand Down Expand Up @@ -347,7 +347,7 @@ export async function verifyUnlock(timeoutMs = null) {
waitMs: timeoutMs ?? 2000,
intervalMs: 500,
});
} catch (ign) {
} catch {
throw new Error('The device has failed to be unlocked');
}
this.log.info('The device has been successfully unlocked');
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export async function mobileStartLogsBroadcast() {
if (!_.isEmpty(this._logcatWebsocketListener)) {
try {
this.adb.removeLogcatListener(this._logcatWebsocketListener);
} catch (ign) {}
} catch {}
this._logcatWebsocketListener = undefined;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/commands/recordscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export async function stopRecordingScreen(options = {}) {
'SIGINT',
PROCESS_SHUTDOWN_TIMEOUT,
);
} catch (e) {
} catch {
throw this.log.errorWithException(
`Unable to stop screen recording within ${PROCESS_SHUTDOWN_TIMEOUT}ms`,
);
Expand Down Expand Up @@ -277,7 +277,7 @@ async function scheduleScreenRecord(recordingProperties) {
waitMs: RETRY_TIMEOUT,
intervalMs: RETRY_PAUSE,
});
} catch (e) {
} catch {
throw new Error(
`The expected screen record file '${pathOnDevice}' does not exist after ${RETRY_TIMEOUT}ms. ` +
`Is ${SCREENRECORD_BINARY} utility available and operational on the device under test?`,
Expand All @@ -297,7 +297,7 @@ async function scheduleScreenRecord(recordingProperties) {
async function mergeScreenRecords(mediaFiles) {
try {
await fs.which(FFMPEG_BINARY);
} catch (e) {
} catch {
throw new Error(
`${FFMPEG_BINARY} utility is not available in PATH. Please install it from https://www.ffmpeg.org/`,
);
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/streamscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async function verifyStreamingRequirements(adb) {
(async () => {
try {
await fs.which(binaryName);
} catch (e) {
} catch {
throw new Error(
`The '${binaryName}' binary is not available in the PATH on the host system. ` +
`See ${GST_TUTORIAL_URL} for more details on how to install it.`,
Expand Down Expand Up @@ -472,7 +472,7 @@ async function initGstreamerPipeline(deviceStreamingProc, deviceInfo, log, opts)
async () => {
try {
return (await checkPortStatus(tcpPort, TCP_HOST)) === 'open';
} catch (ign) {
} catch {
return false;
}
},
Expand Down
2 changes: 1 addition & 1 deletion lib/doctor/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class AndroidSdkCheck {
for (const binary of this.TOOL_NAMES) {
try {
this.log.info(` '${binary}' exists in ${await getAndroidBinaryPath(binary)}`);
} catch (e) {
} catch {
missingBinaries.push(binary);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/doctor/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export async function resolveExecutablePath(cmd) {
if (executablePath && (await fs.exists(executablePath))) {
return executablePath;
}
} catch (err) {}
} catch {}
return null;
}
6 changes: 2 additions & 4 deletions lib/driver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */

import type {
DriverCaps,
DriverOpts,
Expand All @@ -10,11 +8,11 @@ import type {
W3CDriverCaps,
} from '@appium/types';
import _ from 'lodash';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';
import type {LogcatListener} from 'appium-adb';
import type {default as AppiumChromedriver} from 'appium-chromedriver';
import {BaseDriver} from 'appium/driver';
import ANDROID_DRIVER_CONSTRAINTS, {AndroidDriverConstraints} from './constraints';
import {ANDROID_DRIVER_CONSTRAINTS, AndroidDriverConstraints} from './constraints';
import {newMethodMap} from './method-map';
import {SettingsApp} from 'io.appium.settings';
import {parseArray, removeAllSessionWebSocketHandlers} from './utils';
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function parseArray(cap) {
try {
// @ts-ignore this is fine
parsedCaps = JSON.parse(cap);
} catch (ign) {}
} catch {}

if (_.isArray(parsedCaps)) {
return parsedCaps;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"ws": "^8.0.0"
},
"devDependencies": {
"@appium/eslint-config-appium-ts": "^0.x",
"@appium/eslint-config-appium-ts": "^1.0.0",
"@appium/test-support": "^3.0.20",
"@appium/tsconfig": "^0.x",
"@appium/types": "^0.x",
Expand Down
3 changes: 1 addition & 2 deletions test/unit/commands/app-management-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sinon from 'sinon';
import {AndroidDriver} from '../../../lib/driver';
import {fs} from '@appium/support';
import B from 'bluebird';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';
import { errors } from 'appium/driver';

/** @type {AndroidDriver} */
Expand Down Expand Up @@ -163,7 +163,6 @@ describe('App Management', function () {
driver.adb.activateApp.notCalled.should.be.true;
});
it('should bring app to background and back if waiting for other pkg / activity', async function () {
//eslint-disable-line
const appPackage = 'somepkg';
const appActivity = 'someacv';
const appWaitPackage = 'somewaitpkg';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/context-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
setupNewChromedriver,
} from '../../../lib/commands/context/helpers';
import {AndroidDriver} from '../../../lib/driver';
import Chromedriver from 'appium-chromedriver';
import {Chromedriver} from 'appium-chromedriver';
import {errors} from 'appium/driver';

/** @type {AndroidDriver} */
Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/device-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sinon from 'sinon';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';
import _ from 'lodash';
import {AndroidDriver} from '../../../lib/driver';
import {prepareAvdArgs, prepareEmulator} from '../../../lib/commands/device/utils';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/file-actions-specs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sinon from 'sinon';
import {AndroidDriver} from '../../../lib/driver';
import * as support from '@appium/support';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';

/** @type {AndroidDriver} */
let driver;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/geolocation-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sinon from 'sinon';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';
import { AndroidDriver } from '../../../lib/driver';
import { setMockLocationApp } from '../../../lib/commands/geolocation';

Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/ime-specs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sinon from 'sinon';
import {AndroidDriver} from '../../../lib/driver';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';
import {errors} from 'appium/driver';

describe('IME', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/keyboard-specs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sinon from 'sinon';
import {AndroidDriver} from '../../../lib/driver';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';

/** @type {AndroidDriver} */
let driver;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/lock-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sinon from 'sinon';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';
import { AndroidDriver } from '../../../lib/driver';
import {
validateUnlockCapabilities,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/log-specs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';
import sinon from 'sinon';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';
import os from 'os';
import {AndroidDriver} from '../../../lib/driver';

Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/misc-specs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sinon from 'sinon';
import {AndroidDriver} from '../../../lib/driver';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';

/** @type {AndroidDriver} */
let driver;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/network-specs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sinon from 'sinon';
import ADB from 'appium-adb';
import {ADB} from 'appium-adb';
import {AndroidDriver} from '../../../lib/driver';
import B from 'bluebird';
import { SettingsApp } from 'io.appium.settings';
Expand Down
Loading
Loading