Skip to content

Commit 47cde2e

Browse files
fix: Fix lint (#1965)
1 parent 4a269b8 commit 47cde2e

File tree

18 files changed

+237
-175
lines changed

18 files changed

+237
-175
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/node_modules/*
22
/lib/*
3-
/ui/*
3+
/ui/*
4+
/test/*

dashboard-frontend

src/CapabilityManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ export async function iOSCapabilities(
118118
delete caps.firstMatch[0]['appium:wdaLocalPort'];
119119
}
120120
}
121-
if(!freeDevice.realDevice) {
122-
caps.firstMatch[0]['appium:derivedDataPath'] =`${freeDevice.derivedDataPath}`;
121+
if (!freeDevice.realDevice) {
122+
caps.firstMatch[0]['appium:derivedDataPath'] = `${freeDevice.derivedDataPath}`;
123123
}
124124

125125
const deleteMatch = [

src/app/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { registerAuthenticationRoutes } from '../auth/routers';
1313
import { userService } from '../auth/services/user.service';
1414
import { IPluginArgs } from '../interfaces/IPluginArgs';
1515

16-
let dashboardPluginUrl: any = null;
16+
const dashboardPluginUrl: any = null;
1717

1818
const ASYNC_LOCK = new AsyncLock();
1919

src/app/routers/grid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async function getSavedDevices(request: Request, response: Response) {
3434
async function getDevices(request: Request, response: Response) {
3535
const { user } = request as AuthenticatedRequest;
3636
const filterOptions = user?.role === 'admin' ? {} : { userId: user?.userId };
37-
let devices = await getAllDevices(filterOptions as any);
37+
const devices = await getAllDevices(filterOptions as any);
3838
const { sessionId } = request.query;
3939
if (sessionId) {
4040
return response.json(devices.find((value) => value.session_id === sessionId));

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function getDeviceFarmHome() {
2121

2222
export function getServerMetadata() {
2323
const metaFile = path.join(getDeviceFarmHome(), 'metadata.json');
24-
let defaultMetadata = {
24+
const defaultMetadata = {
2525
id: uuid(),
2626
};
2727
if (fs.existsSync(metaFile)) {

src/data-service/node-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class NodeService {
6363
}
6464
}
6565

66-
static async getAllNodes(secure: boolean = true) {
66+
static async getAllNodes(secure = true) {
6767
return prisma.node.findMany({
6868
select: {
6969
id: true,

src/helpers.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/* eslint-disable no-prototype-builtins */
2-
import os from 'os';
3-
import path from 'path';
4-
import tcpPortUsed from 'tcp-port-used';
5-
import getPort from 'get-port';
62
import AsyncLock from 'async-lock';
7-
import { IDevice } from './interfaces/IDevice';
3+
import asyncWait from 'async-wait-until';
4+
import axios from 'axios';
5+
import getPort from 'get-port';
86
import _ from 'lodash';
9-
import log from './logger';
10-
import Cloud from './enums/Cloud';
117
import normalizeUrl from 'normalize-url';
128
import ora from 'ora';
13-
import asyncWait from 'async-wait-until';
14-
import axios from 'axios';
9+
import os from 'os';
10+
import path from 'path';
11+
import tcpPortUsed from 'tcp-port-used';
12+
import Cloud from './enums/Cloud';
1513
import { FakeModuleLoader } from './fake-module-loader';
14+
import { IDevice } from './interfaces/IDevice';
1615
import { IExternalModuleLoader } from './interfaces/IExternalModule';
16+
import log from './logger';
1717

1818
const APPIUM_VENDOR_PREFIX = 'appium:';
1919

@@ -35,8 +35,8 @@ class PortManager {
3535
*/
3636
async getAndAllocateFreePort(portRange?: string): Promise<number> {
3737
return this.lock.acquire('port-allocation', async () => {
38+
// eslint-disable-next-line no-constant-condition
3839
while (true) {
39-
let port: number;
4040
let portOptions: number[] | undefined;
4141

4242
// Determine which ports to try
@@ -59,7 +59,7 @@ class PortManager {
5959
}
6060

6161
// Get a free port from the system
62-
port = portOptions ? await getPort({ port: portOptions }) : await getPort();
62+
const port = portOptions ? await getPort({ port: portOptions }) : await getPort();
6363

6464
// Atomically allocate it (we're in the lock, so this is safe)
6565
if (!this.allocatedPorts.has(port)) {

src/modules

src/plugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,9 @@ class DevicePlugin extends BasePlugin {
587587
let jwt = '';
588588
if (this.pluginArgs.enableAuthentication) {
589589
const user = await getUserFromCapabilities(mergedCapabilites);
590-
jwt = await generateTokenForNode(device.nodeId!, user?.id!);
590+
if (user) {
591+
jwt = await generateTokenForNode(device.nodeId!, user.id);
592+
}
591593
}
592594
if (capabilitiesToCreateSession.capabilities.alwaysMatch) {
593595
capabilitiesToCreateSession.capabilities.alwaysMatch['df:udid'] = device.udid;

0 commit comments

Comments
 (0)