Skip to content

Commit 6ef6f29

Browse files
committed
meta: lint fixes
1 parent 0c25454 commit 6ef6f29

File tree

9 files changed

+47
-25
lines changed

9 files changed

+47
-25
lines changed

packages/feedback/src/constants.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const DEFAULT_THEME = {
2323
},
2424
};
2525

26-
2726
export const ACTOR_LABEL = 'Report a Bug';
2827
export const CANCEL_BUTTON_LABEL = 'Cancel';
2928
export const SUBMIT_BUTTON_LABEL = 'Send Bug Report';
@@ -33,5 +32,5 @@ export const EMAIL_LABEL = 'Email';
3332
export const MESSAGE_PLACEHOLDER = "What's the bug? What did you expect?";
3433
export const MESSAGE_LABEL = 'Description';
3534
export const NAME_PLACEHOLDER = 'Your Name';
36-
export const NAME_LABEL= 'Name';
35+
export const NAME_LABEL = 'Name';
3736
export const SUCCESS_MESSAGE_TEXT = 'Thank you for your report!';

packages/feedback/src/integration.ts

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
import { getCurrentHub } from '@sentry/core';
22
import type { Integration } from '@sentry/types';
33
import { isNodeEnv, logger } from '@sentry/utils';
4-
import { ACTOR_LABEL, CANCEL_BUTTON_LABEL, DEFAULT_THEME, EMAIL_LABEL, EMAIL_PLACEHOLDER, FORM_TITLE, MESSAGE_LABEL, MESSAGE_PLACEHOLDER, NAME_LABEL, NAME_PLACEHOLDER, SUBMIT_BUTTON_LABEL, SUCCESS_MESSAGE_TEXT } from './constants';
54

5+
import {
6+
ACTOR_LABEL,
7+
CANCEL_BUTTON_LABEL,
8+
DEFAULT_THEME,
9+
EMAIL_LABEL,
10+
EMAIL_PLACEHOLDER,
11+
FORM_TITLE,
12+
MESSAGE_LABEL,
13+
MESSAGE_PLACEHOLDER,
14+
NAME_LABEL,
15+
NAME_PLACEHOLDER,
16+
SUBMIT_BUTTON_LABEL,
17+
SUCCESS_MESSAGE_TEXT,
18+
} from './constants';
619
import type { FeedbackConfigurationWithDefaults, FeedbackFormData, FeedbackTheme } from './types';
720
import { handleFeedbackSubmit } from './util/handleFeedbackSubmit';
821
import { Actor } from './widget/Actor';
@@ -30,7 +43,7 @@ interface FeedbackConfiguration extends Partial<Omit<FeedbackConfigurationWithDe
3043
theme?: {
3144
dark?: Partial<FeedbackTheme>;
3245
light?: Partial<FeedbackTheme>;
33-
}
46+
};
3447
}
3548

3649
/**
@@ -78,7 +91,7 @@ export class Feedback implements Integration {
7891
/**
7992
* Tracks if dialog has ever been opened at least one time
8093
*/
81-
private hasDialogEverOpened: boolean;
94+
private _hasDialogEverOpened: boolean;
8295

8396
public constructor({
8497
id = 'sentry-feedback',
@@ -113,15 +126,15 @@ export class Feedback implements Integration {
113126
onDialogOpen,
114127
onSubmitError,
115128
onSubmitSuccess,
116-
}: FeedbackConfiguration = {}) {
129+
}: FeedbackConfiguration = {}) {
117130
// Initializations
118131
this.name = Feedback.id;
119132
this._actor = null;
120133
this._dialog = null;
121134
this._host = null;
122135
this._shadow = null;
123136
this._isDialogOpen = false;
124-
this.hasDialogEverOpened = false;
137+
this._hasDialogEverOpened = false;
125138

126139
this.options = {
127140
id,
@@ -252,7 +265,7 @@ export class Feedback implements Integration {
252265
}
253266

254267
// Lazy-load until dialog is opened and only inject styles once
255-
if (!this.hasDialogEverOpened) {
268+
if (!this._hasDialogEverOpened) {
256269
this._shadow.appendChild(createDialogStyles(document));
257270
}
258271

@@ -279,7 +292,7 @@ export class Feedback implements Integration {
279292
// Hides the default actor whenever dialog is opened
280293
this._actor && this._actor.hide();
281294

282-
this.hasDialogEverOpened = true;
295+
this._hasDialogEverOpened = true;
283296
if (this.options.onDialogOpen) {
284297
this.options.onDialogOpen();
285298
}

packages/feedback/src/sendFeedback.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface SendFeedbackOptions {
2020
export function sendFeedback(
2121
{ name, email, message, url = document.location.href }: SendFeedbackParams,
2222
{ includeReplay = true }: SendFeedbackOptions = {},
23-
) {
23+
): ReturnType<typeof sendFeedbackRequest> {
2424
const hub = getCurrentHub();
2525
const client = hub && hub.getClient<BrowserClient>();
2626
const replay = includeReplay && client ? (client.getIntegrationById('Replay') as Replay | undefined) : undefined;

packages/feedback/src/util/handleFeedbackSubmit.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import type { FeedbackFormData } from '../types';
2-
import { DialogComponent } from '../widget/Dialog';
31
import { sendFeedback } from '../sendFeedback';
2+
import type { FeedbackFormData } from '../types';
3+
import type { DialogComponent } from '../widget/Dialog';
44

5+
/**
6+
*
7+
*/
58
export async function handleFeedbackSubmit(
69
dialog: DialogComponent | null,
710
feedback: FeedbackFormData,
@@ -11,7 +14,7 @@ export async function handleFeedbackSubmit(
1114
return false;
1215
}
1316

14-
const showFetchError = () => {
17+
const showFetchError = (): void => {
1518
if (!dialog) {
1619
return;
1720
}
@@ -23,7 +26,6 @@ export async function handleFeedbackSubmit(
2326
dialog.hideError();
2427
dialog.setSubmitDisabled();
2528
const resp = await sendFeedback(feedback);
26-
console.log({ resp });
2729

2830
if (!resp) {
2931
// Errored... re-enable submit button

packages/feedback/src/widget/Actor.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { FeedbackComponent, FeedbackConfigurationWithDefaults, FeedbackTheme } from '../types';
1+
import type { FeedbackComponent, FeedbackConfigurationWithDefaults } from '../types';
22
import { Icon } from './Icon';
33
import { createElement as h } from './util/createElement';
44

@@ -22,7 +22,7 @@ interface ActorComponent extends FeedbackComponent<HTMLButtonElement> {
2222
*
2323
*/
2424
export function Actor({ options, onClick }: Props): ActorComponent {
25-
function _handleClick(e: MouseEvent) {
25+
function _handleClick(e: MouseEvent): void {
2626
onClick && onClick(e);
2727
}
2828

packages/feedback/src/widget/Dialog.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function Dialog({
6161
* semi-transparent bg behind the form. We want clicks outside of the form to
6262
* hide the form.
6363
*/
64-
function handleDialogClick() {
64+
function handleDialogClick(): void {
6565
close();
6666

6767
// Only this should trigger `onClose`, we don't want the `close()` method to
@@ -72,7 +72,7 @@ export function Dialog({
7272
/**
7373
* Close the dialog
7474
*/
75-
function close() {
75+
function close(): void {
7676
if ($el) {
7777
$el.open = false;
7878
}
@@ -81,7 +81,7 @@ export function Dialog({
8181
/**
8282
* Opens the dialog
8383
*/
84-
function open() {
84+
function open(): void {
8585
if ($el) {
8686
$el.open = true;
8787
}

packages/feedback/src/widget/Form.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ export function Form({
106106
ariaHidden: 'true',
107107
});
108108

109-
function showError(message: string) {
109+
function showError(message: string): void {
110110
$error.textContent = message;
111111
$error.classList.remove('form__error-container--hidden');
112112
$error.setAttribute('ariaHidden', 'false');
113113
}
114114

115-
function hideError() {
115+
function hideError(): void {
116116
$error.textContent = '';
117117
$error.classList.add('form__error-container--hidden');
118118
$error.setAttribute('ariaHidden', 'true');

packages/feedback/src/widget/Main.css.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import type { FeedbackThemes } from '../types';
33
/**
44
* Creates <style> element for widget actor (button that opens the dialog)
55
*/
6-
export function createMainStyles(d: Document, colorScheme: 'system' | 'dark' | 'light', themes: FeedbackThemes): HTMLStyleElement {
6+
export function createMainStyles(
7+
d: Document,
8+
colorScheme: 'system' | 'dark' | 'light',
9+
themes: FeedbackThemes,
10+
): HTMLStyleElement {
711
const style = d.createElement('style');
812
const theme = colorScheme === 'system' ? themes.light : themes[colorScheme];
913
style.textContent = `
@@ -29,7 +33,9 @@ export function createMainStyles(d: Document, colorScheme: 'system' | 'dark' | '
2933
--border: ${theme.border};
3034
--box-shadow: ${theme.boxShadow};
3135
}
32-
${colorScheme === 'system' ? `
36+
${
37+
colorScheme === 'system'
38+
? `
3339
@media (prefers-color-scheme: dark) {
3440
:host {
3541
--bg-color: ${themes.dark.background};
@@ -41,7 +47,9 @@ ${colorScheme === 'system' ? `
4147
--box-shadow: ${themes.dark.boxShadow};
4248
}
4349
}
44-
`: ''}`;
50+
`
51+
: ''
52+
}`;
4553

4654
return style;
4755
}

packages/feedback/src/widget/SuccessMessage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface SuccessMessageComponent extends FeedbackComponent<HTMLDivElement> {
1818
* Feedback dialog component that has the form
1919
*/
2020
export function SuccessMessage({ message, onRemove }: SuccessMessageProps): SuccessMessageComponent {
21-
function remove() {
21+
function remove(): void {
2222
if (!$el) {
2323
return;
2424
}

0 commit comments

Comments
 (0)