Skip to content

Commit aebb97f

Browse files
chore: Remove unused catch variables (#170)
1 parent 54c5ad9 commit aebb97f

File tree

8 files changed

+15
-10
lines changed

8 files changed

+15
-10
lines changed

.eslintrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
"rules": {
1919
"@typescript-eslint/no-empty-function": "off",
2020
"@typescript-eslint/no-namespace": "off",
21-
"@typescript-eslint/no-unused-vars": "error",
21+
"@typescript-eslint/no-unused-vars": [
22+
"error",
23+
{
24+
"caughtErrors": "all"
25+
}
26+
],
2227
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
2328
"@typescript-eslint/explicit-module-boundary-types": "off",
2429
"@typescript-eslint/no-explicit-any": "off",

src/internal/analytics-metadata/dom-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const findLogicalParent = (node: HTMLElement): HTMLElement | null => {
1010
return (node.ownerDocument || node).querySelector(`[id="${referrer}"]`);
1111
}
1212
return node.parentElement;
13-
} catch (ex) {
13+
} catch {
1414
return null;
1515
}
1616
};
@@ -31,7 +31,7 @@ export const isNodeComponent = (node: HTMLElement): boolean => {
3131
try {
3232
const metadata = JSON.parse(metadataString);
3333
return !!metadata.component && !!metadata.component.name;
34-
} catch (ex) {
34+
} catch {
3535
return false;
3636
}
3737
};

src/internal/analytics-metadata/testing-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const getRawAnalyticsMetadata = (target: HTMLElement | null): RawAnalytic
2323
output.metadata.push(currentMetadata);
2424
output.labelSelectors = [...output.labelSelectors, ...getLabelSelectors(currentMetadata)];
2525
}
26-
} catch (ex) {
26+
} catch {
2727
/* empty */
2828
} finally {
2929
currentNode = findLogicalParent(currentNode);

src/internal/analytics-metadata/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const getGeneratedAnalyticsMetadata = (target: HTMLElement | null): Gener
1919
const currentMetadata = JSON.parse(currentMetadataString);
2020
metadata = mergeMetadata(metadata, processMetadata(currentNode, currentMetadata));
2121
}
22-
} catch (ex) {
22+
} catch {
2323
/* empty */
2424
} finally {
2525
currentNode = findLogicalParent(currentNode);

src/internal/base-component/metrics/log-clients.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class CLogClient {
8080
}
8181

8282
return this.findAWSC(currentWindow.parent);
83-
} catch (ex) {
83+
} catch {
8484
// Most likely a cross-origin access error
8585
return undefined;
8686
}
@@ -154,7 +154,7 @@ export class PanoramaClient {
154154
}
155155

156156
return this.findPanorama(currentWindow.parent);
157-
} catch (ex) {
157+
} catch {
158158
// Most likely a cross-origin access error
159159
return undefined;
160160
}

src/internal/global-flags/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const getGlobalFlag = (flagName: keyof GlobalFlags): GlobalFlags[keyof Gl
3434
return ownFlag;
3535
}
3636
return readFlag(getTopWindow(), flagName);
37-
} catch (e) {
37+
} catch {
3838
return undefined;
3939
}
4040
};

src/internal/keycode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ export enum KeyCode {
2424
export function isModifierKey(event: KeyboardEvent) {
2525
// we do not want to highlight focused element
2626
// when special keys are pressed
27-
return [KeyCode.shift, KeyCode.alt, KeyCode.control, KeyCode.meta].indexOf(event.keyCode) > -1;
27+
return [KeyCode.shift, KeyCode.alt, KeyCode.control, KeyCode.meta].includes(event.keyCode);
2828
}

src/internal/stable-callback/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ export function useStableCallback<Callback extends (...args: any[]) => any>(fn:
3535
ref.current = fn;
3636
});
3737

38-
return useCallback((...args: any[]) => ref.current?.apply(undefined, args), []) as Callback;
38+
return useCallback((...args: any[]) => ref.current?.(...args), []) as Callback;
3939
}

0 commit comments

Comments
 (0)