Skip to content

Commit

Permalink
upgrade prettier (#2648)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheyenbrock authored Aug 9, 2022
1 parent 0cf1ca4 commit 48e7710
Show file tree
Hide file tree
Showing 80 changed files with 368 additions and 334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import useOperation from './useOperation';
export default function useQueryFacts() {
const schema = useSchema();
const { text } = useOperation();
return useMemo(() => (schema ? getOperationFacts(schema, text) : null), [
schema,
text,
]);
return useMemo(
() => (schema ? getOperationFacts(schema, text) : null),
[schema, text],
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export function EditorsProvider(props: { children?: any }) {
value={{
...state,
loadEditor,
}}>
}}
>
{props.children}
</EditorContext.Provider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ export function SchemaProvider({
...state,
loadCurrentSchema,
dispatch,
}}>
}}
>
{props.children}
</SchemaContext.Provider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ export function SessionProvider({
changeTab,
operationError,
dispatch,
}}>
}}
>
{children}
</SessionContext.Provider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,15 @@ export class DocExplorer extends React.Component<
<section
className="doc-explorer"
key={navItem.name}
aria-label="Documentation Explorer">
aria-label="Documentation Explorer"
>
<div className="doc-explorer-title-bar">
{prevName && (
<button
className="doc-explorer-back"
onClick={this.handleNavBackClick}
aria-label={`Go back to ${prevName}`}>
aria-label={`Go back to ${prevName}`}
>
{prevName}
</button>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export default class SearchBox extends React.Component<
<button
className="search-box-clear"
onClick={this.handleClear}
aria-label="Clear search input">
aria-label="Clear search input"
>
{'\u2715'}
</button>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export default class SearchResults extends React.Component<
]}
<a
className="field-name"
onClick={event => onClickField(field, type, event)}>
onClick={event => onClickField(field, type, event)}
>
{field.name}
</a>
{matchingArgs && [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ function Field({ type, field, onClickType, onClickField }: FieldProps) {
<div className="doc-category-item">
<a
className="field-name"
onClick={event => onClickField(field, type, event)}>
onClick={event => onClickField(field, type, event)}
>
{field.name}
</a>
{'args' in field &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ function renderType(type: Maybe<GraphQLType>, onClick: OnClickTypeFunction) {
event.preventDefault();
onClick(type as GraphQLNamedType, event);
}}
href="#">
href="#"
>
{type?.name}
</a>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export function ExecuteButton(props: ExecuteButtonProps) {
onMouseUp={() => {
setOptionsOpen(false);
session.executeOperation(operation?.name?.value);
}}>
}}
>
{opName}
</li>
);
Expand Down Expand Up @@ -118,7 +119,8 @@ export function ExecuteButton(props: ExecuteButtonProps) {
className="execute-button"
onMouseDown={onMouseDown}
onClick={onClick}
title={t('Execute Query (Ctrl-Enter)')}>
title={t('Execute Query (Ctrl-Enter)')}
>
<svg width="34" height="34">
{pathJSX}
</svg>
Expand Down
18 changes: 12 additions & 6 deletions examples/graphiql-2-rfc-context/src/components/GraphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,16 @@ export const GraphiQL: React.FC<GraphiQLProps> = props => {
<EditorsProvider>
<SchemaProvider
fetcher={fetcher}
config={{ uri: props.uri, ...props.schemaConfig }}>
config={{ uri: props.uri, ...props.schemaConfig }}
>
<SessionProvider fetcher={fetcher} sessionId={0}>
<GraphiQLInternals
{...{
formatResult,
formatError,
...props,
}}>
}}
>
{props.children}
</GraphiQLInternals>
</SessionProvider>
Expand Down Expand Up @@ -249,7 +251,8 @@ class GraphiQLInternals extends React.Component<
<Tabs
active={session?.currentTabs?.[name] as number}
tabs={tabs}
onChange={tabId => session.changeTab(name, tabId)}>
onChange={tabId => session.changeTab(name, tabId)}
>
{c}
</Tabs>
)}
Expand Down Expand Up @@ -299,7 +302,8 @@ class GraphiQLInternals extends React.Component<
<section aria-label="Response Editor">
<SessionTabs
tabs={[`Response`, `Extensions`, `Playground`]}
name="results">
name="results"
>
<>
{this.state.isWaitingForResponse && (
<div className="spinner-container">
Expand Down Expand Up @@ -395,11 +399,13 @@ class GraphiQLInternals extends React.Component<
}
}}
storage={this._storage}
queryID={this._editorQueryID}>
queryID={this._editorQueryID}
>
<button
className="docExplorerHide"
onClick={() => null}
aria-label="Close History">
aria-label="Close History"
>
{'\u2715'}
</button>
</QueryHistory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,23 @@ class HistoryQuerySource extends React.Component<
) : (
<button
className="history-label"
onClick={this.handleClick.bind(this)}>
onClick={this.handleClick.bind(this)}
>
{displayName}
</button>
)}
<button
onClick={this.handleEditClick.bind(this)}
aria-label={t('Edit label')}>
aria-label={t('Edit label')}
>
{'\u270e'}
</button>
<button
onClick={this.handleStarClick.bind(this)}
aria-label={
this.props.favorite ? t('Remove favorite') : t('Add favorite')
}>
}
>
{starIcon}
</button>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export class ToolbarButton extends React.Component<
className={'toolbar-button' + (error ? ' error' : '')}
onClick={this.handleClick}
title={error ? error.message : this.props.title}
aria-invalid={error ? 'true' : 'false'}>
aria-invalid={error ? 'true' : 'false'}
>
{this.props.label}
</button>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export class ToolbarMenu extends React.Component<
this._node = node;
}
}}
title={this.props.title}>
title={this.props.title}
>
{this.props.label}
<svg width="14" height="8">
<path fill="#666" d="M 5 1.5 L 14 1.5 L 9.5 7 z" />
Expand Down Expand Up @@ -111,7 +112,8 @@ export const ToolbarMenuItem: FC<ToolbarMenuItemProps> = ({
}}
onMouseDown={preventDefault}
onMouseUp={onSelect}
title={title}>
title={title}
>
{label}
</li>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export class ToolbarSelect extends React.Component<
ref={node => {
this._node = node;
}}
title={this.props.title}>
title={this.props.title}
>
{selectedChild?.props.label}
<svg width="13" height="10">
<path fill="#666" d="M 5 5 L 13 5 L 9 1 z" />
Expand Down Expand Up @@ -142,7 +143,8 @@ export function ToolbarSelectOption({
e.currentTarget.className = '';
}}
onMouseDown={preventDefault}
onMouseUp={onSelect}>
onMouseUp={onSelect}
>
{label}
{selected && (
<svg width="13" height="13">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const ListRow = ({
padding: padding ? ({ spaces }) => spaces.rowPadding : undefined,
minHeight: ({ spaces }) => spaces.rowMinHeight,
} as SxStyleProp
}>
}
>
{children}
</div>
);
Expand All @@ -49,7 +50,8 @@ const List = ({ children }: ListPropTypes) => (
'> *': {
flex: '0 0 auto',
},
}}>
}}
>
{children}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export default function Logo({ color = 'currentColor', size = 40 }: Props) {
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 400 400"
style={{ width: size, height: size, fill: color }}>
style={{ width: size, height: size, fill: color }}
>
<path d="M57.468 302.66l-14.376-8.3 160.15-277.38 14.376 8.3z" />
<path d="M39.8 272.2h320.3v16.6H39.8z" />
<path d="M206.348 374.026l-160.21-92.5 8.3-14.376 160.21 92.5zM345.522 132.947l-160.21-92.5 8.3-14.376 160.21 92.5z" />
Expand Down
6 changes: 4 additions & 2 deletions examples/graphiql-2-rfc-context/src/components/common/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export const NavItem = ({
':active': {
transform: 'scale(.95)',
},
}}>
}}
>
{children}
</button>
);
Expand All @@ -59,7 +60,8 @@ export const Nav = ({ children }: NavProps) => {
gridAutoFlow: 'row',
gridAutoRows: '2em',
fontSize: '3em',
}}>
}}
>
{children}
</nav>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export const ResizeHandler: React.FC<ResizeHandlerProps> = props => {
style={{
cursor: `${dir}-resize`,
...style,
}}>
}}
>
{isDragging && (
<style>{`
* {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export default { title: 'Resizer' };
export const resizer = () => (
<Resizer
border="bottom"
handlerStyle={{ backgroundColor: 'rgba(0, 0, 0, 0.2)' }}>
handlerStyle={{ backgroundColor: 'rgba(0, 0, 0, 0.2)' }}
>
<main>Main content</main>
</Resizer>
);
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export const Resizer: React.FC<ResizeProps> = props => {
} = props;

const handlerWidth = isNil(_handlerWidth) ? 16 : (_handlerWidth as number);
const handlerOffset = (isNil(_handlerOffset)
? -handlerWidth / 2
: _handlerOffset) as number;
const handlerOffset = (
isNil(_handlerOffset) ? -handlerWidth / 2 : _handlerOffset
) as number;
const handlerZIndex = (isNil(_handlerZIndex) ? 10 : _handlerZIndex) as number;

const [diffCoord, setDiffCoord] = useState<ResizingData['diffCoord']>(0);
Expand Down Expand Up @@ -120,7 +120,8 @@ export const Resizer: React.FC<ResizeProps> = props => {
style={{
position: 'relative',
...containerStyle,
}}>
}}
>
<ResizeHandler
dir={dir}
className={handlerClassName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export const Tabbar = () => (
{'Component '}
<small style={{ background: 'yellow', padding: 3 }}>2</small>
</>,
]}>
]}
>
<p>With</p>
<p>a</p>
<p>nested</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ const Tabs = ({ tabs, active, onChange, children }: TabsProps) => {
<Tab
key={index}
active={active === index}
onClick={() => onChange?.(index)}>
onClick={() => onChange?.(index)}
>
{tab}
</Tab>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const Toolbar = ({
display: 'flex',
alignItems: 'stretch',
justifyContent,
}}>
}}
>
{needsExtraPadding ? (
<WithDividers padding>{children}</WithDividers>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const WithDividers = ({
'[data-contains-divider] [data-is-divider]': {
display: 'none',
},
}}>
}}
>
{Children.map(children, (child, index) => {
const isFirst = index === 0;
return (
Expand All @@ -57,7 +58,8 @@ const WithDividers = ({
padding && !isFirst
? ({ spaces }) => spaces.rowPadding * 2
: undefined,
}}>
}}
>
{!isFirst && (
<Divider
innerSx={{
Expand Down
Loading

0 comments on commit 48e7710

Please sign in to comment.