From 17b9db77b43077a9ace06a8f2fd750bcb0b7d6ee Mon Sep 17 00:00:00 2001 From: Sorikairo Date: Mon, 2 Jan 2023 00:15:37 +0900 Subject: [PATCH] lint: deno fmt --- README.md | 1 - spec/method-param-decorator.test.ts | 2 -- src/exception/filter/decorator.ts | 6 ++++-- src/guard/decorator.ts | 3 ++- src/metadata/decorator.ts | 33 +++++++++++++++-------------- src/router/controller/decorator.ts | 3 ++- src/router/middleware/decorator.ts | 3 ++- 7 files changed, 27 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index c8d1d794..c497d4f6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ Danet Logo

- [![CI](https://github.com/Sorikairox/Danet/actions/workflows/run-tests.yml/badge.svg)](https://github.com/Sorikairox/Danet/actions/workflows/run-tests.yml) [![codecov](https://codecov.io/gh/Savory/Danet/branch/main/graph/badge.svg?token=R6WXVC669Z)](https://codecov.io/gh/Savory/Danet) ![Made for Deno](https://img.shields.io/badge/made%20for-Deno-6B82F6?style=flat-square) diff --git a/spec/method-param-decorator.test.ts b/spec/method-param-decorator.test.ts index 2ed23ac0..a894d039 100644 --- a/spec/method-param-decorator.test.ts +++ b/spec/method-param-decorator.test.ts @@ -230,7 +230,6 @@ Deno.test(`@Query decorator with no key and value 'first' to return the first va await app.close(); }); - Deno.test(`@Query decorator with no key and no option`, async () => { await app.init(MyModule); const listenEvent = await app.listen(0); @@ -247,7 +246,6 @@ Deno.test(`@Query decorator with no key and no option`, async () => { await app.close(); }); - Deno.test('@Header decorator with attribute', async () => { await app.init(MyModule); const listenEvent = await app.listen(0); diff --git a/src/exception/filter/decorator.ts b/src/exception/filter/decorator.ts index 764ba8c4..9532d1d4 100644 --- a/src/exception/filter/decorator.ts +++ b/src/exception/filter/decorator.ts @@ -2,6 +2,8 @@ import { Constructor } from '../../utils/constructor.ts'; import { SetMetadata } from '../../metadata/decorator.ts'; export const filterExceptionMetadataKey = 'filterException'; -export const UseFilter = (filter: Constructor) => SetMetadata(filterExceptionMetadataKey, filter); +export const UseFilter = (filter: Constructor) => + SetMetadata(filterExceptionMetadataKey, filter); export const filterCatchTypeMetadataKey = 'errorCaught'; -export const Catch = (ErrorType: Constructor) => SetMetadata(filterCatchTypeMetadataKey, ErrorType); +export const Catch = (ErrorType: Constructor) => + SetMetadata(filterCatchTypeMetadataKey, ErrorType); diff --git a/src/guard/decorator.ts b/src/guard/decorator.ts index 30fea298..ac6a4725 100644 --- a/src/guard/decorator.ts +++ b/src/guard/decorator.ts @@ -2,4 +2,5 @@ import { Constructor } from '../utils/constructor.ts'; import { SetMetadata } from '../metadata/decorator.ts'; export const guardMetadataKey = 'authGuards'; -export const UseGuard = (guard: Constructor) => SetMetadata(guardMetadataKey, guard); \ No newline at end of file +export const UseGuard = (guard: Constructor) => + SetMetadata(guardMetadataKey, guard); diff --git a/src/metadata/decorator.ts b/src/metadata/decorator.ts index d3d53c17..5780d40e 100644 --- a/src/metadata/decorator.ts +++ b/src/metadata/decorator.ts @@ -1,20 +1,21 @@ import { ControllerConstructor } from '../router/controller/constructor.ts'; import { MetadataHelper } from './helper.ts'; -export const SetMetadata = (key: string, value: unknown) => ( - // deno-lint-ignore ban-types - target: ControllerConstructor | Object, - propertyKey?: string | symbol, - // deno-lint-ignore no-explicit-any - descriptor?: TypedPropertyDescriptor, +export const SetMetadata = (key: string, value: unknown) => +( + // deno-lint-ignore ban-types + target: ControllerConstructor | Object, + propertyKey?: string | symbol, + // deno-lint-ignore no-explicit-any + descriptor?: TypedPropertyDescriptor, ) => { - if (propertyKey && descriptor) { - MetadataHelper.setMetadata( - key, - value, - descriptor.value, - ); - } else { - MetadataHelper.setMetadata(key, value, target); - } -}; \ No newline at end of file + if (propertyKey && descriptor) { + MetadataHelper.setMetadata( + key, + value, + descriptor.value, + ); + } else { + MetadataHelper.setMetadata(key, value, target); + } +}; diff --git a/src/router/controller/decorator.ts b/src/router/controller/decorator.ts index dfebb4ab..51e99c30 100644 --- a/src/router/controller/decorator.ts +++ b/src/router/controller/decorator.ts @@ -9,7 +9,8 @@ export type HttpMethod = | 'OPTIONS' | 'HEAD'; -export const Controller = (endpoint = '') => SetMetadata('endpoint', endpoint); +export const Controller = (endpoint = '') => + SetMetadata('endpoint', endpoint); function createMappingDecorator(method?: HttpMethod) { return (endpoint = ''): MethodDecorator => { return (_target, _propertyKey, descriptor) => { diff --git a/src/router/middleware/decorator.ts b/src/router/middleware/decorator.ts index d405b489..269dd6c0 100644 --- a/src/router/middleware/decorator.ts +++ b/src/router/middleware/decorator.ts @@ -19,4 +19,5 @@ export type PossibleMiddlewareType = | OakMiddleware; export const isMiddlewareClass = (s: PossibleMiddlewareType) => !!s.prototype; export const middlewareMetadataKey = 'middlewares'; -export const Middleware = (...middlewares: PossibleMiddlewareType[]) => SetMetadata(middlewareMetadataKey, middlewares); \ No newline at end of file +export const Middleware = (...middlewares: PossibleMiddlewareType[]) => + SetMetadata(middlewareMetadataKey, middlewares);