Skip to content

Commit a33191c

Browse files
committed
WIP Updated deps + tslint
1 parent 184ca6a commit a33191c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+546
-585
lines changed

gulpfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ gulp.task('exceptionless', ['exceptionless.umd'], function () {
6464
.pipe($.replace('exceptionless-js/1.0.0.0', 'exceptionless-js/' + pkg.version))
6565
.pipe($.uglify({ output: { beautify: false } }))
6666
.pipe($.sourcemaps.write('.'))
67-
.pipe(gulp.dest('dist'))
67+
.pipe(gulp.dest('dist'));
6868
});
6969

7070
gulp.task('exceptionless.node', ['typescript.node'], function () {

package.json

+31-30
Original file line numberDiff line numberDiff line change
@@ -26,43 +26,44 @@
2626
"type": "git"
2727
},
2828
"devDependencies": {
29-
"@types/angular": "^1.6.14",
30-
"@types/angular-mocks": "^1.5.9",
31-
"@types/assertion-error": "^1.0.30",
32-
"@types/chai": "^3.4.35",
33-
"@types/jquery": "^2.0.41",
34-
"@types/mocha": "^2.2.40",
35-
"@types/mock-fs": "^3.6.30",
36-
"@types/node": "^7.0.12",
37-
"@types/sinon": "^2.1.2",
29+
"@types/angular": "1.6.14",
30+
"@types/angular-mocks": "1.5.9",
31+
"@types/assertion-error": "1.0.30",
32+
"@types/chai": "3.5.0",
33+
"@types/jquery": "2.0.41",
34+
"@types/mocha": "2.2.40",
35+
"@types/mock-fs": "3.6.30",
36+
"@types/node": "7.0.12",
37+
"@types/sinon": "2.1.2",
3838
"@types/stack-trace": "0.0.28",
3939
"chai": "3.5.0",
40-
"del": "2.2.1",
40+
"del": "2.2.2",
4141
"es5-shim": "4.5.9",
42-
"es6-shim": "0.35.1",
43-
"event-stream": "^3.3.4",
42+
"es6-shim": "0.35.3",
43+
"event-stream": "3.3.4",
4444
"gulp": "3.9.1",
45-
"gulp-concat": "2.6.0",
46-
"gulp-exec": "2.1.2",
47-
"gulp-load-plugins": "^1.3.0",
48-
"gulp-mocha": "2.2.0",
49-
"gulp-mocha-phantomjs": "^0.12.0",
45+
"gulp-concat": "2.6.1",
46+
"gulp-exec": "2.1.3",
47+
"gulp-load-plugins": "1.5.0",
48+
"gulp-mocha": "4.3.0",
49+
"gulp-mocha-phantomjs": "0.12.1",
5050
"gulp-replace": "0.5.4",
51-
"gulp-sourcemaps": "1.6.0",
52-
"gulp-tslint": "6.0.1",
53-
"gulp-uglify": "1.5.4",
51+
"gulp-sourcemaps": "2.6.0",
52+
"gulp-tslint": "8.0.0",
53+
"gulp-uglify": "2.1.2",
5454
"gulp-wrap-umd": "0.2.1",
55-
"mock-fs": "3.11.0",
56-
"path": "^0.12.7",
57-
"requirejs": "^2.3.2",
58-
"rewire": "^2.5.2",
59-
"rimraf": "2.5.3",
60-
"run-sequence": "^1.2.2",
61-
"sinon": "^1.17.6",
62-
"source-map-support": "0.4.2",
63-
"systemjs": "^0.19.39",
55+
"jshint": "^2.9.4",
56+
"mock-fs": "4.2.0",
57+
"path": "0.12.7",
58+
"requirejs": "2.3.3",
59+
"rewire": "2.5.2",
60+
"rimraf": "2.6.1",
61+
"run-sequence": "1.2.2",
62+
"sinon": "2.1.0",
63+
"source-map-support": "0.4.14",
64+
"systemjs": "0.20.12",
6465
"tracekit": "0.4.4",
65-
"tslint": "3.15.1",
66+
"tslint": "5.1.0",
6667
"tsproject": "2.0.2",
6768
"typescript": "2.2.2",
6869
"typescript-formatter": "5.1.3"

src/EventBuilder.ts

+17-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ExceptionlessClient } from './ExceptionlessClient';
22
import { IEvent } from './models/IEvent';
3-
import { IUserInfo } from './models/IUserInfo';
43
import { IManualStackingInfo } from './models/IManualStackingInfo';
4+
import { IUserInfo } from './models/IUserInfo';
55
import { ContextData } from './plugins/ContextData';
66
import { EventPluginContext } from './plugins/EventPluginContext';
77
import { Utils } from './Utils';
@@ -49,7 +49,7 @@ export class EventBuilder {
4949
* @param name Reference name
5050
* @param id The reference id that points to a specific event
5151
* @returns {EventBuilder}
52-
*/
52+
*/
5353
public setEventReference(name: string, id: string): EventBuilder {
5454
if (!name) {
5555
throw new Error('Invalid name');
@@ -84,11 +84,10 @@ export class EventBuilder {
8484
return this;
8585
}
8686

87-
public setUserIdentity(userInfo: IUserInfo): EventBuilder;
88-
public setUserIdentity(identity: string): EventBuilder;
87+
public setUserIdentity(userInfo: IUserInfo | string): EventBuilder;
8988
public setUserIdentity(identity: string, name: string): EventBuilder;
9089
public setUserIdentity(userInfoOrIdentity: IUserInfo | string, name?: string): EventBuilder {
91-
let userInfo = typeof userInfoOrIdentity !== 'string' ? userInfoOrIdentity : { identity: userInfoOrIdentity, name: name };
90+
const userInfo = typeof userInfoOrIdentity !== 'string' ? userInfoOrIdentity : { identity: userInfoOrIdentity, name };
9291
if (!userInfo || (!userInfo.identity && !userInfo.name)) {
9392
return this;
9493
}
@@ -103,10 +102,10 @@ export class EventBuilder {
103102
* @param emailAddress The email address
104103
* @param description The user's description of the event.
105104
* @returns {EventBuilder}
106-
*/
105+
*/
107106
public setUserDescription(emailAddress: string, description: string): EventBuilder {
108107
if (emailAddress && description) {
109-
this.setProperty('@user_description', { email_address: emailAddress, description: description });
108+
this.setProperty('@user_description', { email_address: emailAddress, description });
110109
}
111110

112111
return this;
@@ -118,15 +117,14 @@ export class EventBuilder {
118117
* @param signatureData A dictionary of strings to use for stacking.
119118
* @param title An optional title for the stacking information.
120119
* @returns {EventBuilder}
121-
*/
120+
*/
122121
public setManualStackingInfo(signatureData: any, title?: string) {
123122
if (signatureData) {
124-
let stack = <IManualStackingInfo>{
125-
signature_data: signatureData
126-
};
123+
const stack: IManualStackingInfo = { signature_data: signatureData };
127124
if (title) {
128125
stack.title = title;
129126
}
127+
130128
this.setProperty('@stack', stack);
131129
}
132130

@@ -138,12 +136,10 @@ export class EventBuilder {
138136
* @param manualStackingKey The manual stacking key.
139137
* @param title An optional title for the stacking information.
140138
* @returns {EventBuilder}
141-
*/
139+
*/
142140
public setManualStackingKey(manualStackingKey: string, title?: string): EventBuilder {
143141
if (manualStackingKey) {
144-
let data = {
145-
'ManualStackingKey': manualStackingKey
146-
};
142+
const data = { ManualStackingKey: manualStackingKey };
147143
this.setManualStackingInfo(data, title);
148144
}
149145

@@ -180,7 +176,7 @@ export class EventBuilder {
180176
this.target.data = {};
181177
}
182178

183-
let result = JSON.parse(Utils.stringify(value, this.client.config.dataExclusions.concat(excludedPropertyNames || []), maxDepth));
179+
const result = JSON.parse(Utils.stringify(value, this.client.config.dataExclusions.concat(excludedPropertyNames || []), maxDepth));
184180
if (!Utils.isEmpty(result)) {
185181
this.target.data[name] = result;
186182
}
@@ -196,7 +192,7 @@ export class EventBuilder {
196192
return this;
197193
}
198194

199-
public addRequestInfo(request: Object): EventBuilder {
195+
public addRequestInfo(request: object): EventBuilder {
200196
if (!!request) {
201197
this.pluginContextData['@request'] = request;
202198
}
@@ -218,10 +214,10 @@ export class EventBuilder {
218214
}
219215

220216
for (let index = 0; index < value.length; index++) {
221-
let code = value.charCodeAt(index);
222-
let isDigit = (code >= 48) && (code <= 57);
223-
let isLetter = ((code >= 65) && (code <= 90)) || ((code >= 97) && (code <= 122));
224-
let isMinus = code === 45;
217+
const code = value.charCodeAt(index);
218+
const isDigit = (code >= 48) && (code <= 57);
219+
const isLetter = ((code >= 65) && (code <= 90)) || ((code >= 97) && (code <= 122));
220+
const isMinus = code === 45;
225221

226222
if (!(isDigit || isLetter) && !isMinus) {
227223
return false;

src/ExceptionlessClient-spec.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { ExceptionlessClient } from './ExceptionlessClient';
2-
import { EventPluginContext } from './plugins/EventPluginContext';
31
import { expect } from 'chai';
42
import * as sinon from 'sinon';
3+
import { ExceptionlessClient } from './ExceptionlessClient';
4+
import { EventPluginContext } from './plugins/EventPluginContext';
55

66
describe('ExceptionlessClient', () => {
77
let xhr: any;
@@ -15,15 +15,15 @@ describe('ExceptionlessClient', () => {
1515
});
1616

1717
it('should use event reference ids', (done) => {
18-
let error = createException();
18+
const error = createException();
1919

20-
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
20+
const client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
2121
expect(client.config.lastReferenceIdManager.getLast()).to.be.null;
2222
client.submitException(error, (context: EventPluginContext) => {
2323
expect(client.config.lastReferenceIdManager.getLast()).to.be.null;
2424
});
2525

26-
let numberOfPlugins = client.config.plugins.length;
26+
const numberOfPlugins = client.config.plugins.length;
2727
client.config.useReferenceIds();
2828
expect(client.config.plugins.length).to.equal(numberOfPlugins + 1);
2929

@@ -40,41 +40,41 @@ describe('ExceptionlessClient', () => {
4040
});
4141

4242
it('should accept null source', () => {
43-
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
44-
let builder = client.createLog(null, 'Unit Test message', 'Trace');
43+
const client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
44+
const builder = client.createLog(null, 'Unit Test message', 'Trace');
4545

4646
expect(builder.target.source).to.be.undefined;
4747
expect(builder.target.message).to.equal('Unit Test message');
4848
expect(builder.target.data['@level']).to.equal('Trace');
4949
});
5050

5151
it('should accept source and message', () => {
52-
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
53-
let builder = client.createLog('ExceptionlessClient', 'Unit Test message');
52+
const client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
53+
const builder = client.createLog('ExceptionlessClient', 'Unit Test message');
5454

5555
expect(builder.target.source).to.equal('ExceptionlessClient');
5656
expect(builder.target.message).to.equal('Unit Test message');
5757
expect(builder.target.data).to.be.undefined;
5858
});
5959

6060
it('should accept source and message and level', () => {
61-
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
62-
let builder = client.createLog('source', 'Unit Test message', 'Info');
61+
const client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
62+
const builder = client.createLog('source', 'Unit Test message', 'Info');
6363

6464
expect(builder.target.source).to.equal('source');
6565
expect(builder.target.message).to.equal('Unit Test message');
6666
expect(builder.target.data['@level']).to.equal('Info');
6767
});
6868

6969
it('should allow construction via apiKey and serverUrl parameters', () => {
70-
let client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
70+
const client = new ExceptionlessClient('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw', 'http://localhost:50000');
7171

7272
expect(client.config.apiKey).to.equal('LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw');
7373
expect(client.config.serverUrl).to.equal('http://localhost:50000');
7474
});
7575

7676
it('should allow construction via a configuration object', () => {
77-
let client = new ExceptionlessClient({
77+
const client = new ExceptionlessClient({
7878
apiKey: 'LhhP1C9gijpSKCslHHCvwdSIz298twx271n1l6xw',
7979
serverUrl: 'http://localhost:50000'
8080
});

src/ExceptionlessClient.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { IConfigurationSettings } from './configuration/IConfigurationSettings';
21
import { Configuration } from './configuration/Configuration';
2+
import { IConfigurationSettings } from './configuration/IConfigurationSettings';
3+
import { SettingsManager } from './configuration/SettingsManager';
34
import { EventBuilder } from './EventBuilder';
45
import { IEvent } from './models/IEvent';
56
import { IUserDescription } from './models/IUserDescription';
7+
import { ContextData } from './plugins/ContextData';
68
import { EventPluginContext } from './plugins/EventPluginContext';
79
import { EventPluginManager } from './plugins/EventPluginManager';
8-
import { ContextData } from './plugins/ContextData';
910
import { SubmissionResponse } from './submission/SubmissionResponse';
10-
import { SettingsManager } from './configuration/SettingsManager';
1111

1212
export class ExceptionlessClient {
1313
/**
@@ -29,7 +29,7 @@ export class ExceptionlessClient {
2929
if (typeof settingsOrApiKey === 'object') {
3030
this.config = new Configuration(settingsOrApiKey);
3131
} else {
32-
this.config = new Configuration({ apiKey: <string>settingsOrApiKey, serverUrl: serverUrl });
32+
this.config = new Configuration({ apiKey: settingsOrApiKey as string, serverUrl });
3333
}
3434

3535
this.updateSettingsTimer(5000);
@@ -38,7 +38,7 @@ export class ExceptionlessClient {
3838
}
3939

4040
public createException(exception: Error): EventBuilder {
41-
let pluginContextData = new ContextData();
41+
const pluginContextData = new ContextData();
4242
pluginContextData.setException(exception);
4343
return this.createEvent(pluginContextData).setType('error');
4444
}
@@ -48,7 +48,7 @@ export class ExceptionlessClient {
4848
}
4949

5050
public createUnhandledException(exception: Error, submissionMethod?: string): EventBuilder {
51-
let builder = this.createException(exception);
51+
const builder = this.createException(exception);
5252
builder.pluginContextData.markAsUnhandledError();
5353
builder.pluginContextData.setSubmissionMethod(submissionMethod);
5454

@@ -82,7 +82,7 @@ export class ExceptionlessClient {
8282

8383
try {
8484
// TODO: Look into using https: //www.stevefenton.co.uk/Content/Blog/Date/201304/Blog/Obtaining-A-Class-Name-At-Runtime-In-TypeScript/
85-
let caller: any = this.createLog.caller;
85+
const caller: any = this.createLog.caller;
8686
builder = builder.setSource(caller && caller.caller && caller.caller.name);
8787
} catch (e) {
8888
this.config.log.trace('Unable to resolve log source: ' + e.message);
@@ -148,7 +148,7 @@ export class ExceptionlessClient {
148148
return !!callback && callback(context);
149149
}
150150

151-
let context = new EventPluginContext(this, event, pluginContextData);
151+
const context = new EventPluginContext(this, event, pluginContextData);
152152
if (!event) {
153153
return cancelled(context);
154154
}
@@ -166,9 +166,9 @@ export class ExceptionlessClient {
166166
event.tags = [];
167167
}
168168

169-
EventPluginManager.run(context, function (ctx: EventPluginContext) {
170-
let config = ctx.client.config;
171-
let ev = ctx.event;
169+
EventPluginManager.run(context, (ctx: EventPluginContext) => {
170+
const config = ctx.client.config;
171+
const ev = ctx.event;
172172

173173
if (!ctx.cancelled) {
174174
// ensure all required data
@@ -204,7 +204,7 @@ export class ExceptionlessClient {
204204
return !!callback && callback(new SubmissionResponse(500, 'cancelled'));
205205
}
206206

207-
let userDescription: IUserDescription = { email_address: email, description: description };
207+
const userDescription: IUserDescription = { email_address: email, description };
208208
this.config.submissionClient.postUserDescription(referenceId, userDescription, this.config, (response: SubmissionResponse) => {
209209
if (!response.success) {
210210
this.config.log.error(`Failed to submit user email and description for event '${referenceId}': ${response.statusCode} ${response.message}`);
@@ -228,9 +228,9 @@ export class ExceptionlessClient {
228228
this._timeoutId = clearTimeout(this._timeoutId);
229229
this._timeoutId = clearInterval(this._intervalId);
230230

231-
let interval = this.config.updateSettingsWhenIdleInterval;
231+
const interval = this.config.updateSettingsWhenIdleInterval;
232232
if (interval > 0) {
233-
let updateSettings = () => SettingsManager.updateSettings(this.config);
233+
const updateSettings = () => SettingsManager.updateSettings(this.config);
234234
if (initialDelay > 0) {
235235
this._timeoutId = setTimeout(updateSettings, initialDelay);
236236
}

0 commit comments

Comments
 (0)