chore: Update lint dependencies

This commit is contained in:
Joachim Van Herwegen
2024-07-18 11:03:30 +02:00
parent d1282f6b1a
commit ecd031e69f
37 changed files with 3049 additions and 2931 deletions

View File

@@ -31,7 +31,7 @@ export async function instantiateFromConfig(
for (const configPath of configPaths) {
await manager.configRegistry.register(configPath);
}
return await manager.instantiate(componentUrl, { variables });
return manager.instantiate(componentUrl, { variables });
}
export function getTestConfigPath(configFile: string): string {

View File

@@ -257,9 +257,9 @@ describe('AppRunner', (): void => {
} catch (error: unknown) {
caughtError = error as Error;
}
expect(caughtError?.message).toMatch(/^Cannot run a singlethreaded-only component in a multithreaded setup!/mu);
expect(caughtError?.message).toMatch(/^Cannot run a singlethreaded-only component in a multithreaded setup!/u);
expect(caughtError?.message).toMatch(
/\[ViolatingClass\] is not threadsafe and should not be run in multithreaded setups!/mu,
/\[ViolatingClass\] is not threadsafe and should not be run in multithreaded setups!/u,
);
expect(write).toHaveBeenCalledTimes(0);
@@ -295,7 +295,7 @@ describe('AppRunner', (): void => {
}
expect(caughtError?.message).toMatch(/^Cannot run a singlethreaded-only component in a multithreaded setup!/mu);
expect(caughtError?.message).toMatch(
/\[ViolatingClass1, ViolatingClass2\] are not threadsafe and should not be run in multithreaded setups!/mu,
/\[ViolatingClass1, ViolatingClass2\] are not threadsafe and should not be run in multithreaded setups!/u,
);
expect(write).toHaveBeenCalledTimes(0);
@@ -481,7 +481,7 @@ describe('AppRunner', (): void => {
}
expect(caughtError.message).toMatch(/^Cannot run a singlethreaded-only component in a multithreaded setup!/mu);
expect(caughtError?.message).toMatch(
/\[ViolatingClass\] is not threadsafe and should not be run in multithreaded setups!/mu,
/\[ViolatingClass\] is not threadsafe and should not be run in multithreaded setups!/u,
);
expect(write).toHaveBeenCalledTimes(0);
@@ -820,7 +820,7 @@ describe('AppRunner', (): void => {
await flushPromises();
expect(write).toHaveBeenCalledTimes(1);
expect(write).toHaveBeenLastCalledWith(expect.stringMatching(/Error: Fatal/mu));
expect(write).toHaveBeenLastCalledWith(expect.stringMatching(/Error: Fatal/u));
expect(exit).toHaveBeenCalledTimes(1);
expect(exit).toHaveBeenLastCalledWith(1);

View File

@@ -302,7 +302,7 @@ describe('A DataAccessorBasedStore', (): void => {
const generatedID = [ ...result.keys() ].find((id): boolean => id.path !== resourceID.path)!;
expect(generatedID).toBeDefined();
expect(generatedID.path).toMatch(new RegExp(`^${root}[^/]+?/$`, 'u'));
expect(generatedID.path).toMatch(new RegExp(`^${root}[^/]*/$`, 'u'));
expect(accessor.data[generatedID.path]).toBeDefined();
expect(accessor.data[generatedID.path].metadata.contentType).toBeUndefined();
@@ -630,8 +630,7 @@ describe('A DataAccessorBasedStore', (): void => {
data: guardedStreamFrom([ resourceData ]),
metadata: new RepresentationMetadata({
[CONTENT_TYPE]: 'text/plain',
[RDF.type]: namedNode(LDP.Resource),
[RDF.type]: namedNode('http://example.org/Type'),
[RDF.type]: [ namedNode(LDP.Resource), namedNode('http://example.org/Type') ],
}),
isEmpty: false,
};
@@ -659,8 +658,7 @@ describe('A DataAccessorBasedStore', (): void => {
data: guardedStreamFrom([ '<a> <b> <c>' ]),
metadata: new RepresentationMetadata({
[CONTENT_TYPE]: 'text/turtle',
[RDF.type]: namedNode(LDP.Resource),
[RDF.type]: namedNode('http://example.org/Type'),
[RDF.type]: [ namedNode(LDP.Resource), namedNode('http://example.org/Type') ],
}),
isEmpty: false,
};

View File

@@ -17,9 +17,9 @@ describe('A JsonFileStorage', (): void => {
cache = mockFileSystem(rootFilePath);
locker = {
withReadLock:
jest.fn(async(identifier: ResourceIdentifier, whileLocked: () => any): Promise<any> => await whileLocked()),
jest.fn(async(identifier: ResourceIdentifier, whileLocked: () => any): Promise<any> => whileLocked()),
withWriteLock:
jest.fn(async(identifier: ResourceIdentifier, whileLocked: () => any): Promise<any> => await whileLocked()),
jest.fn(async(identifier: ResourceIdentifier, whileLocked: () => any): Promise<any> => whileLocked()),
};
storage = new JsonFileStorage(`${rootFilePath}${jsonPath}`, locker);
});

View File

@@ -78,7 +78,7 @@ export function getSocket(name: typeof socketNames[number]): string {
export function describeIf(envFlag: string): Describe {
const flag = `TEST_${envFlag.toUpperCase()}`;
const enabled = !/^(|0|false)$/iu.test(process.env[flag] ?? '');
const enabled = !/^(?:0|false)?$/iu.test(process.env[flag] ?? '');
return enabled ? describe : describe.skip;
}
@@ -316,7 +316,7 @@ export function mockFileSystem(rootFilepath?: string, time?: Date): { data: any
return mockFs.createWriteStream(path);
},
async realpath(path: string): Promise<string> {
return await mockFs.promises.realpath(path);
return mockFs.promises.realpath(path);
},
async stat(path: string): Promise<Stats> {
return mockFs.promises.lstat(await mockFs.promises.realpath(path));
@@ -334,7 +334,7 @@ export function mockFileSystem(rootFilepath?: string, time?: Date): { data: any
await mockFs.promises.rm(path);
},
async readdir(path: string): Promise<string[]> {
return await mockFs.promises.readdir(path);
return mockFs.promises.readdir(path);
},
async* opendir(path: string): AsyncIterableIterator<Dirent> {
for await (const entry of mockFs.promises.opendir(path)) {
@@ -345,7 +345,7 @@ export function mockFileSystem(rootFilepath?: string, time?: Date): { data: any
await mockFs.promises.mkdir(path);
},
async readFile(path: string): Promise<string> {
return await mockFs.promises.readFile(path);
return mockFs.promises.readFile(path);
},
async writeFile(path: string, data: string): Promise<void> {
await mockFs.promises.writeFile(path, data);