From 66e1e947af87e642278a5b2d930ebb464fecc01a Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Mon, 6 Jan 2025 08:39:32 -0800 Subject: [PATCH] chore: use newer lint (#761) --- driver/.eslintignore | 1 - driver/eslint.config.mjs | 5 +++++ driver/lib/commands/execute/scroll.ts | 4 ++-- driver/lib/commands/screen.ts | 3 ++- driver/lib/driver.ts | 2 +- driver/lib/sessions/android.ts | 2 +- driver/lib/sessions/ios.ts | 2 +- driver/lib/sessions/observatory.ts | 2 +- driver/package.json | 10 ++-------- 9 files changed, 15 insertions(+), 16 deletions(-) delete mode 100644 driver/.eslintignore create mode 100644 driver/eslint.config.mjs diff --git a/driver/.eslintignore b/driver/.eslintignore deleted file mode 100644 index 378eac25..00000000 --- a/driver/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -build diff --git a/driver/eslint.config.mjs b/driver/eslint.config.mjs new file mode 100644 index 00000000..9fb8c9d2 --- /dev/null +++ b/driver/eslint.config.mjs @@ -0,0 +1,5 @@ +import appiumConfig from '@appium/eslint-config-appium-ts'; + +export default [ + ...appiumConfig +]; diff --git a/driver/lib/commands/execute/scroll.ts b/driver/lib/commands/execute/scroll.ts index 1846e7d5..bec3d0c7 100644 --- a/driver/lib/commands/execute/scroll.ts +++ b/driver/lib/commands/execute/scroll.ts @@ -118,7 +118,7 @@ export const scrollUntilVisible = async ( try { await waitFor(self, item, waitTimeoutMilliseconds); isVisible = true; - } catch (ign) {} + } catch {} })(); const startAt = Date.now(); while (!isVisible && shouldRetry(startAt, waitTimeoutMilliseconds)) { @@ -167,7 +167,7 @@ export const scrollUntilTapable = async ( try { await waitForTappable(self, item, waitTimeoutMilliseconds); isVisible = true; - } catch (ign) {} + } catch {} })(); const startAt = Date.now(); while (!isVisible && shouldRetry(startAt, waitTimeoutMilliseconds)) { diff --git a/driver/lib/commands/screen.ts b/driver/lib/commands/screen.ts index 3f997512..bc7a5e82 100644 --- a/driver/lib/commands/screen.ts +++ b/driver/lib/commands/screen.ts @@ -1,6 +1,7 @@ import type { FlutterDriver } from '../driver'; +import { IsolateSocket } from '../sessions/isolate_socket'; export const getScreenshot = async function(this: FlutterDriver) { - const response = await this.socket!.call(`_flutter.screenshot`) as any; + const response = await (this.socket as IsolateSocket).call(`_flutter.screenshot`) as any; return response.screenshot; }; diff --git a/driver/lib/driver.ts b/driver/lib/driver.ts index b5ab5952..97c4a64c 100644 --- a/driver/lib/driver.ts +++ b/driver/lib/driver.ts @@ -18,7 +18,7 @@ import { getScreenshot } from './commands/screen'; import { getClipboard, setClipboard } from './commands/clipboard'; import { desiredCapConstraints } from './desired-caps'; import XCUITestDriver from 'appium-xcuitest-driver'; -import AndroidUiautomator2Driver from 'appium-uiautomator2-driver'; +import { AndroidUiautomator2Driver } from 'appium-uiautomator2-driver'; import type { DefaultCreateSessionResult, DriverCaps, DriverData, W3CDriverCaps, RouteMatcher diff --git a/driver/lib/sessions/android.ts b/driver/lib/sessions/android.ts index b69a2152..0b363dd5 100644 --- a/driver/lib/sessions/android.ts +++ b/driver/lib/sessions/android.ts @@ -1,4 +1,4 @@ -import AndroidUiautomator2Driver from 'appium-uiautomator2-driver'; +import { AndroidUiautomator2Driver } from 'appium-uiautomator2-driver'; import { connectSocket, extractObservatoryUrl, OBSERVATORY_URL_PATTERN } from './observatory'; import type { InitialOpts, StringRecord } from '@appium/types'; import type { IsolateSocket } from './isolate_socket'; diff --git a/driver/lib/sessions/ios.ts b/driver/lib/sessions/ios.ts index c9eb11a7..fc7eee34 100644 --- a/driver/lib/sessions/ios.ts +++ b/driver/lib/sessions/ios.ts @@ -125,7 +125,7 @@ export async function getObservatoryWsUri ( let remoteSocket; try { remoteSocket = await utilities.connectPort(udid, remotePort); - } catch (e) { + } catch { localSocket.destroy(); return; } diff --git a/driver/lib/sessions/observatory.ts b/driver/lib/sessions/observatory.ts index 917aa6b4..963b8039 100644 --- a/driver/lib/sessions/observatory.ts +++ b/driver/lib/sessions/observatory.ts @@ -180,7 +180,7 @@ export function extractObservatoryUrl(logEntry: LogEntry): URL | null { result.protocol = `ws`; result.pathname += `ws`; return result; - } catch (ign) { + } catch { return null; } } diff --git a/driver/package.json b/driver/package.json index b0973fea..781da3bc 100644 --- a/driver/package.json +++ b/driver/package.json @@ -56,18 +56,12 @@ "appium": "^2.4.1" }, "devDependencies": { - "@appium/eslint-config-appium": "^8.0.4", - "@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.3", "@semantic-release/git": "^10.0.1", - "eslint": "^8.46.0", - "eslint-config-prettier": "^9.0.0", - "eslint-import-resolver-typescript": "^3.5.5", - "eslint-plugin-import": "^2.28.0", - "eslint-plugin-mocha": "^10.1.0", - "eslint-plugin-promise": "^6.1.1", + "eslint": "^9.17.0", "semantic-release": "^23.0.0", "ts-node": "^10.9.1", "typescript": "~5.5"