Skip to content

Commit

Permalink
chore: lintfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ola Christian Gundelsby authored and siljekristensen committed Feb 27, 2024
1 parent 7f48753 commit 4314fc5
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 23 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@seald-io/nedb": "^4.0.2",
"body-parser": "^1.20.2",
"compression": "^1.7.4",
"eslint-plugin-prettier": "^5.1.3",
"express": "^4.18.2",
"express-validator": "^7.0.1",
"node-fetch": "^2",
Expand Down
8 changes: 4 additions & 4 deletions src/agents/sofie-core/sofieCoreAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async function createMessage(message: ServiceMessage, instance: SofieInstance):
'Content-Type': 'application/json',
Accept: 'application/json',
}),
})
}),
)
await checkResponse(response, [200, 201])

Expand Down Expand Up @@ -99,7 +99,7 @@ async function recallMessage(message: ServiceMessage, instance: SofieInstance):
targetUrl.pathname = `${REMOTE_SERVICEMESSAGE_API_PATH}/${id}`
const response = await fetch(
targetUrl.href,
Object.assign({}, defaultOptions, { method: 'delete', headers: defaultHeaders })
Object.assign({}, defaultOptions, { method: 'delete', headers: defaultHeaders }),
)
await checkResponse(response, [200, 404])

Expand Down Expand Up @@ -146,7 +146,7 @@ async function getMessage(id: string, instance: SofieInstance): Promise<ServiceM
'Content-Type': 'application/json',
Accept: 'application/json',
}),
})
}),
)
await checkResponse(response, [200, 404])
if (response.status === 404) {
Expand Down Expand Up @@ -243,7 +243,7 @@ async function checkResponse(response: Response, allowed: Array<number>): Promis
if (allowed.indexOf(response.status) < 0) {
const message = await response.text()
const err: SofieCoreAgentError = new Error(
`Unexpected response HTTP ${response.status} ${message}, wanted one of ${allowed.join(',')}!`
`Unexpected response HTTP ${response.status} ${message}, wanted one of ${allowed.join(',')}!`,
)
err.responseStatus = response.status

Expand Down
2 changes: 1 addition & 1 deletion src/api/coreControl/peripheralDevices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function setPeripheralSubDeviceState(
href: string,
peripheralDeviceId: string,
subDeviceId: string,
desiredState: SofieSubDeviceState
desiredState: SofieSubDeviceState,
) {
const actionPath = `/disablePeripheralSubDevice/restApi/${peripheralDeviceId}/${subDeviceId}/${desiredState.enabled}`

Expand Down
2 changes: 1 addition & 1 deletion src/api/serviceMessages/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function registerServiceMessageApiHandlers(app: Application, rootPath: string):
endpoints.read = { path, method: 'GET', useId: true }

app.post(`${path}/refreshPublishStates/:id`, (req, res) =>
callAsyncAsCallback(refreshPublishStatesHandler, undefined, req, res)
callAsyncAsCallback(refreshPublishStatesHandler, undefined, req, res),
)

endpoints.refreshPublishStates = {
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/coreControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ if (process.env.CONTROL_SUB_DEVICES_CONFIG_PATH) {

rk5rk6SubDevicesToEnableDisable.rk5.disablePayloads = createPeripheralSubDevicePayloads(
rk5rk6SubDevicesToEnableDisable.rk5,
false
false,
)
rk5rk6SubDevicesToEnableDisable.rk5.enablePayloads = createPeripheralSubDevicePayloads(
rk5rk6SubDevicesToEnableDisable.rk5,
true
true,
)
rk5rk6SubDevicesToEnableDisable.rk6.disablePayloads = createPeripheralSubDevicePayloads(
rk5rk6SubDevicesToEnableDisable.rk6,
false
false,
)
rk5rk6SubDevicesToEnableDisable.rk6.enablePayloads = createPeripheralSubDevicePayloads(
rk5rk6SubDevicesToEnableDisable.rk6,
true
true,
)
} catch (e) {
logger.error(`Failed to load list of sub-devices to control: ${e}`)
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/sofieInstances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function registerSofieInstancesHandler(app: Application): void {
(req, res, next) => {
callAsyncAsCallback(addInstancesFromQuerystringParam, undefined, req as RequestWithInstances, res, next)
},
(req, res) => callAsyncAsCallback(getHandler, undefined, req, res)
(req, res) => callAsyncAsCallback(getHandler, undefined, req, res),
)
logger.debug('registered sofieInstances route')
}
Expand Down
2 changes: 1 addition & 1 deletion src/data/serviceMessages/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export { createServiceMessage, getAllMessages, getMessage, removeServiceMessage,
async function createServiceMessage(
criticality: Criticality,
message: string,
targetHosts: Array<string>
targetHosts: Array<string>,
): Promise<ServiceMessage> {
const instances = await getInstancesFromTargetHosts(targetHosts)
logger.debug(`Got ${instances.length} instances from ${targetHosts.length} target hosts`, {
Expand Down
2 changes: 1 addition & 1 deletion src/data/serviceMessages/dataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async function update(message: ServiceMessage): Promise<ServiceMessage> {
} catch (e: any) {
reject(`Unknown data error in stored document: ${e.message}`)
}
}
},
)
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/data/sofieInstances/dataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async function update(instance: SofieInstance): Promise<SofieInstance> {
} catch (e: any) {
reject(`Unknown data error in stored document: ${e.message}`)
}
}
},
)
})
}
Expand Down
6 changes: 3 additions & 3 deletions src/distribution/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function distribute(message: ServiceMessage, isUpdate = false): void {
if (!targetInstanceId || !messageId) {
logger.warn(
`Unable to add job for message, missing ${targetInstanceId ? 'message id' : targetInstanceId}`,
{ command, serviceMessage: message, instance: distribution.instance }
{ command, serviceMessage: message, instance: distribution.instance },
)
continue
}
Expand Down Expand Up @@ -86,7 +86,7 @@ function recall(message: ServiceMessage): void {
if (!targetInstanceId || !messageId) {
logger.warn(
`Unable to add job for message, missing ${targetInstanceId ? 'message id' : targetInstanceId}`,
{ command: Command.DELETE, serviceMessage: message, instance: distribution.instance }
{ command: Command.DELETE, serviceMessage: message, instance: distribution.instance },
)
continue
}
Expand Down Expand Up @@ -144,7 +144,7 @@ async function retryingExecution(job: Job): Promise<void> {
} else {
setTimeout(
() => callAsyncAsCallback(retryingExecution, undefined, job),
job.waitingTimeBeforeRetry ?? DEFAULT_JOB_WAITING_PERIOD_BEFORE_RETRY
job.waitingTimeBeforeRetry ?? DEFAULT_JOB_WAITING_PERIOD_BEFORE_RETRY,
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/distribution/processors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ processors[Command.DELETE] = {
const message = await messageStore.read(messageId)
if (!message) {
logger.debug(
`Aborted recall of message ${messageId} from ${targetInstanceId}, message is not in datastore`
`Aborted recall of message ${messageId} from ${targetInstanceId}, message is not in datastore`,
)
return
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function getExternalVersions(serverHost: string): Promise<PromiseSe
error: new Error(`Unable to fetch resource ${url}: ${error}`),
}
}
})
}),
)
}

Expand All @@ -69,7 +69,7 @@ export async function getServerData(serverHosts: Array<string>): Promise<Array<a
serverHealth._extVersions = await getExternalVersions(host)
serverHealth._host = host
return serverHealth
})
}),
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/middleware/autoaddInstances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export { addInstancesFromQuerystringParam }
async function addInstancesFromQuerystringParam(
req: RequestWithInstances,
_res: Response,
next: NextFunction
next: NextFunction,
): Promise<void> {
try {
const hosts = []
Expand Down
4 changes: 2 additions & 2 deletions src/util/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ if (process.env.NODE_ENV === 'production') {
new transports.Console({
level: 'error',
format: format.json(),
})
}),
)
} else {
const logLevel = process.env.DEBUG === 'true' ? 'debug' : 'warn'
logger.add(
new transports.Console({
level: logLevel,
format: format.combine(format.colorize(), format.simple()),
})
}),
)
logger.debug('Logging initialized at debug level')
}
Expand Down
21 changes: 21 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,11 @@
mkdirp "^1.0.4"
rimraf "^3.0.2"

"@pkgr/core@^0.1.0":
version "0.1.1"
resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31"
integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==

"@seald-io/binary-search-tree@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@seald-io/binary-search-tree/-/binary-search-tree-1.0.3.tgz#165a9a456eaa30d15885b25db83861bcce2c6a74"
Expand Down Expand Up @@ -2318,6 +2323,14 @@ eslint-plugin-prettier@^4.2.1:
dependencies:
prettier-linter-helpers "^1.0.0"

eslint-plugin-prettier@^5.1.3:
version "5.1.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz#17cfade9e732cef32b5f5be53bd4e07afd8e67e1"
integrity sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==
dependencies:
prettier-linter-helpers "^1.0.0"
synckit "^0.8.6"

eslint-scope@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
Expand Down Expand Up @@ -5730,6 +5743,14 @@ symbol-tree@^3.2.4:
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==

synckit@^0.8.6:
version "0.8.8"
resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7"
integrity sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==
dependencies:
"@pkgr/core" "^0.1.0"
tslib "^2.6.2"

tar@^6.0.2, tar@^6.1.11, tar@^6.1.2:
version "6.1.13"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.13.tgz#46e22529000f612180601a6fe0680e7da508847b"
Expand Down

0 comments on commit 4314fc5

Please sign in to comment.