Skip to content

Commit 2f5e52d

Browse files
committed
chore: lint
1 parent 1d58079 commit 2f5e52d

File tree

4 files changed

+49
-60
lines changed

4 files changed

+49
-60
lines changed

plugin/platforms/android/buildscript.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
repositories {
3-
jcenter()
43
google()
54
}
65
dependencies {

src/index.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1+
// We need to import it so we patch the hub with global functions
2+
// aka. this has side effects
3+
import '@sentry/tracing';
14
import * as Integrations from './integrations';
25
import { NSSentry } from './nssentry';
36
// logger.disable(); // this crashes for {N} for now
47
export {
58
addBreadcrumb, addGlobalEventProcessor,
6-
7-
89
captureEvent, captureException,
9-
1010
captureMessage,
1111
configureScope,
12-
1312
getCurrentHub, getHubFromCarrier,
14-
1513
Hub,
1614
Scope,
1715
setContext,
@@ -22,25 +20,19 @@ export {
2220
setUser,
2321
withScope
2422
} from '@sentry/core';
25-
26-
// We need to import it so we patch the hub with global functions
27-
// aka. this has side effects
28-
import '@sentry/tracing';
29-
3023
export { Breadcrumb, Event, Exception, Request, Response, SdkInfo, Severity, StackFrame, Stacktrace, Status, Thread, User } from '@sentry/types';
3124
export { NativescriptBackend, NativescriptOptions } from './backend';
3225
export { NativescriptClient as NativescriptClient } from './client';
3326
export { init, nativeCrash, setDist, setRelease } from './sdk';
3427
export {
3528
NSTracing
3629
} from './tracing';
37-
38-
3930
export { SDK_NAME, SDK_VERSION } from './version';
4031
export { Integrations };
41-
const captureUserFeedback = NSSentry.captureUserFeedback;
4232
export {
4333
captureUserFeedback
4434
};
4535

36+
const captureUserFeedback = NSSentry.captureUserFeedback;
37+
4638

src/nssentry.android.ts

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { Application } from '@nativescript/core';
2-
import { Event, Response, Status } from '@sentry/types';
2+
import { android as androidApp } from '@nativescript/core/application';
3+
import { Breadcrumb, Event, Response, Status, User } from '@sentry/types';
34
import { NativescriptOptions, _processLevel } from './backend';
4-
import { rewriteFrameIntegration } from './sdk';
55
import { convertNativescriptFramesToSentryFrames, parseErrorStack } from './integrations/debugsymbolicator';
66
import { UserFeedback } from './nssentry';
7-
import { android as androidApp } from '@nativescript/core/application';
8-
import { Breadcrumb, User } from '@sentry/types';
7+
import { rewriteFrameIntegration } from './sdk';
98

109
export namespace NSSentry {
1110
export const nativeClientAvailable = true;
@@ -82,10 +81,10 @@ export namespace NSSentry {
8281
}
8382
return nUser;
8483
}
85-
const mJsModuleIdPattern = new RegExp('(?:^|[/\\\\])(\\d+\\.js)$').compile();
84+
const mJsModuleIdPattern = new RegExp('(?:^|[/\\\\])(\\d+\\.js)$');
8685
function stackFrameToModuleId(frame: { file?: string }) {
8786
if (!!frame.file) {
88-
const matcher = frame.file.match(mJsModuleIdPattern);
87+
const matcher = mJsModuleIdPattern.exec(frame.file);
8988
if (matcher) {
9089
return matcher[1] + ':';
9190
}
@@ -209,20 +208,20 @@ export namespace NSSentry {
209208

210209
function addPackages( event: io.sentry.SentryEvent, sdk: io.sentry.protocol.SdkVersion) {
211210
const eventSdk = event.getSdk();
212-
if (eventSdk != null && eventSdk.getName() === "sentry.javascript.react-native" && sdk != null) {
211+
if (eventSdk != null && eventSdk.getName() === 'sentry.javascript.react-native' && sdk != null) {
213212
const sentryPackages = sdk.getPackages();
214213
if (sentryPackages != null) {
215214
for (let index = 0; index < sentryPackages.size(); index++) {
216215
const sentryPackage = sentryPackages.get(index);
217216
eventSdk.addPackage(sentryPackage.getName(), sentryPackage.getVersion());
218-
217+
219218
}
220219
}
221220
const integrations = sdk.getIntegrations();
222221
if (integrations != null) {
223222
for (let index = 0; index < integrations.size(); index++) {
224223
eventSdk.addIntegration(integrations.get(index));
225-
224+
226225
}
227226
}
228227
event.setSdk(eventSdk);
@@ -326,7 +325,7 @@ export namespace NSSentry {
326325
throwable = mechanism;
327326
}
328327
if (throwable ) {
329-
const jsStackTrace: string = (throwable as any).getIncomingStackTrace();
328+
const jsStackTrace: string = (throwable ).getIncomingStackTrace();
330329
if (jsStackTrace) {
331330
const stack = parseErrorStack({ stack: jsStackTrace } as any);
332331

@@ -337,8 +336,8 @@ export namespace NSSentry {
337336
}
338337
}
339338
} catch (e) {}
340-
event.setTag("event.origin", "android");
341-
event.setTag("event.environment", "nativescript");
339+
event.setTag('event.origin', 'android');
340+
event.setTag('event.environment', 'nativescript');
342341
addPackages(event, config.getSdkVersion());
343342
return event;
344343
},
@@ -378,17 +377,17 @@ export namespace NSSentry {
378377
// }
379378

380379
export function fetchNativeSdkInfo () {
381-
return {}
380+
return {};
382381
}
383382

384383
export function fetchNativeRelease () {
385384
const context = androidApp.context;
386385
const packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
387386
return {
388-
"id": packageInfo.packageName,
389-
"version": packageInfo.versionName,
390-
"build": packageInfo.versionCode + ''
391-
}
387+
'id': packageInfo.packageName,
388+
'version': packageInfo.versionName,
389+
'build': packageInfo.versionCode + ''
390+
};
392391
}
393392

394393
export function closeNativeSdk () {
@@ -437,33 +436,33 @@ export namespace NSSentry {
437436
scope.setUser(null);
438437
} else {
439438
const userInstance = new io.sentry.protocol.User();
440-
439+
441440
if (user) {
442441
if (user.email) {
443442
userInstance.setEmail(user.email);
444443
}
445-
444+
446445
if (user.id) {
447446
userInstance.setId(user.id);
448447
}
449-
448+
450449
if (user.username) {
451450
userInstance.setUsername(user.username);
452451
}
453-
452+
454453
if (user.ip_address) {
455454
userInstance.setIpAddress(user.ip_address);
456455
}
457456
}
458-
457+
459458
if (otherUserKeys ) {
460459
userInstance.setOthers(getNativeHashMap(otherUserKeys));
461460
}
462461
scope.setUser(userInstance);
463462
}
464463
}
465464
}));
466-
465+
467466
}
468467
export function setTag(key: string, value: string) {
469468
io.sentry.Sentry.configureScope(new io.sentry.ScopeCallback({
@@ -486,29 +485,29 @@ export namespace NSSentry {
486485
run(scope) {
487486
const breadcrumbInstance = new io.sentry.Breadcrumb();
488487

489-
if (breadcrumb.message) {
490-
breadcrumbInstance.setMessage(breadcrumb.message);
491-
}
488+
if (breadcrumb.message) {
489+
breadcrumbInstance.setMessage(breadcrumb.message);
490+
}
492491

493-
if (breadcrumb.type) {
494-
breadcrumbInstance.setType(breadcrumb.type);
495-
}
492+
if (breadcrumb.type) {
493+
breadcrumbInstance.setType(breadcrumb.type);
494+
}
496495

497-
if (breadcrumb.category) {
498-
breadcrumbInstance.setCategory(breadcrumb.category);
499-
}
496+
if (breadcrumb.category) {
497+
breadcrumbInstance.setCategory(breadcrumb.category);
498+
}
500499

501-
if (breadcrumb.level) {
502-
breadcrumbInstance.setLevel(eventLevel(breadcrumb.level));
503-
}
500+
if (breadcrumb.level) {
501+
breadcrumbInstance.setLevel(eventLevel(breadcrumb.level));
502+
}
504503

505-
if (breadcrumb.data) {
506-
Object.keys(breadcrumb.data).forEach(key => {
507-
breadcrumbInstance.setData(key, breadcrumb.data[key]);
508-
})
509-
}
504+
if (breadcrumb.data) {
505+
Object.keys(breadcrumb.data).forEach(key => {
506+
breadcrumbInstance.setData(key, breadcrumb.data[key]);
507+
});
508+
}
510509

511-
scope.addBreadcrumb(breadcrumbInstance);
510+
scope.addBreadcrumb(breadcrumbInstance);
512511
}
513512
}));
514513
}

src/nssentry.ios.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { getClass } from '@nativescript/core/utils/types';
2-
import { Event, Response, Severity, Status } from '@sentry/types';
2+
import { Breadcrumb, Event, Response, Severity, Status, User } from '@sentry/types';
33
import { NativescriptOptions, _processLevel } from './backend';
44
import { UserFeedback } from './nssentry';
5-
import { Breadcrumb, User } from '@sentry/types';
65

76
export namespace NSSentry {
87
export const nativeClientAvailable = true;
@@ -42,8 +41,8 @@ export namespace NSSentry {
4241
};
4342
payload.tags = payload.tags || {};
4443

45-
payload.tags["event.origin"] = "ios";
46-
payload.tags["event.environment"] = "nativescript";
44+
payload.tags['event.origin'] = 'ios';
45+
payload.tags['event.environment'] = 'nativescript';
4746
// Serialize and remove any instances that will crash the native bridge such as Spans
4847
const serializedPayload = JSON.parse(JSON.stringify(payload));
4948
const eventId = SentryId.alloc().initWithUUIDString(event.event_id);
@@ -70,7 +69,7 @@ export namespace NSSentry {
7069
NSSentrySDK.captureEnvelope(envelope);
7170
}
7271
// if (sentryOptions.flushSendEvent === true) {
73-
72+
7473
// }
7574
} catch (err) {
7675
console.error(err);

0 commit comments

Comments
 (0)