mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
update eslint
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
build
|
|
||||||
scripts
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
plugins: [
|
|
||||||
'@typescript-eslint',
|
|
||||||
],
|
|
||||||
extends: [
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
],
|
|
||||||
env: {
|
|
||||||
node: true
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// @ts-check
|
||||||
|
|
||||||
|
import eslint from '@eslint/js';
|
||||||
|
import { defineConfig } from 'eslint/config';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
|
||||||
|
export default defineConfig(
|
||||||
|
eslint.configs.recommended,
|
||||||
|
tseslint.configs.recommended,
|
||||||
|
{
|
||||||
|
ignores: ['build', 'scripts']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-unused-vars': ['warn', { caughtErrors: 'none' }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
Generated
+1119
-815
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -6,8 +6,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./build/index.js",
|
"start": "node ./build/index.js",
|
||||||
"test": "node scripts/test-launch-with-different-databases.js",
|
"test": "node scripts/test-launch-with-different-databases.js",
|
||||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
"lint": "eslint .",
|
||||||
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
|
"lint:fix": "eslint . --fix",
|
||||||
"build": "npm run build:clean && npm run build:json && npm run build:ts && npm run lint && npm run build:doc",
|
"build": "npm run build:clean && npm run build:json && npm run build:ts && npm run lint && npm run build:doc",
|
||||||
"build:clean": "rm -rf build",
|
"build:clean": "rm -rf build",
|
||||||
"build:json": "node ./scripts/build-schemas.js",
|
"build:json": "node ./scripts/build-schemas.js",
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
"homepage": "https://gitlab.com/timelimit.io/timelimit-server-2018#README",
|
"homepage": "https://gitlab.com/timelimit.io/timelimit-server-2018#README",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@adobe/jsonschema2md": "^8.0.8",
|
"@adobe/jsonschema2md": "^8.0.8",
|
||||||
|
"@eslint/js": "^10.0.1",
|
||||||
"@types/basic-auth": "^1.1.3",
|
"@types/basic-auth": "^1.1.3",
|
||||||
"@types/body-parser": "^1.19.0",
|
"@types/body-parser": "^1.19.0",
|
||||||
"@types/ejs": "^3.1.0",
|
"@types/ejs": "^3.1.0",
|
||||||
@@ -38,10 +39,9 @@
|
|||||||
"@types/lodash": "^4.14.166",
|
"@types/lodash": "^4.14.166",
|
||||||
"@types/node": "^16.11.59",
|
"@types/node": "^16.11.59",
|
||||||
"@types/nodemailer": "^6.4.4",
|
"@types/nodemailer": "^6.4.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
"eslint": "^10.0.1",
|
||||||
"@typescript-eslint/parser": "^7.18.0",
|
|
||||||
"eslint": "^8.7.0",
|
|
||||||
"typescript": "^5.5.4",
|
"typescript": "^5.5.4",
|
||||||
|
"typescript-eslint": "^8.56.0",
|
||||||
"typescript-json-schema": "^0.52.0"
|
"typescript-json-schema": "^0.52.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* server component for the TimeLimit App
|
* server component for the TimeLimit App
|
||||||
* Copyright (C) 2019 - 2024 Jonas Lochmann
|
* Copyright (C) 2019 - 2026 Jonas Lochmann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
@@ -27,7 +27,7 @@ export const createUmzug = (sequelize: Sequelize) => (
|
|||||||
resolve: ({ name, path }) => {
|
resolve: ({ name, path }) => {
|
||||||
if (!path) throw new Error()
|
if (!path) throw new Error()
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
const migration = require(path)
|
const migration = require(path)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* server component for the TimeLimit App
|
* server component for the TimeLimit App
|
||||||
* Copyright (C) 2019 - 2023 Jonas Lochmann
|
* Copyright (C) 2019 - 2026 Jonas Lochmann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
@@ -89,7 +89,6 @@ export async function dispatchAddUsedTimeVersion2 ({ deviceId, action, cache, ev
|
|||||||
addUsedTimeForADifferentUserThanTheCurrentUserOfTheDevice = true
|
addUsedTimeForADifferentUserThanTheCurrentUserOfTheDevice = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-inner-declarations
|
|
||||||
async function handle (start: number, end: number) {
|
async function handle (start: number, end: number) {
|
||||||
const lengthInMinutes = (end - start) + 1
|
const lengthInMinutes = (end - start) + 1
|
||||||
const lengthInMs = lengthInMinutes * 1000 * 60
|
const lengthInMs = lengthInMinutes * 1000 * 60
|
||||||
@@ -215,10 +214,10 @@ export async function dispatchAddUsedTimeVersion2 ({ deviceId, action, cache, ev
|
|||||||
|
|
||||||
const fittingDurationItemsLastUsageFiltered =
|
const fittingDurationItemsLastUsageFiltered =
|
||||||
hasTrustedTimestamp ?
|
hasTrustedTimestamp ?
|
||||||
fittingDurationItems.filter((it) => {
|
fittingDurationItems.filter((it) => (
|
||||||
action.trustedTimestamp - item.timeToAdd <=
|
action.trustedTimestamp - item.timeToAdd <=
|
||||||
parseInt(it.lastUsage, 10) + it.sessionPauseDuration - tolerance
|
parseInt(it.lastUsage, 10) + it.sessionPauseDuration - tolerance
|
||||||
}) : fittingDurationItems
|
)) : fittingDurationItems
|
||||||
|
|
||||||
return fittingDurationItemsLastUsageFiltered
|
return fittingDurationItemsLastUsageFiltered
|
||||||
.map((it) => it.lastSessionDuration)
|
.map((it) => it.lastSessionDuration)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* server component for the TimeLimit App
|
* server component for the TimeLimit App
|
||||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
* Copyright (C) 2019 - 2026 Jonas Lochmann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
@@ -48,7 +48,8 @@ export const dispatchChildChangePassword = async ({ action, childUserId, cache }
|
|||||||
|
|
||||||
{
|
{
|
||||||
const clear = cache.getSecondPasswordHashOfChild.cache.clear
|
const clear = cache.getSecondPasswordHashOfChild.cache.clear
|
||||||
clear && clear()
|
|
||||||
|
if (clear) clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
cache.invalidiateUserList = true
|
cache.invalidiateUserList = true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* server component for the TimeLimit App
|
* server component for the TimeLimit App
|
||||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
* Copyright (C) 2019 - 2026 Jonas Lochmann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
@@ -55,7 +55,8 @@ export async function dispatchChangeParentPassword ({ action, cache }: {
|
|||||||
|
|
||||||
{
|
{
|
||||||
const clear = cache.getSecondPasswordHashOfParent.cache.clear
|
const clear = cache.getSecondPasswordHashOfParent.cache.clear
|
||||||
clear && clear()
|
|
||||||
|
if (clear) clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
cache.invalidiateUserList = true
|
cache.invalidiateUserList = true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* server component for the TimeLimit App
|
* server component for the TimeLimit App
|
||||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
* Copyright (C) 2019 - 2026 Jonas Lochmann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
@@ -47,7 +47,8 @@ export async function dispatchSetChildPassword ({ action, cache }: {
|
|||||||
|
|
||||||
{
|
{
|
||||||
const clear = cache.getSecondPasswordHashOfChild.cache.clear
|
const clear = cache.getSecondPasswordHashOfChild.cache.clear
|
||||||
clear && clear()
|
|
||||||
|
if (clear) clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
cache.invalidiateUserList = true
|
cache.invalidiateUserList = true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* server component for the TimeLimit App
|
* server component for the TimeLimit App
|
||||||
* Copyright (C) 2019 - 2022 Jonas Lochmann
|
* Copyright (C) 2019 - 2026 Jonas Lochmann
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
@@ -56,7 +56,7 @@ export const createWebsocketHandler = ({ connectedDevicesManager, database }: {
|
|||||||
|
|
||||||
const importantSyncForAllListener = () => {
|
const importantSyncForAllListener = () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
socket.connected && socket.emit('should sync', { isImportant: true })
|
if (socket.connected) socket.emit('should sync', { isImportant: true })
|
||||||
}, Math.random() * 1000 * 60 /* wait up to one minute */)
|
}, Math.random() * 1000 * 60 /* wait up to one minute */)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user