diff --git a/.flowconfig b/.flowconfig index cb19818a..836f6ec1 100644 --- a/.flowconfig +++ b/.flowconfig @@ -12,6 +12,8 @@ [options] module.system=haste +module.system.node.resolve_dirname=node_modules +module.system.node.resolve_dirname=src esproposal.class_static_fields=enable esproposal.class_instance_fields=enable diff --git a/flow-typed/gatsby-link.js b/flow-typed/gatsby-link.js new file mode 100644 index 00000000..d5fa9036 --- /dev/null +++ b/flow-typed/gatsby-link.js @@ -0,0 +1,3 @@ +declare module 'gatsby-link' { + declare module.exports: any; +} diff --git a/flow-typed/glamor.js b/flow-typed/glamor.js new file mode 100644 index 00000000..507ea4b7 --- /dev/null +++ b/flow-typed/glamor.js @@ -0,0 +1,7 @@ +declare module 'glamor' { + declare module.exports: { + css: { + global: (...params: any) => void, + }, + }; +} diff --git a/flow-typed/graphql.js b/flow-typed/graphql.js new file mode 100644 index 00000000..53685c1a --- /dev/null +++ b/flow-typed/graphql.js @@ -0,0 +1 @@ +declare function graphql(...params: any): any; diff --git a/src/components/Container/Container.js b/src/components/Container/Container.js index 8e17a2cb..266fa066 100644 --- a/src/components/Container/Container.js +++ b/src/components/Container/Container.js @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @emails react-core + * @flow */ 'use strict'; @@ -13,11 +14,13 @@ import React from 'react'; import {media} from 'theme'; +import type {Node} from 'react'; + /** * This component wraps page content sections (eg header, footer, main). * It provides consistent margin and max width behavior. */ -const Container = ({children}) => ( +const Container = ({children}: {children: Node}) => (
( +import type {allMarkdownRemarkData} from 'types'; + +type Props = { + data: allMarkdownRemarkData, +}; + +const AllBlogPosts = ({data}: Props) => (
diff --git a/src/pages/jsx-compiler.html.js b/src/pages/jsx-compiler.html.js index 9c358baf..c3681604 100644 --- a/src/pages/jsx-compiler.html.js +++ b/src/pages/jsx-compiler.html.js @@ -5,7 +5,8 @@ * LICENSE file in the root directory of this source tree. * * @emails react-core -*/ + * @flow + */ 'use strict'; diff --git a/src/prism-styles.js b/src/prism-styles.js index 14899e90..34b9c90c 100644 --- a/src/prism-styles.js +++ b/src/prism-styles.js @@ -5,7 +5,8 @@ * LICENSE file in the root directory of this source tree. * * @emails react-core -*/ + * @flow + */ 'use strict'; diff --git a/src/site-constants.js b/src/site-constants.js index c0596321..8d3b25df 100644 --- a/src/site-constants.js +++ b/src/site-constants.js @@ -4,19 +4,15 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @emails react-core + * @providesModule site-constants * @flow -*/ + */ 'use strict'; -/** - * Variables shared by multiple components. - */ +// NOTE: We can't just use `location.toString()` because when we are rendering +// the SSR part in node.js we won't have a proper location. +const urlRoot = 'https://reactjs.org'; +const version = '16.0.0'; -export default { - // NOTE: We can't just use `location.toString()` because when we are rendering - // the SSR part in node.js we won't have a proper location. - urlRoot: 'https://reactjs.org', - version: '16.0.0', -}; +export {urlRoot, version}; diff --git a/src/theme.js b/src/theme.js index bf811ac1..50297bc9 100644 --- a/src/theme.js +++ b/src/theme.js @@ -4,9 +4,9 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @emails react-core + * @providesModule theme * @flow -*/ + */ 'use strict'; @@ -399,9 +399,4 @@ const sharedStyles = { }, }; -export default { - colors, - fonts, - media, - sharedStyles, -}; +export {colors, fonts, media, sharedStyles}; diff --git a/src/types.js b/src/types.js new file mode 100644 index 00000000..22a7a04e --- /dev/null +++ b/src/types.js @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails react-core + * @flow + */ + +export type Author = { + name: string, + url: string, +}; + +export type Node = { + excerpt: string, + fields: { + date?: string, + path: string, + redirect: string, + slug: string, + }, + frontmatter: { + author?: Array, + next?: string, + prev?: string, + title: string, + }, + html: string, + id: string, +}; + +export type Edge = { + node: Node, +}; + +export type allMarkdownRemarkData = { + allMarkdownRemark: { + edges: Array, + }, +}; + +export type markdownRemarkData = Node; diff --git a/src/utils/createLink.js b/src/utils/createLink.js index 77b67323..88bac825 100644 --- a/src/utils/createLink.js +++ b/src/utils/createLink.js @@ -109,7 +109,7 @@ const linkCss = { }, }; -export default { +export { createLinkBlog, createLinkCommunity, createLinkDocs,