Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Remove flow from the docs #9434

Merged
merged 1 commit into from Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/.eslintrc.js
@@ -1,5 +1,8 @@
// We are more permissive with the documentation as the demos are directly copy and paste by our
// users.
module.exports = {
rules: {
'react/no-multi-comp': 'off',
'flowtype/require-valid-file-annotation': 'off',
},
};
4 changes: 1 addition & 3 deletions docs/src/modules/components/AppContent.js
@@ -1,5 +1,3 @@
// @flow

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
Expand All @@ -19,7 +17,7 @@ const styles = theme => ({
},
});

function AppContent(props: Object) {
function AppContent(props) {
const { className, classes, children } = props;

return <div className={classNames(classes.root, className)}>{children}</div>;
Expand Down
4 changes: 1 addition & 3 deletions docs/src/modules/components/AppDrawer.js
@@ -1,5 +1,3 @@
// @flow

import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -83,7 +81,7 @@ function reduceChildRoutes(props, activePage, items, childPage, index) {

const GITHUB_RELEASE_BASE_URL = 'https://github.com/mui-org/material-ui/releases/tag/';

function AppDrawer(props: Object, context: Object) {
function AppDrawer(props, context) {
const { classes, className, disablePermanent, mobileOpen, onRequestClose } = props;

const drawer = (
Expand Down
4 changes: 1 addition & 3 deletions docs/src/modules/components/AppDrawerNavItem.js
@@ -1,5 +1,3 @@
// @flow

import React from 'react';
import PropTypes from 'prop-types';
import Link from 'docs/src/modules/components/Link';
Expand Down Expand Up @@ -44,7 +42,7 @@ const styles = theme => ({
},
});

class AppDrawerNavItem extends React.Component<Object, Object> {
class AppDrawerNavItem extends React.Component {
static defaultProps = {
openImmediately: false,
};
Expand Down
4 changes: 1 addition & 3 deletions docs/src/modules/components/AppFooter.js
@@ -1,5 +1,3 @@
// @flow

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
Expand All @@ -25,7 +23,7 @@ const styleSheet = theme => ({
},
});

function AppFooter(props: Object) {
function AppFooter(props) {
const { classes } = props;

return (
Expand Down
4 changes: 1 addition & 3 deletions docs/src/modules/components/AppFrame.js
@@ -1,5 +1,3 @@
/* eslint-disable flowtype/require-valid-file-annotation */

import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
Expand Down Expand Up @@ -148,7 +146,7 @@ const styles = theme => ({
},
});

class AppFrame extends React.Component<any, any> {
class AppFrame extends React.Component {
state = {
mobileOpen: false,
};
Expand Down
2 changes: 0 additions & 2 deletions docs/src/modules/components/AppSearch.js
@@ -1,5 +1,3 @@
// @flow

import React from 'react';
import compose from 'recompose/compose';
import pure from 'recompose/pure';
Expand Down
3 changes: 1 addition & 2 deletions docs/src/modules/components/AppWrapper.js
@@ -1,4 +1,3 @@
// @flow weak
/* eslint-disable no-underscore-dangle */

import React from 'react';
Expand All @@ -22,7 +21,7 @@ if (process.browser && !global.__INSERTION_POINT__) {
}
}

class AppWrapper extends React.Component<any, any> {
class AppWrapper extends React.Component {
componentWillMount() {
this.styleContext = getContext();
}
Expand Down
4 changes: 1 addition & 3 deletions docs/src/modules/components/Carbon.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
Expand Down Expand Up @@ -68,7 +66,7 @@ const styles = theme => ({
},
});

class Carbon extends React.Component<any> {
class Carbon extends React.Component {
componentDidMount() {
if (process.env.NODE_ENV !== 'production') {
return;
Expand Down
3 changes: 1 addition & 2 deletions docs/src/modules/components/GitHub.js
@@ -1,10 +1,9 @@
// @flow
/* eslint-disable max-len */

import React from 'react';
import SvgIcon from 'material-ui/SvgIcon';

function GitHub(props: Object) {
function GitHub(props) {
return (
<SvgIcon {...props}>
<path d="M12.007 0C6.12 0 1.1 4.27.157 10.08c-.944 5.813 2.468 11.45 8.054 13.312.19.064.397.033.555-.084.16-.117.25-.304.244-.5v-2.042c-3.33.735-4.037-1.56-4.037-1.56-.22-.726-.694-1.35-1.334-1.756-1.096-.75.074-.735.074-.735.773.103 1.454.557 1.846 1.23.694 1.21 2.23 1.638 3.45.96.056-.61.327-1.178.766-1.605-2.67-.3-5.462-1.335-5.462-6.002-.02-1.193.42-2.35 1.23-3.226-.327-1.015-.27-2.116.166-3.09 0 0 1.006-.33 3.3 1.23 1.966-.538 4.04-.538 6.003 0 2.295-1.5 3.3-1.23 3.3-1.23.445 1.006.49 2.144.12 3.18.81.877 1.25 2.033 1.23 3.226 0 4.607-2.805 5.627-5.476 5.927.578.583.88 1.386.825 2.206v3.29c-.005.2.092.393.26.507.164.115.377.14.565.063 5.568-1.88 8.956-7.514 8.007-13.313C22.892 4.267 17.884.007 12.008 0z" />
Expand Down
2 changes: 0 additions & 2 deletions docs/src/modules/components/Link.js
@@ -1,5 +1,3 @@
/* eslint-disable react/no-multi-comp */

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
Expand Down
27 changes: 10 additions & 17 deletions docs/src/modules/components/MarkdownDocs.js
@@ -1,5 +1,3 @@
// @flow

import React from 'react';
import PropTypes from 'prop-types';
import kebabCase from 'lodash/kebabCase';
Expand Down Expand Up @@ -27,21 +25,7 @@ const styles = {
const demoRegexp = /^demo='(.*)'$/;
const SOURCE_CODE_ROOT_URL = 'https://github.com/mui-org/material-ui/tree/v1-beta';

type InjectedProps = {
classes: Object,
theme?: Object,
};

type Props = {
classes: Object,
demos?: { [key: string]: any },
markdown: string,
// You can define the direction location of the markdown file.
// Otherwise, we try to determine it with an heuristic.
sourceLocation?: string,
};

function MarkdownDocs(props: Props & InjectedProps, context: Object) {
function MarkdownDocs(props, context) {
const { classes, demos, markdown, sourceLocation: sourceLocationProp } = props;
const contents = getContents(markdown);
const headers = getHeaders(markdown);
Expand Down Expand Up @@ -100,6 +84,15 @@ ${headers.components
);
}

MarkdownDocs.propTypes = {
classes: PropTypes.object.isRequired,
demos: PropTypes.object,
markdown: PropTypes.string.isRequired,
// You can define the direction location of the markdown file.
// Otherwise, we try to determine it with an heuristic.
sourceLocation: PropTypes.string,
};

MarkdownDocs.contextTypes = {
activePage: PropTypes.shape({
pathname: PropTypes.string.isRequired,
Expand Down
17 changes: 9 additions & 8 deletions docs/src/modules/components/MarkdownElement.js
@@ -1,7 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { withStyles } from 'material-ui/styles';
import marked from 'marked';
import { withStyles } from 'material-ui/styles';
import prism from 'docs/src/modules/utils/prism';

const renderer = new marked.Renderer();
Expand Down Expand Up @@ -205,13 +206,7 @@ const styles = theme => ({
},
});

type Props = {
classes: Object,
className?: string,
text: string,
};

function MarkdownElement(props: Props) {
function MarkdownElement(props) {
const { classes, className, text, ...other } = props;

/* eslint-disable react/no-danger */
Expand All @@ -225,4 +220,10 @@ function MarkdownElement(props: Props) {
/* eslint-enable */
}

MarkdownElement.propTypes = {
classes: PropTypes.object.isRequired,
className: PropTypes.string,
text: PropTypes.string,
};

export default withStyles(styles, { flip: false })(MarkdownElement);
26 changes: 10 additions & 16 deletions docs/src/modules/components/NoSSR.js
@@ -1,30 +1,24 @@
// @flow

import React from 'react';
import type { Node } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

const DefaultOnSSR = () => null;

type State = {
canRender: boolean,
};

type Props = {
children: Node,
};

class NoSSR extends React.Component<Props, State> {
class NoSSR extends Component {
state = {
canRender: false,
mounted: false,
};

componentDidMount() {
this.setState({ canRender: true }); // eslint-disable-line react/no-did-mount-set-state
this.setState({ mounted: true }); // eslint-disable-line react/no-did-mount-set-state
}

render() {
return this.state.canRender ? this.props.children : <DefaultOnSSR />;
return this.state.mounted ? this.props.children : <DefaultOnSSR />;
}
}

NoSSR.propTypes = {
children: PropTypes.node.isRequired,
};

export default NoSSR;
3 changes: 1 addition & 2 deletions docs/src/modules/components/Twitter.js
@@ -1,10 +1,9 @@
// @flow
/* eslint-disable max-len */

import React from 'react';
import SvgIcon from 'material-ui/SvgIcon';

function Twitter(props: Object) {
function Twitter(props) {
return (
<SvgIcon {...props}>
<path d="M7.6 21.63c8.95 0 13.84-7.4 13.84-13.84v-.63c.94-.7 1.76-1.55 2.4-2.52-.86.38-1.8.64-2.78.76 1-.6 1.78-1.54 2.14-2.68-.94.56-1.98.96-3.1 1.18-.88-.94-2.14-1.53-3.54-1.53-2.7 0-4.86 2.17-4.86 4.86 0 .38.04.75.12 1.1C7.78 8.14 4.2 6.2 1.8 3.27c-.42.72-.66 1.55-.66 2.44 0 1.7.86 3.18 2.16 4.05-.8-.02-1.55-.24-2.2-.6v.05c0 2.36 1.67 4.33 3.9 4.77-.4.1-.84.17-1.28.17-.32 0-.62-.03-.92-.08.62 1.93 2.42 3.33 4.55 3.37-1.67 1.3-3.76 2.1-6.04 2.1-.4 0-.77-.04-1.15-.08 2.15 1.38 4.7 2.18 7.45 2.18" />
Expand Down
2 changes: 0 additions & 2 deletions docs/src/modules/components/withRoot.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import PropTypes from 'prop-types';
import find from 'lodash/find';
Expand Down
1 change: 0 additions & 1 deletion docs/src/modules/styles/getContext.js
@@ -1,4 +1,3 @@
// @flow weak
/* eslint-disable no-underscore-dangle */

import { create, SheetsRegistry } from 'jss';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/modules/utils/generateMarkdown.js
@@ -1,5 +1,3 @@
// @flow weak

import { parse as parseDoctrine } from 'doctrine';
import recast from 'recast';
import kebabCase from 'lodash/kebabCase';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/CssInJs.js
@@ -1,5 +1,3 @@
/* eslint-disable flowtype/require-valid-file-annotation */

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/CustomStyles.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import PropTypes from 'prop-types';
import Checkbox from 'material-ui/Checkbox';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/DarkTheme.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import WithTheme from './WithTheme';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/FontSizeTheme.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import Typography from 'material-ui/Typography';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/JssRegistry.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import JssProvider from 'react-jss/lib/JssProvider';
import { SheetsRegistry } from 'jss';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/Nested.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import PropTypes from 'prop-types';
import Checkbox from 'material-ui/Checkbox';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/OverridesClassNames.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/OverridesClasses.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/OverridesComponent.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import OverridesClassNames from 'docs/src/pages/customization/OverridesClassNames';

Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/OverridesInlineStyle.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import Button from 'material-ui/Button';

Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/OverridesTheme.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import Button from 'material-ui/Button';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/Palette.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import purple from 'material-ui/colors/purple';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/ThemeDefault.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import PropTypes from 'prop-types';
import MarkdownElement from 'docs/src/modules/components/MarkdownElement';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/TypographyTheme.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import Typography from 'material-ui/Typography';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/customization/WithTheme.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import PropTypes from 'prop-types';
import Typography from 'material-ui/Typography';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/demos/app-bar/ButtonAppBar.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/demos/app-bar/MenuAppBar.js
@@ -1,5 +1,3 @@
/* eslint-disable flowtype/require-valid-file-annotation */

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/demos/app-bar/SimpleAppBar.js
@@ -1,5 +1,3 @@
// @flow weak

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
Expand Down