Skip to content

Commit 02b9ef2

Browse files
authored
Merge pull request #11 from kwonoj/chore-prettier
chore(package): introduce prettier
2 parents 157d595 + 50d0a82 commit 02b9ef2

6 files changed

+16
-19
lines changed

commitlint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = {extends: ['@commitlint/config-angular']}
1+
module.exports = { extends: ['@commitlint/config-angular'] };

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"all": true
3434
},
3535
"lint-staged": {
36-
"*.@(ts)": [
36+
"*.{ts,js}": [
37+
"prettier --write --single-quote --print-width 120 --jsx-bracket-same-line true",
3738
"tslint --fix",
3839
"git add"
3940
]
@@ -49,7 +50,7 @@
4950
"lint:staged": "lint-staged",
5051
"build": "npm-run-all build:clean && tsc",
5152
"build:clean": "shx rm -rf ./dist",
52-
"commit": "git-cz",
53+
"commit": "git-cz -S",
5354
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
5455
},
5556
"repository": {
@@ -84,6 +85,7 @@
8485
"lint-staged": "^4.0.3",
8586
"npm-run-all": "^4.0.2",
8687
"nyc": "^10.3.0",
88+
"prettier": "^1.5.3",
8789
"rxjs": "5.x",
8890
"shx": "^0.2.2",
8991
"ts-node": "^3.3.0",
@@ -93,4 +95,4 @@
9395
"peerDependencies": {
9496
"rxjs": "5.x"
9597
}
96-
}
98+
}

src/MessageRecordObserver.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class MessageRecordObserver<T = string> implements MessageRecordObserverBase<T>
1111
*
1212
* @param {() => number} nowMethod function returns current timeframe based on scheduler, as Scheduler::now() provides.
1313
*/
14-
constructor(private readonly nowMethod: typeof Scheduler.now) {
15-
}
14+
constructor(private readonly nowMethod: typeof Scheduler.now) {}
1615

1716
next(value: T): void {
1817
this.messages.push(new TestMessageValue(this.nowMethod(), Rx.Notification.createNext(value)));
@@ -30,9 +29,8 @@ class MessageRecordObserver<T = string> implements MessageRecordObserverBase<T>
3029
/**
3130
* Returns function to instantiate MessageRecordObserver.
3231
*/
33-
const getRecordObserverFactory: (nowMethod: typeof Scheduler.now) => <T = string>() => MessageRecordObserverBase<T> =
34-
(nowMethod: typeof Scheduler.now) => <T = string>() => new MessageRecordObserver<T>(nowMethod);
32+
const getRecordObserverFactory: (nowMethod: typeof Scheduler.now) => <T = string>() => MessageRecordObserverBase<T> = (
33+
nowMethod: typeof Scheduler.now
34+
) => <T = string>() => new MessageRecordObserver<T>(nowMethod);
3535

36-
export {
37-
getRecordObserverFactory
38-
};
36+
export { getRecordObserverFactory };

src/MessageRecordObserverBase.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ export interface MessageRecordObserverBase<T = string> extends Rx.Observer<T> {
1010
* Metadata of subscribed Observable, recorded value of next(), error(), complete() calls.
1111
*/
1212
readonly messages: Readonly<Array<TestMessageValue<T>>>;
13-
}
13+
}

src/TestMessageValue.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import { SubscriptionLog } from 'rxjs/testing/SubscriptionLog';
77
*
88
*/
99
export class TestMessageValue<T = string> implements TestMessage {
10-
11-
constructor(public readonly frame: number,
12-
public readonly notification: Rx.Notification<T>) { }
10+
constructor(public readonly frame: number, public readonly notification: Rx.Notification<T>) {}
1311
}
1412

1513
/**
@@ -38,7 +36,6 @@ export function complete(frame: number): TestMessage {
3836
return new TestMessageValue<void>(frame, Rx.Notification.createComplete());
3937
}
4038

41-
export function subscribe(subscribedFrame: number,
42-
unsubscribedFrame: number = Number.POSITIVE_INFINITY) {
39+
export function subscribe(subscribedFrame: number, unsubscribedFrame: number = Number.POSITIVE_INFINITY) {
4340
return new SubscriptionLog(subscribedFrame, unsubscribedFrame);
44-
}
41+
}

src/VirtualTestScheduler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ export interface SchedulerStartOptions {
2121
*/
2222
export interface VirtualTestScheduler extends VirtualTimeScheduler {
2323
readonly isFlushing: boolean;
24-
}
24+
}

0 commit comments

Comments
 (0)