mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2026-06-22 20:00:39 +00:00
chore(lint): replace ESLint with OXLint for performance
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": [
|
||||
"typescript",
|
||||
"jest",
|
||||
"react",
|
||||
"nextjs",
|
||||
"jsx-a11y",
|
||||
"import",
|
||||
"unicorn",
|
||||
"oxc"
|
||||
],
|
||||
"rules": {
|
||||
"no-debugger": "warn",
|
||||
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_+$" }],
|
||||
"typescript/no-unused-vars": ["warn", { "argsIgnorePattern": "^_+$" }],
|
||||
"typescript/consistent-type-imports": ["error", {
|
||||
"prefer": "type-imports",
|
||||
"disallowTypeAnnotations": false
|
||||
}],
|
||||
"jest/no-disabled-tests": "warn",
|
||||
"jest/no-focused-tests": "error",
|
||||
"jest/no-identical-title": "error",
|
||||
"jest/valid-expect": "error"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"jest": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
*/
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
sourceType: 'module',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['test/**', 'src/**/*.spec.ts'],
|
||||
extends: ['plugin:jest/recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/unbound-method': 'off',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/no-unsafe-argument': 'off',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'off',
|
||||
'@typescript-eslint/require-await': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
// This rule seems to create trouble with our tests and mock-knex-client
|
||||
'@darraghor/nestjs-typed/provided-injected-should-match-factory-parameters':
|
||||
'off',
|
||||
'jest/unbound-method': 'error',
|
||||
'jest/expect-expect': [
|
||||
'error',
|
||||
{
|
||||
assertFunctionNames: [
|
||||
'expect**',
|
||||
'request.**.expect',
|
||||
'agent**.**.expect',
|
||||
],
|
||||
},
|
||||
],
|
||||
'jest/no-standalone-expect': [
|
||||
'error',
|
||||
{
|
||||
additionalTestBlockFunctions: ['afterEach', 'beforeAll'],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['src/database/**'],
|
||||
rules: {
|
||||
'@typescript-eslint/naming-convention': 'off',
|
||||
},
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
'jest',
|
||||
'eslint-plugin-local-rules',
|
||||
'@darraghor/nestjs-typed',
|
||||
],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
'plugin:prettier/recommended',
|
||||
'plugin:@darraghor/nestjs-typed/recommended',
|
||||
],
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
rules: {
|
||||
'prettier/prettier': ['error', require('./.prettierrc.json')],
|
||||
'local-rules/correct-logger-context': 'error',
|
||||
'func-style': ['error', 'declaration'],
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'warn',
|
||||
{ argsIgnorePattern: '^_+$' },
|
||||
],
|
||||
'@typescript-eslint/explicit-function-return-type': 'warn',
|
||||
'no-return-await': 'off',
|
||||
'@typescript-eslint/return-await': ['error', 'always'],
|
||||
'@typescript-eslint/naming-convention': [
|
||||
'error',
|
||||
{
|
||||
selector: 'default',
|
||||
format: ['camelCase'],
|
||||
leadingUnderscore: 'allow',
|
||||
trailingUnderscore: 'allow',
|
||||
},
|
||||
{
|
||||
selector: 'import',
|
||||
format: ['camelCase', 'PascalCase'],
|
||||
},
|
||||
{
|
||||
selector: 'enumMember',
|
||||
format: ['UPPER_CASE'],
|
||||
},
|
||||
{
|
||||
selector: 'variable',
|
||||
format: ['camelCase', 'UPPER_CASE'],
|
||||
leadingUnderscore: 'allow',
|
||||
trailingUnderscore: 'allow',
|
||||
},
|
||||
|
||||
{
|
||||
selector: 'typeLike',
|
||||
format: ['PascalCase'],
|
||||
},
|
||||
],
|
||||
// We have our own OpenApi decorator and don't directly use the one from NestJS
|
||||
'@darraghor/nestjs-typed/api-method-should-specify-api-response': 'off',
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||
"jsPlugins": ["./oxlint-local-rules.js"],
|
||||
"plugins": [
|
||||
"typescript",
|
||||
"jest",
|
||||
"oxc"
|
||||
],
|
||||
"rules": {
|
||||
"no-debugger": "warn",
|
||||
"hedgedoc-local/correct-logger-context": "error",
|
||||
"typescript/no-unused-vars": ["warn", { "argsIgnorePattern": "^_+$" }],
|
||||
"typescript/return-await": ["error", "always"],
|
||||
"typescript/naming-convention": "off",
|
||||
"typescript/no-base-to-string": "error"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["test/**", "src/**/*.spec.ts"],
|
||||
"rules": {
|
||||
"typescript/unbound-method": "off",
|
||||
"typescript/no-unsafe-assignment": "off",
|
||||
"typescript/no-unsafe-argument": "off",
|
||||
"typescript/no-unsafe-member-access": "off",
|
||||
"typescript/require-await": "off",
|
||||
"typescript/explicit-function-return-type": "off",
|
||||
"jest/unbound-method": "error",
|
||||
"jest/no-standalone-expect": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["src/database/**"],
|
||||
"rules": {
|
||||
"typescript/naming-convention": "off"
|
||||
}
|
||||
}
|
||||
],
|
||||
"env": {
|
||||
"node": true,
|
||||
"jest": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const loggerFunctions = ['error', 'log', 'warn', 'debug', 'verbose'];
|
||||
|
||||
module.exports = {
|
||||
'correct-logger-context': {
|
||||
meta: {
|
||||
fixable: 'code',
|
||||
type: 'problem',
|
||||
docs: {
|
||||
recommended: true,
|
||||
},
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
return {
|
||||
CallExpression: function (node) {
|
||||
if (
|
||||
node.callee.type === 'MemberExpression' &&
|
||||
node.callee.object.type === 'MemberExpression' &&
|
||||
node.callee.object.property.name === 'logger' &&
|
||||
loggerFunctions.includes(node.callee.property.name) &&
|
||||
!!node.arguments &&
|
||||
node.arguments.length === 2
|
||||
) {
|
||||
const usedContext = node.arguments[1].value;
|
||||
let correctContext = 'undefined';
|
||||
const ancestors = context.getAncestors();
|
||||
for (let index = ancestors.length - 1; index >= 0; index--) {
|
||||
if (ancestors[index].type === 'MethodDefinition') {
|
||||
correctContext = ancestors[index].key.name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (usedContext !== correctContext) {
|
||||
context.report({
|
||||
node: node,
|
||||
message: `Used wrong context in log statement`,
|
||||
fix: function (fixer) {
|
||||
return fixer.replaceText(
|
||||
node.arguments[1],
|
||||
`'${correctContext}'`,
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
const loggerFunctions = ['error', 'log', 'warn', 'debug', 'verbose'];
|
||||
|
||||
/**
|
||||
* Ensures that logger context strings match the method name where they're called.
|
||||
* This helps with debugging by ensuring log context accurately reflects the source.
|
||||
*
|
||||
* Example of correct usage:
|
||||
* class ExampleService {
|
||||
* exampleMethod() {
|
||||
* this.logger.log('Hello', 'exampleMethod');
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* Example of incorrect usage:
|
||||
* class ExampleService {
|
||||
* exampleMethod() {
|
||||
* this.logger.log('Hello', 'wrongName');
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
const correctLoggerContextRule = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Ensure logger context strings match the method name where they are called',
|
||||
category: 'Best Practices',
|
||||
recommended: true,
|
||||
},
|
||||
fixable: 'code',
|
||||
schema: [],
|
||||
messages: {
|
||||
wrongContext: "Used wrong context in log statement. Expected '{{expected}}', got '{{actual}}'",
|
||||
},
|
||||
},
|
||||
create: function (context) {
|
||||
const sourceCode = context.sourceCode || context.getSourceCode();
|
||||
|
||||
return {
|
||||
CallExpression: function (node) {
|
||||
// Check if this is a logger call: this.logger.log/error/warn/debug/verbose(...)
|
||||
if (
|
||||
node.callee.type === 'MemberExpression' &&
|
||||
node.callee.object.type === 'MemberExpression' &&
|
||||
node.callee.object.property.name === 'logger' &&
|
||||
loggerFunctions.includes(node.callee.property.name) &&
|
||||
node.arguments &&
|
||||
node.arguments.length === 2
|
||||
) {
|
||||
const contextArg = node.arguments[1];
|
||||
|
||||
// Only check string literal contexts
|
||||
if (contextArg.type !== 'Literal' || typeof contextArg.value !== 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
const usedContext = contextArg.value;
|
||||
let correctContext = 'undefined';
|
||||
|
||||
// Walk up the AST to find the enclosing method
|
||||
const ancestors = sourceCode.getAncestors
|
||||
? sourceCode.getAncestors(node)
|
||||
: context.getAncestors();
|
||||
for (let index = ancestors.length - 1; index >= 0; index--) {
|
||||
const ancestor = ancestors[index];
|
||||
if (ancestor.type === 'MethodDefinition' && ancestor.key) {
|
||||
correctContext = ancestor.key.name || ancestor.key.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Report if context doesn't match
|
||||
if (usedContext !== correctContext) {
|
||||
context.report({
|
||||
node: contextArg,
|
||||
messageId: 'wrongContext',
|
||||
data: {
|
||||
expected: correctContext,
|
||||
actual: usedContext,
|
||||
},
|
||||
fix: function (fixer) {
|
||||
return fixer.replaceText(contextArg, `'${correctContext}'`);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
const plugin = {
|
||||
meta: {
|
||||
name: 'hedgedoc-local',
|
||||
version: '1.0.0',
|
||||
},
|
||||
rules: {
|
||||
'correct-logger-context': correctLoggerContextRule,
|
||||
},
|
||||
};
|
||||
|
||||
// Export CommonJS for ESLint, ESM for oxlint
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = plugin;
|
||||
}
|
||||
export default plugin;
|
||||
+5
-12
@@ -11,8 +11,8 @@
|
||||
"format:fix": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"start": "node dist/src/main",
|
||||
"start:dev": "nest start --watch",
|
||||
"lint": "eslint --max-warnings 0 \"{src,apps,libs,test}/**/*.ts\"",
|
||||
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"lint": "../node_modules/.bin/oxlint src test",
|
||||
"lint:fix": "../node_modules/.bin/oxlint src test --fix",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:ci": "jest --coverage --runInBand",
|
||||
@@ -70,7 +70,6 @@
|
||||
"zod": "3.25.76"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@darraghor/eslint-plugin-nestjs-typed": "5.0.32",
|
||||
"@nestjs/cli": "10.4.9",
|
||||
"@nestjs/schematics": "10.2.3",
|
||||
"@nestjs/testing": "10.4.20",
|
||||
@@ -92,14 +91,6 @@
|
||||
"@types/source-map-support": "0.5.10",
|
||||
"@types/supertest": "2.0.16",
|
||||
"@types/ws": "8.18.1",
|
||||
"@typescript-eslint/eslint-plugin": "7.18.0",
|
||||
"@typescript-eslint/parser": "7.18.0",
|
||||
"eslint": "8.57.1",
|
||||
"eslint-config-prettier": "9.1.2",
|
||||
"eslint-plugin-import": "2.32.0",
|
||||
"eslint-plugin-jest": "28.14.0",
|
||||
"eslint-plugin-local-rules": "3.0.2",
|
||||
"eslint-plugin-prettier": "5.5.4",
|
||||
"jest": "29.7.0",
|
||||
"knex-mock-client": "3.0.2",
|
||||
"mocked-env": "1.3.5",
|
||||
@@ -126,7 +117,9 @@
|
||||
{
|
||||
"tsconfig": "test/tsconfig.json",
|
||||
"diagnostics": {
|
||||
"ignoreCodes": [151002]
|
||||
"ignoreCodes": [
|
||||
151002
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -277,12 +277,12 @@ describe('ApiTokenService', () => {
|
||||
});
|
||||
|
||||
// expect is common in this test group, and therefore called in afterEach instead of each test
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
// oxlint-disable-next-line jest/expect-expect
|
||||
it('without validUntil', async () => {
|
||||
token = await service.createToken(userId, label);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
// oxlint-disable-next-line jest/expect-expect
|
||||
it('with validUntil more than two years in the future', async () => {
|
||||
token = await service.createToken(
|
||||
userId,
|
||||
@@ -291,7 +291,7 @@ describe('ApiTokenService', () => {
|
||||
);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
// oxlint-disable-next-line jest/expect-expect
|
||||
it('with validUntil less than two years in the future', async () => {
|
||||
token = await service.createToken(
|
||||
userId,
|
||||
|
||||
@@ -18,7 +18,7 @@ import getRawBody from 'raw-body';
|
||||
* Implementation inspired by https://stackoverflow.com/questions/52283713/how-do-i-pass-plain-text-as-my-request-body-using-nestjs
|
||||
*/
|
||||
// Override naming convention as decorators are in PascalCase
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
export const MarkdownBody = createParamDecorator(
|
||||
async (_, context: ExecutionContext) => {
|
||||
// we have to check req.readable because of raw-body issue #57
|
||||
@@ -43,7 +43,7 @@ export const MarkdownBody = createParamDecorator(
|
||||
(target, key): void => {
|
||||
if (key === undefined) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
`Could not enhance param decorator for target ${target.toString()} because key is undefined`,
|
||||
);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ export const MarkdownBody = createParamDecorator(
|
||||
);
|
||||
if (!ownPropertyDescriptor) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
`Could not get property descriptor for target ${target.toString()} and key ${key.toString()}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -74,13 +74,13 @@ export interface HttpStatusCodeWithExtraInformation {
|
||||
* For non-200 successful responses the appropriate {@link HttpCode} decorator is set
|
||||
* @constructor
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,func-style
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention,func-style
|
||||
export const OpenApi = (
|
||||
...httpStatusCodesMaybeWithExtraInformation: (
|
||||
| HttpStatusCodes
|
||||
| HttpStatusCodeWithExtraInformation
|
||||
)[]
|
||||
): // eslint-disable-next-line @typescript-eslint/ban-types
|
||||
): // oxlint-disable-next-line @typescript-eslint/ban-types
|
||||
(<TFunction extends Function, Y>(
|
||||
target: object | TFunction,
|
||||
propertyKey?: string | symbol,
|
||||
|
||||
@@ -16,7 +16,7 @@ import { CompleteRequest } from '../request.type';
|
||||
*
|
||||
* Will throw an {@link InternalServerErrorException} if no note is present
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
export const RequestNoteId = createParamDecorator(
|
||||
(data: unknown, ctx: ExecutionContext) => {
|
||||
const request: CompleteRequest = ctx.switchToHttp().getRequest();
|
||||
|
||||
@@ -23,7 +23,7 @@ type RequestUserIdParameter = {
|
||||
* If no user is present and guests are allowed, returns `null`.
|
||||
* If no user is present and guests are not allowed, throws {@link UnauthorizedException}.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
export const RequestUserId = createParamDecorator(
|
||||
(
|
||||
data: RequestUserIdParameter = { forbidGuests: false },
|
||||
|
||||
@@ -16,7 +16,7 @@ import { CompleteRequest } from '../request.type';
|
||||
*
|
||||
* Will throw an {@link InternalServerErrorException} if no identifier is present
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
export const SessionAuthProvider = createParamDecorator(
|
||||
(data: unknown, ctx: ExecutionContext) => {
|
||||
const request: CompleteRequest = ctx.switchToHttp().getRequest();
|
||||
|
||||
@@ -45,7 +45,7 @@ describe('extract note from request', () => {
|
||||
: {},
|
||||
headers: headerValue
|
||||
? {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
'hedgedoc-note': headerValue,
|
||||
}
|
||||
: {},
|
||||
|
||||
@@ -21,7 +21,7 @@ import { PendingLdapUserInfoDto } from '../../dtos/pending-ldap-user-info.dto';
|
||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||
|
||||
const LDAP_ERROR_MAP: Record<string, string> = {
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
'530': 'Not Permitted to login at this time',
|
||||
'531': 'Not permitted to logon at this workstation',
|
||||
'532': 'Password expired',
|
||||
@@ -31,7 +31,7 @@ const LDAP_ERROR_MAP: Record<string, string> = {
|
||||
'773': 'User must reset password',
|
||||
'775': 'User account locked',
|
||||
default: 'Invalid username/password',
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
} as const;
|
||||
|
||||
@Injectable()
|
||||
@@ -76,7 +76,7 @@ export class LdapService {
|
||||
const exception = this.getLdapException(username, error);
|
||||
return reject(exception);
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
// oxlint-disable-next-line @typescript-eslint/no-empty-function
|
||||
auth.on('error', () => {}); // Ignore further errors
|
||||
auth.authenticate(
|
||||
username,
|
||||
|
||||
@@ -85,23 +85,23 @@ export class OidcService {
|
||||
const issuer = useAutodiscover
|
||||
? await Issuer.discover(oidcConfig.issuer)
|
||||
: new Issuer({
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
issuer: oidcConfig.issuer,
|
||||
authorization_endpoint: oidcConfig.authorizeUrl,
|
||||
token_endpoint: oidcConfig.tokenUrl,
|
||||
userinfo_endpoint: oidcConfig.userinfoUrl,
|
||||
end_session_endpoint: oidcConfig.endSessionUrl,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
});
|
||||
|
||||
const redirectUri = `${this.appConfig.baseUrl}/api/private/auth/oidc/${oidcConfig.identifier}/callback`;
|
||||
const client = new issuer.Client({
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
client_id: oidcConfig.clientId,
|
||||
client_secret: oidcConfig.clientSecret,
|
||||
redirect_uris: [redirectUri],
|
||||
response_types: ['code'],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
});
|
||||
return {
|
||||
client,
|
||||
@@ -157,11 +157,11 @@ export class OidcService {
|
||||
const client = clientConfig.client;
|
||||
return client.authorizationUrl({
|
||||
scope: clientConfig.config.scope,
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
code_challenge: generators.codeChallenge(code),
|
||||
code_challenge_method: 'S256',
|
||||
state,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
});
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ export class OidcService {
|
||||
? client.callback.bind(client)
|
||||
: client.oauthCallback.bind(client);
|
||||
const tokenSet = await callbackMethod(clientConfig.redirectUri, params, {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
code_verifier: code,
|
||||
state,
|
||||
});
|
||||
|
||||
@@ -25,13 +25,13 @@ describe('appConfig', () => {
|
||||
it('when given correct and complete environment variables', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: baseUrl,
|
||||
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
||||
HD_BACKEND_PORT: port.toString(),
|
||||
HD_LOG_LEVEL: loglevel,
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -49,12 +49,12 @@ describe('appConfig', () => {
|
||||
it('when no HD_RENDER_BASE_URL is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: baseUrl,
|
||||
HD_BACKEND_PORT: port.toString(),
|
||||
HD_LOG_LEVEL: loglevel,
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -72,12 +72,12 @@ describe('appConfig', () => {
|
||||
it('when no PORT is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: baseUrl,
|
||||
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
||||
HD_LOG_LEVEL: loglevel,
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -95,12 +95,12 @@ describe('appConfig', () => {
|
||||
it('when no HD_LOG_LEVEL is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: baseUrl,
|
||||
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
||||
HD_BACKEND_PORT: port.toString(),
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -118,13 +118,13 @@ describe('appConfig', () => {
|
||||
it('when no HD_LOG_SHOW_TIMESTAMP is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: baseUrl,
|
||||
HD_RENDERER_BASE_URL: rendererBaseUrl,
|
||||
HD_LOG_LEVEL: loglevel,
|
||||
HD_BACKEND_PORT: port.toString(),
|
||||
HD_PERSIST_INTERVAL: '0',
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -163,12 +163,12 @@ describe('appConfig', () => {
|
||||
it('when given a non-valid HD_BASE_URL', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: invalidBaseUrl,
|
||||
HD_BACKEND_PORT: port.toString(),
|
||||
HD_LOG_LEVEL: loglevel,
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -185,11 +185,11 @@ describe('appConfig', () => {
|
||||
it('when given a base url with subdirectory in HD_BASE_URL', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: 'https://example.org/subdirectory/',
|
||||
HD_LOG_LEVEL: loglevel,
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -206,12 +206,12 @@ describe('appConfig', () => {
|
||||
it('when given a negative PORT', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: baseUrl,
|
||||
HD_BACKEND_PORT: negativePort.toString(),
|
||||
HD_LOG_LEVEL: loglevel,
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -228,12 +228,12 @@ describe('appConfig', () => {
|
||||
it('when given a out-of-range PORT', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: baseUrl,
|
||||
HD_BACKEND_PORT: outOfRangePort.toString(),
|
||||
HD_LOG_LEVEL: loglevel,
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -250,12 +250,12 @@ describe('appConfig', () => {
|
||||
it('when given a non-integer PORT', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: baseUrl,
|
||||
HD_BACKEND_PORT: floatPort.toString(),
|
||||
HD_LOG_LEVEL: loglevel,
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -272,12 +272,12 @@ describe('appConfig', () => {
|
||||
it('when given a non-number PORT', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: baseUrl,
|
||||
HD_BACKEND_PORT: invalidPort,
|
||||
HD_LOG_LEVEL: loglevel,
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -294,12 +294,12 @@ describe('appConfig', () => {
|
||||
it('when given a non-loglevel HD_LOG_LEVEL', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BASE_URL: baseUrl,
|
||||
HD_BACKEND_PORT: port.toString(),
|
||||
HD_LOG_LEVEL: invalidLoglevel,
|
||||
HD_LOG_SHOW_TIMESTAMP: showLogTimestamp.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
|
||||
@@ -21,9 +21,9 @@ jest.mock('fs', () => ({
|
||||
describe('authConfig', () => {
|
||||
const secret = 'this-is-a-secret';
|
||||
const neededAuthConfig = {
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_AUTH_SESSION_SECRET: secret,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
};
|
||||
|
||||
describe('local', () => {
|
||||
@@ -31,20 +31,20 @@ describe('authConfig', () => {
|
||||
const enableRegister = true;
|
||||
const minimalPasswordStrength = 1;
|
||||
const completeLocalConfig = {
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_AUTH_LOCAL_ENABLE_LOGIN: String(enableLogin),
|
||||
HD_AUTH_LOCAL_ENABLE_REGISTER: String(enableRegister),
|
||||
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: String(minimalPasswordStrength),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
};
|
||||
describe('is correctly parsed', () => {
|
||||
it('when given correct and complete environment variables', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLocalConfig,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -62,11 +62,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_LOCAL_ENABLE_LOGIN is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLocalConfig,
|
||||
HD_AUTH_LOCAL_ENABLE_LOGIN: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -84,11 +84,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_LOCAL_ENABLE_REGISTER is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLocalConfig,
|
||||
HD_AUTH_LOCAL_ENABLE_REGISTER: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -106,11 +106,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLocalConfig,
|
||||
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -147,11 +147,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH is 5', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLocalConfig,
|
||||
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: '5',
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -167,11 +167,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH is -1', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLocalConfig,
|
||||
HD_AUTH_LOCAL_MINIMAL_PASSWORD_STRENGTH: '-1',
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -203,7 +203,7 @@ describe('authConfig', () => {
|
||||
const tlsCa = ['./test.pem'];
|
||||
const tlsCaContent = ['test-cert\n'];
|
||||
const completeLdapConfig = {
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_AUTH_LDAP_SERVERS: ldapNames.join(','),
|
||||
HD_AUTH_LDAP_FUTURAMA_PROVIDER_NAME: providerName,
|
||||
HD_AUTH_LDAP_FUTURAMA_URL: url,
|
||||
@@ -217,16 +217,16 @@ describe('authConfig', () => {
|
||||
HD_AUTH_LDAP_FUTURAMA_BIND_DN: bindDn,
|
||||
HD_AUTH_LDAP_FUTURAMA_BIND_CREDENTIALS: bindCredentials,
|
||||
HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS: tlsCa.join(','),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
};
|
||||
describe('is correctly parsed', () => {
|
||||
it('when given correct and complete environment variables', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -255,11 +255,11 @@ describe('authConfig', () => {
|
||||
it('when no HD_AUTH_LDAP_FUTURAMA_PROVIDER_NAME is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_PROVIDER_NAME: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -287,11 +287,11 @@ describe('authConfig', () => {
|
||||
it('when no HD_AUTH_LDAP_FUTURAMA_SEARCH_FILTER is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_SEARCH_FILTER: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -319,11 +319,11 @@ describe('authConfig', () => {
|
||||
it('when no HD_AUTH_LDAP_FUTURAMA_USER_ID_FIELD is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_USER_ID_FIELD: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -351,11 +351,11 @@ describe('authConfig', () => {
|
||||
it('when no HD_AUTH_LDAP_FUTURAMA_DISPLAY_NAME_FIELD is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_DISPLAY_NAME_FIELD: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -383,11 +383,11 @@ describe('authConfig', () => {
|
||||
it('when no HD_AUTH_LDAP_FUTURAMA_PROFILE_PICTURE_FIELD is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_PROFILE_PICTURE_FIELD: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -415,11 +415,11 @@ describe('authConfig', () => {
|
||||
it('when no HD_AUTH_LDAP_FUTURAMA_BIND_DN is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_BIND_DN: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -447,11 +447,11 @@ describe('authConfig', () => {
|
||||
it('when no HD_AUTH_LDAP_FUTURAMA_BIND_CREDENTIALS is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_BIND_CREDENTIALS: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -479,11 +479,11 @@ describe('authConfig', () => {
|
||||
it('when no HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -531,11 +531,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_LDAP_FUTURAMA_URL is wrong', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_URL: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -551,11 +551,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_LDAP_FUTURAMA_SEARCH_BASE is wrong', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_SEARCH_BASE: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -571,11 +571,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS is wrong', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeLdapConfig,
|
||||
HD_AUTH_LDAP_FUTURAMA_TLS_CERT_PATHS: 'not-a-file.pem',
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -615,7 +615,7 @@ describe('authConfig', () => {
|
||||
const defaultEmailField = 'email';
|
||||
const enableRegistration = 'false';
|
||||
const completeOidcConfig = {
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_AUTH_OIDC_SERVERS: oidcNames.join(','),
|
||||
HD_AUTH_OIDC_GITLAB_PROVIDER_NAME: providerName,
|
||||
HD_AUTH_OIDC_GITLAB_ISSUER: issuer,
|
||||
@@ -633,16 +633,16 @@ describe('authConfig', () => {
|
||||
HD_AUTH_OIDC_GITLAB_PROFILE_PICTURE_FIELD: profilePictureField,
|
||||
HD_AUTH_OIDC_GITLAB_EMAIL_FIELD: emailField,
|
||||
HD_AUTH_OIDC_GITLAB_ENABLE_REGISTRATION: enableRegistration,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
};
|
||||
describe('is correctly parsed', () => {
|
||||
it('when given correct and complete environment variables', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -673,11 +673,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_THEME is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_THEME: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -708,11 +708,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_AUTHORIZE_URL is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_AUTHORIZE_URL: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -743,11 +743,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_TOKEN_URL is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_TOKEN_URL: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -778,11 +778,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_USERINFO_URL is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_USERINFO_URL: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -813,11 +813,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_END_SESSION_URL is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_END_SESSION_URL: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -848,11 +848,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_SCOPE is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_SCOPE: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -883,11 +883,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_USER_ID_FIELD is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_USER_ID_FIELD: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -918,11 +918,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_DISPLAY_NAME_FIELD is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_DISPLAY_NAME_FIELD: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -953,11 +953,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_PROFILE_PICTURE_FIELD is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_PROFILE_PICTURE_FIELD: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -990,11 +990,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_EMAIL_FIELD is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_EMAIL_FIELD: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -1025,11 +1025,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_ENABLE_REGISTRATION is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_ENABLE_REGISTRATION: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -1081,11 +1081,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_ISSUER is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_ISSUER: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -1101,11 +1101,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_CLIENT_ID is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_CLIENT_ID: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -1121,11 +1121,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_CLIENT_SECRET is not set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_CLIENT_SECRET: undefined,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -1141,11 +1141,11 @@ describe('authConfig', () => {
|
||||
it('when HD_AUTH_OIDC_GITLAB_THEME is set to a wrong value', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
...neededAuthConfig,
|
||||
...completeOidcConfig,
|
||||
HD_AUTH_OIDC_GITLAB_THEME: 'something else',
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
|
||||
@@ -61,7 +61,7 @@ const ldapSchema = z
|
||||
tlsCaCerts: z
|
||||
.array(
|
||||
z.string({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
required_error: 'File not found',
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -21,13 +21,13 @@ describe('customizationConfig', () => {
|
||||
it('correctly parses valid config', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BRANDING_CUSTOM_NAME: customName,
|
||||
HD_BRANDING_CUSTOM_LOGO: customLogo,
|
||||
HD_URLS_PRIVACY: privacyUrl,
|
||||
HD_URLS_TERMS_OF_USE: termsOfUseUrl,
|
||||
HD_URLS_IMPRINT: imprintUrl,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -65,13 +65,13 @@ describe('customizationConfig', () => {
|
||||
it('when anything is wrongly configured', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_BRANDING_CUSTOM_NAME: customName,
|
||||
HD_BRANDING_CUSTOM_LOGO: invalidCustomLogo,
|
||||
HD_URLS_PRIVACY: invalidPrivacyUrl,
|
||||
HD_URLS_TERMS_OF_USE: invalidTermsOfUseUrl,
|
||||
HD_URLS_IMPRINT: invalidImprintUrl,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
|
||||
@@ -28,10 +28,10 @@ describe('databaseConfig', () => {
|
||||
it('SQLite config', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_DATABASE_TYPE: databaseTypeSqlite,
|
||||
HD_DATABASE_NAME: databaseFileSqlite,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -46,14 +46,14 @@ describe('databaseConfig', () => {
|
||||
it('MariaDB config', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_DATABASE_TYPE: databaseTypeMariadb,
|
||||
HD_DATABASE_NAME: databaseName,
|
||||
HD_DATABASE_USERNAME: databaseUser,
|
||||
HD_DATABASE_PASSWORD: databasePass,
|
||||
HD_DATABASE_HOST: databaseHost,
|
||||
HD_DATABASE_PORT: String(databasePort),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -72,14 +72,14 @@ describe('databaseConfig', () => {
|
||||
it('Postgres config', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_DATABASE_TYPE: databaseTypePostgres,
|
||||
HD_DATABASE_NAME: databaseName,
|
||||
HD_DATABASE_USERNAME: databaseUser,
|
||||
HD_DATABASE_PASSWORD: databasePass,
|
||||
HD_DATABASE_HOST: databaseHost,
|
||||
HD_DATABASE_PORT: String(databasePort),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -119,14 +119,14 @@ describe('databaseConfig', () => {
|
||||
it('when the port is negative', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_DATABASE_TYPE: databaseTypePostgres,
|
||||
HD_DATABASE_NAME: databaseName,
|
||||
HD_DATABASE_USERNAME: databaseUser,
|
||||
HD_DATABASE_PASSWORD: databasePass,
|
||||
HD_DATABASE_HOST: databaseHost,
|
||||
HD_DATABASE_PORT: String(invalidDatabasePort),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -142,14 +142,14 @@ describe('databaseConfig', () => {
|
||||
it('when the port is too big', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_DATABASE_TYPE: databaseTypePostgres,
|
||||
HD_DATABASE_NAME: databaseName,
|
||||
HD_DATABASE_USERNAME: databaseUser,
|
||||
HD_DATABASE_PASSWORD: databasePass,
|
||||
HD_DATABASE_HOST: databaseHost,
|
||||
HD_DATABASE_PORT: String(invalidDatabasePort2),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
|
||||
@@ -107,7 +107,7 @@ export function getKnexConfig(databaseConfig: DatabaseConfig): Knex.Config {
|
||||
user: databaseConfig.username,
|
||||
database: databaseConfig.name,
|
||||
password: databaseConfig.password,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
application_name: 'HedgeDoc',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -14,9 +14,9 @@ describe('externalServices', () => {
|
||||
it('correctly parses valid config', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_PLANTUML_SERVER: plantUmlServer,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -51,9 +51,9 @@ describe('externalServices', () => {
|
||||
const invalid = 'wrong!';
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_PLANTUML_SERVER: invalid,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -70,9 +70,9 @@ describe('externalServices', () => {
|
||||
it('when image proxy is configured', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_IMAGE_PROXY: imageProxy,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
|
||||
@@ -38,10 +38,10 @@ describe('mediaConfig', () => {
|
||||
it('for backend filesystem', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.FILESYSTEM,
|
||||
HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH: uploadPath,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -56,7 +56,7 @@ describe('mediaConfig', () => {
|
||||
it('for backend s3', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
||||
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
||||
@@ -64,7 +64,7 @@ describe('mediaConfig', () => {
|
||||
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
||||
HD_MEDIA_BACKEND_S3_REGION: region,
|
||||
HD_MEDIA_BACKEND_S3_PATH_STYLE: pathStyle.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -84,11 +84,11 @@ describe('mediaConfig', () => {
|
||||
it('for backend azure', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.AZURE,
|
||||
HD_MEDIA_BACKEND_AZURE_CONNECTION_STRING: azureConnectionString,
|
||||
HD_MEDIA_BACKEND_AZURE_CONTAINER: container,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -106,10 +106,10 @@ describe('mediaConfig', () => {
|
||||
it('for backend imgur', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.IMGUR,
|
||||
HD_MEDIA_BACKEND_IMGUR_CLIENT_ID: clientID,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -124,12 +124,12 @@ describe('mediaConfig', () => {
|
||||
it('for backend webdav', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
||||
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: webdavConnectionString,
|
||||
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
||||
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: publicUrl,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -170,9 +170,9 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH is not set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.FILESYSTEM,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -191,12 +191,12 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_S3_ACCESS_KEY is not set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
||||
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
||||
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -212,12 +212,12 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_S3_SECRET_KEY is not set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
||||
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
||||
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -233,12 +233,12 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_S3_BUCKET is not set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
||||
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
||||
HD_MEDIA_BACKEND_S3_ENDPOINT: endPoint,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -254,12 +254,12 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_S3_ENDPOINT is not set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
||||
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
||||
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -275,13 +275,13 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_S3_ENDPOINT is not an URI', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.S3,
|
||||
HD_MEDIA_BACKEND_S3_ACCESS_KEY: accessKeyId,
|
||||
HD_MEDIA_BACKEND_S3_SECRET_KEY: secretAccessKey,
|
||||
HD_MEDIA_BACKEND_S3_BUCKET: bucket,
|
||||
HD_MEDIA_BACKEND_S3_ENDPOINT: 'wrong-uri',
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -300,10 +300,10 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_AZURE_CONNECTION_STRING is not set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.AZURE,
|
||||
HD_MEDIA_BACKEND_AZURE_CONTAINER: container,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -319,10 +319,10 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_AZURE_CONTAINER is not set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.AZURE,
|
||||
HD_MEDIA_BACKEND_AZURE_CONNECTION_STRING: azureConnectionString,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -341,9 +341,9 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_IMGUR_CLIENT_ID is not set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.IMGUR,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -362,11 +362,11 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING is not set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
||||
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
||||
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: publicUrl,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -382,12 +382,12 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING is not set to an url', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
||||
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: 'not-an-url',
|
||||
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
||||
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: publicUrl,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -403,11 +403,11 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL is not set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
||||
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: webdavConnectionString,
|
||||
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -423,12 +423,12 @@ describe('mediaConfig', () => {
|
||||
it('when HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL is not set to an url', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_MEDIA_BACKEND_TYPE: MediaBackendType.WEBDAV,
|
||||
HD_MEDIA_BACKEND_WEBDAV_CONNECTION_STRING: webdavConnectionString,
|
||||
HD_MEDIA_BACKEND_WEBDAV_UPLOAD_DIR: uploadDir,
|
||||
HD_MEDIA_BACKEND_WEBDAV_PUBLIC_URL: 'not-an-url',
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('noteConfig', () => {
|
||||
it('when given correct and complete environment variables', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
@@ -37,7 +37,7 @@ describe('noteConfig', () => {
|
||||
publiclyVisible.toString(),
|
||||
HD_NOTE_REVISION_RETENTION_DAYS: retentionDays.toString(),
|
||||
HD_NOTE_PERSIST_INTERVAL: persistInteval.toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -65,13 +65,13 @@ describe('noteConfig', () => {
|
||||
it('when no HD_NOTE_FORBIDDEN_ALIASES is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -94,14 +94,14 @@ describe('noteConfig', () => {
|
||||
it('when HD_NOTE_FORBIDDEN_ALIASES is a single item', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAlias,
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -125,13 +125,13 @@ describe('noteConfig', () => {
|
||||
it('when no HD_NOTE_MAX_LENGTH is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -155,14 +155,14 @@ describe('noteConfig', () => {
|
||||
it('when no HD_PERMISSION_DEFAULT_EVERYONE is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -182,12 +182,12 @@ describe('noteConfig', () => {
|
||||
it('when no HD_PERMISSION_DEFAULT_LOGGED_IN is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -211,12 +211,12 @@ describe('noteConfig', () => {
|
||||
it('when no HD_PERMISSIONS_MAX_GUEST_LEVEL is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -240,14 +240,14 @@ describe('noteConfig', () => {
|
||||
it('when no HD_NOTE_REVISION_RETENTION_DAYS is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -272,14 +272,14 @@ describe('noteConfig', () => {
|
||||
it('when no HD_NOTE_PERSIST_INTERVAL is set', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.WRITE],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -324,14 +324,14 @@ describe('noteConfig', () => {
|
||||
it('when given a non-valid HD_NOTE_FORBIDDEN_ALIASES', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: invalidforbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -351,14 +351,14 @@ describe('noteConfig', () => {
|
||||
it('when given a negative HD_NOTE_MAX_LENGTH', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: negativeMaxDocumentLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -375,14 +375,14 @@ describe('noteConfig', () => {
|
||||
it('when given a non-integer HD_NOTE_MAX_LENGTH', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: floatMaxDocumentLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -399,14 +399,14 @@ describe('noteConfig', () => {
|
||||
it('when given a non-number HD_NOTE_MAX_LENGTH', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: invalidMaxDocumentLength,
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -423,13 +423,13 @@ describe('noteConfig', () => {
|
||||
it('when given a non-valid HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: wrongDefaultPermission,
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -446,13 +446,13 @@ describe('noteConfig', () => {
|
||||
it('when given a non-valid HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN: wrongDefaultPermission,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -469,7 +469,7 @@ describe('noteConfig', () => {
|
||||
it('when given a non-valid HD_PERMISSIONS_MAX_GUEST_LEVEL', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
@@ -477,7 +477,7 @@ describe('noteConfig', () => {
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL: wrongDefaultPermission,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -494,7 +494,7 @@ describe('noteConfig', () => {
|
||||
it('when HD_PERMISSIONS_MAX_GUEST_LEVEL is set to deny and HD_PERMISSION_DEFAULT_EVERYONE is set', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
@@ -502,7 +502,7 @@ describe('noteConfig', () => {
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL: 'deny',
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -536,12 +536,12 @@ describe('noteConfig', () => {
|
||||
it(`when HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE is set to ${everyonePermission}, but HD_PERMISSION_DEFAULT_LOGGED_IN is set to ${loggedInPermission}`, async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: everyonePermission,
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN: loggedInPermission,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -566,13 +566,13 @@ describe('noteConfig', () => {
|
||||
it(`when HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL is set to ${PermissionLevelNames[PermissionLevel.FULL]} and HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE is set to ${defaultEveryone}`, async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: defaultEveryone,
|
||||
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL:
|
||||
PermissionLevelNames[PermissionLevel.FULL],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -606,12 +606,12 @@ describe('noteConfig', () => {
|
||||
it(`when 'HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE' is set to '${defaultEveryone}', but 'HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL' is set to '${maxGuestLevel}'`, async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE: defaultEveryone,
|
||||
HD_NOTE_PERMISSIONS_MAX_GUEST_LEVEL: maxGuestLevel,
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -631,7 +631,7 @@ describe('noteConfig', () => {
|
||||
it('when given a negative retention days', async () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
@@ -639,7 +639,7 @@ describe('noteConfig', () => {
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_LOGGED_IN:
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
HD_NOTE_REVISION_RETENTION_DAYS: (-1).toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
@@ -656,7 +656,7 @@ describe('noteConfig', () => {
|
||||
it('when given a negative persistence interval', () => {
|
||||
const restore = mockedEnv(
|
||||
{
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
HD_NOTE_FORBIDDEN_ALIASES: forbiddenAliases.join(' , '),
|
||||
HD_NOTE_MAX_LENGTH: maxLength.toString(),
|
||||
HD_NOTE_PERMISSIONS_DEFAULT_EVERYONE:
|
||||
@@ -665,7 +665,7 @@ describe('noteConfig', () => {
|
||||
PermissionLevelNames[PermissionLevel.READ],
|
||||
HD_NOTE_REVISION_RETENTION_DAYS: retentionDays.toString(),
|
||||
HD_NOTE_PERSIST_INTERVAL: (-1).toString(),
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
/* oxlint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
{
|
||||
clear: true,
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('config utils', () => {
|
||||
});
|
||||
});
|
||||
describe('ensureNoDuplicatesExist', () => {
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
// oxlint-disable-next-line jest/expect-expect
|
||||
it('throws no error if everything is correct', () => {
|
||||
ensureNoDuplicatesExist('Test', ['A']);
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
/* oxlint-disable */
|
||||
const {
|
||||
AuthProviderType,
|
||||
FieldNameAlias,
|
||||
|
||||
@@ -46,7 +46,7 @@ import {
|
||||
} from '@hedgedoc/database';
|
||||
import { Knex } from 'knex';
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* oxlint-disable @typescript-eslint/naming-convention */
|
||||
declare module 'knex/types/tables.js' {
|
||||
interface Tables {
|
||||
[TableAlias]: Knex.CompositeTableType<Alias, Alias, TypeUpdateAlias>;
|
||||
|
||||
@@ -178,7 +178,7 @@ describe('ExploreService', () => {
|
||||
][])(
|
||||
'correctly get all notes owned by user with',
|
||||
(name, noteType, sortBy, search, regex, bindings) => {
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
// oxlint-disable-next-line jest/valid-title
|
||||
it(name, async () => {
|
||||
mockQuery('select', tracker, regex, selectedRows);
|
||||
mockQuery(
|
||||
@@ -254,7 +254,7 @@ describe('ExploreService', () => {
|
||||
][])(
|
||||
'correctly get all notes shared with the user with',
|
||||
(name, noteType, sortBy, search, regex, bindings) => {
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
// oxlint-disable-next-line jest/valid-title
|
||||
it(name, async () => {
|
||||
mockQuery('select', tracker, regex, selectedRows);
|
||||
mockQuery(
|
||||
@@ -337,7 +337,7 @@ describe('ExploreService', () => {
|
||||
][])(
|
||||
'correctly get all public notes with',
|
||||
(name, noteType, sortBy, search, regex, bindings) => {
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
// oxlint-disable-next-line jest/valid-title
|
||||
it(name, async () => {
|
||||
mockSelect(
|
||||
tracker,
|
||||
@@ -462,7 +462,7 @@ describe('ExploreService', () => {
|
||||
][])(
|
||||
'correctly get all notes visited by the user with',
|
||||
(name, noteType, sortBy, search, regex, bindings) => {
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
// oxlint-disable-next-line jest/valid-title
|
||||
it(name, async () => {
|
||||
mockQuery(
|
||||
'select',
|
||||
|
||||
@@ -369,7 +369,7 @@ export class ExploreService {
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
// oxlint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
private joinWithTableVisitedNote(query: Knex.QueryBuilder) {
|
||||
return query.leftJoin(
|
||||
TableVisitedNote,
|
||||
@@ -379,7 +379,7 @@ export class ExploreService {
|
||||
}
|
||||
|
||||
// The correct return type with all joins and selects is very specific and should just be inferred from Knex
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
// oxlint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
private applyCommonQuery(
|
||||
query: Knex.QueryBuilder,
|
||||
transaction: Knex.Transaction,
|
||||
|
||||
@@ -22,7 +22,7 @@ import { LoggerModule } from '../logger/logger.module';
|
||||
import { getServerVersionFromPackageJson } from '../utils/server-version';
|
||||
import { FrontendConfigService } from './frontend-config.service';
|
||||
|
||||
/* eslint-disable jest/no-conditional-expect */
|
||||
/* oxlint-disable jest/no-conditional-expect */
|
||||
describe('FrontendConfigService', () => {
|
||||
const domain = 'http://md.example.com';
|
||||
const emptyAuthConfig: AuthConfig = {
|
||||
|
||||
@@ -17,7 +17,7 @@ interface KnexData {
|
||||
cancelOnTimeout: boolean;
|
||||
bindings: (number | string)[];
|
||||
sql: string;
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
__knexQueryUid: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ export class ImgurBackend implements MediaBackend {
|
||||
const result = (await fetch('https://api.imgur.com/3/image', {
|
||||
method: 'POST',
|
||||
body: params,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
headers: { Authorization: `Client-ID ${this.config.clientId}` },
|
||||
})
|
||||
.then((res) => ImgurBackend.checkStatus(res))
|
||||
@@ -87,12 +87,12 @@ export class ImgurBackend implements MediaBackend {
|
||||
`https://api.imgur.com/3/image/${backendData.deleteHash}`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
headers: { Authorization: `Client-ID ${this.config.clientId}` },
|
||||
},
|
||||
);
|
||||
ImgurBackend.checkStatus(result);
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
this.logger.log(`Deleted file ${uuid}`, 'deleteFile');
|
||||
return;
|
||||
} catch (e) {
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('s3 backend', () => {
|
||||
mockedBuffer,
|
||||
mockedBuffer.length,
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
'Content-Type': 'image/png',
|
||||
},
|
||||
);
|
||||
@@ -189,7 +189,7 @@ describe('s3 backend', () => {
|
||||
mockedBuffer,
|
||||
mockedBuffer.length,
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
'Content-Type': 'image/png',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -63,7 +63,7 @@ export class S3Backend implements MediaBackend {
|
||||
buffer,
|
||||
buffer.length,
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
'Content-Type': fileType.mime,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -47,9 +47,9 @@ export class WebdavBackend implements MediaBackend {
|
||||
fetch(this.baseUrl, {
|
||||
method: 'PROPFIND',
|
||||
headers: {
|
||||
Accept: 'text/plain', // eslint-disable-line @typescript-eslint/naming-convention
|
||||
Authorization: this.authHeader, // eslint-disable-line @typescript-eslint/naming-convention
|
||||
Depth: '0', // eslint-disable-line @typescript-eslint/naming-convention
|
||||
Accept: 'text/plain', // oxlint-disable-line @typescript-eslint/naming-convention
|
||||
Authorization: this.authHeader, // oxlint-disable-line @typescript-eslint/naming-convention
|
||||
Depth: '0', // oxlint-disable-line @typescript-eslint/naming-convention
|
||||
},
|
||||
})
|
||||
.then((response) => {
|
||||
@@ -74,10 +74,10 @@ export class WebdavBackend implements MediaBackend {
|
||||
method: 'PUT',
|
||||
body: buffer,
|
||||
headers: {
|
||||
Authorization: this.authHeader, // eslint-disable-line @typescript-eslint/naming-convention
|
||||
'Content-Type': 'application/octet-stream', // eslint-disable-line @typescript-eslint/naming-convention
|
||||
'Content-Length': `${contentLength}`, // eslint-disable-line @typescript-eslint/naming-convention
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
Authorization: this.authHeader, // oxlint-disable-line @typescript-eslint/naming-convention
|
||||
'Content-Type': 'application/octet-stream', // oxlint-disable-line @typescript-eslint/naming-convention
|
||||
'Content-Length': `${contentLength}`, // oxlint-disable-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
'If-None-Match': '*', // Don't overwrite already existing files
|
||||
},
|
||||
}).then((res) => WebdavBackend.checkStatus(res));
|
||||
@@ -101,7 +101,7 @@ export class WebdavBackend implements MediaBackend {
|
||||
await fetch(WebdavBackend.joinURL(this.baseUrl, '/', file), {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
Authorization: this.authHeader,
|
||||
},
|
||||
}).then((res) => WebdavBackend.checkStatus(res));
|
||||
|
||||
@@ -194,7 +194,7 @@ describe('NoteService', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
/* eslint-disable jest/no-conditional-expect */
|
||||
/* oxlint-disable jest/no-conditional-expect */
|
||||
describe.each([
|
||||
[
|
||||
PermissionLevel.READ,
|
||||
@@ -346,7 +346,7 @@ describe('NoteService', () => {
|
||||
},
|
||||
);
|
||||
});
|
||||
/* eslint-enable jest/no-conditional-expect */
|
||||
/* oxlint-enable jest/no-conditional-expect */
|
||||
|
||||
describe('getNoteContent', () => {
|
||||
let realtimeNoteStoreSpy: jest.SpyInstance;
|
||||
@@ -378,7 +378,7 @@ describe('NoteService', () => {
|
||||
|
||||
describe('getNoteIdByAlias', () => {
|
||||
let aliasServiceSpy: jest.SpyInstance;
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildMockSelect = (returnValues: unknown) => {
|
||||
mockSelect(
|
||||
tracker,
|
||||
|
||||
@@ -17,7 +17,7 @@ import { PERMISSION_METADATA_KEY } from './require-permission.decorator';
|
||||
|
||||
jest.mock('../api/utils/extract-note-id-from-request');
|
||||
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildContext = (
|
||||
userId: number | undefined,
|
||||
handler: () => void,
|
||||
|
||||
@@ -123,7 +123,7 @@ describe('PermissionsService', () => {
|
||||
expectBindings(tracker, 'select', [[mockMediaUploadUuid]], true);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildMockSelect = (returnValues: unknown) => {
|
||||
mockSelect(
|
||||
tracker,
|
||||
@@ -200,7 +200,7 @@ describe('PermissionsService', () => {
|
||||
});
|
||||
|
||||
describe('isOwner', () => {
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildMockSelect = (returnValues: unknown) => {
|
||||
mockSelect(
|
||||
tracker,
|
||||
@@ -285,7 +285,7 @@ describe('PermissionsService', () => {
|
||||
});
|
||||
|
||||
for (const testCase of determinePermissionTestCases) {
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
// oxlint-disable-next-line jest/valid-title
|
||||
it(testCase.description, async () => {
|
||||
// Owner
|
||||
spyOnPermissionsServiceIsOwner.mockResolvedValue(testCase.isOwner);
|
||||
@@ -387,7 +387,7 @@ describe('PermissionsService', () => {
|
||||
});
|
||||
it('and user is registered', async () => {
|
||||
const spyOneNotifyOthers = jest.spyOn(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
service as any,
|
||||
'notifyOthers',
|
||||
);
|
||||
@@ -408,7 +408,7 @@ describe('PermissionsService', () => {
|
||||
let spyOneNotifyOthers: jest.SpyInstance;
|
||||
beforeEach(() => {
|
||||
spyOneNotifyOthers = jest.spyOn(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
service as any,
|
||||
'notifyOthers',
|
||||
);
|
||||
@@ -458,7 +458,7 @@ describe('PermissionsService', () => {
|
||||
describe('setGroupPermission', () => {
|
||||
it('correctly sets group permissions and notifies other user', async () => {
|
||||
const spyOneNotifyOthers = jest.spyOn(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
service as any,
|
||||
'notifyOthers',
|
||||
);
|
||||
@@ -477,12 +477,12 @@ describe('PermissionsService', () => {
|
||||
let spyOneNotifyOthers: jest.SpyInstance;
|
||||
beforeEach(() => {
|
||||
spyOneNotifyOthers = jest.spyOn(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
service as any,
|
||||
'notifyOthers',
|
||||
);
|
||||
});
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildMockDelete = (deletedEntries: number) => {
|
||||
mockDelete(
|
||||
tracker,
|
||||
@@ -514,12 +514,12 @@ describe('PermissionsService', () => {
|
||||
let spyOneNotifyOthers: jest.SpyInstance;
|
||||
beforeEach(() => {
|
||||
spyOneNotifyOthers = jest.spyOn(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
service as any,
|
||||
'notifyOthers',
|
||||
);
|
||||
});
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildMockUpdate = (updatedEntries: number) => {
|
||||
mockUpdate(
|
||||
tracker,
|
||||
@@ -546,7 +546,7 @@ describe('PermissionsService', () => {
|
||||
});
|
||||
|
||||
describe('changePubliclyVisibly', () => {
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildMockUpdate = (updatedEntries: number) => {
|
||||
mockUpdate(
|
||||
tracker,
|
||||
@@ -571,7 +571,7 @@ describe('PermissionsService', () => {
|
||||
});
|
||||
|
||||
describe('getPermissionsDtoForNote', () => {
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildMockOwnerSelect = (returnValues: unknown) => {
|
||||
mockSelect(
|
||||
tracker,
|
||||
@@ -591,7 +591,7 @@ describe('PermissionsService', () => {
|
||||
],
|
||||
);
|
||||
};
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildMockUserPermissionsSelect = (returnValues: unknown) => {
|
||||
mockSelect(
|
||||
tracker,
|
||||
@@ -611,7 +611,7 @@ describe('PermissionsService', () => {
|
||||
],
|
||||
);
|
||||
};
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildMockGroupPermissionsSelect = (returnValues: unknown) => {
|
||||
mockSelect(
|
||||
tracker,
|
||||
|
||||
@@ -13,7 +13,7 @@ export const PERMISSION_METADATA_KEY = 'requiredPermission';
|
||||
* @param permissionLevel the required permission for the decorated action
|
||||
* @returns The custom decorator action
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
export function RequirePermission(
|
||||
permissionLevel: PermissionLevel,
|
||||
): CustomDecorator {
|
||||
|
||||
@@ -27,7 +27,7 @@ jest.mock(
|
||||
() =>
|
||||
({
|
||||
...jest.requireActual('@hedgedoc/commons'),
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
YDocSyncServerAdapter: jest.fn(() => Mock.of<YDocSyncServerAdapter>({})),
|
||||
}) as Record<string, unknown>,
|
||||
);
|
||||
|
||||
@@ -162,7 +162,7 @@ describe('RevisionsService', () => {
|
||||
|
||||
describe('purgeRevisions', () => {
|
||||
let spyOnGetPrimaryAlias: jest.SpyInstance;
|
||||
// eslint-disable-next-line func-style
|
||||
// oxlint-disable-next-line func-style
|
||||
const buildMockSelect = (returnValues: unknown) => {
|
||||
mockSelect(
|
||||
tracker,
|
||||
|
||||
@@ -11,7 +11,7 @@ export function setupValidationPipe(
|
||||
logger: ConsoleLoggerService,
|
||||
): ValidationPipe {
|
||||
// This issue is only relevant for usage of class-validator, however we use Zod
|
||||
// eslint-disable-next-line @darraghor/nestjs-typed/should-specify-forbid-unknown-values
|
||||
// oxlint-disable-next-line @darraghor/nestjs-typed/should-specify-forbid-unknown-values
|
||||
return new ValidationPipe({
|
||||
forbidUnknownValues: false,
|
||||
skipMissingProperties: false,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
/* eslint-disable
|
||||
/* oxlint-disable
|
||||
@typescript-eslint/no-unsafe-assignment,
|
||||
@typescript-eslint/no-unsafe-member-access
|
||||
*/
|
||||
|
||||
@@ -212,7 +212,7 @@ export class TestSetupBuilder {
|
||||
password: 'hedgedoc',
|
||||
host: process.env.HD_DATABASE_HOST || 'localhost',
|
||||
port: parseInt(process.env.HD_DATABASE_PORT || '5432'),
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
// oxlint-disable-next-line @typescript-eslint/naming-convention
|
||||
application_name: 'HedgeDoc Test Server',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"./tsconfig.test.json"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint",
|
||||
"jest",
|
||||
"prettier"
|
||||
],
|
||||
"env": {
|
||||
"jest": true,
|
||||
"jest/globals": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"rules": {
|
||||
"prettier/prettier": ["error",
|
||||
require('./.prettierrc.json')
|
||||
],
|
||||
"jest/no-disabled-tests": "warn",
|
||||
"jest/no-focused-tests": "error",
|
||||
"jest/no-identical-title": "error",
|
||||
"jest/prefer-to-have-length": "warn",
|
||||
"jest/valid-expect": "error"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": [
|
||||
"typescript",
|
||||
"jest",
|
||||
"oxc"
|
||||
],
|
||||
"rules": {
|
||||
"jest/no-disabled-tests": "warn",
|
||||
"jest/no-focused-tests": "error",
|
||||
"jest/no-identical-title": "error",
|
||||
"jest/valid-expect": "error"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"jest": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
@@ -10,8 +10,8 @@
|
||||
"test": "jest",
|
||||
"test:ci": "jest --ci",
|
||||
"prepublish": "rm -rf dist && yarn lint && yarn build && yarn test",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"lint:fix": "eslint --fix --ext .ts src"
|
||||
"lint": "../node_modules/.bin/oxlint src",
|
||||
"lint:fix": "../node_modules/.bin/oxlint --fix src"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "src/index.ts",
|
||||
@@ -56,12 +56,6 @@
|
||||
"@mrdrogdrog/optional": "1.2.1",
|
||||
"@types/js-yaml": "4.0.9",
|
||||
"@types/ws": "8.18.1",
|
||||
"@typescript-eslint/eslint-plugin": "8.14.0",
|
||||
"@typescript-eslint/parser": "8.14.0",
|
||||
"eslint": "8.57.1",
|
||||
"eslint-config-prettier": "9.1.2",
|
||||
"eslint-plugin-jest": "28.14.0",
|
||||
"eslint-plugin-prettier": "5.5.4",
|
||||
"jest": "29.7.0",
|
||||
"prettier": "3.7.4",
|
||||
"ts-jest": "29.4.6",
|
||||
|
||||
@@ -68,7 +68,7 @@ export class RealtimeDoc extends EventEmitter2<RealtimeDocEvents> {
|
||||
* @return The current note content.
|
||||
*/
|
||||
public getCurrentContent(): string {
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
return this.getMarkdownContentChannel().toString()
|
||||
}
|
||||
|
||||
|
||||
@@ -29,15 +29,15 @@ describe('y-doc-sync-adapter', () => {
|
||||
const textClient2 = docClient2.getMarkdownContentChannel()
|
||||
|
||||
textServer.observe(() =>
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
console.log('textServer', new Date(), textServer.toString()),
|
||||
)
|
||||
textClient1.observe(() =>
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
console.log('textClient1', new Date(), textClient1.toString()),
|
||||
)
|
||||
textClient2.observe(() =>
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
console.log('textClient2', new Date(), textClient2.toString()),
|
||||
)
|
||||
|
||||
@@ -209,11 +209,11 @@ describe('y-doc-sync-adapter', () => {
|
||||
textClient1.insert(0, 'test3')
|
||||
textClient2.insert(0, 'test4')
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
expect(textServer.toString()).toBe('test4test3test2This is a test note')
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
expect(textClient1.toString()).toBe('test4test3test2This is a test note')
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
expect(textClient2.toString()).toBe('test4test3test2This is a test note')
|
||||
|
||||
docServer.destroy()
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.test.json'],
|
||||
},
|
||||
plugins: ['@typescript-eslint', 'prettier'],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'prettier',
|
||||
],
|
||||
rules: {
|
||||
'prettier/prettier': ['error', require('./.prettierrc.json')],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": [
|
||||
"typescript",
|
||||
"oxc"
|
||||
],
|
||||
"env": {
|
||||
"node": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
@@ -7,8 +7,8 @@
|
||||
"license": "AGPL-3.0",
|
||||
"scripts": {
|
||||
"build": "./build.sh",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"lint:fix": "eslint --fix --ext .ts src"
|
||||
"lint": "../node_modules/.bin/oxlint src",
|
||||
"lint:fix": "../node_modules/.bin/oxlint --fix src"
|
||||
},
|
||||
"type": "module",
|
||||
"source": "src/index.ts",
|
||||
@@ -35,12 +35,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "24.10.7",
|
||||
"@typescript-eslint/eslint-plugin": "8.14.0",
|
||||
"@typescript-eslint/parser": "8.14.0",
|
||||
"eslint": "8.57.1",
|
||||
"eslint-config-prettier": "9.1.2",
|
||||
"eslint-plugin-jest": "28.14.0",
|
||||
"eslint-plugin-prettier": "5.5.4",
|
||||
"prettier": "3.7.4",
|
||||
"typescript": "5.9.3"
|
||||
},
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
**/
|
||||
module.exports = {
|
||||
"root": true,
|
||||
"parserOptions": {
|
||||
"tsconfigRootDir": ".",
|
||||
"project": [
|
||||
"./tsconfig.json"
|
||||
]
|
||||
},
|
||||
"rules": {
|
||||
"prettier/prettier": ["error",
|
||||
require('./.prettierrc.json')
|
||||
],
|
||||
"no-use-before-define": "off",
|
||||
"no-debugger": "warn",
|
||||
"default-param-last": "off",
|
||||
"@typescript-eslint/consistent-type-imports": [
|
||||
"error",
|
||||
{
|
||||
"prefer": "type-imports",
|
||||
"disallowTypeAnnotations": false
|
||||
}
|
||||
],
|
||||
"jest/no-disabled-tests": "warn",
|
||||
"jest/no-focused-tests": "error",
|
||||
"jest/no-identical-title": "error",
|
||||
"jest/prefer-to-have-length": "warn",
|
||||
"jest/valid-expect": "error"
|
||||
},
|
||||
"env": {
|
||||
"jest": true,
|
||||
"jest/globals": true
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint",
|
||||
"testing-library",
|
||||
"jest",
|
||||
"prettier"
|
||||
],
|
||||
"extends": [
|
||||
"next/core-web-vitals",
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||
"prettier"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"**/__tests__/**/*.[jt]s?(x)",
|
||||
"**/?(*.)+(spec|test).[jt]s?(x)"
|
||||
],
|
||||
"extends": ["plugin:testing-library/react"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": [
|
||||
"typescript",
|
||||
"react",
|
||||
"nextjs",
|
||||
"jsx-a11y",
|
||||
"jest",
|
||||
"oxc"
|
||||
],
|
||||
"rules": {
|
||||
"no-debugger": "warn",
|
||||
"typescript/consistent-type-imports": ["error", {
|
||||
"prefer": "type-imports",
|
||||
"disallowTypeAnnotations": false
|
||||
}],
|
||||
"jest/no-disabled-tests": "warn",
|
||||
"jest/no-focused-tests": "error",
|
||||
"jest/no-identical-title": "error",
|
||||
"jest/valid-expect": "error",
|
||||
"jest/expect-expect": ["error", {
|
||||
"assertFunctionNames": ["expect*", "screen.*", "test*"]
|
||||
}]
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"jest": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"parserOptions": {
|
||||
"tsconfigRootDir": "",
|
||||
"project": [
|
||||
"./tsconfig.json"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
"cypress",
|
||||
"chai-friendly"
|
||||
],
|
||||
"extends": [
|
||||
"plugin:cypress/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-expressions": 0,
|
||||
"no-unused-expressions": 0,
|
||||
"chai-friendly/no-unused-expressions": 2,
|
||||
"@typescript-eslint/no-namespace": 0
|
||||
},
|
||||
"env": {
|
||||
"cypress/globals": true
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* oxlint-disable @typescript-eslint/no-unsafe-call */
|
||||
describe('Intro page', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('/public/intro.md', 'test content')
|
||||
|
||||
+2
-14
@@ -10,8 +10,8 @@
|
||||
"analyze": "cross-env ANALYZE=true yarn build --profile",
|
||||
"format": "prettier -c \"src/**/*.{ts,tsx,js}\" \"cypress/**/*.{ts,tsx}\"",
|
||||
"format:fix": "prettier -w \"src/**/*.{ts,tsx,js}\" \"cypress/**/*.{ts,tsx}\"",
|
||||
"lint": "eslint --max-warnings=0 --ext .ts,.tsx src",
|
||||
"lint:fix": "eslint --fix --ext .ts,.tsx src",
|
||||
"lint": "../node_modules/.bin/oxlint src",
|
||||
"lint:fix": "../node_modules/.bin/oxlint --fix src",
|
||||
"start": "cross-env PORT=${HD_FRONTEND_PORT:-3001} node dist/frontend/server.js",
|
||||
"start:dev": "cross-env PORT=${HD_FRONTEND_PORT:-3001} next dev",
|
||||
"start:dev:mock": "cross-env PORT=${HD_FRONTEND_PORT:-3001} NEXT_PUBLIC_USE_MOCK_API=true HD_BASE_URL=\"http://localhost:3001/\" HD_RENDERER_BASE_URL=\"http://127.0.0.1:3001/\" next dev",
|
||||
@@ -140,23 +140,11 @@
|
||||
"@types/react": "18.3.27",
|
||||
"@types/react-dom": "18.3.7",
|
||||
"@types/ws": "8.18.1",
|
||||
"@typescript-eslint/eslint-plugin": "8.14.0",
|
||||
"@typescript-eslint/parser": "8.14.0",
|
||||
"csstype": "3.2.3",
|
||||
"cypress": "13.17.0",
|
||||
"cypress-commands": "3.0.0",
|
||||
"cypress-fill-command": "1.0.2",
|
||||
"dotenv-cli": "11.0.0",
|
||||
"eslint": "8.57.1",
|
||||
"eslint-config-next": "14.2.35",
|
||||
"eslint-config-prettier": "9.1.2",
|
||||
"eslint-plugin-chai-friendly": "1.1.0",
|
||||
"eslint-plugin-cypress": "4.3.0",
|
||||
"eslint-plugin-jest": "28.14.0",
|
||||
"eslint-plugin-n": "17.23.1",
|
||||
"eslint-plugin-prettier": "5.5.4",
|
||||
"eslint-plugin-promise": "7.2.1",
|
||||
"eslint-plugin-testing-library": "6.5.0",
|
||||
"jest": "29.7.0",
|
||||
"jest-environment-jsdom": "29.7.0",
|
||||
"prettier": "3.7.4",
|
||||
|
||||
@@ -35,7 +35,7 @@ export const CustomBranding: React.FC<BrandingProps> = ({ inline = false }) => {
|
||||
return null
|
||||
} else if (branding.logo) {
|
||||
return (
|
||||
/* eslint-disable-next-line @next/next/no-img-element */
|
||||
/* oxlint-disable-next-line @next/next/no-img-element */
|
||||
<img
|
||||
src={branding.logo}
|
||||
alt={branding.name !== null ? branding.name : undefined}
|
||||
|
||||
@@ -69,7 +69,7 @@ export const ProfilePictureSelectField: React.FC<ProfilePictureSelectFieldProps>
|
||||
onChange={onSetProviderPicture}
|
||||
/>
|
||||
<Form.Check.Label>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
{/* oxlint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={photoUrl} alt={'Profile picture provided by the identity provider'} height={48} width={48} />
|
||||
</Form.Check.Label>
|
||||
</Form.Check>
|
||||
@@ -81,7 +81,7 @@ export const ProfilePictureSelectField: React.FC<ProfilePictureSelectFieldProps>
|
||||
onChange={onSetFallbackPicture}
|
||||
/>
|
||||
<Form.Check.Label>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
{/* oxlint-disable-next-line @next/next/no-img-element */}
|
||||
<img alt={'Fallback profile picture'} src={fallbackUrl} height={48} width={48} />
|
||||
</Form.Check.Label>
|
||||
</Form.Check>
|
||||
|
||||
@@ -33,7 +33,7 @@ export const UploadInput: React.FC<UploadInputProps> = ({ onLoad, allowedFileTyp
|
||||
|
||||
const onChange = useCallback<React.ChangeEventHandler<HTMLInputElement>>(
|
||||
// TODO Check and fix this
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
// oxlint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
async (event) => {
|
||||
const fileInput = event.currentTarget
|
||||
if (!fileInput.files || fileInput.files.length < 1) {
|
||||
|
||||
@@ -64,7 +64,7 @@ export const UserAvatar: React.FC<UserAvatarProps> = ({
|
||||
return (
|
||||
<span className={'d-inline-flex align-items-center ' + additionalClasses}>
|
||||
{photoComponent ?? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
// oxlint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={avatarUrl}
|
||||
className={`rounded ${styles['user-image']}`}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import { useEffect } from 'react'
|
||||
export const useBindYTextToRedux = (realtimeDoc: RealtimeDoc): void => {
|
||||
useEffect(() => {
|
||||
const yText = realtimeDoc.getMarkdownContentChannel()
|
||||
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
// oxlint-disable-next-line @typescript-eslint/no-base-to-string
|
||||
const yTextCallback = () => setNoteContent(yText.toString())
|
||||
yText.observe(yTextCallback)
|
||||
return () => yText.unobserve(yTextCallback)
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ export const MediaEntry: React.FC<MediaEntryProps> = ({ entry, onDelete }) => {
|
||||
return (
|
||||
<div className={'p-2 border-bottom border-opacity-50'}>
|
||||
<a href={imageUrl} target={'_blank'} rel={'noreferrer'} className={'text-center d-block mb-2'}>
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
{/* oxlint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={imageUrl} alt={`Upload ${entry.fileName}`} className={styles.preview} />
|
||||
</a>
|
||||
<div className={'w-100 d-flex flex-row align-items-center justify-content-between'}>
|
||||
|
||||
+2
-2
@@ -11,12 +11,12 @@ import type MarkdownIt from 'markdown-it'
|
||||
* Base class for Markdown extensions.
|
||||
*/
|
||||
export abstract class MarkdownRendererExtension {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
// oxlint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public configureMarkdownIt(markdownIt: MarkdownIt): void {
|
||||
return
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
// oxlint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public configureMarkdownItPost(markdownIt: MarkdownIt): void {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -32,6 +32,6 @@ export const ProxyImageFrame: React.FC<React.ImgHTMLAttributes<HTMLImageElement>
|
||||
}, [imageProxyEnabled, src])
|
||||
|
||||
// The next image processor works with a whitelist of origins. Therefore, we can't use it for general images.
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
// oxlint-disable-next-line @next/next/no-img-element
|
||||
return <img src={imageProxyEnabled ? imageUrl : (src ?? '')} title={title ?? alt ?? ''} alt={alt} {...props} />
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ export class AnchorNodePreprocessor extends TravelerNodeProcessor {
|
||||
|
||||
const url = node.attribs.href.trim()
|
||||
|
||||
// eslint-disable-next-line no-script-url
|
||||
// oxlint-disable-next-line no-script-url
|
||||
if (url.startsWith('data:') || url.startsWith('javascript:') || url.startsWith('vbscript:')) {
|
||||
delete node.attribs.href
|
||||
return
|
||||
|
||||
@@ -20,7 +20,7 @@ export interface MarkdownRendererExtensionOptions {
|
||||
}
|
||||
|
||||
export abstract class AppExtension {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
// oxlint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public buildMarkdownRendererExtensions(options: MarkdownRendererExtensionOptions): MarkdownRendererExtension[] {
|
||||
return []
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Vimeo as IconVimeo } from 'react-bootstrap-icons'
|
||||
|
||||
interface VimeoApiResponse {
|
||||
// Vimeo uses strange names for their fields. ESLint doesn't like that.
|
||||
// eslint-disable-next-line camelcase
|
||||
// oxlint-disable-next-line camelcase
|
||||
thumbnail_large?: string
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ export const useEffectWithCatch = (effect: EffectCallback, deps: DependencyList
|
||||
} catch (error) {
|
||||
setError(error as Error)
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, deps)
|
||||
|
||||
return error
|
||||
|
||||
@@ -1186,7 +1186,7 @@ export const InboxesFill: Icon = () => <>BootstrapIconMock_InboxesFill</>
|
||||
export const Inboxes: Icon = () => <>BootstrapIconMock_Inboxes</>
|
||||
export const Incognito: Icon = () => <>BootstrapIconMock_Incognito</>
|
||||
export const Indent: Icon = () => <>BootstrapIconMock_Indent</>
|
||||
// eslint-disable-next-line no-shadow-restricted-names
|
||||
// oxlint-disable-next-line no-shadow-restricted-names
|
||||
export const Infinity: Icon = () => <>BootstrapIconMock_Infinity</>
|
||||
export const InfoCircleFill: Icon = () => <>BootstrapIconMock_InfoCircleFill</>
|
||||
export const InfoCircle: Icon = () => <>BootstrapIconMock_InfoCircle</>
|
||||
|
||||
@@ -20,7 +20,7 @@ export const updateObject = <T extends Record<string, unknown>>(oldObject: T, ne
|
||||
Object.keys(oldObject).forEach((key) => {
|
||||
if (Object.prototype.hasOwnProperty.call(newValues, key) && typeof oldObject[key] === typeof newValues[key]) {
|
||||
// TypeScript does not allow to assign a value to a key of a generic object (as it could be potentially readonly)
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// oxlint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
oldObject[key] = newValues[key]
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { updateObject } from './update-object'
|
||||
describe('updateObject', () => {
|
||||
it('should not update the object if newValues is not an object', () => {
|
||||
const oldObject = { a: 1, b: 2 }
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// oxlint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
updateObject(oldObject, 'abc')
|
||||
expect(oldObject).toEqual({ a: 1, b: 2 })
|
||||
@@ -37,7 +37,7 @@ describe('updateObject', () => {
|
||||
it('should ignore keys with different types', () => {
|
||||
const oldObject = { a: 1, b: 2 }
|
||||
const newValues = { a: '3', b: 4 }
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// oxlint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
updateObject(oldObject, newValues)
|
||||
expect(oldObject).toEqual({ a: 1, b: 4 })
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"./tsconfig.test.json"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint",
|
||||
"jest",
|
||||
"prettier"
|
||||
],
|
||||
"env": {
|
||||
"jest": true,
|
||||
"jest/globals": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"rules": {
|
||||
"prettier/prettier": ["error",
|
||||
require('./.prettierrc.json')
|
||||
],
|
||||
"jest/no-disabled-tests": "warn",
|
||||
"jest/no-focused-tests": "error",
|
||||
"jest/no-identical-title": "error",
|
||||
"jest/prefer-to-have-length": "warn",
|
||||
"jest/valid-expect": "error"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": [
|
||||
"typescript",
|
||||
"jest",
|
||||
"oxc"
|
||||
],
|
||||
"rules": {
|
||||
"jest/no-disabled-tests": "warn",
|
||||
"jest/no-focused-tests": "error",
|
||||
"jest/no-identical-title": "error",
|
||||
"jest/valid-expect": "error"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"jest": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
@@ -21,8 +21,8 @@
|
||||
"test": "jest",
|
||||
"build": "./build.sh",
|
||||
"prepublish": "yarn lint && yarn build && yarn test",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"lint:fix": "eslint --fix --ext .ts src"
|
||||
"lint": "../node_modules/.bin/oxlint src",
|
||||
"lint:fix": "../node_modules/.bin/oxlint --fix src"
|
||||
},
|
||||
"files": [
|
||||
"LICENSES/*",
|
||||
@@ -52,12 +52,6 @@
|
||||
"@jest/types": "29.6.3",
|
||||
"@types/react": "18.3.27",
|
||||
"@types/react-dom": "18.3.7",
|
||||
"@typescript-eslint/eslint-plugin": "8.14.0",
|
||||
"@typescript-eslint/parser": "8.14.0",
|
||||
"eslint": "8.57.1",
|
||||
"eslint-config-prettier": "9.1.2",
|
||||
"eslint-plugin-jest": "28.14.0",
|
||||
"eslint-plugin-prettier": "5.5.4",
|
||||
"jest": "29.7.0",
|
||||
"prettier": "3.7.4",
|
||||
"react": "18.3.1",
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"./tsconfig.test.json"
|
||||
]
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint",
|
||||
"jest",
|
||||
"prettier"
|
||||
],
|
||||
"env": {
|
||||
"jest": true,
|
||||
"jest/globals": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"rules": {
|
||||
"prettier/prettier": ["error",
|
||||
require('./.prettierrc.json')
|
||||
],
|
||||
"jest/no-disabled-tests": "warn",
|
||||
"jest/no-focused-tests": "error",
|
||||
"jest/no-identical-title": "error",
|
||||
"jest/prefer-to-have-length": "warn",
|
||||
"jest/valid-expect": "error"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "../node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": [
|
||||
"typescript",
|
||||
"jest",
|
||||
"oxc"
|
||||
],
|
||||
"rules": {
|
||||
"jest/no-disabled-tests": "warn",
|
||||
"jest/no-focused-tests": "error",
|
||||
"jest/no-identical-title": "error",
|
||||
"jest/valid-expect": "error"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"jest": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2026 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
@@ -89,8 +89,8 @@
|
||||
"test": "jest",
|
||||
"test:ci": "jest --ci",
|
||||
"prepublish": "rm -rf dist && yarn lint && yarn build && yarn test",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"lint:fix": "eslint --fix --ext .ts src"
|
||||
"lint": "../node_modules/.bin/oxlint src",
|
||||
"lint:fix": "../node_modules/.bin/oxlint --fix src"
|
||||
},
|
||||
"keywords": [
|
||||
"markdown",
|
||||
@@ -110,12 +110,6 @@
|
||||
"devDependencies": {
|
||||
"@jest/types": "29.6.3",
|
||||
"@types/markdown-it": "13.0.8",
|
||||
"@typescript-eslint/eslint-plugin": "8.14.0",
|
||||
"@typescript-eslint/parser": "8.14.0",
|
||||
"eslint": "8.57.1",
|
||||
"eslint-config-prettier": "9.1.2",
|
||||
"eslint-plugin-jest": "28.14.0",
|
||||
"eslint-plugin-prettier": "5.5.4",
|
||||
"jest": "29.7.0",
|
||||
"markdown-it": "13.0.2",
|
||||
"prettier": "3.7.4",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"dotenv-cli": "11.0.0",
|
||||
"oxlint": "1.38.0",
|
||||
"turbo": "2.6.3"
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -78,7 +78,8 @@
|
||||
"lint:fix": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
],
|
||||
"cache": false
|
||||
},
|
||||
"format": {},
|
||||
"test": {
|
||||
|
||||
Reference in New Issue
Block a user