diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..e632239 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,9 @@ +lib/ +es/ +es6/ +*.d.ts +src/**/*.js +test/**/*.js +.eslintrc.js +jest.config.js +coverage diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..824e691 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,74 @@ +/* + Rules Severity + - 0 = off + - 1 = warn + - 2 = error +*/ +{ + "env": { + "node": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaFeatures": { + "impliedStrict": true + }, + "ecmaVersion": "latest", + "project": "./tsconfig.json", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint", + "typescript-sort-keys" + ], + "rules": { + // Javscript Specific Rules That Are Applied To Typescript Too + "max-len": [ + "error", + { + "code": 80, + "ignoreComments": true, + "ignorePattern": "^(import)|(it\\()", + "ignoreTemplateLiterals": true + } + ], + "no-console": 1, + "quotes": [ + 2, + "single" + ], + "semi": 2, + "sort-keys": [ + 2, + "asc", + { + "caseSensitive": true, + "natural": false, + "minKeys": 2 + } + ], + // Typescript Specific Rules From This Point On + "typescript-sort-keys/interface": 2, + "typescript-sort-keys/string-enum": 0, + "@typescript-eslint/explicit-function-return-type": 2, + "@typescript-eslint/no-explicit-any": 2, + "@typescript-eslint/no-inferrable-types": 2, + "@typescript-eslint/no-non-null-assertion": 2, + "@typescript-eslint/no-unsafe-call": 2, + "@typescript-eslint/no-unsafe-member-access": 2, + "@typescript-eslint/no-unused-vars": [ + 2, + { + "argsIgnorePattern": "_", + "ignoreRestSiblings": true + } + ], + "@typescript-eslint/no-var-requires": 2, + "@typescript-eslint/require-await": 2 + } +} \ No newline at end of file diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..d4f6575 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,6 @@ +name-template: 'Next Release' +tag-template: 'next' +change-template: '- $TITLE #$NUMBER' +no-changes-template: '- No changes yet' +template: | + $CHANGES diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..0f90665 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,34 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 14.x, 16.x] + ts-project: [src/tsconfig.json, src/tsconfig-es6.json] + + env: + TS_NODE_PROJECT: ${{ matrix.ts-project }} + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm cache clean --force + - run: npm ci + - run: npm run build --if-present + - run: npm test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 286fd4e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: node_js -node_js: -- stable -- 16 -- 14 -- 12 -- 10 -- 8 -before_install: -- npm install -g codeclimate-test-reporter -after_success: -- codeclimate-test-reporter < coverage/lcov.info diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 6987b5f..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,181 +0,0 @@ -"use strict"; - -//****************************************************************************** -//* DEPENDENCIES -//****************************************************************************** -const gulp = require("gulp"), - tslint = require("gulp-tslint"), - tsc = require("gulp-typescript"), - mocha = require("gulp-mocha"), - istanbul = require("gulp-istanbul"), - sourcemaps = require("gulp-sourcemaps"), - del = require('del'); - -//****************************************************************************** -//* CLEAN -//****************************************************************************** -gulp.task("clean", function () { - return del([ - "src/**/*.js", - "test/**/*.test.js", - "src/*.js", - "test/*.test.js", - "lib", - "es", - "amd" - ]); -}); - -//****************************************************************************** -//* LINT -//****************************************************************************** -gulp.task("lint", function () { - - const config = { - fornatter: "verbose", - emitError: (process.env.CI) ? true : false - }; - - return gulp.src([ - "src/**/**.ts", - "test/**/**.test.ts" - ]) - .pipe(tslint(config)) - .pipe(tslint.report()); -}); - -//****************************************************************************** -//* SOURCE -//****************************************************************************** -const tsLibProject = tsc.createProject("tsconfig.json", { - module: "commonjs" -}); - -gulp.task("build-lib", function () { - return gulp.src([ - "src/**/*.ts" - ]) - .pipe(tsLibProject()) - .on("error", function (err) { - process.exit(1); - }) - .js.pipe(gulp.dest("lib/")); -}); - -const tsEsProject = tsc.createProject("tsconfig.json", { - module: "es2015" -}); - -gulp.task("build-es", function () { - return gulp.src([ - "src/**/*.ts" - ]) - .pipe(tsEsProject()) - .on("error", function (err) { - process.exit(1); - }) - .js.pipe(gulp.dest("es/")); -}); - -const tsDtsProject = tsc.createProject("tsconfig.json", { - declaration: true, - noResolve: false -}); - -gulp.task("build-dts", function () { - return gulp.src([ - "src/**/*.ts" - ]) - .pipe(tsDtsProject()) - .on("error", function (err) { - process.exit(1); - }) - .dts.pipe(gulp.dest("dts")); - -}); - -//****************************************************************************** -//* TESTS -//****************************************************************************** -const tstProject = tsc.createProject("tsconfig.json"); - -gulp.task("build-src", function () { - return gulp.src([ - "src/**/*.ts" - ]) - .pipe(sourcemaps.init()) - .pipe(tstProject()) - .on("error", function (err) { - process.exit(1); - }) - .js.pipe(sourcemaps.write(".", { - sourceRoot: function (file) { - return file.cwd + '/src'; - } - })) - .pipe(gulp.dest("src/")); -}); - -const tsTestProject = tsc.createProject("tsconfig.json"); -gulp.task("build-test", function () { - return gulp.src([ - "test/**/*.ts" - ]) - .pipe(sourcemaps.init()) - .pipe(tsTestProject()) - .on("error", function (err) { - process.exit(1); - }) - .js.pipe(sourcemaps.write(".", { - sourceRoot: function (file) { - return file.cwd + '/test'; - } - })) - .pipe(gulp.dest("test/"));; -}); - -gulp.task("mocha", function () { - return gulp.src([ - "node_modules/reflect-metadata/Reflect.js", - "test/**/*.test.js" - ]) - .pipe(mocha({ - ui: "bdd" - })) - .pipe(istanbul.writeReports()); -}); - -gulp.task("istanbul:hook", function () { - return gulp.src(["src/**/*.js"]) - // Covering files - .pipe(istanbul()) - // Force `require` to return covered files - .pipe(istanbul.hookRequire()); -}); - -gulp.task("test", gulp.series( - "istanbul:hook", - "mocha", -)); - -gulp.task("build", - gulp.series( - "lint", - gulp.parallel( - "build-src" - , "build-test" - , "build-es" - , "build-lib" - , "build-dts" - ), - - ) -); - -//****************************************************************************** -//* DEFAULT -//****************************************************************************** -gulp.task("default", gulp.series( - "build", - "test", -)); diff --git a/jest.config.json b/jest.config.json new file mode 100644 index 0000000..54aa69b --- /dev/null +++ b/jest.config.json @@ -0,0 +1,26 @@ +{ + "collectCoverage": true, + "coverageDirectory": "/coverage", + "coverageReporters": [ + "html", + "json", + "text" + ], + "moduleFileExtensions": [ + "js", + "json", + "ts" + ], + "rootDir": ".", + "setupFilesAfterEnv": [ + "/test/helpers/jest.setup.ts" + ], + "testEnvironment": "node", + "testPathIgnorePatterns": [ + "node_modules" + ], + "testRegex": ".test.ts$", + "transform": { + "^.+\\.ts$": "ts-jest" + } +} \ No newline at end of file diff --git a/package.json b/package.json index d50aade..c8c6439 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,12 @@ "jsnext:main": "es/index.js", "typings": "./dts/index.d.ts", "scripts": { - "test": "gulp", + "build": "npm run build:lib && npm run build:es && npm run build:es6", + "build:lib": "tsc -p src/tsconfig.json", + "build:es": "tsc -p src/tsconfig-es.json", + "build:es6": "tsc -p src/tsconfig-es6.json", + "clean": "rm -r es es6 lib", + "test": "jest", "publish-please": "publish-please", "prepublish": "publish-please guard", "update": "updates --update --minor && npm install", @@ -29,30 +34,21 @@ }, "homepage": "https://github.com/inversify/inversify-restify-utils#readme", "devDependencies": { - "@types/chai": "^4.3.4", - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.10", - "@types/restify": "^8.5.5", - "@types/sinon": "^10.0.13", - "@types/supertest": "^2.0.12", - "chai": "^4.3.7", - "del": "^6.1.1", - "gulp": "^4.0.2", - "gulp-istanbul": "^1.1.3", - "gulp-mocha": "^8.0.0", - "gulp-sourcemaps": "^3.0.0", - "gulp-tslint": "^8.1.4", - "gulp-typescript": "^5.0.1", - "inversify": "^5.1.1", - "mocha": "^10.1.0", - "publish-please": "^5.5.2", - "reflect-metadata": "^0.1.13", - "sinon": "^15.0.0", - "source-map-support": "^0.5.21", - "supertest": "^6.3.1", - "tslint": "^5.20.1", - "typescript": "^3.9.10", - "updates": "^13.2.2" + "@types/jest": "27.4.0", + "@types/node": "18.11.18", + "@types/restify": "8.5.5", + "@types/supertest": "2.0.12", + "chai": "4.3.7", + "del": "6.1.1", + "inversify": "5.1.1", + "jest": "27.4.7", + "publish-please": "5.5.2", + "reflect-metadata": "0.1.13", + "source-map-support": "0.5.21", + "supertest": "6.3.3", + "ts-jest": "27.1.3", + "typescript": "4.5.5", + "updates": "13.2.7" }, "peerDependencies": { "restify": ">=8.6.1" diff --git a/src/tsconfig-es.json b/src/tsconfig-es.json new file mode 100644 index 0000000..2e545da --- /dev/null +++ b/src/tsconfig-es.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "outDir": "../es", + "module": "ES2015" + }, + "extends": "../tsconfig.json", + "include": [ + "./**/*.ts" + ] +} \ No newline at end of file diff --git a/src/tsconfig-es6.json b/src/tsconfig-es6.json new file mode 100644 index 0000000..c2607ad --- /dev/null +++ b/src/tsconfig-es6.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "ES6", + "outDir": "../es6" + }, + "extends": "../tsconfig.json", + "include": [ + "./**/*.ts" + ] +} \ No newline at end of file diff --git a/src/tsconfig.json b/src/tsconfig.json new file mode 100644 index 0000000..7e0412d --- /dev/null +++ b/src/tsconfig.json @@ -0,0 +1,12 @@ +{ + "include": [ + "./**/*.ts" + ], + "extends": "../tsconfig.json", + "compilerOptions": { + "composite": true, + "declaration": true, + "outDir": "../lib", + "rootDir": "." + }, +} \ No newline at end of file diff --git a/test/bugs.test.ts b/test/bugs.test.ts index 9fc7679..f61ba2a 100644 --- a/test/bugs.test.ts +++ b/test/bugs.test.ts @@ -1,6 +1,4 @@ -import { expect } from "chai"; import { Container, injectable } from "inversify"; -import { spy } from "sinon"; import request from "supertest"; import { TYPE } from "../src/constants"; import { Controller, Get } from "../src/decorators"; @@ -22,7 +20,7 @@ describe("Unit Test: Bugs", () => { } } - let spyA = spy((req: any, res: any) => null); + let spyA = jest.fn((req: any, res: any) => null); container.bind(TYPE.Controller).to(TestController).whenTargetNamed("TestController"); @@ -35,7 +33,7 @@ describe("Unit Test: Bugs", () => { .get("/noPromise") .set("Accept", "text/plain") .expect(200, "GET", () => { - expect(spyA.calledOnce).to.eq(true); + expect(spyA).toHaveBeenCalledTimes(1); done(); }); @@ -50,7 +48,7 @@ describe("Unit Test: Bugs", () => { } } - let spyA = spy((req: any, res: any) => null); + let spyA = jest.fn((req: any, res: any) => null); container.bind(TYPE.Controller).to(TestController).whenTargetNamed("TestController"); @@ -63,7 +61,7 @@ describe("Unit Test: Bugs", () => { .get("/") .set("Accept", "text/plain") .expect(200, "GET", () => { - expect(spyA.calledOnce).to.eq(true); + expect(spyA).toHaveBeenCalledTimes(1); done(); }); diff --git a/test/decorators.test.ts b/test/decorators.test.ts index 312ac64..97802aa 100644 --- a/test/decorators.test.ts +++ b/test/decorators.test.ts @@ -1,4 +1,3 @@ -import { expect } from "chai"; import { Controller, Method } from "../src/decorators"; import { interfaces } from "../src/interfaces"; @@ -13,9 +12,9 @@ describe("Unit Test: Controller Decorators", () => { let controllerMetadata: interfaces.ControllerMetadata = Reflect.getMetadata("_controller", TestController); - expect(controllerMetadata.middleware).eql(middleware); - expect(controllerMetadata.path).eql(path); - expect(controllerMetadata.target).eql(TestController); + expect(controllerMetadata.middleware).toEqual(middleware); + expect(controllerMetadata.path).toEqual(path); + expect(controllerMetadata.target).toEqual(TestController); done(); }); @@ -38,15 +37,15 @@ describe("Unit Test: Controller Decorators", () => { let methodMetadata: interfaces.ControllerMethodMetadata[] = Reflect.getMetadata("_controller-method", TestController); - expect(methodMetadata.length).eql(3); + expect(methodMetadata.length).toEqual(3); let metadata: interfaces.ControllerMethodMetadata = methodMetadata[0]; - expect(metadata.middleware).eql(middleware); - expect(metadata.options).eql(path); - expect(metadata.target.constructor).eql(TestController); - expect(metadata.key).eql("test"); - expect(metadata.method).eql(method); + expect(metadata.middleware).toEqual(middleware); + expect(metadata.options).toEqual(path); + expect(metadata.target.constructor).toEqual(TestController); + expect(metadata.key).toEqual("test"); + expect(metadata.method).toEqual(method); done(); }); }); diff --git a/test/framework.test.ts b/test/framework.test.ts index 96c9f15..8cdd36e 100644 --- a/test/framework.test.ts +++ b/test/framework.test.ts @@ -1,9 +1,5 @@ -import "reflect-metadata"; - -import { expect } from "chai"; import { Container, injectable } from "inversify"; import { Next, Request, RequestHandler, Response } from "restify"; -import { spy } from "sinon"; import request from "supertest"; import { TYPE } from "../src/constants"; import { Controller, Delete, Get, Head, Method, Patch, Post, Put } from "../src/decorators"; @@ -197,15 +193,15 @@ describe("Integration Tests:", () => { next(); } }; - let spyA = spy(middleware, "a"); - let spyB = spy(middleware, "b"); - let spyC = spy(middleware, "c"); + let spyA = jest.fn().mockImplementation(middleware.a); + let spyB = jest.fn().mockImplementation(middleware.b); + let spyC = jest.fn().mockImplementation(middleware.c); beforeEach((done) => { result = ""; - spyA.resetHistory(); - spyB.resetHistory(); - spyC.resetHistory(); + spyA.mockClear(); + spyB.mockClear(); + spyC.mockClear(); done(); }); @@ -221,10 +217,10 @@ describe("Integration Tests:", () => { request(server.build()) .get("/") .expect(200, "GET", function () { - expect(spyA.calledOnce).to.eq(true); - expect(spyB.calledOnce).to.eq(true); - expect(spyC.calledOnce).to.eq(true); - expect(result).to.equal("abc"); + expect(spyA).toHaveBeenCalledTimes(1); + expect(spyB).toHaveBeenCalledTimes(1); + expect(spyC).toHaveBeenCalledTimes(1); + expect(result).toEqual("abc"); done(); }); }); @@ -242,10 +238,10 @@ describe("Integration Tests:", () => { request(server.build()) .get("/") .expect(200, "GET", function () { - expect(spyA.calledOnce).to.eq(true); - expect(spyB.calledOnce).to.eq(true); - expect(spyC.calledOnce).to.eq(true); - expect(result).to.equal("abc"); + expect(spyA).toHaveBeenCalledTimes(1); + expect(spyB).toHaveBeenCalledTimes(1); + expect(spyC).toHaveBeenCalledTimes(1); + expect(result).toEqual("abc"); done(); }); }); @@ -262,18 +258,18 @@ describe("Integration Tests:", () => { server = new InversifyRestifyServer(container); server.setConfig((app) => { - app.use(spyA); - app.use(spyB); - app.use(spyC); + app.use(spyA); + app.use(spyB); + app.use(spyC); }); request(server.build()) .get("/") .expect(200, "GET", function () { - expect(spyA.calledOnce).to.eq(true); - expect(spyB.calledOnce).to.eq(true); - expect(spyC.calledOnce).to.eq(true); - expect(result).to.equal("abc"); + expect(spyA).toHaveBeenCalledTimes(1); + expect(spyB).toHaveBeenCalledTimes(1); + expect(spyC).toHaveBeenCalledTimes(1); + expect(result).toEqual("abc"); done(); }); }); @@ -290,16 +286,16 @@ describe("Integration Tests:", () => { server = new InversifyRestifyServer(container); server.setConfig((app) => { - app.use(spyA); + app.use(spyA); }); request(server.build()) .get("/") .expect(200, "GET", function () { - expect(spyA.calledOnce).to.eq(true); - expect(spyB.calledOnce).to.eq(true); - expect(spyC.calledOnce).to.eq(true); - expect(result).to.equal("abc"); + expect(spyA).toHaveBeenCalledTimes(1); + expect(spyB).toHaveBeenCalledTimes(1); + expect(spyC).toHaveBeenCalledTimes(1); + expect(result).toEqual("abc"); done(); }); }); @@ -323,9 +319,9 @@ describe("Integration Tests:", () => { request(server.build()) .get("/") .expect(200, "GET", function() { - expect(spyA.calledOnce).to.eq(true); - expect(spyB.calledOnce).to.eq(true); - expect(result).to.equal("ab"); + expect(spyA).toHaveBeenCalledTimes(1); + expect(spyB).toHaveBeenCalledTimes(1); + expect(result).toEqual("ab"); done(); }); }); @@ -349,10 +345,10 @@ describe("Integration Tests:", () => { request(server.build()) .get("/") - .expect(200, "GET", function() { - expect(spyA.calledOnce).to.eq(true); - expect(spyB.calledOnce).to.eq(true); - expect(result).to.equal("ab"); + .expect(200, "GET", () => { + expect(spyA).toHaveBeenCalledTimes(1); + expect(spyB).toHaveBeenCalledTimes(1); + expect(result).toEqual("ab"); done(); }); }); @@ -365,7 +361,7 @@ describe("Integration Tests:", () => { @Controller("/", symbolId) class TestController { @Get("/", strId) - public getTest(req: Request, res: Response) { res.send("GET"); } + public async getTest(req: Request, res: Response) { res.send("GET"); } } container.bind(TYPE.Controller).to(TestController).whenTargetNamed("TestController"); @@ -377,9 +373,9 @@ describe("Integration Tests:", () => { request(server.build()) .get("/") .expect(200, "GET", function() { - expect(spyA.calledOnce).to.eq(true); - expect(spyB.calledOnce).to.eq(true); - expect(result).to.equal("ab"); + expect(spyA).toHaveBeenCalledTimes(1); + expect(spyB).toHaveBeenCalledTimes(1); + expect(result).toEqual("ab"); done(); }); }); diff --git a/test/helpers/jest.setup.ts b/test/helpers/jest.setup.ts new file mode 100644 index 0000000..d2c9bc6 --- /dev/null +++ b/test/helpers/jest.setup.ts @@ -0,0 +1 @@ +import 'reflect-metadata'; diff --git a/test/server.test.ts b/test/server.test.ts index 78c49bd..6a5405f 100644 --- a/test/server.test.ts +++ b/test/server.test.ts @@ -1,7 +1,5 @@ -import { expect } from "chai"; import { Container, injectable } from "inversify"; import { Next, Request, Response, Server } from "restify"; -import { spy } from "sinon"; import { TYPE } from "../src/constants"; import { Controller, Method } from "../src/decorators"; import { InversifyRestifyServer } from "../src/server"; @@ -10,7 +8,7 @@ describe("Unit Test: InversifyRestifyServer", () => { it("should call the configFn", () => { let middleware = function(req: Request, res: Response, next: Next) { return; }; - let configFn = spy((app: Server) => { app.use(middleware); }); + let configFn = jest.fn((app: Server) => { app.use(middleware); }); let container = new Container(); @injectable() @@ -21,11 +19,11 @@ describe("Unit Test: InversifyRestifyServer", () => { server.setConfig(configFn); - expect(configFn.called).to.eq(false); + expect(configFn).not.toHaveBeenCalled(); server.build(); - expect(configFn.calledOnce).to.eq(true); + expect(configFn).toHaveBeenCalledTimes(1); }); it("should generate routes for controller methods", () => { @@ -51,14 +49,14 @@ describe("Unit Test: InversifyRestifyServer", () => { let routes = (Object).values(app.router.getRoutes()); let routeOne = routes.find((route: any) => route.path === "/root/routeOne" && route.method === "GET"); - expect(routeOne).not.to.eq(undefined); + expect(routeOne).not.toEqual(undefined); let routeTwo = routes.find((route: any) => route.path === "/root/routeTwo" && route.method === "GET"); - expect(routeTwo).not.to.eq(undefined); - expect((routeTwo).spec.options).to.eq("test"); + expect(routeTwo).not.toEqual(undefined); + expect((routeTwo).spec.options).toEqual("test"); let routeThree = routes.find((route: any) => route.path === "/root/routeThree" && route.method === "GET"); - expect(routeThree).not.to.eq(undefined); + expect(routeThree).not.toEqual(undefined); }); @@ -89,14 +87,14 @@ describe("Unit Test: InversifyRestifyServer", () => { let routes = (Object).values(app.router.getRoutes()); let routeOne = routes.find((route: any) => route.path === "/v1/root/routeOne" && route.method === "GET"); - expect(routeOne).not.to.eq(undefined); + expect(routeOne).not.toEqual(undefined); let routeTwo = routes.find((route: any) => route.path === "/v1/root/routeTwo" && route.method === "GET"); - expect(routeTwo).not.to.eq(undefined); - expect((routeTwo).spec.options).to.eq("test"); + expect(routeTwo).not.toEqual(undefined); + expect((routeTwo).spec.options).toEqual("test"); let routeThree = routes.find((route: any) => route.path === "/v1/root/routeThree" && route.method === "GET"); - expect(routeThree).not.eq(undefined); + expect(routeThree).not.toEqual(undefined); }); diff --git a/test/tsconfig.json b/test/tsconfig.json new file mode 100644 index 0000000..dd0cf88 --- /dev/null +++ b/test/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "rootDir": ".", + "noUnusedLocals": false, + "strict": false + }, + "extends": "../tsconfig.json", + "include": [ + "./**/*.ts" + ], + "references": [ + { + "path": "../src" + } + ] +} diff --git a/tsconfig.json b/tsconfig.json index 12d4e8a..a1e5c51 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,24 +1,47 @@ { - "compilerOptions": { - "lib": ["es2017"], - "module": "commonjs", - "target": "es2017", // node 8 - "strict": true, - "strictPropertyInitialization": false, // should be true - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "node", - "allowUnusedLabels": false, - "allowUnreachableCode": false, - "noFallthroughCasesInSwitch": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "noUnusedParameters": false, // should be true - "importsNotUsedAsValues": "remove", // should be error - "types": ["inversify", "mocha", "reflect-metadata", "restify"], - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "removeComments": true - } -} + "compilerOptions": { + "allowJs": true, + "allowSyntheticDefaultImports": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "alwaysStrict": true, + "assumeChangesOnlyAffectDirectDependencies": true, + "emitDecoratorMetadata": true, + "esModuleInterop": true, + "exactOptionalPropertyTypes": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true, + "importsNotUsedAsValues": "remove", + "incremental": true, + "isolatedModules": true, + "module": "commonjs", + "moduleResolution": "node", + "noErrorTruncation": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noPropertyAccessFromIndexSignature": true, + "noUncheckedIndexedAccess": true, + "noUnusedParameters": false, + "pretty": true, + "removeComments": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": false, + "strict": true, + "target": "ES5", + "types": [ + "node", + "reflect-metadata", + "jest" + ], + "typeRoots": [ + "node_modules/@types" + ] + }, + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 736615f..0000000 --- a/tslint.json +++ /dev/null @@ -1,67 +0,0 @@ - -{ - "rules": { - "class-name": true, - "comment-format": [true, "check-space"], - "curly": true, - "eofline": true, - "forin": true, - "indent": [true, "spaces"], - "label-position": true, - "max-line-length": [true, 140], - "member-access": true, - "member-ordering": [true, - "public-before-private", - "static-before-instance", - "variables-before-functions" - ], - "no-arg": true, - "no-bitwise": true, - "no-console": [true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-construct": true, - "no-debugger": true, - "no-duplicate-variable": true, - "no-empty": true, - "no-eval": true, - "no-inferrable-types": true, - "no-shadowed-variable": true, - "no-string-literal": true, - "no-switch-case-fall-through": false, - "no-trailing-whitespace": true, - "no-unused-expression": true, - "no-var-keyword": true, - "object-literal-sort-keys": true, - "one-line": [true, - "check-open-brace", - "check-catch", - "check-else", - "check-whitespace" - ], - "quotemark": [true, "double", "avoid-escape"], - "radix": true, - "semicolon": true, - "trailing-comma": false, - "triple-equals": [true, "allow-null-check"], - "typedef-whitespace": [true, { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }], - "variable-name": false, - "whitespace": [true, - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type" - ] - } -} \ No newline at end of file