From de174b8894863a2210a99162b153ac6041f70886 Mon Sep 17 00:00:00 2001 From: Jerko Steiner Date: Fri, 18 Jan 2019 20:24:19 +0100 Subject: [PATCH] Create package common --- packages/server/.gitignore => .gitignore | 0 packages/common/src/index.ts | 21 ++++++++++++ packages/common/tsconfig.json | 19 +++++++++++ packages/common/tslint.json | 43 ++++++++++++++++++++++++ 4 files changed, 83 insertions(+) rename packages/server/.gitignore => .gitignore (100%) create mode 100644 packages/common/src/index.ts create mode 100644 packages/common/tsconfig.json create mode 100644 packages/common/tslint.json diff --git a/packages/server/.gitignore b/.gitignore similarity index 100% rename from packages/server/.gitignore rename to .gitignore diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts new file mode 100644 index 0000000..12d2789 --- /dev/null +++ b/packages/common/src/index.ts @@ -0,0 +1,21 @@ +export type IMethod = 'get' + | 'post' + | 'put' + | 'delete' + | 'patch' + | 'head' + | 'options' + +export interface IRoutes { + // has to be any because otherwise TypeScript will start + // throwing error and interfaces without an index signature + // would not be usable + [route: string]: any +} + +export interface IRoute { + params: any + query: any + body: any + response: any +} diff --git a/packages/common/tsconfig.json b/packages/common/tsconfig.json new file mode 100644 index 0000000..b360d6b --- /dev/null +++ b/packages/common/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "lib": ["es2015", "dom"], + "target": "es3", + "moduleResolution": "node", + "jsx": "react", + "noImplicitAny": true, + "strict": true, + "skipLibCheck": true, + "noUnusedLocals": true, + "esModuleInterop": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "plugins": [{ + "name": "typescript-tslint-plugin", + "suppressWhileTypeErrorsPresent": true + }] + } +} diff --git a/packages/common/tslint.json b/packages/common/tslint.json new file mode 100644 index 0000000..16a990c --- /dev/null +++ b/packages/common/tslint.json @@ -0,0 +1,43 @@ +{ + "defaultSeverity": "error", + "extends": [ + "tslint:recommended" + ], + "jsRules": {}, + "rules": { + "quotemark": [true, "single", "jsx-single"], + "member-access": false, + "no-bitwise": false, + "semicolon": [true, "never"], + "object-literal-sort-keys": false, + "ordered-imports": false, + "max-line-length": [true, 80], + "arrow-parens": false, + "variable-name": [ + true, + "ban-keywords", + "check-format", + "allow-leading-underscore", + "allow-pascal-case" + ], + "member-ordering": false, + "max-classes-per-file": false, + "no-empty-interface": false, + "trailing-comma": [true, { + "multiline": { + "objects": "always", + "arrays": "always", + "functions": "always", + "typeLiterals": "ignore" + }, + "singleline": "never", + "esSpecCompliant": true + }] + }, + "linterOptions": { + "exclude": [ + "src/server/migrations/*.ts" + ] + }, + "rulesDirectory": [] +}