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

fix(lint-error): Fix expected { after 'if' condition curly (#31104)

Priscila Oliveira 3 лет назад
Родитель
Сommit
d68c2a940b

+ 6 - 2
static/app/utils/profiling/colors/utils.tsx

@@ -10,7 +10,9 @@ const uniqueBy = <T,>(arr: ReadonlyArray<T>, predicate: (t: T) => unknown): Arra
       .reduce((map, item) => {
         const key = item === null || item === undefined ? item : cb(item);
 
-        if (key === undefined || key === null) return map;
+        if (key === undefined || key === null) {
+          return map;
+        }
         map.has(key) || map.set(key, item);
 
         return map;
@@ -189,7 +191,9 @@ export const makeColorMapByImage = (
   for (const frame of frames) {
     const key = frame.image ?? '';
 
-    if (!reverseFrameToImageIndex[key]) reverseFrameToImageIndex[key] = [];
+    if (!reverseFrameToImageIndex[key]) {
+      reverseFrameToImageIndex[key] = [];
+    }
     reverseFrameToImageIndex[key].push(frame);
   }
 

+ 3 - 1
tests/js/spec/utils/profiling/colors/utils.spec.tsx

@@ -14,7 +14,9 @@ const f = (name: string, file?: string, image?: string) =>
 const getDominantColor = (
   c: [number, number, number] | [number, number, number, number] | undefined
 ): string => {
-  if (!c) throw new Error('Color not found');
+  if (!c) {
+    throw new Error('Color not found');
+  }
 
   const index = c.indexOf(Math.max(...c.slice(0, 3)));
   return index === 0 ? 'red' : index === 1 ? 'green' : 'blue';