mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-02 17:29:23 +02:00
Replace tslint by eslint
This commit is contained in:
parent
b43059f8e2
commit
f028b99bbc
24 changed files with 2498 additions and 311 deletions
3
.eslintignore
Normal file
3
.eslintignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
node_modules
|
||||
build
|
||||
scripts
|
14
.eslintrc.js
Normal file
14
.eslintrc.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
],
|
||||
env: {
|
||||
node: true
|
||||
}
|
||||
};
|
2648
package-lock.json
generated
2648
package-lock.json
generated
File diff suppressed because it is too large
Load diff
11
package.json
11
package.json
|
@ -6,8 +6,8 @@
|
|||
"scripts": {
|
||||
"start": "node ./build/index.js",
|
||||
"test": "node scripts/test-launch-with-different-databases.js",
|
||||
"lint": "tslint --project .",
|
||||
"lint:fix": "tslint --project . --fix",
|
||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
||||
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
|
||||
"build": "npm run build:clean && npm run build:json && npm run build:ts && npm run lint && npm run build:doc",
|
||||
"build:clean": "rimraf build",
|
||||
"build:json": "node ./scripts/build-schemas.js",
|
||||
|
@ -40,10 +40,11 @@
|
|||
"@types/nodemailer": "^6.4.4",
|
||||
"@types/tokgen": "^1.0.0",
|
||||
"@types/umzug": "^2.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
||||
"@typescript-eslint/parser": "^5.10.0",
|
||||
"eslint": "^8.7.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-standard": "^9.0.0",
|
||||
"typescript": "^4.1.3",
|
||||
"typescript": "^4.4.4",
|
||||
"typescript-json-schema": "^0.52.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -115,7 +115,7 @@ types.forEach((type) => {
|
|||
const functionBody = 'ajv.compile(' + schemaString + ')'
|
||||
const functionName = 'is' + type.substr(0, 1).toUpperCase() + type.substr(1)
|
||||
|
||||
output += 'export const ' + functionName + ': (value: object) => value is ' + type + ' = ' + functionBody + '\n'
|
||||
output += 'export const ' + functionName + ': (value: unknown) => value is ' + type + ' = ' + functionBody + '\n'
|
||||
})
|
||||
|
||||
allTypes.forEach((type) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -18,13 +18,11 @@
|
|||
import { ChildAction } from './basetypes'
|
||||
|
||||
export class ChildSignInAction extends ChildAction {
|
||||
static instance = new ChildSignInAction()
|
||||
|
||||
constructor () {
|
||||
super()
|
||||
}
|
||||
|
||||
static parse = (_: SerializedChildSignInAction) => (
|
||||
new ChildSignInAction()
|
||||
)
|
||||
}
|
||||
|
||||
export interface SerializedChildSignInAction {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -23,8 +23,6 @@ export class ForceSyncAction extends AppLogicAction {
|
|||
private constructor () {
|
||||
super()
|
||||
}
|
||||
|
||||
static parse = (_: SerializedForceSyncAction) => ForceSyncAction.instance
|
||||
}
|
||||
|
||||
export interface SerializedForceSyncAction {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -48,13 +48,13 @@ export const parseAppLogicAction = (serialized: SerializedAppLogicAction): AppLo
|
|||
} else if (serialized.type === 'ADD_INSTALLED_APPS') {
|
||||
return AddInstalledAppsAction.parse(serialized)
|
||||
} else if (serialized.type === 'FORCE_SYNC') {
|
||||
return ForceSyncAction.parse(serialized)
|
||||
return ForceSyncAction.instance
|
||||
} else if (serialized.type === 'MARK_TASK_PENDING') {
|
||||
return MarkTaskPendingAction.parse(serialized)
|
||||
} else if (serialized.type === 'REMOVE_INSTALLED_APPS') {
|
||||
return RemoveInstalledAppsAction.parse(serialized)
|
||||
} else if (serialized.type === 'SIGN_OUT_AT_DEVICE') {
|
||||
return SignOutAtDeviceAction.parse(serialized)
|
||||
return SignOutAtDeviceAction.instance
|
||||
} else if (serialized.type === 'TRIED_DISABLING_DEVICE_ADMIN') {
|
||||
return new TriedDisablingDeviceAdminAction()
|
||||
} else if (serialized.type === 'UPDATE_APP_ACTIVITIES') {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -25,7 +25,7 @@ export const parseChildAction = (serialized: SerializedChildAction) => {
|
|||
if (serialized.type === 'CHILD_CHANGE_PASSWORD') {
|
||||
return ChildChangePasswordAction.parse(serialized)
|
||||
} else if (serialized.type === 'CHILD_SIGN_IN') {
|
||||
return ChildSignInAction.parse(serialized)
|
||||
return ChildSignInAction.instance
|
||||
} else {
|
||||
throw new UnknownActionTypeException({ group: 'child' })
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@ export class SignOutAtDeviceAction extends AppLogicAction {
|
|||
private constructor () {
|
||||
super()
|
||||
}
|
||||
|
||||
static parse = (_: SerializedSignOutAtDeviceAction) => SignOutAtDeviceAction.instance
|
||||
}
|
||||
|
||||
export interface SerializedSignOutAtDeviceAction {
|
||||
|
|
|
@ -2426,7 +2426,7 @@ const definitions = {
|
|||
}
|
||||
}
|
||||
|
||||
export const isClientPushChangesRequest: (value: object) => value is ClientPushChangesRequest = ajv.compile({
|
||||
export const isClientPushChangesRequest: (value: unknown) => value is ClientPushChangesRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"deviceAuthToken": {
|
||||
|
@ -2447,7 +2447,7 @@ export const isClientPushChangesRequest: (value: object) => value is ClientPushC
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isClientPullChangesRequest: (value: object) => value is ClientPullChangesRequest = ajv.compile({
|
||||
export const isClientPullChangesRequest: (value: unknown) => value is ClientPullChangesRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"deviceAuthToken": {
|
||||
|
@ -2465,7 +2465,7 @@ export const isClientPullChangesRequest: (value: object) => value is ClientPullC
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isMailAuthTokenRequestBody: (value: object) => value is MailAuthTokenRequestBody = ajv.compile({
|
||||
export const isMailAuthTokenRequestBody: (value: unknown) => value is MailAuthTokenRequestBody = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"mailAuthToken": {
|
||||
|
@ -2479,7 +2479,7 @@ export const isMailAuthTokenRequestBody: (value: object) => value is MailAuthTok
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isCreateFamilyByMailTokenRequest: (value: object) => value is CreateFamilyByMailTokenRequest = ajv.compile({
|
||||
export const isCreateFamilyByMailTokenRequest: (value: unknown) => value is CreateFamilyByMailTokenRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"mailAuthToken": {
|
||||
|
@ -2513,7 +2513,7 @@ export const isCreateFamilyByMailTokenRequest: (value: object) => value is Creat
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isSignIntoFamilyRequest: (value: object) => value is SignIntoFamilyRequest = ajv.compile({
|
||||
export const isSignIntoFamilyRequest: (value: unknown) => value is SignIntoFamilyRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"mailAuthToken": {
|
||||
|
@ -2535,7 +2535,7 @@ export const isSignIntoFamilyRequest: (value: object) => value is SignIntoFamily
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isRecoverParentPasswordRequest: (value: object) => value is RecoverParentPasswordRequest = ajv.compile({
|
||||
export const isRecoverParentPasswordRequest: (value: unknown) => value is RecoverParentPasswordRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"mailAuthToken": {
|
||||
|
@ -2553,7 +2553,7 @@ export const isRecoverParentPasswordRequest: (value: object) => value is Recover
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isRegisterChildDeviceRequest: (value: object) => value is RegisterChildDeviceRequest = ajv.compile({
|
||||
export const isRegisterChildDeviceRequest: (value: unknown) => value is RegisterChildDeviceRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"registerToken": {
|
||||
|
@ -2575,7 +2575,7 @@ export const isRegisterChildDeviceRequest: (value: object) => value is RegisterC
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isSerializedParentAction: (value: object) => value is SerializedParentAction = ajv.compile({
|
||||
export const isSerializedParentAction: (value: unknown) => value is SerializedParentAction = ajv.compile({
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SerializedAddCategoryAppsAction"
|
||||
|
@ -2722,7 +2722,7 @@ export const isSerializedParentAction: (value: object) => value is SerializedPar
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isSerializedAppLogicAction: (value: object) => value is SerializedAppLogicAction = ajv.compile({
|
||||
export const isSerializedAppLogicAction: (value: unknown) => value is SerializedAppLogicAction = ajv.compile({
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SerializedAddInstalledAppsAction"
|
||||
|
@ -2758,7 +2758,7 @@ export const isSerializedAppLogicAction: (value: object) => value is SerializedA
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isSerializedChildAction: (value: object) => value is SerializedChildAction = ajv.compile({
|
||||
export const isSerializedChildAction: (value: unknown) => value is SerializedChildAction = ajv.compile({
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SerializedChildChangePasswordAction"
|
||||
|
@ -2770,7 +2770,7 @@ export const isSerializedChildAction: (value: object) => value is SerializedChil
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isCreateRegisterDeviceTokenRequest: (value: object) => value is CreateRegisterDeviceTokenRequest = ajv.compile({
|
||||
export const isCreateRegisterDeviceTokenRequest: (value: unknown) => value is CreateRegisterDeviceTokenRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"deviceAuthToken": {
|
||||
|
@ -2792,7 +2792,7 @@ export const isCreateRegisterDeviceTokenRequest: (value: object) => value is Cre
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isCanDoPurchaseRequest: (value: object) => value is CanDoPurchaseRequest = ajv.compile({
|
||||
export const isCanDoPurchaseRequest: (value: unknown) => value is CanDoPurchaseRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
|
@ -2814,7 +2814,7 @@ export const isCanDoPurchaseRequest: (value: object) => value is CanDoPurchaseRe
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isFinishPurchaseByGooglePlayRequest: (value: object) => value is FinishPurchaseByGooglePlayRequest = ajv.compile({
|
||||
export const isFinishPurchaseByGooglePlayRequest: (value: unknown) => value is FinishPurchaseByGooglePlayRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"deviceAuthToken": {
|
||||
|
@ -2836,7 +2836,7 @@ export const isFinishPurchaseByGooglePlayRequest: (value: object) => value is Fi
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isLinkParentMailAddressRequest: (value: object) => value is LinkParentMailAddressRequest = ajv.compile({
|
||||
export const isLinkParentMailAddressRequest: (value: unknown) => value is LinkParentMailAddressRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"mailAuthToken": {
|
||||
|
@ -2862,7 +2862,7 @@ export const isLinkParentMailAddressRequest: (value: object) => value is LinkPar
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isUpdatePrimaryDeviceRequest: (value: object) => value is UpdatePrimaryDeviceRequest = ajv.compile({
|
||||
export const isUpdatePrimaryDeviceRequest: (value: unknown) => value is UpdatePrimaryDeviceRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"action": {
|
||||
|
@ -2888,7 +2888,7 @@ export const isUpdatePrimaryDeviceRequest: (value: object) => value is UpdatePri
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isRemoveDeviceRequest: (value: object) => value is RemoveDeviceRequest = ajv.compile({
|
||||
export const isRemoveDeviceRequest: (value: unknown) => value is RemoveDeviceRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"deviceAuthToken": {
|
||||
|
@ -2914,7 +2914,7 @@ export const isRemoveDeviceRequest: (value: object) => value is RemoveDeviceRequ
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isRequestWithAuthToken: (value: object) => value is RequestWithAuthToken = ajv.compile({
|
||||
export const isRequestWithAuthToken: (value: unknown) => value is RequestWithAuthToken = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"deviceAuthToken": {
|
||||
|
@ -2928,7 +2928,7 @@ export const isRequestWithAuthToken: (value: object) => value is RequestWithAuth
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isSendMailLoginCodeRequest: (value: object) => value is SendMailLoginCodeRequest = ajv.compile({
|
||||
export const isSendMailLoginCodeRequest: (value: unknown) => value is SendMailLoginCodeRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"mail": {
|
||||
|
@ -2949,7 +2949,7 @@ export const isSendMailLoginCodeRequest: (value: object) => value is SendMailLog
|
|||
"definitions": definitions,
|
||||
"$schema": "http://json-schema.org/draft-07/schema#"
|
||||
})
|
||||
export const isSignInByMailCodeRequest: (value: object) => value is SignInByMailCodeRequest = ajv.compile({
|
||||
export const isSignInByMailCodeRequest: (value: unknown) => value is SignInByMailCodeRequest = ajv.compile({
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"mailLoginToken": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -79,12 +79,12 @@ export class VisibleConnectedDevicesManager {
|
|||
}): {
|
||||
shutdown: () => void
|
||||
} => {
|
||||
let observesDevices = new Set<string>()
|
||||
let devicesWithSharingEnabled = new Set<string>()
|
||||
let connectedDevices = new Set<string>()
|
||||
let sentConnectedDevices = new Set<string>()
|
||||
const observesDevices = new Set<string>()
|
||||
const devicesWithSharingEnabled = new Set<string>()
|
||||
const connectedDevices = new Set<string>()
|
||||
const sentConnectedDevices = new Set<string>()
|
||||
let hasShutDown = false
|
||||
let shutdownHooks: Array<() => void> = []
|
||||
const shutdownHooks: Array<() => void> = []
|
||||
|
||||
const shutdown = () => {
|
||||
hasShutDown = true
|
||||
|
@ -97,7 +97,7 @@ export class VisibleConnectedDevicesManager {
|
|||
return
|
||||
}
|
||||
|
||||
let result: Array<string> = []
|
||||
const result: Array<string> = []
|
||||
|
||||
sentConnectedDevices.forEach((deviceId) => result.push(deviceId))
|
||||
|
||||
|
@ -191,7 +191,7 @@ export class VisibleConnectedDevicesManager {
|
|||
devices.forEach(({ deviceId, showDeviceConnected }) => {
|
||||
addDevice({ deviceId, showDeviceConnected })
|
||||
})
|
||||
})().catch((ex) => { /* ignore */ })
|
||||
})().catch(() => { /* ignore */ })
|
||||
|
||||
{
|
||||
// add all new devices + apply changes of sharing
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2021 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -86,7 +86,7 @@ const createDatabase = (sequelize: Sequelize.Sequelize): Database => ({
|
|||
transaction: <T> (autoCallback: (transaction: Transaction) => Promise<T>, options?: { transaction: Transaction }) => (sequelize.transaction({
|
||||
isolationLevel: Sequelize.Transaction.ISOLATION_LEVELS.SERIALIZABLE,
|
||||
transaction: options?.transaction
|
||||
}, autoCallback) as any) as Promise<T>,
|
||||
}, autoCallback)) as Promise<T>,
|
||||
dialect: sequelize.getDialect()
|
||||
})
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -17,6 +17,7 @@
|
|||
|
||||
import * as Sequelize from 'sequelize'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type SequelizeAttributes<T extends { [key: string]: any }> = {
|
||||
[P in keyof T]: Sequelize.ModelAttributeColumnOptions;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2021 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -21,7 +21,7 @@ import { Database } from '../main'
|
|||
|
||||
export class SerializationFeatureCheckException extends Error {}
|
||||
|
||||
export function shouldRetryWithException (database: Database, e: any): boolean {
|
||||
export function shouldRetryWithException (database: Database, e: unknown): boolean {
|
||||
if (e instanceof Sequelize.TimeoutError) return true
|
||||
|
||||
if (!(e instanceof Sequelize.DatabaseError)) return false
|
||||
|
@ -32,10 +32,13 @@ export function shouldRetryWithException (database: Database, e: any): boolean {
|
|||
if (parent.message.startsWith('SQLITE_BUSY:')) return true
|
||||
} else if (database.dialect === 'postgres') {
|
||||
// 40001 = serialization_failure
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
if ((parent as any).code === '40001') return true
|
||||
// 40P01 = deadlock detected
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
if ((parent as any).code === '40P01') return true
|
||||
} else if (database.dialect === 'mariadb') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const errno = (parent as any).errno
|
||||
|
||||
// ER_LOCK_DEADLOCK
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -17,6 +17,7 @@
|
|||
|
||||
const IABVerifier: new (publicKey: string) => {
|
||||
verifyReceipt: (data: string, signature: string) => boolean
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
} = require('iab_verifier')
|
||||
|
||||
export const googlePlayPublicKey = process.env.GOOGLE_PLAY_PUBLIC_KEY || ''
|
||||
|
|
|
@ -86,7 +86,7 @@ export async function dispatchAddUsedTimeVersion2 ({ deviceId, action, cache, ev
|
|||
addUsedTimeForADifferentUserThanTheCurrentUserOfTheDevice = true
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:no-inner-declarations
|
||||
// eslint-disable-next-line no-inner-declarations
|
||||
async function handle (start: number, end: number) {
|
||||
const lengthInMinutes = (end - start) + 1
|
||||
const lengthInMs = lengthInMinutes * 1000 * 60
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -26,7 +26,7 @@ import { parseEncodedAction } from '../parse-encoded-action'
|
|||
export async function dispatch<T1 extends { type: string }, T2> ({ type, action, validator, parser, applier, eventHandler }: {
|
||||
type: 'app logic' | 'parent' | 'child'
|
||||
action: ClientPushChangesRequestAction
|
||||
validator: (input: any) => input is T1
|
||||
validator: (input: unknown) => input is T1
|
||||
parser: (input: T1) => T2
|
||||
applier: (input: T2) => Promise<void>
|
||||
eventHandler: EventHandler
|
||||
|
|
|
@ -39,7 +39,7 @@ export const generateServerDataStatus = async ({ database, clientStatus, familyI
|
|||
const familyEntry = await getFamilyEntry({ database, familyId, transaction })
|
||||
const doesClientSupportTasks = clientStatus.clientLevel !== undefined && clientStatus.clientLevel >= 3
|
||||
|
||||
let result: ServerDataStatus = {
|
||||
const result: ServerDataStatus = {
|
||||
fullVersion: config.alwaysPro ? 1 : (
|
||||
familyEntry.hasFullVersion ? parseInt(familyEntry.fullVersionUntil, 10) : 0
|
||||
),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2020 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -56,7 +56,7 @@ export const validateBitmask = (bitmask: string, maxLength: number) => {
|
|||
export const validateAndParseBitmask = (bitmask: string, maxLength: number) => {
|
||||
validateBitmask(bitmask, maxLength)
|
||||
|
||||
const result = range(0, maxLength).map((_) => false)
|
||||
const result = range(0, maxLength).map(() => false)
|
||||
|
||||
const splitpoints = split(bitmask, ',').map((item) => parseInt(item, 10))
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ function createMailTemplateSender (templateName: string) {
|
|||
reject(err)
|
||||
} else {
|
||||
if (isDevMode) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const data = (info as any).message
|
||||
|
||||
console.log(JSON.stringify(JSON.parse(data), null, 2))
|
||||
|
@ -238,6 +239,7 @@ export function sanitizeMailAddress (input: string): string | null {
|
|||
return null
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const address = (parsed as any).address
|
||||
|
||||
if (typeof address !== 'string') {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -28,7 +28,7 @@ const randomWord = () => wordlist[Math.floor(Math.random() * (wordlist.length -
|
|||
|
||||
export const randomWords = (numberOfWords: number) => (
|
||||
range(numberOfWords)
|
||||
.map((item) => randomWord())
|
||||
.map(() => randomWord())
|
||||
.join(' ')
|
||||
)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* server component for the TimeLimit App
|
||||
* Copyright (C) 2019 - 2021 Jonas Lochmann
|
||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
@ -45,7 +45,7 @@ export const createWebsocketHandler = ({ connectedDevicesManager, database }: {
|
|||
socketCounter++
|
||||
socket.on('disconnect', () => socketCounter--)
|
||||
|
||||
socket.on('devicelogin', (deviceAuthToken: any, ack: any) => {
|
||||
socket.on('devicelogin', (deviceAuthToken: unknown, ack: unknown) => {
|
||||
socket.rooms.forEach((room) => socket.leave(room))
|
||||
|
||||
if (typeof deviceAuthToken !== 'string') {
|
||||
|
@ -95,7 +95,7 @@ export const createWebsocketHandler = ({ connectedDevicesManager, database }: {
|
|||
shutdown()
|
||||
})
|
||||
}
|
||||
})().catch((ex) => { /* ignore */ })
|
||||
})().catch(() => { /* ignore */ })
|
||||
|
||||
if (typeof ack === 'function') {
|
||||
ack()
|
||||
|
|
12
tslint.json
12
tslint.json
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"defaultSeverity": "error",
|
||||
"extends": [
|
||||
"tslint-config-standard"
|
||||
],
|
||||
"jsRules": {},
|
||||
"rules": {
|
||||
"await-promise": [true, "Bluebird"],
|
||||
"ordered-imports": true
|
||||
},
|
||||
"rulesDirectory": []
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue