Skip to content

Commit

Permalink
Update gulp-tslint to the latest version 🚀 (#529)
Browse files Browse the repository at this point in the history
* chore(package): update gulp-tslint to version 8.0.0

https://greenkeeper.io/

* Solve gulp-tslint upgrade issues

* Solve gulp-tslint upgrade issues

* Solve gulp-tslint upgrade issues
  • Loading branch information
greenkeeper[bot] authored and remojansen committed Apr 23, 2017
1 parent 93f83c2 commit 52596e0
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 100 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ class Ninja implements Warrior {
this._shuriken = shuriken;
}

public fight() { return this._katana.hit(); };
public sneak() { return this._shuriken.throw(); };
public fight() { return this._katana.hit(); }
public sneak() { return this._shuriken.throw(); }

}

Expand All @@ -186,8 +186,8 @@ If you prefer it you can use property injection instead of constructor injection
class Ninja implements Warrior {
@inject(TYPES.Weapon) private _katana: Weapon;
@inject(TYPES.ThrowableWeapon) private _shuriken: ThrowableWeapon;
public fight() { return this._katana.hit(); };
public sneak() { return this._shuriken.throw(); };
public fight() { return this._katana.hit(); }
public sneak() { return this._shuriken.throw(); }
}
```

Expand Down
9 changes: 5 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var gulp = require("gulp"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
buffer = require("vinyl-buffer"),
tslint = require("gulp-tslint"),
gulpTslint = require("gulp-tslint"),
tslint = require("tslint"),
tsc = require("gulp-typescript"),
sourcemaps = require("gulp-sourcemaps"),
uglify = require("gulp-uglify"),
Expand Down Expand Up @@ -42,14 +43,14 @@ gulp.task("clean", function() {
//******************************************************************************
gulp.task("lint", function() {

var config = { formatter: "verbose", emitError: (process.env.CI) ? true : false };
var program = tslint.Linter.createProgram("./tsconfig.json");

return gulp.src([
"src/**/**.ts",
"test/**/**.test.ts"
])
.pipe(tslint(config))
.pipe(tslint.report());
.pipe(gulpTslint({ program }))
.pipe(gulpTslint.report());

});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"gulp-mocha": "3.0.1",
"gulp-rename": "^1.2.2",
"gulp-sourcemaps": "^2.2.1",
"gulp-tslint": "^7.0.0",
"gulp-tslint": "^8.0.0",
"gulp-typescript": "^3.0.0",
"gulp-uglify": "^2.0.0",
"harmonize": "^2.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/container/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class Lookup<T extends interfaces.Clonable<T>> implements interfaces.Lookup<T> {

if (serviceIdentifier === null || serviceIdentifier === undefined) {
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
};
}

if (value === null || value === undefined) {
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
};
}

let entry = this._map.get(serviceIdentifier);
if (entry !== undefined) {
Expand Down Expand Up @@ -101,7 +101,7 @@ class Lookup<T extends interfaces.Clonable<T>> implements interfaces.Lookup<T> {
this._map.forEach((value, key) => {
func(key, value);
});
};
}

}

Expand Down
50 changes: 25 additions & 25 deletions src/interfaces/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ namespace interfaces {

export type ServiceIdentifier<T> = (string | symbol | Newable<T> | Abstract<T>);

export interface Clonable<T> {
clone(): T;
}

export interface Binding<T> extends Clonable<Binding<T>> {
guid: string;
moduleId: string;
Expand Down Expand Up @@ -219,10 +223,6 @@ namespace interfaces {
middleware: Next | null;
}

export interface Clonable<T> {
clone(): T;
}

export interface Lookup<T> extends Clonable<Lookup<T>> {
add(serviceIdentifier: ServiceIdentifier<any>, value: T): void;
getMap(): Map<interfaces.ServiceIdentifier<any>, T[]>;
Expand All @@ -234,31 +234,10 @@ namespace interfaces {
traverse(func: (key: interfaces.ServiceIdentifier<any>, value: T[]) => void): void;
}

export interface BindingInSyntax<T> {
inSingletonScope(): BindingWhenOnSyntax<T>;
inTransientScope(): BindingWhenOnSyntax<T>;
}

export interface BindingInWhenOnSyntax<T> extends BindingInSyntax<T>, BindingWhenOnSyntax<T> { }

export interface BindingOnSyntax<T> {
onActivation(fn: (context: Context, injectable: T) => T): BindingWhenSyntax<T>;
}

export interface BindingToSyntax<T> {
to(constructor: { new (...args: any[]): T; }): BindingInWhenOnSyntax<T>;
toSelf(): BindingInWhenOnSyntax<T>;
toConstantValue(value: T): BindingWhenOnSyntax<T>;
toDynamicValue(func: (context: Context) => T): BindingInWhenOnSyntax<T>;
toConstructor<T2>(constructor: Newable<T2>): BindingWhenOnSyntax<T>;
toFactory<T2>(factory: FactoryCreator<T2>): BindingWhenOnSyntax<T>;
toFunction(func: T): BindingWhenOnSyntax<T>;
toAutoFactory<T2>(serviceIdentifier: ServiceIdentifier<T2>): BindingWhenOnSyntax<T>;
toProvider<T2>(provider: ProviderCreator<T2>): BindingWhenOnSyntax<T>;
}

export interface BindingWhenOnSyntax<T> extends BindingWhenSyntax<T>, BindingOnSyntax<T> { }

export interface BindingWhenSyntax<T> {
when(constraint: (request: Request) => boolean): BindingOnSyntax<T>;
whenTargetNamed(name: string|number|symbol): BindingOnSyntax<T>;
Expand All @@ -277,6 +256,27 @@ namespace interfaces {
whenNoAncestorMatches(constraint: (request: Request) => boolean): BindingOnSyntax<T>;
}

export interface BindingWhenOnSyntax<T> extends BindingWhenSyntax<T>, BindingOnSyntax<T> { }

export interface BindingInSyntax<T> {
inSingletonScope(): BindingWhenOnSyntax<T>;
inTransientScope(): BindingWhenOnSyntax<T>;
}

export interface BindingInWhenOnSyntax<T> extends BindingInSyntax<T>, BindingWhenOnSyntax<T> { }

export interface BindingToSyntax<T> {
to(constructor: { new (...args: any[]): T; }): BindingInWhenOnSyntax<T>;
toSelf(): BindingInWhenOnSyntax<T>;
toConstantValue(value: T): BindingWhenOnSyntax<T>;
toDynamicValue(func: (context: Context) => T): BindingInWhenOnSyntax<T>;
toConstructor<T2>(constructor: Newable<T2>): BindingWhenOnSyntax<T>;
toFactory<T2>(factory: FactoryCreator<T2>): BindingWhenOnSyntax<T>;
toFunction(func: T): BindingWhenOnSyntax<T>;
toAutoFactory<T2>(serviceIdentifier: ServiceIdentifier<T2>): BindingWhenOnSyntax<T>;
toProvider<T2>(provider: ProviderCreator<T2>): BindingWhenOnSyntax<T>;
}

export interface ConstraintFunction extends Function {
metaData?: Metadata;
(request: Request | null): boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/syntax/binding_to_syntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class BindingToSyntax<T> implements interfaces.BindingToSyntax<T> {

public toFunction(func: T): interfaces.BindingWhenOnSyntax<T> {
// toFunction is an alias of toConstantValue
if (typeof func !== "function") { throw new Error(ERROR_MSGS.INVALID_FUNCTION_BINDING); };
if (typeof func !== "function") { throw new Error(ERROR_MSGS.INVALID_FUNCTION_BINDING); }
let bindingWhenOnSyntax = this.toConstantValue(func);
this._binding.type = BindingTypeEnum.Function;
return bindingWhenOnSyntax;
Expand Down
12 changes: 6 additions & 6 deletions test/annotation/inject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ describe("@inject", () => {
let m1: interfaces.Metadata = paramsMetadata["0"][0];
expect(m1.key).to.be.eql(METADATA_KEY.INJECT_TAG);
expect(m1.value).to.be.eql("Katana");
expect(paramsMetadata["0"][1]).to.be.undefined;
expect(paramsMetadata["0"][1]).to.eq(undefined);

// assert metadata for second argument
expect(paramsMetadata["1"]).to.be.instanceof(Array);
let m2: interfaces.Metadata = paramsMetadata["1"][0];
expect(m2.key).to.be.eql(METADATA_KEY.INJECT_TAG);
expect(m2.value).to.be.eql("Shuriken");
expect(paramsMetadata["1"][1]).to.be.undefined;
expect(paramsMetadata["1"][1]).to.eq(undefined);

// no more metadata should be available
expect(paramsMetadata["2"]).to.be.undefined;
expect(paramsMetadata["2"]).to.eq(undefined);

});

Expand Down Expand Up @@ -119,17 +119,17 @@ describe("@inject", () => {
let m1: interfaces.Metadata = paramsMetadata["0"][0];
expect(m1.key).to.be.eql(METADATA_KEY.INJECT_TAG);
expect(m1.value).to.be.eql("Katana");
expect(paramsMetadata["0"][1]).to.be.undefined;
expect(paramsMetadata["0"][1]).to.eq(undefined);

// assert metadata for second argument
expect(paramsMetadata["1"]).to.be.instanceof(Array);
let m2: interfaces.Metadata = paramsMetadata["1"][0];
expect(m2.key).to.be.eql(METADATA_KEY.INJECT_TAG);
expect(m2.value).to.be.eql("Shurien");
expect(paramsMetadata["1"][1]).to.be.undefined;
expect(paramsMetadata["1"][1]).to.eq(undefined);

// no more metadata should be available
expect(paramsMetadata["2"]).to.be.undefined;
expect(paramsMetadata["2"]).to.eq(undefined);

});

Expand Down
2 changes: 1 addition & 1 deletion test/annotation/injectable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("@injectable", () => {

expect(metadata[0]).to.be.eql(Katana);
expect(metadata[1]).to.be.eql(Object);
expect(metadata[2]).to.be.undefined;
expect(metadata[2]).to.eq(undefined);
});

it("Should throw when applayed mutiple times", () => {
Expand Down
8 changes: 4 additions & 4 deletions test/annotation/multi_inject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ describe("@multiInject", () => {
let m1: interfaces.Metadata = paramsMetadata["0"][0];
expect(m1.key).to.be.eql(METADATA_KEY.MULTI_INJECT_TAG);
expect(m1.value).to.be.eql("Weapon");
expect(paramsMetadata["0"][1]).to.be.undefined;
expect(paramsMetadata["0"][1]).to.eq(undefined);

// no more metadata should be available
expect(paramsMetadata["1"]).to.be.undefined;
expect(paramsMetadata["1"]).to.eq(undefined);

});

Expand Down Expand Up @@ -105,10 +105,10 @@ describe("@multiInject", () => {
let m1: interfaces.Metadata = paramsMetadata["0"][0];
expect(m1.key).to.be.eql(METADATA_KEY.MULTI_INJECT_TAG);
expect(m1.value).to.be.eql("Weapon");
expect(paramsMetadata["0"][1]).to.be.undefined;
expect(paramsMetadata["0"][1]).to.eq(undefined);

// no more metadata should be available
expect(paramsMetadata["1"]).to.be.undefined;
expect(paramsMetadata["1"]).to.eq(undefined);

});

Expand Down
14 changes: 7 additions & 7 deletions test/annotation/named.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ describe("@named", () => {
let m1: interfaces.Metadata = paramsMetadata["0"][0];
expect(m1.key).to.be.eql(METADATA_KEY.NAMED_TAG);
expect(m1.value).to.be.eql("more_powerful");
expect(paramsMetadata["0"][1]).to.be.undefined;
expect(paramsMetadata["0"][1]).to.eq(undefined);

// assert metadata for second argument
expect(paramsMetadata["1"]).to.be.instanceof(Array);
let m2: interfaces.Metadata = paramsMetadata["1"][0];
expect(m2.key).to.be.eql(METADATA_KEY.NAMED_TAG);
expect(m2.value).to.be.eql("less_powerful");
expect(paramsMetadata["1"][1]).to.be.undefined;
expect(paramsMetadata["1"][1]).to.eq(undefined);

// no more metadata should be available
expect(paramsMetadata["2"]).to.be.undefined;
expect(paramsMetadata["2"]).to.eq(undefined);

});

Expand All @@ -80,7 +80,7 @@ describe("@named", () => {
let m1 = metadata.weapon[0];
expect(m1.key).to.be.eql(METADATA_KEY.NAMED_TAG);
expect(m1.value).to.be.eql("throwwable");
expect(metadata.weapon[1]).to.be.undefined;
expect(metadata.weapon[1]).to.eq(undefined);

});

Expand Down Expand Up @@ -132,17 +132,17 @@ describe("@named", () => {
let m1: interfaces.Metadata = paramsMetadata["0"][0];
expect(m1.key).to.be.eql(METADATA_KEY.NAMED_TAG);
expect(m1.value).to.be.eql("more_powerful");
expect(paramsMetadata["0"][1]).to.be.undefined;
expect(paramsMetadata["0"][1]).to.eq(undefined);

// assert metadata for second argument
expect(paramsMetadata["1"]).to.be.instanceof(Array);
let m2: interfaces.Metadata = paramsMetadata["1"][0];
expect(m2.key).to.be.eql(METADATA_KEY.NAMED_TAG);
expect(m2.value).to.be.eql("less_powerful");
expect(paramsMetadata["1"][1]).to.be.undefined;
expect(paramsMetadata["1"][1]).eq(undefined);

// no more metadata should be available
expect(paramsMetadata["2"]).to.be.undefined;
expect(paramsMetadata["2"]).to.eq(undefined);

});

Expand Down
16 changes: 8 additions & 8 deletions test/annotation/tagged.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe("@Tagged", () => {
expect(m1.value).to.be.eql(1);

// argumnet at index 0 should only have one tag
expect(paramsMetadata["0"][1]).to.be.undefined;
expect(paramsMetadata["0"][1]).to.eq(undefined);

// assert metadata for second argument
expect(paramsMetadata["1"]).to.be.instanceof(Array);
Expand All @@ -78,10 +78,10 @@ describe("@Tagged", () => {
expect(m2.value).to.be.eql(2);

// argumnet at index 1 should only have one tag
expect(paramsMetadata["1"][1]).to.be.undefined;
expect(paramsMetadata["1"][1]).to.eq(undefined);

// no more metadata should be available
expect(paramsMetadata["2"]).to.be.undefined;
expect(paramsMetadata["2"]).to.eq(undefined);
});

it("Should generate metadata for tagged properties", () => {
Expand All @@ -96,7 +96,7 @@ describe("@Tagged", () => {
let m1 = metadata.weapon[0];
expect(m1.key).to.be.eql("throwwable");
expect(m1.value).to.be.eql(false);
expect(metadata.weapon[1]).to.be.undefined;
expect(metadata.weapon[1]).to.eq(undefined);

});

Expand Down Expand Up @@ -132,7 +132,7 @@ describe("@Tagged", () => {
expect(m22.value).to.be.eql(2);

// no more metadata (argument at index > 1)
expect(paramsMetadata["2"]).to.be.undefined;
expect(paramsMetadata["2"]).to.eq(undefined);

});

Expand Down Expand Up @@ -188,7 +188,7 @@ describe("@Tagged", () => {
expect(m1.value).to.be.eql(1);

// argumnet at index 0 should only have one tag
expect(paramsMetadata["0"][1]).to.be.undefined;
expect(paramsMetadata["0"][1]).to.eq(undefined);

// assert metadata for second argument
expect(paramsMetadata["1"]).to.be.instanceof(Array);
Expand All @@ -197,10 +197,10 @@ describe("@Tagged", () => {
expect(m2.value).to.be.eql(2);

// argumnet at index 1 should only have one tag
expect(paramsMetadata["1"][1]).to.be.undefined;
expect(paramsMetadata["1"][1]).to.eq(undefined);

// no more metadata should be available
expect(paramsMetadata["2"]).to.be.undefined;
expect(paramsMetadata["2"]).to.eq(undefined);

});

Expand Down
8 changes: 4 additions & 4 deletions test/features/metadata_reader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ describe("Custom Metadata Reader", () => {
this._shuriken = shuriken;
}

public fight() { return this._katana.hit(); };
public sneak() { return this._shuriken.throw(); };
public fight() { return this._katana.hit(); }
public sneak() { return this._shuriken.throw(); }

}

Expand Down Expand Up @@ -192,8 +192,8 @@ describe("Custom Metadata Reader", () => {

private _katana: Katana;
private _shuriken: Shuriken;
public fight() { return this._katana.hit(); };
public sneak() { return this._shuriken.throw(); };
public fight() { return this._katana.hit(); }
public sneak() { return this._shuriken.throw(); }

}

Expand Down
Loading

0 comments on commit 52596e0

Please sign in to comment.