chore: Update linting dependency

This commit is contained in:
Joachim Van Herwegen 2023-12-08 13:30:44 +01:00
parent 6c1c935260
commit 3a9b0d69f0
9 changed files with 1575 additions and 4141 deletions

View File

@ -1,10 +1,18 @@
const antfu = require('@antfu/eslint-config').default;
const antfu = require('@antfu/eslint-config');
const generalConfig = require('./eslint/general');
const testConfig = require('./eslint/test');
const typedConfig = require('./eslint/typed');
const unicornConfig = require('./eslint/unicorn');
const configs = antfu(
// The default ignore list contains all `output` folders, which conflicts with our src/http/output folder
// See https://github.com/antfu/eslint-config/blob/7071af7024335aad319a91db41ce594ebc6a0899/src/globs.ts#L55
const index = antfu.GLOB_EXCLUDE.indexOf('**/output');
if (index < 0) {
throw new Error('Could not update GLOB_EXCLUDE. Check if antfu changed how it handles ignores.');
}
antfu.GLOB_EXCLUDE.splice(index, 1);
module.exports = antfu.default(
{
// Don't want to lint test assets, or TS snippets in markdown files
ignores: [ 'test/assets/*', '**/*.md/**/*.ts' ],
@ -35,12 +43,3 @@ const configs = antfu(
},
},
);
// The default ignore list contains all `output` folders, which conflicts with our src/http/output folder
// See https://github.com/antfu/eslint-config/blob/29f29f1e16d0187f5c870102f910d798acd9b874/src/globs.ts#L53
if (!configs[1].ignores.includes('**/output')) {
throw new Error('Unexpected data in config position. Check if antfu changed how it handles ignores.');
}
delete configs[1].ignores;
module.exports = configs;

View File

@ -61,6 +61,8 @@ module.exports = {
'style/block-spacing': 'off',
'style/brace-style': [ 'error', '1tbs', { allowSingleLine: false }],
'style/generator-star-spacing': [ 'error', { before: false, after: true }],
// Seems to be inconsistent in when it adds indentation and when it does not
'style/indent-binary-ops': 'off',
'style/member-delimiter-style': [ 'error', {
multiline: { delimiter: 'semi', requireLast: true },
singleline: { delimiter: 'semi', requireLast: false },

5679
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -143,7 +143,7 @@
"yup": "^1.3.2"
},
"devDependencies": {
"@antfu/eslint-config": "^1.0.0-beta.27",
"@antfu/eslint-config": "2.3.4",
"@commitlint/cli": "^17.7.2",
"@commitlint/config-conventional": "^17.7.0",
"@inrupt/solid-client-authn-core": "^1.17.3",

View File

@ -144,7 +144,6 @@ export function transformSafely<T = any>(
source: NodeJS.ReadableStream,
{
transform = function(data): void {
// eslint-disable-next-line ts/no-invalid-this
this.push(data);
},
flush = (): null => null,

View File

@ -310,6 +310,7 @@ describe('An IdentityProviderFactory', (): void => {
expect(use).toHaveBeenCalledTimes(1);
const middleware = use.mock.calls[0][0];
// eslint-disable-next-line jest/unbound-method
const oldAccept = ctx.accepts;
const next = jest.fn();
await expect(middleware(ctx, next)).resolves.toBeUndefined();
@ -325,6 +326,7 @@ describe('An IdentityProviderFactory', (): void => {
expect(use).toHaveBeenCalledTimes(1);
const middleware = use.mock.calls[0][0];
// eslint-disable-next-line jest/unbound-method
const oldAccept = ctx.accepts;
const next = jest.fn();
await expect(middleware(ctx, next)).resolves.toBeUndefined();

View File

@ -22,8 +22,8 @@ describe('A ClusterManager', (): void => {
beforeAll((): void => {
Object.assign(mockCluster, {
fork: jest.fn().mockImplementation((): any => mockWorker),
on: jest.fn().mockImplementation(emitter.on),
emit: jest.fn().mockImplementation(emitter.emit),
on: jest.fn().mockImplementation(emitter.on.bind(emitter)),
emit: jest.fn().mockImplementation(emitter.emit.bind(emitter)),
isMaster: true,
isWorker: false,
});

View File

@ -819,7 +819,7 @@ describe('A DataAccessorBasedStore', (): void => {
const auxResourceID = { path: `${root}resource.dummy` };
accessor.data[resourceID.path] = representation;
accessor.data[auxResourceID.path] = representation;
const deleteFn = accessor.deleteResource;
const deleteFn = accessor.deleteResource.bind(accessor);
jest.spyOn(accessor, 'deleteResource')
.mockImplementation(async(identifier: ResourceIdentifier): Promise<void> => {
if (auxiliaryStrategy.isAuxiliaryIdentifier(identifier)) {
@ -862,6 +862,7 @@ describe('A DataAccessorBasedStore', (): void => {
it('should rethrow any unexpected errors from validateIdentifier.', async(): Promise<void> => {
const resourceID = { path: `${root}resource` };
// eslint-disable-next-line jest/unbound-method
const originalMetaData = accessor.getMetadata;
jest.spyOn(accessor, 'getMetadata').mockImplementation(async(): Promise<any> => {
throw new Error('error');

View File

@ -33,7 +33,7 @@ describe('A LockingResourceStore', (): void => {
}
const readable = guardedStreamFrom([ 1, 2, 3 ]);
const { destroy } = readable;
const destroy = readable.destroy.bind(readable);
jest.spyOn(readable, 'destroy').mockImplementation((error): any => destroy.call(readable, error));
source = {
getRepresentation: jest.fn((): any => addOrder('getRepresentation', { data: readable } as Representation)),