From 89867fbc169adc06162fc8936b95e35ce4b0554c Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Tue, 7 Nov 2017 10:23:00 +0700 Subject: [PATCH] Various tweaks --- package.json | 4 ++-- source/tests/test.ts | 26 +++++++++++++++----------- tsconfig.json | 37 +++++++++++++++++++++---------------- 3 files changed, 38 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 1fcc978..ae72df0 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "node": ">=4" }, "scripts": { - "lint": "tslint --project .", + "lint": "tslint --format stylish --project .", "build": "tsc", "test": "npm run lint && npm run build && ava dist/tests", "prepublish": "npm run build && del dist/tests" @@ -53,7 +53,7 @@ "del-cli": "^1.1.0", "jsdom": "^9.12.0", "tslint": "^5.8.0", - "tslint-xo": "^0.2.2", + "tslint-xo": "^0.3.0", "typescript": "^2.6.1" }, "types": "dist/index.d.ts" diff --git a/source/tests/test.ts b/source/tests/test.ts index 6e9246a..9b350c5 100644 --- a/source/tests/test.ts +++ b/source/tests/test.ts @@ -72,13 +72,13 @@ const types = new Map([ ['function', { is: m.function_, fixtures: [ - // tslint:disable:no-empty no-unused-variable only-arrow-functions no-function-expression - function foo() {}, // tslint:disable-line:no-unused - function() {}, + // tslint:disable:no-unused no-empty no-unused-variable only-arrow-functions no-function-expression + function foo() {}, + function () {}, () => {}, - async function() {}, - function *(): any {} - // tslint:enable:no-empty no-unused-variable only-arrow-functions no-function-expression + async function () {}, + function * (): any {} + // tslint:enable:no-unused no-empty no-unused-variable only-arrow-functions no-function-expression ] }], ['buffer', { @@ -130,19 +130,23 @@ const types = new Map([ ['generator', { is: m.generator, fixtures: [ - (function *() { yield 4; })() // tslint:disable-line + (function * () { + yield 4; + })() ] }], ['generatorFunction', { is: m.generatorFunction, fixtures: [ - function *() { yield 4; } // tslint:disable-line + function * () { + yield 4; + } ] }], ['asyncFunction', { is: m.asyncFunction, fixtures: [ - async function() {}, // tslint:disable-line:no-empty only-arrow-functions no-function-expression + async function () {}, // tslint:disable-line:no-empty only-arrow-functions no-function-expression async () => {} // tslint:disable-line:no-empty ] }], @@ -282,7 +286,7 @@ const types = new Map([ document.createProcessingInstruction('xml-stylesheet', 'href="mycss.css" type="text/css"'), document.createComment('This is a comment'), document, - document.implementation.createDocumentType('svg:svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'), // tslint:disable-line + document.implementation.createDocumentType('svg:svg', '-//W3C//DTD SVG 1.1//EN', 'https://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'), document.createDocumentFragment() ] }], @@ -579,7 +583,7 @@ test('is.typedArray', t => { }); test('is.arrayLike', t => { - (() => { + (function () { // tslint:disable-line:only-arrow-functions t.true(m.arrayLike(arguments)); })(); t.true(m.arrayLike([])); diff --git a/tsconfig.json b/tsconfig.json index 7448590..05773b4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,25 @@ { - "compileOnSave": true, "compilerOptions": { - /* es2015 requires moduleResolution and module to be set, - see https://github.com/Microsoft/TypeScript/issues/8189 */ - "target": "es2015", - "moduleResolution": "node", - "module": "none", - "strict": true, - "declaration": true, - "sourceMap": true, "outDir": "dist", - "removeComments": true, - "lib": [ - "es2015", - "dom", - "scripthost" - ] - } + "target": "es2015", + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + "pretty": true, + "newLine": "lf", + "stripInternal": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "alwaysStrict": true + }, + "exclude": [ + "node_modules", + "dist" + ] }