update eslint

This commit is contained in:
Jonas Lochmann
2026-02-16 01:00:00 +01:00
parent abb2d1657e
commit a13656b27d
11 changed files with 1160 additions and 853 deletions
-3
View File
@@ -1,3 +0,0 @@
node_modules
build
scripts
-14
View File
@@ -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
}
};
+18
View File
@@ -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' }]
}
}
)
+1121 -817
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -6,8 +6,8 @@
"scripts": {
"start": "node ./build/index.js",
"test": "node scripts/test-launch-with-different-databases.js",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
"lint": "eslint .",
"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:clean": "rm -rf build",
"build:json": "node ./scripts/build-schemas.js",
@@ -30,6 +30,7 @@
"homepage": "https://gitlab.com/timelimit.io/timelimit-server-2018#README",
"devDependencies": {
"@adobe/jsonschema2md": "^8.0.8",
"@eslint/js": "^10.0.1",
"@types/basic-auth": "^1.1.3",
"@types/body-parser": "^1.19.0",
"@types/ejs": "^3.1.0",
@@ -38,10 +39,9 @@
"@types/lodash": "^4.14.166",
"@types/node": "^16.11.59",
"@types/nodemailer": "^6.4.4",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.7.0",
"eslint": "^10.0.1",
"typescript": "^5.5.4",
"typescript-eslint": "^8.56.0",
"typescript-json-schema": "^0.52.0"
},
"dependencies": {
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* 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
* it under the terms of the GNU Affero General Public License as
@@ -27,7 +27,7 @@ export const createUmzug = (sequelize: Sequelize) => (
resolve: ({ name, path }) => {
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)
return {
@@ -1,6 +1,6 @@
/*
* 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
* 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
}
// eslint-disable-next-line no-inner-declarations
async function handle (start: number, end: number) {
const lengthInMinutes = (end - start) + 1
const lengthInMs = lengthInMinutes * 1000 * 60
@@ -215,10 +214,10 @@ export async function dispatchAddUsedTimeVersion2 ({ deviceId, action, cache, ev
const fittingDurationItemsLastUsageFiltered =
hasTrustedTimestamp ?
fittingDurationItems.filter((it) => {
fittingDurationItems.filter((it) => (
action.trustedTimestamp - item.timeToAdd <=
parseInt(it.lastUsage, 10) + it.sessionPauseDuration - tolerance
}) : fittingDurationItems
)) : fittingDurationItems
return fittingDurationItemsLastUsageFiltered
.map((it) => it.lastSessionDuration)
@@ -1,6 +1,6 @@
/*
* 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
* 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
clear && clear()
if (clear) clear()
}
cache.invalidiateUserList = true
@@ -1,6 +1,6 @@
/*
* 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
* 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
clear && clear()
if (clear) clear()
}
cache.invalidiateUserList = true
@@ -1,6 +1,6 @@
/*
* 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
* 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
clear && clear()
if (clear) clear()
}
cache.invalidiateUserList = true
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* 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
* it under the terms of the GNU Affero General Public License as
@@ -56,7 +56,7 @@ export const createWebsocketHandler = ({ connectedDevicesManager, database }: {
const importantSyncForAllListener = () => {
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 */)
}