Browse Source

style(js): Enable useBlockStatements (#77960)

We lost this when enabling some biome features and disbling eslint
feature


https://github.com/getsentry/eslint-config-sentry/commit/24d720842939eb18548bcab2ff99027738c03cb5#diff-8240c7fa00318e050d9ba1a3b01538434fb10dd1ac1a8d111a62613e3f647be2L123
Evan Purkhiser 5 months ago
parent
commit
587ccc6c9b

+ 8 - 3
biome.json

@@ -84,7 +84,8 @@
         "useNodejsImportProtocol": "error",
         "useLiteralEnumMembers": "error",
         "useEnumInitializers": "error",
-        "useAsConstAssertion": "error"
+        "useAsConstAssertion": "error",
+        "useBlockStatements": "error"
       }
     }
   },
@@ -100,8 +101,12 @@
     ]
   },
   "css": {
-    "formatter": { "enabled": false },
-    "linter": { "enabled": false }
+    "formatter": {
+      "enabled": false
+    },
+    "linter": {
+      "enabled": false
+    }
   },
   "formatter": {
     "enabled": true,

+ 6 - 2
static/app/components/events/autofix/autofixRootCause.tsx

@@ -217,11 +217,15 @@ export function SuggestedFixSnippet({
   icon?: React.ReactNode;
 }) {
   function getSourceLink() {
-    if (!repos) return undefined;
+    if (!repos) {
+      return undefined;
+    }
     const repo = repos.find(
       r => r.name === snippet.repo_name && r.provider === 'integrations:github'
     );
-    if (!repo) return undefined;
+    if (!repo) {
+      return undefined;
+    }
     return `${repo.url}/blob/${repo.default_branch}/${snippet.file_path}`;
   }
   const extension = getFileExtension(snippet.file_path);

+ 8 - 3
static/app/components/events/autofix/autofixSteps.tsx

@@ -119,10 +119,11 @@ function useInView(ref: HTMLElement | null) {
       setInView(entry.isIntersecting);
     });
 
-    if (!ref)
+    if (!ref) {
       return () => {
         observer.disconnect();
       };
+    }
 
     observer.observe(ref);
     return () => {
@@ -143,9 +144,13 @@ export function AutofixSteps({data, groupId, runId, onRetry}: AutofixStepsProps)
     if (text.length > 0) {
       handleSelectFix({customRootCause: text});
     } else {
-      if (!steps) return;
+      if (!steps) {
+        return;
+      }
       const step = steps[steps.length - 1];
-      if (step.type !== AutofixStepType.ROOT_CAUSE_ANALYSIS) return;
+      if (step.type !== AutofixStepType.ROOT_CAUSE_ANALYSIS) {
+        return;
+      }
       const cause = step.causes[0];
       const id = cause.id;
       handleSelectFix({causeId: id});

+ 3 - 1
static/app/components/modals/recoveryOptionsModal.tsx

@@ -48,7 +48,9 @@ function RecoveryOptionsModal({
     setSkipSms(true);
   };
 
-  if (isPending) return <LoadingIndicator />;
+  if (isPending) {
+    return <LoadingIndicator />;
+  }
 
   if (isError) {
     return (

+ 3 - 1
static/app/components/profiling/flamegraph/continuousFlamegraph.tsx

@@ -236,7 +236,9 @@ export function ContinuousFlamegraph(): ReactElement {
   const start: number | null = useMemo(() => {
     const qs = new URLSearchParams(window.location.search);
     const startedAt = qs.get('start');
-    if (!startedAt) return null;
+    if (!startedAt) {
+      return null;
+    }
 
     const sinceEpoch = new Date(startedAt).getTime();
     return isNaN(sinceEpoch) ? null : sinceEpoch;

+ 3 - 1
static/app/components/profiling/flamegraph/flamegraphChart.tsx

@@ -266,7 +266,9 @@ export function FlamegraphChart({
   );
 
   const isInsufficientDuration = useMemo(() => {
-    if (!chart) return false;
+    if (!chart) {
+      return false;
+    }
     return formatTo(chart?.configSpace.width, configViewUnit, 'millisecond') < 200;
   }, [chart, configViewUnit]);
 

+ 3 - 1
static/app/components/profiling/profilingOnboardingSidebar.tsx

@@ -70,7 +70,9 @@ function ProfilingOnboarding(props: CommonSidebarProps) {
   );
 
   useEffect(() => {
-    if (currentProject) return;
+    if (currentProject) {
+      return;
+    }
 
     // we'll only ever select an unsupportedProject if they do not have a supported project in their organization
     if (supportedProjects.length === 0 && unsupportedProjects.length > 0) {

+ 2 - 1
static/app/components/searchQueryBuilder/tokens/filter/valueCombobox.tsx

@@ -761,7 +761,7 @@ export function SearchQueryBuilderValueCombobox({
 
   const customMenu: CustomComboboxMenu<SelectOptionWithKey<string>> | undefined =
     useMemo(() => {
-      if (!showDatePicker)
+      if (!showDatePicker) {
         return function (props) {
           return (
             <ValueListBox
@@ -773,6 +773,7 @@ export function SearchQueryBuilderValueCombobox({
             />
           );
         };
+      }
 
       return function (props) {
         return (

+ 3 - 1
static/app/components/smartSearchBar/index.tsx

@@ -110,7 +110,9 @@ function isMultiProject(projectIds: number[] | Readonly<number[] | undefined>) {
    * - [-1] (All Projects)
    * - [a, b, ...] (two or more projects)
    */
-  if (projectIds === undefined) return false;
+  if (projectIds === undefined) {
+    return false;
+  }
   return (
     projectIds.length === 0 ||
     (projectIds.length === 1 && projectIds[0] === -1) ||

+ 3 - 1
static/app/utils/profiling/profile/continuousProfile.tsx

@@ -46,7 +46,9 @@ export class ContinuousProfile extends Profile {
 
       for (let j = stack.length - 1; j >= 0; j--) {
         frame = resolveFrame(stack[j]);
-        if (frame) resolvedStack[size++] = frame;
+        if (frame) {
+          resolvedStack[size++] = frame;
+        }
       }
 
       profile.appendSample(

Some files were not shown because too many files changed in this diff