Преглед на файлове

Fixed prettier issue (#15471)

Fixed prettier CI issue that caused build failures
Torkel Ödegaard преди 6 години
родител
ревизия
2d5fd7fdfd
променени са 3 файла, в които са добавени 33 реда и са изтрити 16 реда
  1. 1 1
      package.json
  2. 16 4
      public/app/features/explore/LogMessageAnsi.test.tsx
  3. 16 11
      public/app/features/explore/LogMessageAnsi.tsx

+ 1 - 1
package.json

@@ -121,7 +121,7 @@
     "jest": "jest --notify --watch",
     "api-tests": "jest --notify --watch --config=tests/api/jest.js",
     "storybook": "cd packages/grafana-ui && yarn storybook",
-    "prettier:check": "prettier -- --list-different \"**/*.{ts,tsx,scss}\""
+    "prettier:check": "prettier --list-different \"**/*.{ts,tsx,scss}\""
   },
   "husky": {
     "hooks": {

+ 16 - 4
public/app/features/explore/LogMessageAnsi.test.tsx

@@ -16,9 +16,21 @@ describe('<LogMessageAnsi />', () => {
     const wrapper = shallow(<LogMessageAnsi value={value} />);
 
     expect(wrapper.find('span')).toHaveLength(1);
-    expect(wrapper.find('span').first().prop('style')).toMatchObject(expect.objectContaining({
-      color: expect.any(String)
-    }));
-    expect(wrapper.find('span').first().text()).toBe('ipsum');
+    expect(
+      wrapper
+        .find('span')
+        .first()
+        .prop('style')
+    ).toMatchObject(
+      expect.objectContaining({
+        color: expect.any(String),
+      })
+    );
+    expect(
+      wrapper
+        .find('span')
+        .first()
+        .text()
+    ).toBe('ipsum');
   });
 });

+ 16 - 11
public/app/features/explore/LogMessageAnsi.tsx

@@ -46,15 +46,15 @@ export class LogMessageAnsi extends PureComponent<Props, State> {
     const parsed = ansicolor.parse(props.value);
 
     return {
-      chunks: parsed.spans.map((span) => {
-        return span.css ?
-          {
-            style: convertCSSToStyle(span.css),
-            text: span.text
-          } :
-          { text: span.text };
+      chunks: parsed.spans.map(span => {
+        return span.css
+          ? {
+              style: convertCSSToStyle(span.css),
+              text: span.text,
+            }
+          : { text: span.text };
       }),
-      prevValue: props.value
+      prevValue: props.value,
     };
   }
 
@@ -62,9 +62,14 @@ export class LogMessageAnsi extends PureComponent<Props, State> {
     const { chunks } = this.state;
 
     return chunks.map(
-      (chunk, index) => chunk.style ?
-        <span key={index} style={chunk.style}>{chunk.text}</span> :
-        chunk.text
+      (chunk, index) =>
+        chunk.style ? (
+          <span key={index} style={chunk.style}>
+            {chunk.text}
+          </span>
+        ) : (
+          chunk.text
+        )
     );
   }
 }