From 8a5b88e336eaf7951d9b07e0b9fc6a0faa936141 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jan 2025 08:40:19 -0800 Subject: [PATCH] chore(deps-dev): bump @appium/eslint-config-appium-ts from 0.3.3 to 1.0.1 (#287) * chore(deps-dev): bump @appium/eslint-config-appium-ts Bumps [@appium/eslint-config-appium-ts](https://github.com/appium/appium/tree/HEAD/packages/eslint-config-appium-ts) from 0.3.3 to 1.0.1. - [Release notes](https://github.com/appium/appium/releases) - [Changelog](https://github.com/appium/appium/blob/master/packages/eslint-config-appium-ts/CHANGELOG.md) - [Commits](https://github.com/appium/appium/commits/@appium/eslint-config-appium-ts@1.0.1/packages/eslint-config-appium-ts) --- updated-dependencies: - dependency-name: "@appium/eslint-config-appium-ts" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * update --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kazuaki Matsuo --- .eslintignore | 1 - eslint.config.mjs | 5 +++++ lib/commands/record-screen.js | 6 +++--- lib/commands/winapi/user32.js | 6 +++--- lib/driver.js | 2 +- lib/installer.js | 4 ++-- lib/registry.js | 2 +- lib/winappdriver.js | 4 ++-- package.json | 2 +- scripts/install-wad.mjs | 4 ++-- test/e2e/commands/file-movement-e2e-specs.js | 2 +- test/e2e/commands/winapi-e2e-specs.js | 4 ++-- test/e2e/driver-e2e-specs.js | 2 +- test/unit/driver-specs.js | 4 ++-- test/unit/registry-specs.js | 2 +- 15 files changed, 27 insertions(+), 23 deletions(-) delete mode 100644 .eslintignore create mode 100644 eslint.config.mjs diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 378eac25..00000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -build diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..4d523257 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,5 @@ +import appiumConfig from '@appium/eslint-config-appium-ts'; + +export default [ + ...appiumConfig, +]; diff --git a/lib/commands/record-screen.js b/lib/commands/record-screen.js index b505f148..68deeee4 100644 --- a/lib/commands/record-screen.js +++ b/lib/commands/record-screen.js @@ -45,7 +45,7 @@ async function uploadRecordedMedia (localFile, remotePath = null, uploadOptions async function requireFfmpegPath () { try { return await fs.which(FFMPEG_BINARY); - } catch (e) { + } catch { throw new Error(`${FFMPEG_BINARY} has not been found in PATH. ` + `Please make sure it is installed`); } @@ -85,7 +85,7 @@ class ScreenRecorder { this.log.debug('Force-stopping the currently running video recording'); try { await this._process.stop('SIGKILL'); - } catch (ign) {} + } catch {} } this._process = null; const videoPath = await this.getVideoPath(); @@ -155,7 +155,7 @@ class ScreenRecorder { waitMs: RETRY_TIMEOUT, intervalMs: RETRY_PAUSE, }); - } catch (e) { + } catch { await this._enforceTermination(); throw this.log.errorWithException( `The expected screen record file '${this._videoPath}' does not exist. ` + diff --git a/lib/commands/winapi/user32.js b/lib/commands/winapi/user32.js index 2f9a2cad..64b6ce30 100644 --- a/lib/commands/winapi/user32.js +++ b/lib/commands/winapi/user32.js @@ -7,16 +7,16 @@ import nodeUtil from 'node:util'; let /** @type {import('koffi')|undefined} */ ffi; try { ffi = require('koffi'); -} catch (ign) {} +} catch {} let /** @type {import('koffi').struct|undefined} */ StructType; try { StructType = ffi?.struct; -} catch (ign) {} +} catch {} let /** @type {any|undefined} */ UnionType; try { // @ts-ignore This is a typedef bug in koffi lib UnionType = ffi?.union; -} catch (ign) {} +} catch {} const NATIVE_LIBS_LOAD_ERROR = `Native Windows API calls cannot be invoked. ` + `Please make sure you have the latest version of Visual Studio` + diff --git a/lib/driver.js b/lib/driver.js index 7ccc3a71..84a7f5ab 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -3,7 +3,7 @@ import { BaseDriver } from 'appium/driver'; import { system } from 'appium/support'; import { WinAppDriver } from './winappdriver'; import { desiredCapConstraints } from './desired-caps'; -import commands from './commands/index'; +import { commands } from './commands/index'; import { POWER_SHELL_FEATURE } from './constants'; import { newMethodMap } from './method-map'; diff --git a/lib/installer.js b/lib/installer.js index cca359c7..30b66149 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import { fs, tempDir } from 'appium/support'; import path from 'path'; import { exec } from 'teen_process'; -import log from './logger'; +import { log } from './logger'; import { queryRegistry } from './registry'; import { shellExec } from './utils'; @@ -97,7 +97,7 @@ export async function isAdmin () { try { await exec('fsutil.exe', ['dirty', 'query', process.env.SystemDrive || 'C:']); return true; - } catch (ign) { + } catch { return false; } }; diff --git a/lib/registry.js b/lib/registry.js index a5e2280a..d53d2cf3 100644 --- a/lib/registry.js +++ b/lib/registry.js @@ -63,7 +63,7 @@ async function queryRegistry (root) { let stdout; try { ({stdout} = await shellExec(REG, ['query', root, '/s'])); - } catch (e) { + } catch { return []; } return parseRegQueryOutput(stdout); diff --git a/lib/winappdriver.js b/lib/winappdriver.js index a1b6ddbf..de4adb58 100644 --- a/lib/winappdriver.js +++ b/lib/winappdriver.js @@ -68,7 +68,7 @@ class WADProcess { const [startPort, endPort] = WAD_PORT_RANGE; try { this.port = await findAPortNotInUse(startPort, endPort); - } catch (e) { + } catch { throw this.log.errorWithException( `Could not find any free port in range ${startPort}..${endPort}. ` + `Please check your system firewall settings or set 'systemPort' capability ` + @@ -120,7 +120,7 @@ process.once('exit', () => { const command = 'taskkill.exe ' + RUNNING_PROCESS_IDS.map((pid) => `/PID ${pid}`).join(' '); try { execSync(command); - } catch (ign) {} + } catch {} }); class WinAppDriver { diff --git a/package.json b/package.json index 12e3a365..a97e099a 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "koffi": "^2.8.1" }, "devDependencies": { - "@appium/eslint-config-appium-ts": "^0.x", + "@appium/eslint-config-appium-ts": "^1.x", "@appium/tsconfig": "^0.x", "@appium/types": "^0.x", "@semantic-release/changelog": "^6.0.1", diff --git a/scripts/install-wad.mjs b/scripts/install-wad.mjs index 6befaf0f..8f5cf2cc 100644 --- a/scripts/install-wad.mjs +++ b/scripts/install-wad.mjs @@ -1,5 +1,5 @@ import axios from 'axios'; -import semver from 'semver'; +import * as semver from 'semver'; import _ from 'lodash'; import path from 'node:path'; import { tmpdir } from 'node:os'; @@ -170,7 +170,7 @@ async function installWad(version) { } finally { try { await fs.unlink(installerPath); - } catch (ign) {} + } catch {} } } diff --git a/test/e2e/commands/file-movement-e2e-specs.js b/test/e2e/commands/file-movement-e2e-specs.js index 73ec6fc0..9038afa2 100644 --- a/test/e2e/commands/file-movement-e2e-specs.js +++ b/test/e2e/commands/file-movement-e2e-specs.js @@ -27,7 +27,7 @@ describe('file movement', function () { chai = await import('chai'); const chaiAsPromised = await import('chai-as-promised'); - should = chai.should(); + chai.should(); chai.use(chaiAsPromised.default); }); diff --git a/test/e2e/commands/winapi-e2e-specs.js b/test/e2e/commands/winapi-e2e-specs.js index 8bd24d43..ff7f1f97 100644 --- a/test/e2e/commands/winapi-e2e-specs.js +++ b/test/e2e/commands/winapi-e2e-specs.js @@ -1,5 +1,5 @@ import { commands } from '../../../lib/commands/gestures'; -import log from '../../../lib/logger'; +import { log } from '../../../lib/logger'; describe('winapi', function () { @@ -9,7 +9,7 @@ describe('winapi', function () { chai = await import('chai'); const chaiAsPromised = await import('chai-as-promised'); - should = chai.should(); + chai.should(); chai.use(chaiAsPromised.default); commands.log = log; }); diff --git a/test/e2e/driver-e2e-specs.js b/test/e2e/driver-e2e-specs.js index 3fcbdb9a..2a7762ac 100644 --- a/test/e2e/driver-e2e-specs.js +++ b/test/e2e/driver-e2e-specs.js @@ -24,7 +24,7 @@ describe('Driver', function () { chai = await import('chai'); const chaiAsPromised = await import('chai-as-promised'); - should = chai.should(); + chai.should(); chai.use(chaiAsPromised.default); }); diff --git a/test/unit/driver-specs.js b/test/unit/driver-specs.js index 10bd89d5..794ecf0b 100644 --- a/test/unit/driver-specs.js +++ b/test/unit/driver-specs.js @@ -1,6 +1,6 @@ // transpile:mocha -import WindowsDriver from '../../lib/driver'; +import { WindowsDriver } from '../../lib/driver'; import sinon from 'sinon'; import B from 'bluebird'; import { system } from 'appium/support'; @@ -14,7 +14,7 @@ describe('driver.js', function () { chai = await import('chai'); const chaiAsPromised = await import('chai-as-promised'); - should = chai.should(); + chai.should(); chai.use(chaiAsPromised.default); isWindowsStub = sinon.stub(system, 'isWindows').returns(true); diff --git a/test/unit/registry-specs.js b/test/unit/registry-specs.js index cf742ac8..9b336bd9 100644 --- a/test/unit/registry-specs.js +++ b/test/unit/registry-specs.js @@ -6,7 +6,7 @@ describe('registry', function () { before(async function () { chai = await import('chai'); - should = chai.should(); + chai.should(); }); it('should parse reg query output', function () {