Skip to content

Commit

Permalink
chore(deps): update dependency @types/lodash to v4.17.10 (golevelup#800)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
renovate[bot] authored Oct 6, 2024
1 parent be0ae70 commit 334e87f
Show file tree
Hide file tree
Showing 23 changed files with 12,910 additions and 2,726 deletions.
27 changes: 0 additions & 27 deletions .eslintrc.js

This file was deleted.

49 changes: 49 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ['**/*.d.ts', '**/node_modules/', '**/*.js'],
},
...compat.extends('plugin:@typescript-eslint/recommended', 'prettier'),
{
plugins: {
'@typescript-eslint': typescriptEslint,
},

languageOptions: {
globals: {
...globals.node,
...globals.jest,
},

parser: tsParser,
ecmaVersion: 2018,
sourceType: 'commonjs',

parserOptions: {
source: 'module',
},
},

rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/camelcase': 'off',
},
},
];
1 change: 0 additions & 1 deletion integration/rabbitmq/e2e/configuration.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ describe('Module Configuration', () => {
app = await Test.createTestingModule({
imports: [
RabbitMQModule.forRootAsync(RabbitMQModule, {
// eslint-disable-next-line
useFactory: async () => {
return {
exchanges: [
Expand Down
2 changes: 1 addition & 1 deletion integration/rabbitmq/e2e/connection-failover.e2e-spec1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import { Controller, Get, Injectable, Module } from '@nestjs/common';
import { INestApplication } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import request = require('supertest');
import request from 'supertest';

const rabbitHost =
process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_HOST : 'localhost';
Expand Down
2 changes: 0 additions & 2 deletions integration/rabbitmq/e2e/multiple-channels.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ describe('Rabbit Multiple Channels', () => {
const payload = { message: 'hi' };
amqpConnection.publish(exchange, `${routePrefix}3`, payload);

// eslint-disable-next-line sonarjs/no-identical-functions
setTimeout(() => {
expect(pubsubMessageHandler).toHaveBeenCalledTimes(1);
expect(pubsubMessageHandler).toHaveBeenCalledWith(payload);
Expand All @@ -245,7 +244,6 @@ describe('Rabbit Multiple Channels', () => {
const payload = { message: 'guten tag' };
amqpConnection.publish(exchange, `${routePrefix}5`, payload);

// eslint-disable-next-line sonarjs/no-identical-functions
setTimeout(() => {
expect(pubsubMessageHandler).toHaveBeenCalledTimes(1);
expect(pubsubMessageHandler).toHaveBeenCalledWith(payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export class ControllerDiscoveryController {
errorBehavior: MessageHandlerErrorBehavior.ACK,
errorHandler: ReplyErrorCallback,
})
// eslint-disable-next-line sonarjs/no-identical-functions
pipedParamRpc(@RabbitPayload(ValidationPipe) message: number) {
return {
message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export class SubmoduleController {
errorBehavior: MessageHandlerErrorBehavior.ACK,
errorHandler: ReplyErrorCallback,
})
// eslint-disable-next-line sonarjs/no-identical-functions
pipedParamRpc(@RabbitPayload(ValidationPipe) message: number) {
return {
message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export class NamedConnectionController {
errorBehavior: MessageHandlerErrorBehavior.ACK,
errorHandler: ReplyErrorCallback,
})
// eslint-disable-next-line sonarjs/no-identical-functions
pipedParamRpc(@RabbitPayload(ValidationPipe) message: number) {
return {
message,
Expand Down
2 changes: 1 addition & 1 deletion integration/rabbitmq/src/validation.pipe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PipeTransform, Injectable, ArgumentMetadata } from '@nestjs/common';
import { PipeTransform, Injectable } from '@nestjs/common';
import { RpcException } from './rpc/rpc-exception';

@Injectable()
Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@
"@commitlint/cli": "^19.0.0",
"@commitlint/config-conventional": "^19.0.0",
"@commitlint/prompt": "^19.0.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.12.0",
"@nestjs/testing": "^10.0.5",
"@types/jest": "^27.0.3",
"@types/lodash": "^4.17.9",
"@types/lodash": "^4.17.10",
"@types/mime": "3.0.4",
"@types/node": "^20.16.10",
"@types/supertest": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^5.6.0",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "8.8.0",
"all-contributors-cli": "^6.26.1",
"commitizen": "^4.3.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-sonarjs": "^2.0.0",
"globals": "^15.10.0",
"husky": "^1.3.1",
"jest": "^27.4.3",
"lerna": "^6.0.0",
Expand Down Expand Up @@ -60,7 +63,7 @@
"test:ci": "jest --coverage --coverageReporters=cobertura --coverageReporters=html",
"test:vitest": "vitest",
"test:vitest:ci": "vitest run --coverage",
"lint": "eslint --ext ts .",
"lint": "eslint .",
"contributors:generate": "all-contributors generate"
},
"husky": {
Expand Down
2 changes: 1 addition & 1 deletion packages/discovery/src/discovery.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Type } from '@nestjs/common';
export interface DiscoveredModule<T = object> {
name: string;
instance: T;
// eslint-disable-next-line @typescript-eslint/ban-types
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
injectType?: Function | Type<any>;
dependencyType: Type<T>;
}
Expand Down
52 changes: 27 additions & 25 deletions packages/discovery/src/discovery.service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-function-type */
import { Injectable, Scope, Type } from '@nestjs/common';
import { PATH_METADATA } from '@nestjs/common/constants';
import { STATIC_CONTEXT } from '@nestjs/core/injector/constants';
Expand All @@ -21,11 +22,11 @@ import {
*/
export function getComponentMetaAtKey<T>(
key: MetaKey,
component: DiscoveredClass
component: DiscoveredClass,
): T | undefined {
const dependencyMeta = Reflect.getMetadata(
key,
component.dependencyType
component.dependencyType,
) as T;
if (dependencyMeta) {
return dependencyMeta;
Expand All @@ -43,10 +44,8 @@ export function getComponentMetaAtKey<T>(
*/
export const withMetaAtKey: (key: MetaKey) => Filter<DiscoveredClass> =
(key) => (component) => {
// eslint-disable-next-line @typescript-eslint/ban-types
const metaTargets: Function[] = [
get(component, 'instance.constructor') as any,
// eslint-disable-next-line @typescript-eslint/ban-types
component.injectType as Function,
].filter((x) => !isNil(x));

Expand All @@ -60,8 +59,8 @@ export class DiscoveryService {

constructor(
private readonly modulesContainer: ModulesContainer,
private readonly metadataScanner: MetadataScanner
) { }
private readonly metadataScanner: MetadataScanner,
) {}

/**
* Discovers all providers in a Nest App that match a filter
Expand All @@ -82,7 +81,7 @@ export class DiscoveryService {
*/
async methodsAndControllerMethodsWithMetaAtKey<T>(
metaKey: MetaKey,
metaFilter: Filter<T> = () => true
metaFilter: Filter<T> = () => true,
): Promise<DiscoveredMethodWithMeta<T>[]> {
const controllersWithMeta = (
await this.controllersWithMetaAtKey<T>(metaKey)
Expand All @@ -93,9 +92,9 @@ export class DiscoveryService {
(controller) => {
return this.classMethodsWithMetaAtKey<T>(
controller.discoveredClass,
PATH_METADATA
PATH_METADATA,
);
}
},
);

const decoratedMethods = (
Expand All @@ -104,7 +103,7 @@ export class DiscoveryService {

return uniqBy(
[...methodsFromDecoratedControllers, ...decoratedMethods],
(x) => x.discoveredMethod.handler
(x) => x.discoveredMethod.handler,
);
}

Expand All @@ -113,7 +112,7 @@ export class DiscoveryService {
* @param metaKey The metakey to scan for
*/
async providersWithMetaAtKey<T>(
metaKey: MetaKey
metaKey: MetaKey,
): Promise<DiscoveredClassWithMeta<T>[]> {
const providers = await this.providers(withMetaAtKey(metaKey));

Expand All @@ -128,7 +127,7 @@ export class DiscoveryService {
* @param filter
*/
async controllers(
filter: Filter<DiscoveredClass>
filter: Filter<DiscoveredClass>,
): Promise<DiscoveredClass[]> {
if (!this.discoveredControllers) {
this.discoveredControllers = this.discover('controllers');
Expand All @@ -141,7 +140,7 @@ export class DiscoveryService {
* @param metaKey The metakey to scan for
*/
async controllersWithMetaAtKey<T>(
metaKey: MetaKey
metaKey: MetaKey,
): Promise<DiscoveredClassWithMeta<T>[]> {
const controllers = await this.controllers(withMetaAtKey(metaKey));

Expand All @@ -158,7 +157,7 @@ export class DiscoveryService {
*/
classMethodsWithMetaAtKey<T>(
component: DiscoveredClass,
metaKey: MetaKey
metaKey: MetaKey,
): DiscoveredMethodWithMeta<T>[] {
const { instance } = component;

Expand All @@ -168,9 +167,12 @@ export class DiscoveryService {

const prototype = Object.getPrototypeOf(instance);

return this.metadataScanner.getAllMethodNames(prototype).map((name) =>
this.extractMethodMetaAtKey<T>(metaKey, component, prototype, name)
).filter((x) => !isNil(x.meta));
return this.metadataScanner
.getAllMethodNames(prototype)
.map((name) =>
this.extractMethodMetaAtKey<T>(metaKey, component, prototype, name),
)
.filter((x) => !isNil(x.meta));
}

/**
Expand All @@ -180,12 +182,12 @@ export class DiscoveryService {
*/
async providerMethodsWithMetaAtKey<T>(
metaKey: MetaKey,
providerFilter: Filter<DiscoveredClass> = () => true
providerFilter: Filter<DiscoveredClass> = () => true,
): Promise<DiscoveredMethodWithMeta<T>[]> {
const providers = await this.providers(providerFilter);

return flatMap(providers, (provider) =>
this.classMethodsWithMetaAtKey<T>(provider, metaKey)
this.classMethodsWithMetaAtKey<T>(provider, metaKey),
);
}

Expand All @@ -196,22 +198,22 @@ export class DiscoveryService {
*/
async controllerMethodsWithMetaAtKey<T>(
metaKey: MetaKey,
controllerFilter: Filter<DiscoveredClass> = () => true
controllerFilter: Filter<DiscoveredClass> = () => true,
): Promise<DiscoveredMethodWithMeta<T>[]> {
const controllers = await this.controllers(controllerFilter);

return flatMap(controllers, (controller) =>
this.classMethodsWithMetaAtKey<T>(controller, metaKey)
this.classMethodsWithMetaAtKey<T>(controller, metaKey),
);
}

private async toDiscoveredClass(
nestModule: Module,
wrapper: InstanceWrapper<any>
wrapper: InstanceWrapper<any>,
): Promise<DiscoveredClass> {
const instanceHost = wrapper.getInstanceByContextId(
STATIC_CONTEXT,
wrapper && wrapper.id ? wrapper.id : undefined
wrapper && wrapper.id ? wrapper.id : undefined,
);

if (instanceHost.isPending && !instanceHost.isResolved) {
Expand All @@ -236,7 +238,7 @@ export class DiscoveryService {
metaKey: MetaKey,
discoveredClass: DiscoveredClass,
prototype: any,
methodName: string
methodName: string,
): DiscoveredMethodWithMeta<T> {
const handler = prototype[methodName];
const meta: T = Reflect.getMetadata(metaKey, handler);
Expand All @@ -260,7 +262,7 @@ export class DiscoveryService {
return components
.filter((component) => component.scope !== Scope.REQUEST)
.map((component) => this.toDiscoveredClass(nestModule, component));
})
}),
);
}
}
1 change: 1 addition & 0 deletions packages/hasura/src/hasura.interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const exampleEvent = {
id: 'ecd5fe4a-7113-4243-bb0e-6177c78a0033',
table: { schema: 'public', name: 'user' },
Expand Down
Loading

0 comments on commit 334e87f

Please sign in to comment.