Skip to content

Commit

Permalink
lint: deno fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Sorikairox committed Jan 1, 2023
1 parent e27d8e5 commit 17b9db7
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 24 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<img src="https://user-images.githubusercontent.com/38007824/205580360-fa032554-5e9e-4266-8ec9-c78ca9a233bc.svg" width="250" alt="Danet Logo" />
</p>


[![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)
Expand Down
2 changes: 0 additions & 2 deletions spec/method-param-decorator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions src/exception/filter/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
3 changes: 2 additions & 1 deletion src/guard/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
export const UseGuard = (guard: Constructor) =>
SetMetadata(guardMetadataKey, guard);
33 changes: 17 additions & 16 deletions src/metadata/decorator.ts
Original file line number Diff line number Diff line change
@@ -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<any>,
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<any>,
) => {
if (propertyKey && descriptor) {
MetadataHelper.setMetadata(
key,
value,
descriptor.value,
);
} else {
MetadataHelper.setMetadata(key, value, target);
}
};
if (propertyKey && descriptor) {
MetadataHelper.setMetadata(
key,
value,
descriptor.value,
);
} else {
MetadataHelper.setMetadata(key, value, target);
}
};
3 changes: 2 additions & 1 deletion src/router/controller/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export type HttpMethod =
| 'OPTIONS'
| 'HEAD';

export const Controller = <T>(endpoint = '') => SetMetadata('endpoint', endpoint);
export const Controller = <T>(endpoint = '') =>
SetMetadata('endpoint', endpoint);
function createMappingDecorator(method?: HttpMethod) {
return (endpoint = ''): MethodDecorator => {
return (_target, _propertyKey, descriptor) => {
Expand Down
3 changes: 2 additions & 1 deletion src/router/middleware/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
export const Middleware = (...middlewares: PossibleMiddlewareType[]) =>
SetMetadata(middlewareMetadataKey, middlewares);

0 comments on commit 17b9db7

Please sign in to comment.