Skip to content

Commit 16bcb57

Browse files
committed
Apply Prettier to files touching Prism
1 parent 71eb2bf commit 16bcb57

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

ui/frontend/.eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ module.exports = {
7676
'BuildMenu.tsx',
7777
'ButtonSet.tsx',
7878
'Header.tsx',
79+
'HelpExample.tsx',
7980
'Notifications.tsx',
81+
'Output/OutputPrism.tsx',
82+
'Output/PaneWithMir.tsx',
83+
'Output/SimplePane.tsx',
8084
'PopButton.tsx',
8185
'Stdin.tsx',
8286
'actions.ts',

ui/frontend/.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ node_modules
1616
!BuildMenu.tsx
1717
!ButtonSet.tsx
1818
!Header.tsx
19+
!HelpExample.tsx
1920
!Notifications.tsx
21+
!Output/OutputPrism.tsx
22+
!Output/PaneWithMir.tsx
23+
!Output/SimplePane.tsx
2024
!PopButton.tsx
2125
!Stdin.tsx
2226
!actions.ts

ui/frontend/HelpExample.tsx

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import React, { useCallback } from 'react';
2-
import root from 'react-shadow';
3-
41
import 'prismjs/components/prism-rust.min';
2+
import React, { useCallback } from 'react';
53
import { PrismCode } from 'react-prism';
4+
import root from 'react-shadow';
65

76
import * as actions from './actions';
87
import { useAppDispatch } from './hooks';
@@ -16,10 +15,7 @@ export interface HelpExampleProps {
1615

1716
const HelpExample: React.FC<HelpExampleProps> = ({ code }) => {
1817
const dispatch = useAppDispatch();
19-
const showExample = useCallback(
20-
() => dispatch(actions.showExample(code)),
21-
[dispatch, code]
22-
);
18+
const showExample = useCallback(() => dispatch(actions.showExample(code)), [dispatch, code]);
2319

2420
return (
2521
<div className={styles.container}>
@@ -30,9 +26,7 @@ const HelpExample: React.FC<HelpExampleProps> = ({ code }) => {
3026
<link href={prismTheme} rel="stylesheet" />
3127

3228
<pre>
33-
<PrismCode className="language-rust">
34-
{code}
35-
</PrismCode>
29+
<PrismCode className="language-rust">{code}</PrismCode>
3630
</pre>
3731
</root.div>
3832
</div>

ui/frontend/Output/OutputPrism.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ interface OutputPrismProps {
1010

1111
const OutputPrism: React.FC<OutputPrismProps> = ({ languageCode, children }) => (
1212
<pre>
13-
<PrismCode className={`${styles.container} ${languageCode}`}>
14-
{children}
15-
</PrismCode>
13+
<PrismCode className={`${styles.container} ${languageCode}`}>{children}</PrismCode>
1614
</pre>
1715
);
1816

ui/frontend/Output/PaneWithMir.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22

33
import Header from './Header';
4-
import SimplePane, { SimplePaneProps } from './SimplePane';
54
import OutputPrism from './OutputPrism';
5+
import SimplePane, { SimplePaneProps } from './SimplePane';
66

77
interface PaneWithMirProps extends SimplePaneProps {
88
code?: string;
@@ -12,9 +12,7 @@ const PaneWithMir: React.FC<PaneWithMirProps> = ({ code, ...rest }) => (
1212
<SimplePane {...rest}>
1313
<div data-test-id="output-result">
1414
<Header label="Result" />
15-
<OutputPrism languageCode="language-rust_mir">
16-
{code}
17-
</OutputPrism>
15+
<OutputPrism languageCode="language-rust_mir">{code}</OutputPrism>
1816
</div>
1917
</SimplePane>
2018
);

ui/frontend/Output/SimplePane.tsx

+11-9
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import React from 'react';
22

33
import Header from './Header';
44
import Loader from './Loader';
5-
import Section from './Section';
65
import OutputPrism from './OutputPrism';
6+
import Section from './Section';
77

88
interface HighlightErrorsProps {
99
children: React.ReactNode;
1010
label: string;
1111
}
1212

13-
const onOutputPrismCopy: React.ClipboardEventHandler = event => {
13+
const onOutputPrismCopy: React.ClipboardEventHandler = (event) => {
1414
// Blank out HTML copy data.
1515
// Though linkified output is handy in the Playground, it does more harm
1616
// than good when copied elsewhere, and terminal output is usable on its own.
@@ -24,9 +24,7 @@ const onOutputPrismCopy: React.ClipboardEventHandler = event => {
2424
const HighlightErrors: React.FC<HighlightErrorsProps> = ({ label, children }) => (
2525
<div data-test-id="output-stderr" onCopy={onOutputPrismCopy}>
2626
<Header label={label} />
27-
<OutputPrism languageCode="language-rust_errors">
28-
{children}
29-
</OutputPrism>
27+
<OutputPrism languageCode="language-rust_errors">{children}</OutputPrism>
3028
</div>
3129
);
3230

@@ -42,12 +40,16 @@ export interface ReallySimplePaneProps {
4240
error?: string;
4341
}
4442

45-
const SimplePane: React.FC<SimplePaneProps> = props => (
43+
const SimplePane: React.FC<SimplePaneProps> = (props) => (
4644
<div data-test-id={`output-${props.kind}`}>
47-
{(props.requestsInProgress > 0) && <Loader />}
48-
<Section kind="error" label="Errors">{props.error}</Section>
45+
{props.requestsInProgress > 0 && <Loader />}
46+
<Section kind="error" label="Errors">
47+
{props.error}
48+
</Section>
4949
<HighlightErrors label="Standard Error">{props.stderr}</HighlightErrors>
50-
<Section kind="stdout" label="Standard Output">{props.stdout}</Section>
50+
<Section kind="stdout" label="Standard Output">
51+
{props.stdout}
52+
</Section>
5153
{props.children}
5254
</div>
5355
);

0 commit comments

Comments
 (0)