Skip to content

Commit

Permalink
Fix tslint not breaking CI on error (Azure#538)
Browse files Browse the repository at this point in the history
* Fix tslint not breaking CI on error

* fix specs
  • Loading branch information
timotheeguerin authored Jul 6, 2017
1 parent 4a012d5 commit c3c128e
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 28 deletions.
4 changes: 2 additions & 2 deletions app/components/base/abstract-list/abstract-list-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ export class AbstractListBase implements AfterViewInit, OnDestroy {
default:
}
index = (index + items.length) % items.length;
const item = items[index];
this.focusedItem.next(item.key);
const newItem = items[index];
this.focusedItem.next(newItem.key);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions app/components/job/action/delete/delete-job-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import { LongRunningDeleteAction } from "app/services/core";

// todo: refactor me along with WaitForDeleteJobPollTask
export class DeleteJobAction extends LongRunningDeleteAction {
constructor(private JobService: JobService, jobIds: string[]) {
constructor(private jobService: JobService, jobIds: string[]) {
super("job", jobIds);
}

public deleteAction(id: string) {
return this.JobService.delete(id);
return this.jobService.delete(id);
}

protected waitForDelete(id: string, taskManager?: BackgroundTaskService) {
this.JobService.getOnce(id).subscribe({
this.jobService.getOnce(id).subscribe({
next: (job: Job) => {
const task = new WaitForDeleteJobPoller(this.JobService, id);
const task = new WaitForDeleteJobPoller(this.jobService, id);
if (taskManager) {
taskManager.startTask(`Deleting Job '${id}'`, (bTask) => {
return task.start(bTask.progress);
Expand Down
2 changes: 1 addition & 1 deletion app/services/core/rx-list-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export abstract class RxListProxy<TParams, TEntity> extends RxProxyBase<TParams,
}
return List<TEntity>(keys.map((x) => items.get(x)));
});
}).switch().distinctUntilChanged((a, b) => a === b || (a && a.equals(b))).takeUntil(this.isDisposed);
}).switch().distinctUntilChanged((a, b) => a.equals(b)).takeUntil(this.isDisposed);

this.deleted.subscribe((deletedKey) => {
this._itemKeys.next(OrderedSet<string>(this._itemKeys.value.filter((key) => key !== deletedKey)));
Expand Down
4 changes: 2 additions & 2 deletions app/services/file/file-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ export class FileLoader {

public download(dest: string): Observable<string> {
if (this._download) {
const obs = Observable.fromPromise(this._fs.ensureDir(path.dirname(dest)));
return obs.flatMap(() => this._download(dest)).map(x => dest).share();
const checkDirObs = Observable.fromPromise(this._fs.ensureDir(path.dirname(dest)));
return checkDirObs.flatMap(() => this._download(dest)).map(x => dest).share();
}
const obs = this.content().concatMap((result) => {
return this._fs.saveFile(dest, result.content);
Expand Down
8 changes: 4 additions & 4 deletions app/utils/validators/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ import { isPresent } from "../object";
/**
* Validator that requires controls to have a value of a min value.
*/
export function min(min: number): ValidatorFn {
export function min(val: number): ValidatorFn {
return (control: AbstractControl): { [key: string]: any } => {
if (isPresent(Validators.required(control))) { return null; }

let v: number = control.value;
return v >= min ? null : { min: true };
return v >= val ? null : { min: true };
};
}

/**
* Validator that requires controls to have a value of a max value.
*/
export function max(max: number): ValidatorFn {
export function max(val: number): ValidatorFn {
return (control: AbstractControl): { [key: string]: any } => {
if (isPresent(Validators.required(control))) { return null; }

let v: number = control.value;
return v <= max ? null : { max: true };
return v <= val ? null : { max: true };
};
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"stylelint": "~7.11.1",
"to-string-loader": "^1.1.5",
"ts-node": "~3.1.0",
"tslint": "~5.4.3",
"tslint": "^5.5.0",
"typescript": "~2.3.4",
"url-loader": "^0.5.7",
"webpack": "~3.0.0",
Expand Down
11 changes: 8 additions & 3 deletions test/app/services/core/rx-batch-list-proxy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ describe("RxBatchListProxy", () => {
proxy.error.subscribe((x) => error = x);
});

afterEach(() => {
proxy.dispose();
});

it("It retrieve the first batch of items", fakeAsync(() => {
proxy.fetchNext();
tick();
Expand All @@ -133,7 +137,7 @@ describe("RxBatchListProxy", () => {
expect(hasMore).toBe(false);
}));

it("should not clear the items when refresing with params true", fakeAsync(() => {
it("should clear the items when refresing with params true", fakeAsync(() => {
proxy.fetchNext();
tick();
proxy.refresh(true);
Expand All @@ -148,8 +152,9 @@ describe("RxBatchListProxy", () => {
proxy.refresh(false);
expect(items.size).not.toBe(0);
expect(items).toEqualImmutable(List(data[0].map((x) => new FakeModel(x))));
items = null; // To make sure items get reassigned
items = null; // Make sure it get the new value
tick();
proxy.items.subscribe((x) => items = x);
expect(items).not.toBe(null);
expect(items).toEqualImmutable(List(data[0].map((x) => new FakeModel(x))));
}));
Expand All @@ -174,7 +179,7 @@ describe("RxBatchListProxy", () => {
expect(hasMore).toBe(false);
}));

fit("Should remove item from the list when the cache call onItemDeleted", fakeAsync(() => {
it("Should remove item from the list when the cache call onItemDeleted", fakeAsync(() => {
proxy.fetchNext();
tick();
const subSpy = jasmine.createSpy("items sub");
Expand Down
8 changes: 4 additions & 4 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "tslint:recommended",
"defaultSeverity": "warning",
"defaultSeverity": "error",
"rulesDirectory": [
"node_modules/codelyzer"
],
Expand Down Expand Up @@ -30,8 +30,8 @@
"ban": [
true,
["main", "debugCrash"], // Show a warning if the main window is being shown on start for debug purposes
["fdescribe"],
["fit"]
{"name": "fdescribe", "message": "Don't keep jasmine fit methods in the code."},
{"name": "fit", "message": "Don't keep jasmine fit methods in the code."}
],
"no-empty-interface": false,
"space-before-function-paren": [false],
Expand All @@ -56,7 +56,7 @@
"directive-class-suffix": true,
"import-destructuring-spacing": true,
"invoke-injectable": true,

"no-shadowed-variable": false,
// TODO enable
"prefer-const": false
},
Expand Down
16 changes: 9 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6419,9 +6419,9 @@ tslib@^1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec"

tslint@~5.4.3:
version "5.4.3"
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.4.3.tgz#761c8402b80e347b7733a04390a757b253580467"
tslint@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.5.0.tgz#10e8dab3e3061fa61e9442e8cee3982acf20a6aa"
dependencies:
babel-code-frame "^6.22.0"
colors "^1.1.2"
Expand All @@ -6432,11 +6432,13 @@ tslint@~5.4.3:
resolve "^1.3.2"
semver "^5.3.0"
tslib "^1.7.1"
tsutils "^2.3.0"
tsutils "^2.5.1"

tsutils@^2.3.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.4.0.tgz#ad4ce6dba0e5a3edbddf8626b7ca040782189fea"
tsutils@^2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.5.1.tgz#c2001390c79eec1a5ccfa7ac12d599639683e0cf"
dependencies:
tslib "^1.7.1"

tty-browserify@0.0.0:
version "0.0.0"
Expand Down

0 comments on commit c3c128e

Please sign in to comment.