10000 TODO => JSDoc for a better searchability · lordnox/sentry-javascript@c5db814 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit c5db814

Browse files
committed
TODO => JSDoc for a better searchability
1 parent f512fad commit c5db814

File tree

13 files changed

+94
-171
lines changed
  • types/src
  • utils/src
  • 13 files changed

    +94
    -171
    lines changed

    packages/browser/src/client.ts

    Lines changed: 1 addition & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -19,9 +19,7 @@ export class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
    1919
    super(BrowserBackend, options);
    2020
    }
    2121

    22-
    /**
    23-
    * TODO
    24-
    */
    22+
    /** JSDoc */
    2523
    public showReportDialog(options: {
    2624
    [key: string]: any;
    2725
    eventId?: string;

    packages/browser/src/integrations/breadcrumbs.ts

    Lines changed: 15 additions & 30 deletions
    Original file line numberDiff line numberDiff line change
    @@ -10,16 +10,12 @@ import { breadcrumbEventHandler, keypressEventHandler, wrap } from './helpers';
    1010
    const global = getGlobalObject() as Window;
    1111
    let lastHref: string | undefined;
    1212

    13-
    /**
    14-
    * TODO
    15-
    */
    13+
    /** JSDoc */
    1614
    interface ExtensibleConsole extends Console {
    1715
    [key: string]: any;
    1816
    }
    1917

    20-
    /**
    21-
    * TODO
    22-
    */
    18+
    /** JSDoc */
    2319
    export interface SentryWrappedXMLHttpRequest extends XMLHttpRequest {
    2420
    [key: string]: any;
    2521
    __sentry_xhr__?: {
    @@ -35,6 +31,7 @@ export class Breadcrumbs implements Integration {
    3531
    * @inheritDoc
    3632
    */
    3733
    public name: string = 'Breadcrumbs';
    34+
    3835
    /**
    3936
    * @inheritDoc
    4037
    */
    @@ -53,9 +50,8 @@ export class Breadcrumbs implements Integration {
    5350
    xhr: true,
    5451
    },
    5552
    ) {}
    56-
    /**
    57-
    * TODO
    58-
    */
    53+
    54+
    /** JSDoc */
    5955
    private instrumentConsole(): void {
    6056
    if (!('console' in global)) {
    6157
    return;
    @@ -100,9 +96,8 @@ export class Breadcrumbs implements Integration {
    10096
    };
    10197
    });
    10298
    }
    103-
    /**
    104-
    * TODO
    105-
    */
    99+
    100+
    /** JSDoc */
    106101
    private instrumentDOM(): void {
    107102
    if (!('document' in global)) {
    108103
    return;
    @@ -112,9 +107,8 @@ export class Breadcrumbs implements Integration {
    112107
    global.document.addEventListener('click', breadcrumbEventHandler('click'), false);
    113108
    global.document.addEventListener('keypress', keypressEventHandler(), false);
    114109
    }
    115-
    /**
    116-
    * TODO
    117-
    */
    110+
    111+
    /** JSDoc */
    118112
    private instrumentFetch(): void {
    119113
    if (!supportsFetch()) {
    120114
    return;
    @@ -180,9 +174,8 @@ export class Breadcrumbs implements Integration {
    180174
    };
    181175
    });
    182176
    }
    183-
    /**
    184-
    * TODO
    185-
    */
    177+
    178+
    /** JSDoc */
    186179
    private instrumentHistory(): void {
    187180
    if (!supportsHistory()) {
    188181
    return;
    @@ -228,9 +221,7 @@ export class Breadcrumbs implements Integration {
    228221
    }
    229222
    };
    230223

    231-
    /**
    232-
    * TODO
    233-
    */
    224+
    /** JSDoc */
    234225
    function historyReplacementFunction(originalHistoryFunction: () => void): () => void {
    235226
    // note history.pushState.length is 0; intentionally not declaring
    236227
    // params to preserve 0 arity
    @@ -248,17 +239,13 @@ export class Breadcrumbs implements Integration {
    248239
    fill(global.history, 'pushState', historyReplacementFunction);
    249240
    fill(global.history, 'replaceState', historyReplacementFunction);
    250241
    }
    251-
    /**
    252-
    * TODO
    253-
    */
    242+
    /** JSDoc */
    254243
    private instrumentXHR(): void {
    255244
    if (!('XMLHttpRequest' in global)) {
    256245
    return;
    257246
    }
    258247

    259-
    /**
    260-
    * TODO
    261-
    */
    248+
    /** JSDoc */
    262249
    function wrapProp(prop: string, xhr: XMLHttpRequest): void {
    263250
    // TODO: Fix XHR types
    264251
    if (prop in xhr && isFunction((xhr as { [key: string]: any })[prop])) {
    @@ -303,9 +290,7 @@ export class Breadcrumbs implements Integration {
    303290
    function(this: SentryWrappedXMLHttpRequest, ...args: any[]): void {
    304291
    const xhr = this; // tslint:disable-line:no-this-assignment
    305292

    306-
    /**
    307-
    * TODO
    308-
    */
    293+
    /** JSDoc */
    309294
    function onreadystatechangeHandler(): void {
    310295
    if (xhr.__sentry_xhr__ && xhr.readyState === 4) {
    311296
    try {

    packages/browser/src/integrations/globalhandlers.ts

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -57,7 +57,7 @@ export class GlobalHandlers implements Integration {
    5757
    }
    5858
    }
    5959

    60-
    /** TODO */
    60+
    /** JSDoc */
    6161
    private eventFromGlobalHandler(stacktrace: TraceKitStackTrace): SentryEvent {
    6262
    const event = eventFromStacktrace(stacktrace);
    6363
    return {

    packages/browser/src/integrations/helpers.ts

    Lines changed: 1 addition & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -11,9 +11,7 @@ let ignoreOnError: number = -1;
    1111
    // TODO: Just temporary build fix for unused variable
    1212
    ignoreOnError = ignoreOnError + 1;
    1313

    14-
    /**
    15-
    * TODO
    16-
    */
    14+
    /** JSDoc */
    1715
    export function ignoreNextOnError(): void {
    1816
    // onerror should trigger before setTimeout
    1917
    ignoreOnError += 1;

    packages/browser/src/integrations/inboundfilters.ts

    Lines changed: 10 additions & 10 deletions
    Original file line numberDiff line numberDiff line change
    @@ -12,11 +12,11 @@ const MATCH_EVERYTHING = new RegExp('');
    1212

    1313
    /** Inbound filters configurable by the user */
    1414
    export class InboundFilters implements Integration {
    15-
    /** TODO */
    15+
    /** JSDoc */
    1616
    private ignoreErrors: RegExp = joinRegExp(DEFAULT_IGNORE_ERRORS);
    17-
    /** TODO */
    17+
    /** JSDoc */
    1818
    private blacklistUrls: RegExp = MATCH_NOTHING;
    19-
    /** TODO */
    19+
    /** JSDoc */
    2020
    private whitelistUrls: RegExp = MATCH_EVERYTHING;
    2121

    2222
    /**
    @@ -37,7 +37,7 @@ export class InboundFilters implements Integration {
    3737
    });
    3838
    }
    3939

    40-
    /** TODO */
    40+
    /** JSDoc */
    4141
    private configureOptions(options: BrowserOptions): void {
    4242
    if (options.ignoreErrors) {
    4343
    // TODO: Afair people wanted an option to disable defaults. Should we do it?
    @@ -51,7 +51,7 @@ export class InboundFilters implements Integration {
    5151
    }
    5252
    }
    5353

    54-
    /** TODO */
    54+
    /** JSDoc */
    5555
    private shouldDropEvent(event: SentryEvent): boolean {
    5656
    if (this.isIgnoredError(event)) {
    5757
    logger.warn(`Event dropped due to being ignored.\n Event: ${event.event_id}`);
    @@ -68,22 +68,22 @@ export class InboundFilters implements Integration {
    6868
    return false;
    6969
    }
    7070

    71-
    /** TODO */
    71+
    /** JSDoc */
    7272
    private isIgnoredError(event: SentryEvent): boolean {
    7373
    return this.getPossibleEventMessages(event).some(message => this.ignoreErrors.test(message));
    7474
    }
    7575

    76-
    /** TODO */
    76+
    /** JSDoc */
    7777
    private isWhitelistedUrl(event: SentryEvent): boolean {
    7878
    return this.whitelistUrls.test(this.getEventFilterUrl(event));
    7979
    }
    8080

    81-
    /** TODO */
    81+
    /** JSDoc */
    8282
    private isBlacklistedUrl(event: SentryEvent): boolean {
    8383
    return this.blacklistUrls.test(this.getEventFilterUrl(event));
    8484
    }
    8585

    86-
    /** TODO */
    86+
    /** JSDoc */
    8787
    private getPossibleEventMessages(event: SentryEvent): string[] {
    8888
    const evt = event as any;
    8989

    @@ -102,7 +102,7 @@ export class InboundFilters implements Integration {
    102102
    }
    103103
    }
    104104

    105-
    /** TODO */
    105+
    /** JSDoc */
    106106
    private getEventFilterUrl(event: SentryEvent): string {
    107107
    const evt = event as any;
    108108

    packages/browser/src/integrations/trycatch.ts

    Lines changed: 4 additions & 12 deletions
    Original file line numberDiff line numberDiff line change
    @@ -5,19 +5,15 @@ import { breadcrumbEventHandler, keypressEventHandler, wrap } from './helpers';
    55

    66
    /** Wrap timer functions and event targets to catch errors and provide better meta data */
    77
    export class TryCatch implements Integration {
    8-
    /**
    9-
    * TODO
    10-
    */
    8+
    /** JSDoc */
    119
    private ignoreOnError: number = 0;
    1210

    1311
    /**
    1412
    * @inheritDoc
    1513
    */
    1614
    public name: string = 'TryCatch';
    1715

    18-
    /**
    19-
    * TODO
    20-
    */
    16+
    /** JSDoc */
    2117
    private wrapTimeFunction(original: () => void): () => number {
    2218
    return (...args: any[]): number => {
    2319
    const originalCallback = args[0];
    @@ -31,9 +27,7 @@ export class TryCatch implements Integration {
    3127
    };
    3228
    }
    3329

    34-
    /**
    35-
    * TODO
    36-
    */
    30+
    /** JSDoc */
    3731
    private wrapRAF(original: any): (callback: () => void) => any {
    3832
    return (callback: () => void) =>
    3933
    original(
    @@ -49,9 +43,7 @@ export class TryCatch implements Integration {
    4943
    );
    5044
    }
    5145

    52-
    /**
    53-
    * TODO
    54-
    */
    46+
    /** JSDoc */
    5547
    private wrapEventTarget(target: string): void {
    5648
    const global = getGlobalObject() as { [key: string]: any };
    5749
    const proto = global[target] && global[target].prototype;

    packages/browser/src/parsers.ts

    Lines changed: 3 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -9,7 +9,7 @@ const md5 = ((md5proxy as any).default || md5proxy) as (input: string) => string
    99

    1010
    const STACKTRACE_LIMIT = 50;
    1111

    12-
    /** TODO */
    12+
    /** JSDoc */
    1313
    export function getEventOptionsFromPlainObject(exception: {}): {
    1414
    extra: {
    1515
    __serialized__: object;
    @@ -27,7 +27,7 @@ export function getEventOptionsFromPlainObject(exception: {}): {
    2727
    };
    2828
    }
    2929

    30-
    /** TODO */
    30+
    /** JSDoc */
    3131
    export function eventFromStacktrace(stacktrace: TraceKitStackTrace): SentryEvent {
    3232
    const frames = prepareFramesForEvent(stacktrace.stack);
    3333
    const transaction = stacktrace.url || (stacktrace.stack && stacktrace.stack[0].url) || '<unknown>';
    @@ -51,7 +51,7 @@ export function eventFromStacktrace(stacktrace: TraceKitStackTrace): SentryEvent
    5151
    };
    5252
    }
    5353

    54-
    /** TODO */
    54+
    /** JSDoc */
    5555
    export function prepareFramesForEvent(stack: TraceKitStackFrame[]): StackFrame[] {
    5656
    if (!stack) {
    5757
    return [];

    packages/core/src/logger.ts

    Lines changed: 9 additions & 9 deletions
    Original file line numberDiff line numberDiff line change
    @@ -3,41 +3,41 @@ import { getGlobalObject } from '@sentry/utils/misc';
    33
    // TODO: Implement different loggers for different environments
    44
    const global = getGlobalObject() as Window;
    55

    6-
    /** TODO */
    6+
    /** JSDoc */
    77
    class Logger {
    8-
    /** TODO */
    8+
    /** JSDoc */
    99
    private readonly console: Console;
    10-
    /** TODO */
    10+
    /** JSDoc */
    1111
    private disabled: boolean;
    1212

    13-
    /** TODO */
    13+
    /** JSDoc */
    1414
    public constructor() {
    1515
    this.console = global.console;
    1616
    this.disabled = true;
    1717
    }
    18-
    /** TODO */
    18+
    /** JSDoc */
    1919
    public disable(): void {
    2020
    this.disabled = true;
    2121
    }
    22-
    /** TODO */
    22+
    /** JSDoc */
    2323
    public enable(): void {
    2424
    this.disabled = false;
    2525
    }
    26-
    /** TODO */
    26+
    /** JSDoc */
    2727
    public log(message: any): void {
    2828
    if (this.disabled) {
    2929
    return;
    3030
    }
    3131
    this.console.log(`Sentry Logger [Log]: ${message}`); // tslint:disable-line:no-console
    3232
    }
    33-
    /** TODO */
    33+
    /** JSDoc */
    3434
    public warn(message: any): void {
    3535
    if (this.disabled) {
    3636
    return;
    3737
    }
    3838
    this.console.warn(`Sentry Logger [Warn]: ${message}`); // tslint:disable-line:no-console
    3939
    }
    40-
    /** TODO */
    40+
    /** JSDoc */
    4141
    public error(message: any): void {
    4242
    if (this.disabled) {
    4343
    return;

    0 commit comments

    Comments
     (0)
    0