mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Bring lint config back to original strictness
This commit is contained in:
@@ -85,7 +85,7 @@ export class AcpReader extends PermissionReader {
|
||||
}
|
||||
const modes = allowAccessModes(policies, context);
|
||||
|
||||
const permissionSet: PermissionSet = { };
|
||||
const permissionSet: PermissionSet = {};
|
||||
for (const aclMode of modes) {
|
||||
if (aclMode in modesMap) {
|
||||
for (const mode of modesMap[aclMode]) {
|
||||
|
||||
@@ -4,4 +4,4 @@ import type { RepresentationMetadata } from '../representation/RepresentationMet
|
||||
/**
|
||||
* Generic interface for classes that add metadata to a RepresentationMetadata.
|
||||
*/
|
||||
export abstract class MetadataGenerator extends AsyncHandler<RepresentationMetadata> { }
|
||||
export abstract class MetadataGenerator extends AsyncHandler<RepresentationMetadata> {}
|
||||
|
||||
@@ -10,4 +10,4 @@ export type ValidatorInput = {
|
||||
/**
|
||||
* Generic interface for classes that validate Representations in some way.
|
||||
*/
|
||||
export abstract class Validator extends AsyncHandler<ValidatorInput, Representation> { }
|
||||
export abstract class Validator extends AsyncHandler<ValidatorInput, Representation> {}
|
||||
|
||||
@@ -62,6 +62,7 @@ export class ConvertingErrorHandler extends ErrorHandler {
|
||||
private async extractErrorDetails({ error, request }: ErrorHandlerArgs): Promise<PreparedArguments> {
|
||||
if (!this.showStackTrace) {
|
||||
delete error.stack;
|
||||
// eslint-disable-next-line ts/no-unsafe-member-access
|
||||
delete (error as any).cause;
|
||||
}
|
||||
const representation = new BasicRepresentation([ error ], error.metadata, INTERNAL_ERROR, false);
|
||||
|
||||
@@ -29,7 +29,7 @@ export class LinkRelMetadataWriter extends MetadataWriter {
|
||||
const values = input.metadata.getAll(predicate)
|
||||
.map((term): string => `<${term.value}>; rel="${relValue}"`);
|
||||
if (values.length > 0) {
|
||||
this.logger.debug(`Adding Link header ${values}`);
|
||||
this.logger.debug(`Adding Link header ${values.join(',')}`);
|
||||
addHeader(input.response, 'Link', values);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export class WacAllowMetadataWriter extends MetadataWriter {
|
||||
}
|
||||
}
|
||||
|
||||
private aclToPermission(aclTerm: Term): string {
|
||||
private aclToPermission(this: void, aclTerm: Term): string {
|
||||
return aclTerm.value.slice(ACL.namespace.length).toLowerCase();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ export class HtmlViewEntry {
|
||||
public constructor(
|
||||
public readonly route: InteractionRoute,
|
||||
public readonly filePath: string,
|
||||
) { }
|
||||
) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,4 +25,4 @@ export interface InteractionHandlerInput {
|
||||
/**
|
||||
* Handler used for IDP interactions.
|
||||
*/
|
||||
export abstract class InteractionHandler extends AsyncHandler<InteractionHandlerInput, Representation> { }
|
||||
export abstract class InteractionHandler extends AsyncHandler<InteractionHandlerInput, Representation> {}
|
||||
|
||||
@@ -38,4 +38,4 @@ export interface JsonInteractionHandlerInput {
|
||||
* designed to be used for IDP/OIDC interactions.
|
||||
*/
|
||||
export abstract class JsonInteractionHandler<TOut extends Dict<Json> = Dict<Json>>
|
||||
extends AsyncHandler<JsonInteractionHandlerInput, JsonRepresentation<TOut>> { }
|
||||
extends AsyncHandler<JsonInteractionHandlerInput, JsonRepresentation<TOut>> {}
|
||||
|
||||
@@ -160,7 +160,7 @@ export class BaseResourcesGenerator implements TemplatedResourcesGenerator {
|
||||
private async groupLinks(folderPath: string, mapper: FileIdentifierMapper):
|
||||
Promise<Record<string, { link: TemplateResourceLink; meta?: TemplateResourceLink }>> {
|
||||
const files = await fsPromises.readdir(folderPath);
|
||||
const links: Record<string, { link: TemplateResourceLink; meta?: TemplateResourceLink }> = { };
|
||||
const links: Record<string, { link: TemplateResourceLink; meta?: TemplateResourceLink }> = {};
|
||||
for (const name of files) {
|
||||
const link = await this.toTemplateLink(joinFilePath(folderPath, name), mapper);
|
||||
const { path } = link.identifier;
|
||||
|
||||
@@ -21,7 +21,7 @@ export class StaticAssetEntry {
|
||||
public constructor(
|
||||
public readonly relativeUrl: string,
|
||||
public readonly filePath: string,
|
||||
) { }
|
||||
) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,4 +5,4 @@ import type { NotificationHandlerInput } from '../NotificationHandler';
|
||||
/**
|
||||
* Creates a {@link Notification} based on the provided input.
|
||||
*/
|
||||
export abstract class NotificationGenerator extends AsyncHandler<NotificationHandlerInput, Notification> { }
|
||||
export abstract class NotificationGenerator extends AsyncHandler<NotificationHandlerInput, Notification> {}
|
||||
|
||||
@@ -14,4 +14,4 @@ export interface NotificationSerializerInput {
|
||||
* This is a separate class between a generator and emitter,
|
||||
* so that a specific notification channel type can add extra metadata to the Representation if needed.
|
||||
*/
|
||||
export abstract class NotificationSerializer extends AsyncHandler<NotificationSerializerInput, Representation> { }
|
||||
export abstract class NotificationSerializer extends AsyncHandler<NotificationSerializerInput, Representation> {}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class InMemoryDataAccessor implements DataAccessor, SingleThreaded {
|
||||
public constructor(identifierStrategy: IdentifierStrategy) {
|
||||
this.identifierStrategy = identifierStrategy;
|
||||
|
||||
this.store = { entries: { }};
|
||||
this.store = { entries: {}};
|
||||
}
|
||||
|
||||
public async canHandle(): Promise<void> {
|
||||
|
||||
@@ -65,7 +65,7 @@ export class MaxKeyLengthStorage<T> implements KeyValueStorage<string, T> {
|
||||
const parts = key.split('/');
|
||||
|
||||
// Prevent non-hashed keys with the prefix to prevent false hits
|
||||
if (parts[parts.length - 1].startsWith(this.hashPrefix)) {
|
||||
if (parts.at(-1)?.startsWith(this.hashPrefix)) {
|
||||
throw new NotImplementedHttpError(`Unable to store keys starting with ${this.hashPrefix}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export function isGuarded<T extends NodeJS.EventEmitter>(stream: T): stream is G
|
||||
function guardingErrorListener(this: Guarded, error: Error): void {
|
||||
// Only fall back to this if no new listeners are attached since guarding started.
|
||||
const errorListeners = this.listeners('error');
|
||||
if (errorListeners[errorListeners.length - 1] === guardingErrorListener) {
|
||||
if (errorListeners.at(-1) === guardingErrorListener) {
|
||||
this[guardedErrors].push(error);
|
||||
if (!this[guardedTimeout]) {
|
||||
this[guardedTimeout] = setTimeout((): void => {
|
||||
|
||||
@@ -38,7 +38,7 @@ const logger = getLoggerFor('HeaderUtil');
|
||||
export function transformQuotedStrings(input: string): { result: string; replacements: Record<string, string> } {
|
||||
let idx = 0;
|
||||
const replacements: Record<string, string> = {};
|
||||
const result = input.replace(/"(?:[^"\\]|\\.)*"/gu, (match): string => {
|
||||
const result = input.replaceAll(/"(?:[^"\\]|\\.)*"/gu, (match): string => {
|
||||
// Not all characters allowed in quoted strings, see BNF above
|
||||
if (!QUOTED_STRING.test(match)) {
|
||||
logger.warn(`Invalid quoted string in header: ${match}`);
|
||||
|
||||
@@ -173,7 +173,6 @@ async function findNextSorted<T>(iterators: AsyncIterator<T>[], results: (T | un
|
||||
export async function* sortedAsyncMerge<T>(iterators: AsyncIterator<T>[], comparator?: (left: T, right: T) => number):
|
||||
AsyncIterable<T> {
|
||||
if (!comparator) {
|
||||
// eslint-disable-next-line style/no-extra-parens
|
||||
comparator = (left, right): number => left < right ? -1 : (left > right ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import { errorTermsToMetadata } from './errors/HttpErrorUtil';
|
||||
* @returns The potentially changed path (POSIX).
|
||||
*/
|
||||
function windowsToPosixPath(path: string): string {
|
||||
return path.replace(/\\+/gu, '/');
|
||||
return path.replaceAll(/\\+/gu, '/');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@ export function splitCommaSeparated(input: string): string[] {
|
||||
* @returns The sanitized output.
|
||||
*/
|
||||
export function sanitizeUrlPart(urlPart: string): string {
|
||||
return urlPart.replace(/\W/gu, '-');
|
||||
return urlPart.replaceAll(/\W/gu, '-');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,7 @@ export type VocabularyTerm<T> = T extends Vocabulary<any, infer TKey> ? T['terms
|
||||
*/
|
||||
function createValueVocabulary<TBase extends string, TLocal extends string>(baseUri: TBase, localNames: TLocal[]):
|
||||
ValueVocabulary<TBase, TLocal> {
|
||||
const expanded: Partial<ExpandedRecord<TBase, TLocal>> = { };
|
||||
const expanded: Partial<ExpandedRecord<TBase, TLocal>> = {};
|
||||
// Expose the listed local names as properties
|
||||
for (const localName of localNames) {
|
||||
expanded[localName] = `${baseUri}${localName}`;
|
||||
|
||||
Reference in New Issue
Block a user