refactor: Use default TSLint configuration

This commit is contained in:
ExE Boss
2019-03-07 22:39:37 +01:00
parent af9058995f
commit 12cb57ea10
5 changed files with 43 additions and 125 deletions
+14 -20
View File
@@ -9,13 +9,11 @@
import tapeSync = require("tape");
export = tape;
declare function tape(name: string, cb: tape.TestCase): void
declare function tape(name: string | tape.TestOptions, cb: tape.TestCase): void;
declare function tape(name: string, opts: tape.TestOptions, cb: tape.TestCase): void;
declare function tape(cb: tape.TestCase): void;
declare function tape(opts: tape.TestOptions, cb: tape.TestCase): void;
declare namespace tape {
interface TestCase {
(test: Test): void | Iterator<any> | PromiseLike<void>;
}
@@ -23,45 +21,41 @@ declare namespace tape {
/**
* Available opts options for the tape function.
*/
interface TestOptions extends tapeSync.TestOptions {
}
type TestOptions = tapeSync.TestOptions;
/**
* Options for the createStream function.
*/
interface StreamOptions extends tapeSync.StreamOptions {
}
type StreamOptions = tapeSync.StreamOptions;
/**
* Generate a new test that will be skipped over.
*/
export function skip(name: string, cb: tape.TestCase): void;
export function skip(name: string, opts: tape.TestOptions, cb: tape.TestCase): void;
export function skip(cb: tape.TestCase): void;
export function skip(opts: tape.TestOptions, cb: tape.TestCase): void;
function skip(name: string | TestOptions, cb: TestCase): void;
function skip(name: string, opts: TestOptions, cb: TestCase): void;
function skip(cb: TestCase): void;
/**
* The onFinish hook will get invoked when ALL tape tests have finished right before tape is about to print the test summary.
*/
export function onFinish(cb: () => void): void;
function onFinish(cb: () => void): void;
/**
* Like test(name?, opts?, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored.
*/
export function only(name: string, cb: tape.TestCase): void;
export function only(name: string, opts: tape.TestOptions, cb: tape.TestCase): void;
export function only(cb: tape.TestCase): void;
export function only(opts: tape.TestOptions, cb: tape.TestCase): void;
function only(name: string | TestOptions, cb: TestCase): void;
function only(name: string, opts: TestOptions, cb: TestCase): void;
function only(cb: TestCase): void;
/**
* Create a new test harness instance, which is a function like test(), but with a new pending stack and test state.
*/
export function createHarness(): typeof tape;
function createHarness(): typeof tape;
/**
* Create a stream of output, bypassing the default output stream that writes messages to console.log().
* By default stream will be a text stream of TAP output, but you can get an object stream instead by setting opts.objectMode to true.
*/
export function createStream(opts?: tape.StreamOptions): NodeJS.ReadableStream;
function createStream(opts?: StreamOptions): NodeJS.ReadableStream;
interface Test extends tapeSync.Test {
/**
@@ -69,7 +63,7 @@ declare namespace tape {
* cb(st) will only fire when t finishes.
* Additional tests queued up after t will not be run until all subtests finish.
*/
test(name: string, cb: tape.TestCase): void;
test(name: string, opts: TestOptions, cb: tape.TestCase): void;
test(name: string, cb: TestCase): void;
test(name: string, opts: TestOptions, cb: TestCase): void;
}
}
@@ -2,10 +2,10 @@
import tape = require("tape-async");
var name: string;
var cb: (test: tape.Test) => Promise<void>;
var opts: tape.TestOptions;
var t: tape.Test;
let name: string;
let cb: (test: tape.Test) => Promise<void>;
let opts: tape.TestOptions;
let t: tape.Test;
tape(cb);
tape(name, cb);
@@ -2,17 +2,17 @@
import tape = require("tape-async");
var name: string;
var cb: (test: tape.Test) => IterableIterator<any>;
var opts: tape.TestOptions;
var t: tape.Test;
let name: string;
let cb: (test: tape.Test) => IterableIterator<any>;
let opts: tape.TestOptions;
let t: tape.Test;
tape(cb);
tape(name, cb);
tape(opts, cb);
tape(name, opts, cb);
tape(name, function* (test: tape.Test): IterableIterator<void> {
tape(name, function*(test: tape.Test): IterableIterator<void> {
t = test;
});
@@ -26,12 +26,12 @@ tape.only(name, cb);
tape.only(opts, cb);
tape.only(name, opts, cb);
tape(name, function* (test: tape.Test): IterableIterator<void> {
test.test(name, function* (st: tape.Test): IterableIterator<void> {
tape(name, function*(test: tape.Test): IterableIterator<void> {
test.test(name, function*(st: tape.Test): IterableIterator<void> {
t = st;
});
test.test(name, opts, function* (st: tape.Test): IterableIterator<void> {
test.test(name, opts, function*(st: tape.Test): IterableIterator<void> {
t = st;
});
});
+16 -20
View File
@@ -1,9 +1,9 @@
import tape = require("tape-async");
var name: string;
var cb: (test: tape.Test) => void;
var opts: tape.TestOptions;
var t: tape.Test;
let name: string;
let cb: (test: tape.Test) => void;
let opts: tape.TestOptions;
let t: tape.Test;
tape(cb);
tape(name, cb);
@@ -26,14 +26,12 @@ tape.only(name, opts, cb);
tape.onFinish(() => {});
var sopts: tape.StreamOptions;
var rs: NodeJS.ReadableStream;
let sopts: tape.StreamOptions;
let rs: NodeJS.ReadableStream;
rs = tape.createStream();
rs = tape.createStream(sopts);
var htest: typeof tape;
let htest: typeof tape;
htest = tape.createHarness();
class CustomException extends Error {
@@ -42,19 +40,17 @@ class CustomException extends Error {
}
}
tape(name, (test: tape.Test) => {
let num: number;
let ms: number;
let value: any;
let actual: any;
let expected: any;
let err: any;
let fn = () => {};
let msg: string;
var num: number;
var ms: number;
var value: any;
var actual: any;
var expected: any;
var err: any;
var fn = function() {};
var msg: string;
var exceptionExpected: RegExp | (() => void);
let exceptionExpected: RegExp | (() => void);
test.plan(num);
test.end();
+1 -73
View File
@@ -1,83 +1,11 @@
{
"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,
"indent": [
true,
"tabs"
],
"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
"prefer-const": false
}
}