Skip to content

Commit

Permalink
style(tslint): expand tslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Nov 4, 2015
1 parent 6e82f27 commit 3793e47
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
- alias babel=./node_modules/.bin/babel

install:
- npm install
- npm install && npm run lint

script:
- npm test && npm run cover
Expand Down
6 changes: 6 additions & 0 deletions .tslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"no-duplicate-variable": true,
"no-unreachable": true,
"no-var-keyword": true,
"no-empty": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-use-before-declare": true,
"no-var-requires": true,
"no-require-imports": true,
"one-line": [true,
"check-else",
"check-whitespace",
Expand Down
1 change: 0 additions & 1 deletion src/Notification.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Observer from './Observer';
import Observable from './Observable';
import noop from './util/noop';

export default class Notification<T> {
hasValue: boolean;
Expand Down
6 changes: 4 additions & 2 deletions src/observables/InfiniteObservable.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Observable from '../Observable';
import Subscriber from '../Subscriber';
import noop from '../util/noop';

export default class InfiniteObservable<T> extends Observable<T> {

static create<T>() {
return new InfiniteObservable();
}
Expand All @@ -10,6 +11,7 @@ export default class InfiniteObservable<T> extends Observable<T> {
super();
}

_subscribe(subscriber) {
_subscribe(subscriber: Subscriber<T>): void {
noop();
}
}
1 change: 0 additions & 1 deletion src/operators/expand-support.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Operator from '../Operator';
import Observer from '../Observer';
import Observable from '../Observable';
import Subscriber from '../Subscriber';
import Subscription from '../Subscription';
Expand Down
1 change: 0 additions & 1 deletion src/operators/first.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Observable from '../Observable';
import Operator from '../Operator';
import Subscriber from '../Subscriber';
import Observer from '../Observer';

import tryCatch from '../util/tryCatch';
import {errorObject} from '../util/errorObject';
Expand Down
5 changes: 4 additions & 1 deletion src/operators/ignoreElements.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Operator from '../Operator';
import Subscriber from '../Subscriber';
import noop from '../util/noop';

export default function ignoreElements() {
return this.lift(new IgnoreElementsOperator());
Expand All @@ -12,5 +13,7 @@ class IgnoreElementsOperator<T, R> implements Operator<T, R> {
}

class IgnoreElementsSubscriber<T> extends Subscriber<T> {
_next() {}
_next(unused: T): void {
noop();
}
}
1 change: 0 additions & 1 deletion src/operators/last.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Observable from '../Observable';
import Operator from '../Operator';
import Subscriber from '../Subscriber';
import Observer from '../Observer';

import tryCatch from '../util/tryCatch';
import {errorObject} from '../util/errorObject';
Expand Down
1 change: 0 additions & 1 deletion src/operators/switch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Operator from '../Operator';
import Observer from '../Observer';
import Observable from '../Observable';
import Subscriber from '../Subscriber';
import Subscription from '../Subscription';
Expand Down
12 changes: 7 additions & 5 deletions src/operators/takeUntil.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Operator from '../Operator';
import Observable from '../Observable';
import Subscriber from '../Subscriber';
import noop from '../util/noop';

export default function takeUntil<T>(notifier: Observable<any>) {
return this.lift(new TakeUntilOperator(notifier));
Expand All @@ -25,7 +26,7 @@ class TakeUntilSubscriber<T> extends Subscriber<T> {
this.add(notifier.subscribe(this.notificationSubscriber));
}

_complete() {
_complete(): void {
this.destination.complete();
this.notificationSubscriber.unsubscribe();
}
Expand All @@ -36,14 +37,15 @@ class TakeUntilInnerSubscriber<T> extends Subscriber<T> {
super(null);
}

_next() {
_next(unused: T): void {
this.destination.complete();
}

_error(e) {
this.destination.error(e);
_error(err: any): void {
this.destination.error(err);
}

_complete() {
_complete(): void {
noop();
}
}
5 changes: 2 additions & 3 deletions src/util/Immediate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class ImmediateDefinition {
this.nextHandle = 1;
this.tasksByHandle = {};
this.currentlyRunningATask = false;
const doc = root.document;

// Don't get fooled by e.g. browserify environments.
if (this.canUseProcessNextTick()) {
Expand Down Expand Up @@ -204,12 +203,12 @@ export class ImmediateDefinition {
const doc = root.document;
const html = doc.documentElement;

let handle = instance.addFromSetImmediateArguments(arguments);
let handle = addFromSetImmediateArguments(arguments);
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
let script = doc.createElement('script');
script.onreadystatechange = () => {
instance.runIfPresent(handle);
runIfPresent(handle);
script.onreadystatechange = null;
html.removeChild(script);
script = null;
Expand Down
1 change: 1 addition & 0 deletions src/util/noop.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/* tslint:disable:no-empty */
export default function noop() { }
1 change: 1 addition & 0 deletions src/util/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ declare module NodeJS {

export let root: any = (objectTypes[typeof self] && self) || (objectTypes[typeof window] && window);

/* tslint:disable:no-unused-variable */
let freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
let freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
let freeGlobal = objectTypes[typeof global] && global;
Expand Down

0 comments on commit 3793e47

Please sign in to comment.