Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.

Update prettier and eslint config for packages/site

+1
package.json
···
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
+
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.0",
"eslint-plugin-react-hooks": "^2.3.0",
"execa": "^4.0.0",
+6 -6
packages/site/src/app.js
···
-
import React, { Suspense} from "react";
-
import { Routes, Root } from "react-static";
-
import Analytics from "react-router-ga";
+
import React, { Suspense } from 'react';
+
import { Routes, Root } from 'react-static';
+
import Analytics from 'react-router-ga';
-
import { GlobalStyle } from "./global-style";
-
import { ScrollToTop } from "./scroll-to-top";
+
import { GlobalStyle } from './global-style';
+
import { ScrollToTop } from './scroll-to-top';
-
import "prismjs/themes/prism.css";
+
import 'prismjs/themes/prism.css';
const App = () => (
<Root>
+1 -1
packages/site/src/components/article-typography/h1.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
const H1 = styled.h1`
font-size: 3.2rem;
+1 -1
packages/site/src/components/article-typography/h2.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
const H2 = styled.h2`
font-size: 2.2rem;
+1 -1
packages/site/src/components/article-typography/h3.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
const H3 = styled.h3`
font-size: 1.5rem;
+1 -1
packages/site/src/components/article-typography/h4.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
const H4 = styled.h4`
font-size: 1.5rem;
+1 -1
packages/site/src/components/article-typography/h5.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
const H5 = styled.h5`
font-size: 1.5rem;
+1 -1
packages/site/src/components/article-typography/h6.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
const H6 = styled.h6`
font-size: 1.3rem;
+7 -7
packages/site/src/components/article-typography/index.js
···
-
export { default as H1 } from "./h1";
-
export { default as H2 } from "./h2";
-
export { default as H3 } from "./h3";
-
export { default as H4 } from "./h4";
-
export { default as H5 } from "./h5";
-
export { default as H6 } from "./h6";
-
export { default as P } from "./p";
+
export { default as H1 } from './h1';
+
export { default as H2 } from './h2';
+
export { default as H3 } from './h3';
+
export { default as H4 } from './h4';
+
export { default as H5 } from './h5';
+
export { default as H6 } from './h6';
+
export { default as P } from './p';
+1 -1
packages/site/src/components/article-typography/p.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
const P = styled.p`
font-size: 1.5rem;
+1 -1
packages/site/src/components/body-copy.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
export const BodyCopy = styled.p`
font-size: 1.4rem;
+2 -2
packages/site/src/components/bounce-animation.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
export const BounceAnimation = styled.span`
display: block;
transition: all 0.1s;
transform: ${props =>
-
props.bouncing ? "translateY(-0.6rem)" : "translateY(0)"};
+
props.bouncing ? 'translateY(-0.6rem)' : 'translateY(0)'};
`;
+6 -6
packages/site/src/components/button.js
···
-
import styled from "styled-components";
-
import { Link } from "react-router-dom";
+
import styled from 'styled-components';
+
import { Link } from 'react-router-dom';
export const Button = styled(Link)`
-
background: ${props => (props.light ? "white" : "#202020")};
-
color: ${props => (props.light ? "#202020" : "white")};
+
background: ${props => (props.light ? 'white' : '#202020')};
+
color: ${props => (props.light ? '#202020' : 'white')};
display: block;
font-size: 1.5rem;
height: 4rem;
letter-spacing: 0.05em;
line-height: 4rem;
-
margin: ${props => (props.noMargin ? "0" : "5rem auto 3rem")};
+
margin: ${props => (props.noMargin ? '0' : '5rem auto 3rem')};
max-width: 21rem;
min-width: 10rem;
text-align: center;
···
transition: background 0.4s;
width: 100%;
&:hover {
-
background: ${props => (props.light ? "#f6f6f6" : "#333")};
+
background: ${props => (props.light ? '#f6f6f6' : '#333')};
}
&:active {
opacity: 0.6;
+5 -5
packages/site/src/components/footer.js
···
-
import React from "react";
-
import { Wrapper } from "./wrapper";
-
import styled from "styled-components";
-
import logoFormidableWhite from "../static/svgs/logo_formidable_white.svg";
+
import React from 'react';
+
import { Wrapper } from './wrapper';
+
import styled from 'styled-components';
+
import logoFormidableWhite from '../static/svgs/logo_formidable_white.svg';
const Container = styled.footer`
background: #1f1f1f;
···
Formidable is a Seattle, Denver, and London-based engineering
consultancy and open source software organization, specializing in
React.js, React Native, GraphQL, Node.js, and the extended JavaScript
-
ecosystem. For more information about Formidable, please visit{" "}
+
ecosystem. For more information about Formidable, please visit{' '}
<a href="https://www.formidable.com">formidable.com</a>.
</FooterDescription>
</Wrapper>
+6 -6
packages/site/src/components/header.js
···
-
import React from "react";
-
import Hero from "../screens/home/hero";
-
import styled from "styled-components";
-
import logoFormidableWhite from "../static/svgs/logo_formidable_white.svg";
-
import LeftTriangles from "../static/svgs/left-triangles.svg";
-
import RightTriangles from "../static/svgs/right-triangles.svg";
+
import React from 'react';
+
import Hero from '../screens/home/hero';
+
import styled from 'styled-components';
+
import logoFormidableWhite from '../static/svgs/logo_formidable_white.svg';
+
import LeftTriangles from '../static/svgs/left-triangles.svg';
+
import RightTriangles from '../static/svgs/right-triangles.svg';
const Container = styled.header`
background: rgb(109, 117, 153);
+7 -7
packages/site/src/components/markdown.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
export const Markdown = styled.article`
width: 60vw;
···
width: 75vw;
}
& h1 {
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 3.4rem;
margin: 0 0 2rem;
···
}
& h2 {
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 2.8rem;
margin: 6rem 0 2rem;
@media (min-width: 1024px) {
···
}
& h3 {
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1.8rem;
margin: 2rem 0;
@media (min-width: 1024px) {
···
th,
td {
font-size: 1.7rem;
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
tr:nth-child(even) {
background-color: #f2f2f2;
}
···
}
& p {
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1.7rem;
line-height: 1.6;
}
···
}
& li {
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1.7rem;
line-height: 1.6;
padding: 0.5rem;
+6 -6
packages/site/src/components/navigation.js
···
-
import styled from "styled-components";
-
import { Link } from "react-router-dom";
-
import collapsedSidebarBackground from "../static/svgs/collapsed-sidebar-background.svg";
+
import styled from 'styled-components';
+
import { Link } from 'react-router-dom';
+
import collapsedSidebarBackground from '../static/svgs/collapsed-sidebar-background.svg';
export const Navigation = styled.div`
align-items: center;
···
`;
export const SidebarWrapper = styled.aside`
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
background-size: 100% 100%;
background: linear-gradient(
rgba(223, 223, 223, 0.4),
···
@media (max-width: 768px) {
background: #dfdfdf;
-
min-width: ${props => (props.overlay ? "24rem" : "2.5rem")};
-
width: ${props => (props.overlay ? "24rem" : "2.5rem")};
+
min-width: ${props => (props.overlay ? '24rem' : '2.5rem')};
+
width: ${props => (props.overlay ? '24rem' : '2.5rem')};
background-size: cover;
}
`;
+2 -2
packages/site/src/components/secondary-title.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
export const SecondaryTitle = styled.h3`
font-size: 2rem;
line-height: 2.4rem;
margin: 2rem auto 1rem;
-
color: ${p => (p.pop ? "white" : "inherit")};
+
color: ${p => (p.pop ? 'white' : 'inherit')};
@media (min-width: 768px) {
font-size: 2.2rem;
line-height: 2.6rem;
+1 -1
packages/site/src/components/section-title.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
export const SectionTitle = styled.h2`
color: #fff;
+7 -7
packages/site/src/components/title-meta.js
···
-
import React from "react";
-
import PropTypes from "prop-types";
-
import DocumentMeta from "react-document-meta";
+
import React from 'react';
+
import PropTypes from 'prop-types';
+
import DocumentMeta from 'react-document-meta';
class TitleMeta extends React.Component {
render() {
···
title: this.props.title,
meta: {
property: {
-
"og:title": this.props.title
-
}
-
}
+
'og:title': this.props.title,
+
},
+
},
};
return <div {...titleMeta}>{this.props.children}</div>;
···
TitleMeta.propTypes = {
children: PropTypes.node,
-
title: PropTypes.string
+
title: PropTypes.string,
};
export default TitleMeta;
+4 -4
packages/site/src/components/wrapper.js
···
-
import styled from "styled-components";
+
import styled from 'styled-components';
export const Wrapper = styled.div`
display: flex;
···
flex-wrap: wrap;
justify-content: space-between;
margin: 0;
-
padding: ${props => (props.noPadding ? "0 4rem" : "4rem")};
+
padding: ${props => (props.noPadding ? '0 4rem' : '4rem')};
text-align: center;
width: 100%;
@media (min-width: 768px) {
flex-direction: row;
max-width: 116rem;
-
padding: ${props => (props.noPadding ? "0 4rem" : "4rem 8rem")};
+
padding: ${props => (props.noPadding ? '0 4rem' : '4rem 8rem')};
}
@media (max-width: 768px) {
-
padding: ${props => (props.noPadding ? "0 4rem" : "0 8rem")};
+
padding: ${props => (props.noPadding ? '0 4rem' : '0 8rem')};
text-align: center;
img {
max-width: 240px;
+5 -5
packages/site/src/constants.js
···
const constants = {
-
docsTitle: "URQL",
-
githubIssues: "https://www.github.com/FormidableLabs/urql/issues",
-
github: "https://www.github.com/FormidableLabs/urql",
-
readme: "https://github.com/FormidableLabs/urql/blob/master/README.md",
-
color: "#8196FF"
+
docsTitle: 'URQL',
+
githubIssues: 'https://www.github.com/FormidableLabs/urql/issues',
+
github: 'https://www.github.com/FormidableLabs/urql',
+
readme: 'https://github.com/FormidableLabs/urql/blob/master/README.md',
+
color: '#8196FF',
};
export default constants;
+1 -1
packages/site/src/global-style.js
···
-
import { createGlobalStyle } from "styled-components";
+
import { createGlobalStyle } from 'styled-components';
export const GlobalStyle = createGlobalStyle`
html {
+10 -10
packages/site/src/index.js
···
-
import React from 'react'
-
import { render, hydrate } from 'react-dom'
-
import { AppContainer } from 'react-hot-loader'
+
import React from 'react';
+
import { render, hydrate } from 'react-dom';
+
import { AppContainer } from 'react-hot-loader';
-
import App from './app'
+
import App from './app';
-
export default App
+
export default App;
// Render your app
if (typeof document !== 'undefined') {
-
const renderMethod = module.hot ? render : hydrate
+
const renderMethod = module.hot ? render : hydrate;
const mount = Comp => {
renderMethod(
<AppContainer>
<Comp />
</AppContainer>,
document.getElementById('root')
-
)
-
}
+
);
+
};
-
mount(App)
+
mount(App);
if (module.hot) {
-
module.hot.accept('./app', () => mount(require('./app').default))
+
module.hot.accept('./app', () => mount(require('./app').default));
}
}
+7 -7
packages/site/src/screens/docs/article.js
···
-
import React from "react";
-
import PropTypes from "prop-types";
-
import styled from "styled-components";
-
import { withRouteData } from "react-static";
-
import { Markdown } from "../../components/markdown";
+
import React from 'react';
+
import PropTypes from 'prop-types';
+
import styled from 'styled-components';
+
import { withRouteData } from 'react-static';
+
import { Markdown } from '../../components/markdown';
const Container = styled.div`
max-width: 80rem;
···
}
Article.propTypes = {
-
renderedMd: PropTypes.string
+
renderedMd: PropTypes.string,
};
Article.defaultProps = {
-
params: null
+
params: null,
};
export default withRouteData(Article);
+16 -15
packages/site/src/screens/docs/index.js
···
-
import React, { forwardRef } from "react";
-
import styled from "styled-components";
-
import PropTypes from "prop-types";
-
import { withRouteData } from "react-static";
-
import { Link } from "react-router-dom";
+
import React, { forwardRef } from 'react';
+
import styled from 'styled-components';
+
import PropTypes from 'prop-types';
+
import { withRouteData } from 'react-static';
+
import { Link } from 'react-router-dom';
-
import Article from "./article";
-
import Sidebar from "./sidebar";
-
import burger from "../../static/svgs/burger.svg";
-
import logoFormidableDark from "../../static/svgs/logo_formidable_dark.svg";
-
import constants from "../../constants";
+
import Article from './article';
+
import Sidebar from './sidebar';
+
import burger from '../../static/svgs/burger.svg';
+
import logoFormidableDark from '../../static/svgs/logo_formidable_dark.svg';
+
import constants from '../../constants';
const Container = styled.div`
display: flex;
···
@media (max-width: 768px) {
display: block;
-
visibility: ${props => (props.overlay ? "hidden" : "visible")};
+
visibility: ${props => (props.overlay ? 'hidden' : 'visible')};
padding-left: 2.5rem;
position: absolute;
left: 0;
···
}
`;
+
// eslint-disable-next-line react/display-name
const SideBarWithRef = forwardRef((props, ref) => {
return (
<div ref={ref}>
···
<img src={burger} alt="Menu" onClick={() => this.openSidebar()} />
</CollapsedMenu>
<DocsTitle>
-
<Link to={"/"} style={{ color: "#3b3b3b" }}>
+
<Link to={'/'} style={{ color: '#3b3b3b' }}>
{constants.docsTitle}
</Link>
</DocsTitle>
-
<Link to={"https://formidable.com"}>
+
<Link to={'https://formidable.com'}>
<HeaderLogo src={logoFormidableDark} alt="Formidable Logo" />
</Link>
</Wrapper>
···
}
Docs.propTypes = {
-
params: PropTypes.object
+
params: PropTypes.object,
};
Docs.defaultProps = {
-
params: null
+
params: null,
};
export default withRouteData(Docs);
+23 -23
packages/site/src/screens/docs/sidebar.js
···
-
import React, { Fragment } from "react";
-
import PropTypes from "prop-types";
-
import styled from "styled-components";
-
import { withRouteData } from "react-static";
-
import { withRouter, Link } from "react-router-dom";
+
import React, { Fragment } from 'react';
+
import PropTypes from 'prop-types';
+
import styled from 'styled-components';
+
import { withRouteData } from 'react-static';
+
import { withRouter, Link } from 'react-router-dom';
import {
SidebarNavItem,
SidebarNavSubItem,
SidebarContainer,
SidebarWrapper,
-
SideBarSvg
-
} from "../../components/navigation";
+
SideBarSvg,
+
} from '../../components/navigation';
-
import closeButton from "../../static/svgs/x.svg";
-
import logoSidebar from "../../static/sidebar-badge.svg";
-
import constants from "../../constants";
+
import closeButton from '../../static/svgs/x.svg';
+
import logoSidebar from '../../static/sidebar-badge.svg';
+
import constants from '../../constants';
const HeroLogo = styled.img`
position: absolute;
···
width: 14rem;
@media (max-width: 768px) {
-
display: ${props => (props.overlay ? "" : "none")};
+
display: ${props => (props.overlay ? '' : 'none')};
}
`;
···
margin: 3rem 0rem 0rem 2.5rem;
height: auto;
@media (max-width: 768px) {
-
display: ${props => (props.overlay ? "" : "none")};
+
display: ${props => (props.overlay ? '' : 'none')};
}
`;
···
display: none;
@media (max-width: 768px) {
-
display: ${props => (props.overlay ? "block" : "none")};
+
display: ${props => (props.overlay ? 'block' : 'none')};
right: 1rem;
}
`;
···
`/docs${item.path}` === this.props.history.location.pathname;
// eslint-disable-next-line no-magic-numbers
const subContent = tocArray.filter(toc => toc.level === 2);
-
const key = item.title.split(" ").join("_");
+
const key = item.title.split(' ').join('_');
return (
<Fragment key={`${key}-group`}>
···
to={`/docs${item.path}`}
replace
key={key}
-
className={currentPath ? "is-current" : ""}
+
className={currentPath ? 'is-current' : ''}
>
{item.title}
</SidebarNavItem>
···
{subContent.map(sh => (
<SidebarNavSubItem
to={`#${sh.content
-
.split(" ")
-
.join("-")
+
.split(' ')
+
.join('-')
.toLowerCase()}`}
-
key={sh.content.split(" ").join("_")}
+
key={sh.content.split(' ').join('_')}
>
{sh.content}
</SidebarNavSubItem>
···
overlay={overlay}
onClick={() => closeSidebar()}
/>
-
<Link to={"/"}>
+
<Link to={'/'}>
<HeroLogo
src={logoSidebar}
alt="Formidable Logo"
···
/>
</Link>
<ContentWrapper overlay={overlay}>
-
<SidebarNavItem to={constants.readme} key={"readme"}>
+
<SidebarNavItem to={constants.readme} key={'readme'}>
Readme
</SidebarNavItem>
{sidebarHeaders &&
sidebarHeaders.map(sh => this.renderSidebarItem(sh))}
<HorizontalLine />
-
<SidebarNavItem to={constants.githubIssues} key={"issues"}>
+
<SidebarNavItem to={constants.githubIssues} key={'issues'}>
Issues
</SidebarNavItem>
-
<SidebarNavItem to={constants.github} key={"github"}>
+
<SidebarNavItem to={constants.github} key={'github'}>
Github
</SidebarNavItem>
</ContentWrapper>
···
history: PropTypes.object,
overlay: PropTypes.bool,
sidebarHeaders: PropTypes.array,
-
tocArray: PropTypes.array
+
tocArray: PropTypes.array,
};
export default withRouter(withRouteData(Sidebar));
+41 -41
packages/site/src/screens/home/_content.js
···
const content = {
features: [
{
-
title: "Fully functional GraphQL client with a single import",
+
title: 'Fully functional GraphQL client with a single import',
description:
-
"Urql is a lightweight, powerful, and easy to use alternative to bulky GraphQL clients.",
-
icon: require("../../static/svgs/gql-tile.svg")
+
'Urql is a lightweight, powerful, and easy to use alternative to bulky GraphQL clients.',
+
icon: require('../../static/svgs/gql-tile.svg'),
},
{
-
title: "Logical default behavior and caching",
+
title: 'Logical default behavior and caching',
description:
-
"Urql helps you to rapidly use GraphQL in your apps without complex configuration or large API overhead.",
-
icon: require("../../static/svgs/clock-tile.svg")
+
'Urql helps you to rapidly use GraphQL in your apps without complex configuration or large API overhead.',
+
icon: require('../../static/svgs/clock-tile.svg'),
},
{
-
title: "Extensible library that grows with you",
+
title: 'Extensible library that grows with you',
description:
-
"Want to change how you fetch, cache, or subscribe to data? Urql Exchanges allow you to customize your data layer to suit your needs.",
-
icon: require("../../static/svgs/eagle-tile.svg")
-
}
+
'Want to change how you fetch, cache, or subscribe to data? Urql Exchanges allow you to customize your data layer to suit your needs.',
+
icon: require('../../static/svgs/eagle-tile.svg'),
+
},
],
components: {
-
title: "Minimal React Components and Hooks",
+
title: 'Minimal React Components and Hooks',
description:
"Whether you prefer a <Query> component or useQuery Hook, urql's API is intuitive to use, with full support for GraphQL Queries, Mutations and Subscriptions in both styles!",
-
icon: require("../../static/svgs/React-icon.svg")
+
icon: require('../../static/svgs/React-icon.svg'),
},
preview: {
-
description: "",
-
media: ""
+
description: '',
+
media: '',
},
getStarted: {
description:
-
"Dive into the documentation to see how you can get your urql client up and running.",
-
link: "/docs"
+
'Dive into the documentation to see how you can get your urql client up and running.',
+
link: '/docs',
},
oss: [
{
-
title: "Victory",
+
title: 'Victory',
description:
-
"An ecosystem of modular data visualization components for React. Friendly and flexible.",
-
logo: require("../../static/svgs/logo_victory.svg"),
-
link: "https://formidable.com/open-source/victory",
-
hasOwnLogo: true
+
'An ecosystem of modular data visualization components for React. Friendly and flexible.',
+
logo: require('../../static/svgs/logo_victory.svg'),
+
link: 'https://formidable.com/open-source/victory',
+
hasOwnLogo: true,
},
{
-
title: "Development Dashboards",
+
title: 'Development Dashboards',
description:
-
"Dashboards to organize and intuitively display your dev server and tooling output.",
-
abbreviation: "Dd",
-
color: "#8bd48b",
-
number: "17",
-
link: "https://formidable.com/open-source/development-dashboards/"
+
'Dashboards to organize and intuitively display your dev server and tooling output.',
+
abbreviation: 'Dd',
+
color: '#8bd48b',
+
number: '17',
+
link: 'https://formidable.com/open-source/development-dashboards/',
},
{
-
title: "React Animations",
+
title: 'React Animations',
description:
-
"A collection of animations that can be used with many inline style libraries, such as Radium or Aphrodite.",
-
abbreviation: "Ra",
-
color: "#86b9e6",
-
number: "03",
-
link: "https://formidable.com/open-source/react-animations"
+
'A collection of animations that can be used with many inline style libraries, such as Radium or Aphrodite.',
+
abbreviation: 'Ra',
+
color: '#86b9e6',
+
number: '03',
+
link: 'https://formidable.com/open-source/react-animations',
},
{
-
title: "Enzyme Matchers",
+
title: 'Enzyme Matchers',
description:
-
"Run common assertions on your React components using Enzyme in a Jest or Jasmine environment.",
-
abbreviation: "Em",
-
color: "#e48055",
-
number: "09",
-
link: "https://formidable.com/open-source/jest-enzyme/"
-
}
-
]
+
'Run common assertions on your React components using Enzyme in a Jest or Jasmine environment.',
+
abbreviation: 'Em',
+
color: '#e48055',
+
number: '09',
+
link: 'https://formidable.com/open-source/jest-enzyme/',
+
},
+
],
};
export default content;
+7 -7
packages/site/src/screens/home/features.js
···
-
import React from "react";
-
import PropTypes from "prop-types";
-
import styled from "styled-components";
-
import { BodyCopy } from "../../components/body-copy";
-
import { SecondaryTitle } from "../../components/secondary-title";
-
import { SectionTitle } from "../../components/section-title";
+
import React from 'react';
+
import PropTypes from 'prop-types';
+
import styled from 'styled-components';
+
import { BodyCopy } from '../../components/body-copy';
+
import { SecondaryTitle } from '../../components/secondary-title';
+
import { SectionTitle } from '../../components/section-title';
const FullWidthContainer = styled.div`
display: flex;
···
Features.propTypes = {
components: PropTypes.object,
-
featureArray: PropTypes.array
+
featureArray: PropTypes.array,
};
export default Features;
+9 -9
packages/site/src/screens/home/get-started.js
···
-
import React from "react";
-
import PropTypes from "prop-types";
-
import styled from "styled-components";
-
import { Link } from "react-router-dom";
-
import { BodyCopy } from "../../components/body-copy";
-
import { SectionTitle } from "../../components/section-title";
-
import constants from "../../constants";
-
import octoCat from "../../static/svgs/Octicons-mark-github.svg";
+
import React from 'react';
+
import PropTypes from 'prop-types';
+
import styled from 'styled-components';
+
import { Link } from 'react-router-dom';
+
import { BodyCopy } from '../../components/body-copy';
+
import { SectionTitle } from '../../components/section-title';
+
import constants from '../../constants';
+
import octoCat from '../../static/svgs/Octicons-mark-github.svg';
const OuterWrapper = styled.div`
background: ${constants.color};
···
}
GetStarted.propTypes = {
-
getStartedObj: PropTypes.object
+
getStartedObj: PropTypes.object,
};
export default GetStarted;
+11 -11
packages/site/src/screens/home/hero.js
···
-
import React from "react";
-
import { Link } from "react-router-dom";
-
import { Wrapper } from "../../components/wrapper";
-
import styled from "styled-components";
-
import badge from "../../static/sidebar-badge.svg";
+
import React from 'react';
+
import { Link } from 'react-router-dom';
+
import { Wrapper } from '../../components/wrapper';
+
import styled from 'styled-components';
+
import badge from '../../static/sidebar-badge.svg';
const WrapperStyled = styled(Wrapper)`
z-index: 1;
···
`;
const HeroBody = styled.p`
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
letter-spacing: 0.08em;
font-size: 2rem;
line-height: 3rem;
···
`;
const copyFallBack = () => {
-
const copyTextArea = document.createElement("textArea");
-
copyTextArea.value = "npm install urql";
+
const copyTextArea = document.createElement('textArea');
+
copyTextArea.value = 'npm install urql';
document.body.appendChild(copyTextArea);
copyTextArea.focus();
copyTextArea.select();
-
document.execCommand("copy");
+
document.execCommand('copy');
copyTextArea.remove();
};
···
this.state = {
animating: false,
-
copied: false
+
copied: false,
};
}
···
e.preventDefault();
return;
}
-
navigator.clipboard.writeText("npm install urql");
+
navigator.clipboard.writeText('npm install urql');
}
render() {
+8 -8
packages/site/src/screens/home/index.js
···
-
import React from "react";
-
import Features from "./features";
-
import GetStarted from "./get-started";
-
import MoreOSS from "./more-oss";
-
import content from "./_content";
-
import styled from "styled-components";
-
import { Header } from "../../components/header";
-
import { Footer } from "../../components/footer";
+
import React from 'react';
+
import Features from './features';
+
import GetStarted from './get-started';
+
import MoreOSS from './more-oss';
+
import content from './_content';
+
import styled from 'styled-components';
+
import { Header } from '../../components/header';
+
import { Footer } from '../../components/footer';
const Container = styled.div`
width: 100%;
+9 -9
packages/site/src/screens/home/more-oss.js
···
-
import React from "react";
-
import PropTypes from "prop-types";
+
import React from 'react';
+
import PropTypes from 'prop-types';
// import { ProjectBadge } from "formidable-oss-badges";
-
import styled from "styled-components";
-
import { BodyCopy } from "../../components/body-copy";
-
import { Button } from "../../components/button";
-
import { SecondaryTitle } from "../../components/secondary-title";
-
import { SectionTitle } from "../../components/section-title";
-
import { Wrapper } from "../../components/wrapper";
+
import styled from 'styled-components';
+
import { BodyCopy } from '../../components/body-copy';
+
import { Button } from '../../components/button';
+
import { SecondaryTitle } from '../../components/secondary-title';
+
import { SectionTitle } from '../../components/section-title';
+
import { Wrapper } from '../../components/wrapper';
const OuterWrapper = styled.div`
background-color: #000000;
···
}
MoreOSS.propTypes = {
-
ossArray: PropTypes.array
+
ossArray: PropTypes.array,
};
export default MoreOSS;
+1 -1
packages/site/src/scroll-to-top.js
···
}, [pathname]);
return null;
-
}
+
};
+32 -32
packages/site/static-config-helpers/get-md-files.js
···
/* eslint-disable func-style */
-
import { stage, landerBasePath } from "../static-config-parts/constants";
-
const fs = require("fs");
-
const klaw = require("klaw");
-
const path = require("path");
-
const html = require("remark-html");
-
const frontmatter = require("remark-frontmatter");
-
const yaml = require("js-yaml");
-
const remark = require("remark");
-
const _ = require("lodash");
-
const select = require("unist-util-select");
-
const visit = require("unist-util-visit");
-
const slug = require("remark-slug");
-
const slugs = require("github-slugger")();
+
import { stage, landerBasePath } from '../static-config-parts/constants';
+
const fs = require('fs');
+
const klaw = require('klaw');
+
const path = require('path');
+
const html = require('remark-html');
+
const frontmatter = require('remark-frontmatter');
+
const yaml = require('js-yaml');
+
const remark = require('remark');
+
const _ = require('lodash');
+
const select = require('unist-util-select');
+
const visit = require('unist-util-visit');
+
const slug = require('remark-slug');
+
const slugs = require('github-slugger')();
// gatsby-remark plugins are usable for remark parsing without requiring gatsby.
-
const remarkPrism = require("gatsby-remark-prismjs");
+
const remarkPrism = require('gatsby-remark-prismjs');
function defaultSort(items) {
return items;
···
if (node.depth) {
const nodeClass = props.className
? `${props.className} doc-hash-link`
-
: "doc-hash-link";
+
: 'doc-hash-link';
// This adds GH style links to our md based on existing behaviors by converting mdast heading
// nodes to html so we can inject the link and svg directly rather than do something like add
// a marker value to the mdast and let the renderer handle it, in part because our "renderer"
···
data.className = nodeClass;
}
}
-
visit(ast, "heading", visitor);
+
visit(ast, 'heading', visitor);
}
function slugWithLink() {
···
function appendImageBasePath(ast) {
function visitor(node) {
-
if (!!node.value.match(/<img /) && stage !== "development") {
+
if (!!node.value.match(/<img /) && stage !== 'development') {
node.value = node.value.replace(`src="`, `src="/${landerBasePath}`);
}
}
-
visit(ast, "html", visitor);
+
visit(ast, 'html', visitor);
}
function imageTransformer() {
···
const subHeadingRangeDefaults = {
start: 1,
-
end: 3
+
end: 3,
};
function setYamlToFile(subHeadingRange = subHeadingRangeDefaults) {
function transformer(ast, file) {
-
const yamlObj = select(ast, "yaml");
+
const yamlObj = select(ast, 'yaml');
let obj;
if (yamlObj.length > 0) {
const { children } = ast;
···
file.data = obj;
-
Object.defineProperty(file, "raw", {
+
Object.defineProperty(file, 'raw', {
value: file.contents,
-
enumerable: true
+
enumerable: true,
});
file.data.subHeadings = children
.filter(
c =>
-
c.type === "heading" &&
+
c.type === 'heading' &&
c.depth >= subHeadingRange.start &&
c.depth <= subHeadingRange.end
)
···
type: c.type,
value: c.children[0].value,
depth: c.depth,
-
slug: _.kebabCase(c.children[0].value).toLowerCase()
+
slug: _.kebabCase(c.children[0].value).toLowerCase(),
}));
}
}
···
const baseConfig = {
renderer: remark()
-
.use(frontmatter, ["yaml", "toml"])
+
.use(frontmatter, ['yaml', 'toml'])
.use(setYamlToFile)
.use(html)
.use(codeHighlightTransformer)
···
outputHarmonizer: result => ({
content: result.contents,
data: result.data,
-
raw: result.raw
-
})
+
raw: result.raw,
+
}),
};
// eslint-disable-next-line max-params
···
new Promise(resolve => {
if (fs.existsSync(mdPath)) {
klaw(mdPath)
-
.on("data", item => {
-
if (path.extname(item.path) === ".md") {
-
const data = fs.readFileSync(item.path, "utf8");
+
.on('data', item => {
+
if (path.extname(item.path) === '.md') {
+
const data = fs.readFileSync(item.path, 'utf8');
const { renderer, outputHarmonizer } = config;
renderer.process(data, (err, result) => {
···
});
}
})
-
.on("error", e => {
+
.on('error', e => {
throw e;
})
-
.on("end", () => {
+
.on('end', () => {
resolve(sort(items));
});
} else {
+12 -12
packages/site/static-config-helpers/md-data-transforms.js
···
/* eslint-disable func-style */
// we can switch to single-function lodash deps like the cool kids once we've got feature parity,
// keeping in mind this is naught but the build step.
-
const _ = require("lodash");
-
const path = require("path");
-
const getMdFiles = require("./get-md-files");
+
const _ = require('lodash');
+
const path = require('path');
+
const getMdFiles = require('./get-md-files');
const capitalizeSlugComponent = word => {
// this is suboptimal, we should be able to define page
// titles as we want them instead of relying on the slug
switch (word) {
-
case "and":
-
return "and";
-
case "api":
-
return "API";
+
case 'and':
+
return 'and';
+
case 'api':
+
return 'API';
default:
return _.upperFirst(word);
}
···
mdData.slug = name.toLowerCase();
mdData.path = `/${name.toLowerCase()}/`;
mdData.title = name
-
.split("-")
+
.split('-')
.map(capitalizeSlugComponent)
-
.join(" ");
+
.join(' ');
};
-
const sidebarSort = items => _.orderBy(items, ["data.order"], "asc");
+
const sidebarSort = items => _.orderBy(items, ['data.order'], 'asc');
function getSidebarItems(
-
mdPath = "src/content/docs/",
+
mdPath = 'src/content/docs/',
items = [],
mutations = [sidebarTitleSlugMutation],
sort = sidebarSort
···
}
module.exports = {
-
getSidebarItems
+
getSidebarItems,
};
+6 -6
packages/site/static-config-parts/constants.js
···
// react-static build, aka production: REACT_STATIC_ENV="production" && REACT_STATIC_STAGING=undefined
const stage =
-
process.env.REACT_STATIC_STAGING === "true"
-
? "staging"
+
process.env.REACT_STATIC_STAGING === 'true'
+
? 'staging'
: process.env.REACT_STATIC_ENV;
-
const landerBasePath = "open-source/urql";
+
const landerBasePath = 'open-source/urql';
const metaData = {
-
title: "urql",
+
title: 'urql',
description:
-
"A GraphQL client that exposes a set of React components and hooks.",
-
url: "http://www.formidable.com/open-source/urql/"
+
'A GraphQL client that exposes a set of React components and hooks.',
+
url: 'http://www.formidable.com/open-source/urql/',
};
module.exports = { stage, landerBasePath, metaData };
+9 -9
packages/site/static-config-parts/static-webpack-config.js
···
test: /\.svg$/,
use: [
{
-
loader: "url-loader",
+
loader: 'url-loader',
options: {
-
limit: Number.MAX_SAFE_INTEGER
-
}
-
}
-
]
+
limit: Number.MAX_SAFE_INTEGER,
+
},
+
},
+
],
},
{
test: /\.md$/,
-
use: "raw-loader"
+
use: 'raw-loader',
},
defaultLoaders.cssLoader,
defaultLoaders.jsLoader,
-
defaultLoaders.fileLoader
-
]
-
}
+
defaultLoaders.fileLoader,
+
],
+
},
];
return config;
};
+18 -18
packages/site/static.config.js
···
-
import { getSidebarItems } from "./static-config-helpers/md-data-transforms";
+
import { getSidebarItems } from './static-config-helpers/md-data-transforms';
-
const staticWebpackConfig = require("./static-config-parts/static-webpack-config");
+
const staticWebpackConfig = require('./static-config-parts/static-webpack-config');
const {
stage,
landerBasePath,
-
metaData
-
} = require("./static-config-parts/constants");
+
metaData,
+
} = require('./static-config-parts/constants');
export default {
plugins: [
···
devBasePath: '',
getSiteData: () => ({
-
title: metaData.title
+
title: metaData.title,
}),
getRoutes: async () => {
···
const sidebarHeaders = sidebarItems.map(d => ({
title: d.title,
path: `/${d.slug}/`,
-
slug: d.slug
+
slug: d.slug,
}));
return [
{
-
path: "/",
-
template: "src/screens/home"
+
path: '/',
+
template: 'src/screens/home',
},
{
-
path: "/docs",
-
template: "src/screens/docs",
+
path: '/docs',
+
template: 'src/screens/docs',
getData: () => ({
title: `${metaData.title} | Documentation`,
markdown: sidebarItems[0].markdown,
···
sidebarHeaders,
tocArray: sidebarItems[0].data.subHeadings.map(sh => ({
content: sh.value,
-
level: sh.depth
-
}))
+
level: sh.depth,
+
})),
}),
// move slug + path to data in transform, renderedMd to data, and nuke markdown prop
children: sidebarItems.map(
({ slug, path, markdown, content, data }) => ({
path,
-
template: "src/screens/docs",
+
template: 'src/screens/docs',
getData: () => ({
title: data.title,
markdown,
···
sidebarHeaders,
tocArray: data.subHeadings.map(sh => ({
content: sh.value,
-
level: sh.depth
-
}))
-
})
+
level: sh.depth,
+
})),
+
}),
})
-
)
-
}
+
),
+
},
];
},
};
+7 -1
scripts/eslint/js-preset.js
···
'scripts/'
],
plugins: [
-
'react-hooks'
+
'react-hooks',
+
'prettier',
],
rules: {
'consistent-return': 'warn',
···
'sort-keys': 'off',
'no-console': ['error', { allow: ['warn', 'error'] }],
'prefer-arrow/prefer-arrow-functions': 'off',
+
+
'prettier/prettier': ['error', {
+
singleQuote: true,
+
trailingComma: 'es5',
+
}],
},
settings: {
react: {
+9 -1
scripts/eslint/preset.js
···
'examples/',
'scripts/'
],
-
plugins: ['react-hooks'],
+
plugins: [
+
'react-hooks',
+
'prettier',
+
],
rules: {
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
···
'no-console': ['error', { allow: ['warn', 'error'] }],
'import/no-internal-modules': 'off',
'prefer-arrow/prefer-arrow-functions': 'off',
+
+
'prettier/prettier': ['error', {
+
singleQuote: true,
+
trailingComma: 'es5',
+
}],
},
settings: {
react: {
+19
yarn.lock
···
read-pkg-up "^2.0.0"
resolve "^1.12.0"
+
eslint-plugin-prettier@^3.1.2:
+
version "3.1.2"
+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.2.tgz#432e5a667666ab84ce72f945c72f77d996a5c9ba"
+
integrity sha512-GlolCC9y3XZfv3RQfwGew7NnuFDKsfI4lbvRK+PIIo23SFH+LemGs4cKwzAaRa+Mdb+lQO/STaIayno8T5sJJA==
+
dependencies:
+
prettier-linter-helpers "^1.0.0"
+
eslint-plugin-react-hooks@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.3.0.tgz#53e073961f1f5ccf8dd19558036c1fac8c29d99a"
···
version "3.1.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4"
integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==
+
+
fast-diff@^1.1.2:
+
version "1.2.0"
+
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
+
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
fast-glob@^2.2.6:
version "2.2.7"
···
version "2.0.0"
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
+
+
prettier-linter-helpers@^1.0.0:
+
version "1.0.0"
+
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
+
integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
+
dependencies:
+
fast-diff "^1.1.2"
prettier@^1.18.2, prettier@^1.19.1:
version "1.19.1"