From 394f436a2a0b73b9352b9ed0bc90fd9ee8955786 Mon Sep 17 00:00:00 2001 From: Matthew Bull Date: Mon, 6 Nov 2017 09:32:58 +0000 Subject: [PATCH] Scaffolded rule directory --- types/koa-joi-router/index.d.ts | 27 +++++++ types/koa-joi-router/koa-joi-router-tests.ts | 9 +++ types/koa-joi-router/tsconfig.json | 23 ++++++ types/koa-joi-router/tslint.json | 79 ++++++++++++++++++++ 4 files changed, 138 insertions(+) create mode 100644 types/koa-joi-router/index.d.ts create mode 100644 types/koa-joi-router/koa-joi-router-tests.ts create mode 100644 types/koa-joi-router/tsconfig.json create mode 100644 types/koa-joi-router/tslint.json diff --git a/types/koa-joi-router/index.d.ts b/types/koa-joi-router/index.d.ts new file mode 100644 index 0000000000..5230dc3712 --- /dev/null +++ b/types/koa-joi-router/index.d.ts @@ -0,0 +1,27 @@ +import * as Koa from 'koa'; +import * as Joi from 'joi'; + +declare type METHODS = 'POST' | 'GET' | 'DELETE' | 'PUT' | 'PATCH' | 'OPTIONS' | 'HEAD'; + +interface ISpec { + method: METHODS; + path: string|RegExp; + handler: (ctx: Koa.Context) => void; + validate: { + type: string; + body?: Joi.AnySchema; + params?: Joi.AnySchema; + [status: number]: Joi.AnySchema; + }; +} + +declare class Router { + route(spec: ISpec): Router; + middleware(): Koa.Middleware; +} + +declare function createRouter(): Router; + +declare namespace createRouter {} + +export = createRouter; diff --git a/types/koa-joi-router/koa-joi-router-tests.ts b/types/koa-joi-router/koa-joi-router-tests.ts new file mode 100644 index 0000000000..96fea85da4 --- /dev/null +++ b/types/koa-joi-router/koa-joi-router-tests.ts @@ -0,0 +1,9 @@ +import * as router from 'koa-joi-router'; + +const spec1 = { + route: '/user', + method: 'POST', + handler: (ctx) => ctx.body = ''; +}; + +router().route(spec1); \ No newline at end of file diff --git a/types/koa-joi-router/tsconfig.json b/types/koa-joi-router/tsconfig.json new file mode 100644 index 0000000000..5c4ba0f656 --- /dev/null +++ b/types/koa-joi-router/tsconfig.json @@ -0,0 +1,23 @@ +{ + "files": [ + "index.d.ts", + "koa-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/koa-joi-router/tslint.json b/types/koa-joi-router/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/koa-joi-router/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +}