Просмотр исходного кода

lint: Enable `object-shorthand` (#82273)

Followup to https://github.com/getsentry/sentry/pull/82260
Related to https://github.com/getsentry/frontend-tsc/issues/82
Ryan Albrecht 2 месяцев назад
Родитель
Сommit
7cb3a89c7a

+ 1 - 2
.eslintrc.js

@@ -164,9 +164,8 @@ const baseRules = {
   // https://eslint.org/docs/rules/space-in-brackets.html
   'object-curly-spacing': ['off'],
 
-  // TODO(ryan953): Enable this rule
   // https://eslint.org/docs/rules/object-shorthand
-  'object-shorthand': ['off', 'properties'],
+  'object-shorthand': ['error', 'properties'],
 
   // Disabled because of prettier
   // https://eslint.org/docs/rules/space-infix-ops.html

+ 1 - 1
static/app/actionCreators/tags.tsx

@@ -248,7 +248,7 @@ export const makeFetchOrganizationTags = ({
   if (end) {
     query.end = end;
   }
-  return [`/organizations/${orgSlug}/tags/`, {query: query}];
+  return [`/organizations/${orgSlug}/tags/`, {query}];
 };
 
 export const useFetchOrganizationTags = (

+ 5 - 5
static/app/bootstrap/initializeSdk.tsx

@@ -60,11 +60,11 @@ function getSentryIntegrations() {
       depth: 6,
     }),
     Sentry.reactRouterV6BrowserTracingIntegration({
-      useEffect: useEffect,
-      useLocation: useLocation,
-      useNavigationType: useNavigationType,
-      createRoutesFromChildren: createRoutesFromChildren,
-      matchRoutes: matchRoutes,
+      useEffect,
+      useLocation,
+      useNavigationType,
+      createRoutesFromChildren,
+      matchRoutes,
     }),
     Sentry.browserProfilingIntegration(),
     Sentry.thirdPartyErrorFilterIntegration({

+ 3 - 3
static/app/components/analyticsArea.spec.tsx

@@ -15,7 +15,7 @@ function TestButton({org}: {org: Organization}) {
       onClick={() => {
         analytics.trackAnalytics('button-clicked', {
           organization: org,
-          area: area,
+          area,
         });
       }}
     />
@@ -41,7 +41,7 @@ describe('AnalyticsAreaProvider', function () {
     await userEvent.click(button);
 
     expect(analyticsSpy).toHaveBeenCalledWith('button-clicked', {
-      organization: organization,
+      organization,
       area: 'feedback.details.activity',
     });
   });
@@ -61,7 +61,7 @@ describe('AnalyticsAreaProvider', function () {
     await userEvent.click(button);
 
     expect(analyticsSpy).toHaveBeenCalledWith('button-clicked', {
-      organization: organization,
+      organization,
       area: 'my-modal',
     });
   });

+ 3 - 3
static/app/components/assigneeSelectorDropdown.tsx

@@ -344,10 +344,10 @@ export default function AssigneeSelectorDropdown({
         actor => actor.type === type && actor.id === assignee.id
       );
       onAssign({
-        assignee: assignee,
+        assignee,
         id: assigneeId,
-        type: type,
-        suggestedAssignee: suggestedAssignee,
+        type,
+        suggestedAssignee,
       });
     }
   };

+ 2 - 2
static/app/components/events/autofix/autofixInsightCards.tsx

@@ -53,8 +53,8 @@ function AutofixBreadcrumbSnippet({breadcrumb}: AutofixBreadcrumbSnippetProps) {
   const rawCrumb = {
     message: breadcrumb.body,
     category: breadcrumb.category,
-    type: type,
-    level: level,
+    type,
+    level,
   };
 
   return (

+ 1 - 1
static/app/components/events/contexts/index.tsx

@@ -62,7 +62,7 @@ export function getOrderedContextItems(event: Event): ContextItem[] {
       return !isInvalid;
     })
     .map<ContextItem>(([alias, ctx]) => ({
-      alias: alias,
+      alias,
       type: overrideTypesWithAliases.has(alias) ? alias : ctx?.type,
       value: ctx,
     }));

+ 1 - 1
static/app/components/events/eventAttachments.spec.tsx

@@ -27,7 +27,7 @@ describe('EventAttachments', function () {
 
   const props = {
     group: undefined,
-    project: project,
+    project,
     event,
   };
 

+ 1 - 1
static/app/components/events/eventTags/eventTagsTree.tsx

@@ -154,7 +154,7 @@ function TagTreeColumns({
     // root parent so that we do not split up roots/branches when forming columns
     const tagTreeRowGroups: React.ReactNode[][] = Object.entries(tagTree).map(
       ([tagKey, content], i) =>
-        getTagTreeRows({tagKey, content, uniqueKey: `${i}`, project: project, ...props})
+        getTagTreeRows({tagKey, content, uniqueKey: `${i}`, project, ...props})
     );
     // Get the total number of TagTreeRow components to be rendered, and a goal size for each column
     const tagTreeRowTotal = tagTreeRowGroups.reduce(

+ 2 - 2
static/app/components/events/eventTagsAndScreenshot/index.spec.tsx

@@ -221,7 +221,7 @@ describe('EventTagsAndScreenshot', function () {
       const allTags = applicationTags.concat(customTags);
       const testEvent = EventFixture({tags: allTags});
       render(<EventTagsAndScreenshot projectSlug={project.slug} event={testEvent} />, {
-        organization: organization,
+        organization,
       });
       expect(mockDetailedProject).toHaveBeenCalled();
       expect(await screen.findByTestId('loading-indicator')).not.toBeInTheDocument();
@@ -260,7 +260,7 @@ describe('EventTagsAndScreenshot', function () {
       ];
       const testEvent = EventFixture({tags: applicationTags});
       render(<EventTagsAndScreenshot projectSlug={project.slug} event={testEvent} />, {
-        organization: organization,
+        organization,
       });
       expect(mockDetailedProject).toHaveBeenCalled();
       expect(await screen.findByTestId('loading-indicator')).not.toBeInTheDocument();

Некоторые файлы не были показаны из-за большого количества измененных файлов