Skip to content

Commit

Permalink
lint: Fix no-empty-pattern and no-dupe-else-if eslint violations (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan953 authored Jan 11, 2025
1 parent d6c9eb9 commit f8f3a8a
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 58 deletions.
2 changes: 0 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ export default typescript.config([
'no-case-declarations': 'off', // TODO(ryan953): Fix violations and delete this line
'no-constant-binary-expression': 'off', // TODO(ryan953): Fix violations and delete this line
'no-dupe-class-members': 'off', // TODO(ryan953): Fix violations and delete this line
'no-dupe-else-if': 'off', // TODO(ryan953): Fix violations and delete this line
'no-empty-pattern': 'off', // TODO(ryan953): Fix violations and delete this line
'no-import-assign': 'off', // TODO(ryan953): Fix violations and delete this line
'no-loss-of-precision': 'off', // TODO(ryan953): Fix violations and delete this line
'no-prototype-builtins': 'off', // TODO(ryan953): Fix violations and delete this line
Expand Down
4 changes: 2 additions & 2 deletions static/app/components/lazyLoad.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ type TestProps = {
testProp?: boolean;
};

function FooComponent({}: TestProps) {
function FooComponent() {
return <div>my foo component</div>;
}

function BarComponent({}: TestProps) {
function BarComponent() {
return <div>my bar component</div>;
}

Expand Down
1 change: 0 additions & 1 deletion static/app/components/replays/utils.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ describe('getFramesByColumn', () => {

const {
errorFrames: [CRUMB_1, CRUMB_2, CRUMB_3, CRUMB_4, CRUMB_5],
feedbackFrames: [],
} = hydrateErrors(
ReplayRecordFixture({
started_at: new Date('2022-04-14T14:19:47.326000Z'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {IconMegaphone} from 'sentry/icons';
import {t} from 'sentry/locale';
import {useFeedbackForm} from 'sentry/utils/useFeedbackForm';

export default function DynamicAlertsFeedbackButton({}) {
export default function DynamicAlertsFeedbackButton() {
const openForm = useFeedbackForm();

if (!openForm) {
Expand Down
11 changes: 3 additions & 8 deletions static/app/views/explore/content.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {useCallback, useMemo} from 'react';
import styled from '@emotion/styled';
import * as Sentry from '@sentry/react';
import type {Location} from 'history';

import Feature from 'sentry/components/acl/feature';
import {Alert} from 'sentry/components/alert';
Expand Down Expand Up @@ -57,11 +56,7 @@ import {ExploreTables} from 'sentry/views/explore/tables';
import {ExploreToolbar} from 'sentry/views/explore/toolbar';
import {combineConfidenceForSeries} from 'sentry/views/explore/utils';

interface ExploreContentProps {
location: Location;
}

function ExploreContentImpl({}: ExploreContentProps) {
function ExploreContentImpl() {
const location = useLocation();
const navigate = useNavigate();
const organization = useOrganization();
Expand Down Expand Up @@ -257,13 +252,13 @@ function ExploreTagsProvider({children}) {
);
}

export function ExploreContent(props: ExploreContentProps) {
export function ExploreContent() {
Sentry.setTag('explore.visited', 'yes');

return (
<PageParamsProvider>
<ExploreTagsProvider>
<ExploreContentImpl {...props} />
<ExploreContentImpl />
</ExploreTagsProvider>
</PageParamsProvider>
);
Expand Down
4 changes: 1 addition & 3 deletions static/app/views/explore/toolbar/toolbarVisualize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ type ParsedVisualize = {
label: string;
};

interface ToolbarVisualizeProps {}

export function ToolbarVisualize({}: ToolbarVisualizeProps) {
export function ToolbarVisualize() {
const visualizes = useExploreVisualizes();
const setVisualizes = useSetExploreVisualizes();

Expand Down
5 changes: 1 addition & 4 deletions static/app/views/feedback/feedbackListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
import {feedbackWidgetPlatforms} from 'sentry/data/platformCategories';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import useProjects from 'sentry/utils/useProjects';
import FluidHeight from 'sentry/views/replays/detail/layout/fluidHeight';

interface Props extends RouteComponentProps<{}, {}, {}> {}

export default function FeedbackListPage({}: Props) {
export default function FeedbackListPage() {
const organization = useOrganization();
const {hasSetupOneFeedback} = useHaveSelectedProjectsSetupFeedback();
const {hasSetupNewFeedback} = useHaveSelectedProjectsSetupNewFeedback();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ export function FullSpanDescription({
result = prettyPrintJsonString(description);
} else if (fullSpan?.sentry_tags?.description) {
result = prettyPrintJsonString(fullSpan?.sentry_tags.description);
} else if (fullSpan?.sentry_tags?.description) {
result = prettyPrintJsonString(fullSpan?.sentry_tags?.description);
} else {
stringifiedQuery = description || fullSpan?.sentry_tags?.description || 'N/A';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,5 @@ const StyledIconBuisness = styled(IconBusiness)`

export const UpsellFooterHook = HookOrDefault({
hookName: 'component:insights-date-range-query-limit-footer',
defaultComponent: ({}) => undefined,
defaultComponent: () => undefined,
});
4 changes: 2 additions & 2 deletions static/app/views/profiling/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export default function ProfilingContent({location}: ProfilingContentProps) {
</Tabs>
</div>
{tab === 'flamegraph' ? (
<FlamegraphTab location={location} selection={selection} />
<FlamegraphTab />
) : (
<TransactionsTab location={location} selection={selection} />
)}
Expand Down Expand Up @@ -232,7 +232,7 @@ function TransactionsTab({location, selection}: TabbedContentProps) {
);
}

function FlamegraphTab({}: TabbedContentProps) {
function FlamegraphTab() {
return (
<LandingAggregateFlamegraphSizer>
<LandingAggregateFlamegraphContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const mockUseLocation = jest.mocked(useLocation);

const {
errorFrames: [ERROR_1_JS_RANGEERROR, ERROR_2_NEXTJS_TYPEERROR, ERROR_3_JS_UNDEFINED],
feedbackFrames: [],
} = hydrateErrors(
ReplayRecordFixture({started_at: new Date('2023-06-09T12:00:00+00:00')}),
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jest.mock('sentry/utils/useUrlParams', () => {

const {
errorFrames: [ERROR_1_JS_RANGEERROR, ERROR_2_NEXTJS_TYPEERROR, ERROR_3_JS_UNDEFINED],
feedbackFrames: [],
} = hydrateErrors(
ReplayRecordFixture({started_at: new Date('2023-06-09T12:00:00+00:00')}),
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {SELF_NOTIFICATION_SETTINGS_TYPES} from 'sentry/views/settings/account/no
import {NOTIFICATION_SETTING_FIELDS} from 'sentry/views/settings/account/notifications/fields2';
import NotificationSettings from 'sentry/views/settings/account/notifications/notificationSettings';

function renderMockRequests({}: {}) {
function renderMockRequests() {
MockApiClient.addMockResponse({
url: '/users/me/notifications/',
method: 'GET',
Expand All @@ -22,7 +22,7 @@ describe('NotificationSettings', function () {
it('should render', async function () {
const {router, organization} = initializeOrg();

renderMockRequests({});
renderMockRequests();

render(<NotificationSettings organizations={[organization]} />, {
router,
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('NotificationSettings', function () {
},
});

renderMockRequests({});
renderMockRequests();

render(<NotificationSettings organizations={[organization]} />, {
router,
Expand Down Expand Up @@ -87,7 +87,7 @@ describe('NotificationSettings', function () {
const organizationNoFlag = OrganizationFixture();
organizationNoFlag.features.push('user-spend-notifications-settings');

renderMockRequests({});
renderMockRequests();

render(<NotificationSettings organizations={[organization, organizationNoFlag]} />, {
router,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import NewTokenHandler from 'sentry/views/settings/components/newTokenHandler';

describe('NewTokenHandler', () => {
it('renders', () => {
const callback = ({}) => {};
const callback = () => {};
render(<NewTokenHandler token={ApiTokenFixture().token} handleGoBack={callback} />);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {organizationSamplingForm} from 'sentry/views/settings/dynamicSampling/ut

const {useFormField} = organizationSamplingForm;

export function OrganizationSampleRateField({}) {
export function OrganizationSampleRateField() {
const field = useFormField('targetSampleRate');
const hasAccess = useHasDynamicSamplingWriteAccess();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import NewProviderForm from 'sentry/views/settings/featureFlags/newProviderForm'

describe('NewProviderForm', () => {
it('renders', () => {
const callback = ({}) => {};
const callback = () => {};
render(<NewProviderForm onSetProvider={callback} onCreatedSecret={callback} />);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import NewSecretHandler from 'sentry/views/settings/featureFlags/newSecretHandle

describe('NewSecretHandler', () => {
it('renders', () => {
const callback = ({}) => {};
const callback = () => {};
render(
<NewSecretHandler
secret={SecretFixture().secret}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ describe('OrganizationGeneralSettings', function () {
const {organization, router} = initializeOrg();
let configState: Config;

const defaultProps = {
organization,
router,
location: router.location,
params: {orgId: organization.slug},
routes: router.routes,
route: {},
routeParams: router.params,
};

beforeEach(function () {
configState = ConfigStore.getState();
OrganizationsStore.addOrReplace(organization);
Expand All @@ -58,7 +48,7 @@ describe('OrganizationGeneralSettings', function () {
});

it('can enable "early adopter"', async function () {
render(<OrganizationGeneralSettings {...defaultProps} />);
render(<OrganizationGeneralSettings />);
const mock = MockApiClient.addMockResponse({
url: ENDPOINT,
method: 'PUT',
Expand All @@ -81,7 +71,7 @@ describe('OrganizationGeneralSettings', function () {
features: ['codecov-integration'],
codecovAccess: false,
});
render(<OrganizationGeneralSettings {...defaultProps} />, {
render(<OrganizationGeneralSettings />, {
organization: organizationWithCodecovFeature,
});
const mock = MockApiClient.addMockResponse({
Expand All @@ -106,7 +96,7 @@ describe('OrganizationGeneralSettings', function () {
});

it('changes org slug and redirects to new slug', async function () {
render(<OrganizationGeneralSettings {...defaultProps} />, {router});
render(<OrganizationGeneralSettings />, {router});
const mock = MockApiClient.addMockResponse({
url: ENDPOINT,
method: 'PUT',
Expand Down Expand Up @@ -143,7 +133,7 @@ describe('OrganizationGeneralSettings', function () {
body: {...org, slug: 'acme', links: {organizationUrl: 'https://acme.sentry.io'}},
});

render(<OrganizationGeneralSettings {...defaultProps} />, {organization: org});
render(<OrganizationGeneralSettings />, {organization: org});

const input = screen.getByRole('textbox', {name: /slug/i});

Expand All @@ -170,7 +160,7 @@ describe('OrganizationGeneralSettings', function () {
it('disables the entire form if user does not have write access', function () {
const readOnlyOrg = OrganizationFixture({access: ['org:read']});

render(<OrganizationGeneralSettings {...defaultProps} />, {
render(<OrganizationGeneralSettings />, {
organization: readOnlyOrg,
});

Expand All @@ -192,7 +182,7 @@ describe('OrganizationGeneralSettings', function () {
});

it('does not have remove organization button without org:admin permission', function () {
render(<OrganizationGeneralSettings {...defaultProps} />, {
render(<OrganizationGeneralSettings />, {
organization: OrganizationFixture({
access: ['org:write'],
}),
Expand All @@ -206,7 +196,7 @@ describe('OrganizationGeneralSettings', function () {
it('can remove organization when org admin', async function () {
act(() => ProjectsStore.loadInitialData([ProjectFixture({slug: 'project'})]));

render(<OrganizationGeneralSettings {...defaultProps} />, {
render(<OrganizationGeneralSettings />, {
organization: OrganizationFixture({access: ['org:admin']}),
});
renderGlobalModal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import PanelHeader from 'sentry/components/panels/panelHeader';
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
import {t, tct} from 'sentry/locale';
import ConfigStore from 'sentry/stores/configStore';
import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
import type {Organization} from 'sentry/types/organization';
import {trackAnalytics} from 'sentry/utils/analytics';
import useApi from 'sentry/utils/useApi';
Expand All @@ -30,7 +29,7 @@ import {OrganizationRegionAction} from 'sentry/views/settings/organizationGenera

import OrganizationSettingsForm from './organizationSettingsForm';

export default function OrganizationGeneralSettings({}: RouteComponentProps<{}, {}>) {
export default function OrganizationGeneralSettings() {
const api = useApi();
const organization = useOrganization();
const {projects} = useProjects();
Expand Down
4 changes: 1 addition & 3 deletions static/app/views/traces/tracesChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import {CHART_HEIGHT} from 'sentry/views/insights/database/settings';

import {areQueriesEmpty} from './utils';

interface Props {}

export function TracesChart({}: Props) {
export function TracesChart() {
const location = useLocation();

const queries = useMemo(() => {
Expand Down

0 comments on commit f8f3a8a

Please sign in to comment.