diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index bc94100c4..000000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -static -espresso-server/ -build diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..8306e52e6 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,10 @@ +import appiumConfig from '@appium/eslint-config-appium-ts'; + +export default [ + ...appiumConfig, + { + ignores: [ + 'espresso-server/**', + ], + }, +]; diff --git a/lib/driver.ts b/lib/driver.ts index 557edb816..8b8944627 100644 --- a/lib/driver.ts +++ b/lib/driver.ts @@ -634,7 +634,7 @@ export class EspressoDriver extends AndroidDriver implements ExternalDriver< (async () => { try { await task(); - } catch (ign) {} + } catch {} })(); })); if (this.wasAnimationEnabled) { @@ -680,19 +680,19 @@ export class EspressoDriver extends AndroidDriver implements ExternalDriver< // settings to the espresso server already } - // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars proxyActive (sessionId) { // we always have an active proxy to the espresso server return true; } - // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars canProxy (sessionId) { // we can always proxy to the espresso server return true; } - // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars getProxyAvoidList (sessionId): RouteMatcher[] { // we are maintaining two sets of NO_PROXY lists, one for chromedriver(CHROME_NO_PROXY) // and one for Espresso(NO_PROXY), based on current context will return related NO_PROXY list diff --git a/lib/espresso-runner.js b/lib/espresso-runner.js index 271948491..124d558c7 100644 --- a/lib/espresso-runner.js +++ b/lib/espresso-runner.js @@ -7,7 +7,7 @@ import B from 'bluebird'; import _ from 'lodash'; import { copyGradleProjectRecursively, getPackageInfoSync, getPackageInfo } from './utils'; import axios from 'axios'; -import semver from 'semver'; +import * as semver from 'semver'; const TEST_SERVER_ROOT = path.resolve(__dirname, '..', '..', 'espresso-server'); @@ -375,7 +375,7 @@ class EspressoRunner { (serverStatus = /** @type {import('@appium/types').StringRecord} */ ( await this.jwproxy.command('/status', 'GET') )); - } catch (e) { + } catch { return false; } return await this._verifyServerStatus(manifestPayload.version, serverStatus); diff --git a/lib/utils.js b/lib/utils.js index 92dbb9898..aaec27f83 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -95,7 +95,7 @@ export async function getPackageInfo () { return PACKAGE_INFO; } } - } catch (ign) {} + } catch {} currentDir = path.dirname(currentDir); isAtFsRoot = currentDir.length <= path.dirname(currentDir).length; } @@ -128,7 +128,7 @@ export function getPackageInfoSync () { return PACKAGE_INFO; } } - } catch (ign) {} + } catch {} currentDir = path.dirname(currentDir); isAtFsRoot = currentDir.length <= path.dirname(currentDir).length; } diff --git a/package.json b/package.json index 010f775eb..9f0163386 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "appium": "^2.4.1" }, "devDependencies": { - "@appium/eslint-config-appium-ts": "^0.x", + "@appium/eslint-config-appium-ts": "^1.0", "@appium/tsconfig": "^0.x", "@appium/types": "^0.x", "@semantic-release/changelog": "^6.0.1", diff --git a/scripts/build-espresso.js b/scripts/build-espresso.js index 89cf65dfe..431777ef1 100644 --- a/scripts/build-espresso.js +++ b/scripts/build-espresso.js @@ -32,7 +32,7 @@ async function buildEspressoServer () { opts.buildConfiguration = JSON.parse(buildConfigurationStr); LOG.info(`The espresso build config is ${JSON.stringify(opts.buildConfiguration)}`); } catch (e) { - throw new Error(`Failed to parse the ${process.env.ESPRESSO_BUILD_CONFIG}. ` + throw new Error(`Failed to parse the ${process.env.ESPRESSO_BUILD_CONFIG}. ` + `Please make sure that the JSON is valid format. Error: ${e}`); } } @@ -41,7 +41,7 @@ async function buildEspressoServer () { try { await builder.build(); } catch (e) { - throw new Error(`Failed to build the espresso server. ` + throw new Error(`Failed to build the espresso server. ` + `SHOW_GRADLE_LOG=true environment variable helps to check the gradle log. Error: ${e}`); } diff --git a/test/functional/commands/clipboard-e2e-specs.js b/test/functional/commands/clipboard-e2e-specs.js index f3472cd5e..78af93a54 100644 --- a/test/functional/commands/clipboard-e2e-specs.js +++ b/test/functional/commands/clipboard-e2e-specs.js @@ -27,7 +27,7 @@ describe('clipboard', function () { const text = await driver.getClipboard('PLAINTEXT'); try { text.should.eql('SGVsbG8='); - } catch (AssertionError) { + } catch (AssertionError) { // eslint-disable-line @typescript-eslint/no-unused-vars // API level 23 and 25 emulator has '\n' text.should.eql('SGVsbG8=\n'); } diff --git a/test/functional/commands/jetpack-compose-attributes-e2e-specs.js b/test/functional/commands/jetpack-compose-attributes-e2e-specs.js index ee8bc078d..3cc8d0cc2 100644 --- a/test/functional/commands/jetpack-compose-attributes-e2e-specs.js +++ b/test/functional/commands/jetpack-compose-attributes-e2e-specs.js @@ -38,7 +38,7 @@ describe('compose node attributes', function () { afterEach(async function () { try { await driver.deleteSession(); - } catch (ign) {} + } catch {} driver = null; }); diff --git a/test/functional/commands/keyboard-e2e-specs.js b/test/functional/commands/keyboard-e2e-specs.js index 12bdc0fb7..322dd208b 100644 --- a/test/functional/commands/keyboard-e2e-specs.js +++ b/test/functional/commands/keyboard-e2e-specs.js @@ -61,7 +61,7 @@ describe('keyboard', function () { await el.clear(); }); - it('should send keys to the correct element', async function () { + it('should send keys to the correct element with setImmediateValue', async function () { let el = await driver.elementByXPath('//android.widget.AutoCompleteTextView'); await el.setImmediateValue(['hello world']); await el.text().should.eventually.equal('hello world'); diff --git a/test/functional/commands/touch-e2e-specs.js b/test/functional/commands/touch-e2e-specs.js index 3238c5b75..b64253817 100644 --- a/test/functional/commands/touch-e2e-specs.js +++ b/test/functional/commands/touch-e2e-specs.js @@ -411,7 +411,7 @@ describe('touch actions -', function () { }); }); - describe('mjsonwp touch actions', function () { + describe('mjsonwp multi touch actions', function () { describe('multi touch actions', function () { // let nextEl; diff --git a/test/functional/driver-e2e-specs.js b/test/functional/driver-e2e-specs.js index a42bce196..09901dad7 100644 --- a/test/functional/driver-e2e-specs.js +++ b/test/functional/driver-e2e-specs.js @@ -26,7 +26,7 @@ describe('EspressoDriver', function () { afterEach(async function () { try { await driver.deleteSession(); - } catch (ign) {} + } catch {} driver = null; }); @@ -81,7 +81,7 @@ describe('EspressoDriver', function () { afterEach(async function () { try { await driver.deleteSession(); - } catch (ign) {} + } catch {} driver = null; }); it('should start activity by name', async function () { @@ -122,7 +122,7 @@ describe('EspressoDriver', function () { // afterEach(async function () { // try { // await driver.deleteSession(); - // } catch (ign) {} + // } catch {} // driver = null; // }); // it('should send keys to focused-on element', async function () { diff --git a/test/functional/helpers/session.js b/test/functional/helpers/session.js index 2167f464d..d82973501 100644 --- a/test/functional/helpers/session.js +++ b/test/functional/helpers/session.js @@ -1,4 +1,4 @@ -import remote from 'webdriverio'; +import { remote } from 'webdriverio'; import AsyncLock from 'async-lock'; const SESSION_GUARD = new AsyncLock(); @@ -23,7 +23,7 @@ async function deleteSession () { await SESSION_GUARD.acquire(HOST, async () => { try { await driver.quit(); - } catch (ign) {} + } catch {} driver = null; }); } diff --git a/test/unit/commands/execute-specs.js b/test/unit/commands/execute-specs.js index 1b5784870..a23f2612a 100644 --- a/test/unit/commands/execute-specs.js +++ b/test/unit/commands/execute-specs.js @@ -1,5 +1,5 @@ import sinon from 'sinon'; -import EspressoDriver from '../../../lib/driver'; +import { EspressoDriver } from '../../../lib/driver'; let sandbox = sinon.createSandbox(); diff --git a/test/unit/driver-specs.js b/test/unit/driver-specs.js index 714e83083..15cf7c66c 100644 --- a/test/unit/driver-specs.js +++ b/test/unit/driver-specs.js @@ -1,6 +1,6 @@ import sinon from 'sinon'; import { ADB } from 'appium-adb'; -import EspressoDriver from '../../lib/driver'; +import { EspressoDriver } from '../../lib/driver'; let sandbox = sinon.createSandbox();