mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Replace linting configurations
The previous package was outdated, preventing us from updating TS. This one also lints YAML and JSON, and applies many more rules to the test files, explaining all the changes in this PR.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import type { ServerResponse, IncomingMessage, Server } from 'http';
|
||||
import type { IncomingMessage, Server, ServerResponse } from 'http';
|
||||
import { Readable } from 'stream';
|
||||
import type { Logger } from '../../../src/logging/Logger';
|
||||
import { getLoggerFor } from '../../../src/logging/LogUtil';
|
||||
|
||||
@@ -9,7 +9,6 @@ import { WebSocketServerConfigurator } from '../../../src/server/WebSocketServer
|
||||
import { flushPromises } from '../../util/Util';
|
||||
|
||||
jest.mock('ws', (): any => ({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
WebSocketServer: jest.fn().mockImplementation((): any => ({
|
||||
handleUpgrade(upgradeRequest: any, socket: any, head: any, callback: any): void {
|
||||
callback(socket, upgradeRequest);
|
||||
|
||||
@@ -37,7 +37,7 @@ describe('A KeyValueChannelStorage', (): void => {
|
||||
internalStorage = internalMap as any;
|
||||
|
||||
locker = {
|
||||
withWriteLock: jest.fn(async <T,>(rid: ResourceIdentifier, whileLocked: () => T | Promise<T>):
|
||||
withWriteLock: jest.fn(async <T>(rid: ResourceIdentifier, whileLocked: () => T | Promise<T>):
|
||||
Promise<T> => whileLocked()),
|
||||
withReadLock: jest.fn(),
|
||||
};
|
||||
|
||||
@@ -27,7 +27,6 @@ describe('A ListeningActivityHandler', (): void => {
|
||||
let storage: jest.Mocked<NotificationChannelStorage>;
|
||||
let emitter: ActivityEmitter;
|
||||
let notificationHandler: jest.Mocked<NotificationHandler>;
|
||||
let handler: ListeningActivityHandler;
|
||||
|
||||
beforeEach(async(): Promise<void> => {
|
||||
jest.clearAllMocks();
|
||||
@@ -49,8 +48,8 @@ describe('A ListeningActivityHandler', (): void => {
|
||||
handleSafe: jest.fn().mockResolvedValue(undefined),
|
||||
} as any;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
handler = new ListeningActivityHandler(storage, emitter, notificationHandler);
|
||||
// eslint-disable-next-line no-new
|
||||
new ListeningActivityHandler(storage, emitter, notificationHandler);
|
||||
});
|
||||
|
||||
it('calls the NotificationHandler if there is an event.', async(): Promise<void> => {
|
||||
|
||||
@@ -12,6 +12,7 @@ import type {
|
||||
import { INTERNAL_QUADS } from '../../../../src/util/ContentTypes';
|
||||
import { readableToString } from '../../../../src/util/StreamUtil';
|
||||
import { NOTIFY } from '../../../../src/util/Vocabularies';
|
||||
|
||||
const { namedNode, quad } = DataFactory;
|
||||
|
||||
describe('A NotificationDescriber', (): void => {
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { HttpResponse } from '../../../../../src/server/HttpResponse';
|
||||
import { WebhookWebId } from '../../../../../src/server/notifications/WebhookChannel2023/WebhookWebId';
|
||||
import { readableToString } from '../../../../../src/util/StreamUtil';
|
||||
import { SOLID } from '../../../../../src/util/Vocabularies';
|
||||
|
||||
const { namedNode, quad } = DataFactory;
|
||||
|
||||
describe('A WebhookWebId', (): void => {
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
import { NotImplementedHttpError } from '../../../../../src/util/errors/NotImplementedHttpError';
|
||||
|
||||
jest.mock('ws', (): any => ({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
WebSocketServer: jest.fn().mockImplementation((): any => ({
|
||||
handleUpgrade(upgradeRequest: any, socket: any, head: any, callback: any): void {
|
||||
callback(socket, upgradeRequest);
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
AbsolutePathInteractionRoute,
|
||||
} from '../../../../../src/identity/interaction/routing/AbsolutePathInteractionRoute';
|
||||
import type { NotificationChannel } from '../../../../../src/server/notifications/NotificationChannel';
|
||||
|
||||
import {
|
||||
generateWebSocketUrl,
|
||||
} from '../../../../../src/server/notifications/WebSocketChannel2023/WebSocket2023Util';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { HttpRequest,
|
||||
import type { HttpHandler,
|
||||
HttpRequest,
|
||||
HttpResponse,
|
||||
TargetExtractor,
|
||||
ResourceIdentifier,
|
||||
HttpHandler } from '../../../../src';
|
||||
TargetExtractor } from '../../../../src';
|
||||
import { joinUrl } from '../../../../src';
|
||||
import { RouterHandler } from '../../../../src/server/util/RouterHandler';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user