Skip to content

Commit

Permalink
[core] Upgrade prettier (mui#7941)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored Aug 28, 2017
1 parent 55b583e commit ceb6637
Show file tree
Hide file tree
Showing 121 changed files with 647 additions and 871 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
build
/build
/tmp
coverage
/.next
Expand Down
18 changes: 10 additions & 8 deletions docs/scripts/buildIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ display.info('Generating Icons');
const promises = SIZES.map(
size =>
new Promise((resolve, reject) => {
gm(INPUT_ICON).resize(size, size).write(path.join(OUTPUT_DIR, `${size}x${size}.png`), err => {
if (err) {
reject(err);
return;
}
gm(INPUT_ICON)
.resize(size, size)
.write(path.join(OUTPUT_DIR, `${size}x${size}.png`), err => {
if (err) {
reject(err);
return;
}

resolve();
display.success(`Size ${size} created`);
});
resolve();
display.success(`Size ${size} created`);
});
}),
);

Expand Down
6 changes: 1 addition & 5 deletions docs/src/modules/components/AppContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ const styles = theme => ({
function AppContent(props) {
const { className, classes, children } = props;

return (
<div className={classNames(classes.content, className)}>
{children}
</div>
);
return <div className={classNames(classes.content, className)}>{children}</div>;
}

AppContent.propTypes = {
Expand Down
48 changes: 22 additions & 26 deletions docs/src/modules/components/AppDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ function renderNavItems(props, pages, activePage) {
navItems = pages.reduce(reduceChildRoutes.bind(null, props, activePage), []);
}

return (
<List>
{navItems}
</List>
);
return <List>{navItems}</List>;
}

function reduceChildRoutes(props, activePage, items, childPage, index) {
Expand Down Expand Up @@ -98,14 +94,14 @@ function AppDrawer(props, context) {
Material-UI
</Typography>
</Link>
{process.env.MATERIAL_UI_VERSION
? <Link
className={classes.anchor}
href={`${GITHUB_RELEASE_BASE_URL}v${process.env.MATERIAL_UI_VERSION}`}
>
<Typography type="caption">{`v${process.env.MATERIAL_UI_VERSION}`}</Typography>
</Link>
: null}
{process.env.MATERIAL_UI_VERSION ? (
<Link
className={classes.anchor}
href={`${GITHUB_RELEASE_BASE_URL}v${process.env.MATERIAL_UI_VERSION}`}
>
<Typography type="caption">{`v${process.env.MATERIAL_UI_VERSION}`}</Typography>
</Link>
) : null}
<Divider absolute />
</Toolbar>
</div>
Expand All @@ -130,19 +126,19 @@ function AppDrawer(props, context) {
{drawer}
</Drawer>
</Hidden>
{disablePermanent
? null
: <Hidden lgDown implementation="css">
<Drawer
classes={{
paper: classes.paper,
}}
type="permanent"
open
>
{drawer}
</Drawer>
</Hidden>}
{disablePermanent ? null : (
<Hidden lgDown implementation="css">
<Drawer
classes={{
paper: classes.paper,
}}
type="permanent"
open
>
{drawer}
</Drawer>
</Hidden>
)}
</div>
);
}
Expand Down
5 changes: 3 additions & 2 deletions docs/src/modules/components/AppFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ class AppFrame extends React.Component<any, any> {
>
<MenuIcon />
</IconButton>
{title !== null &&
{title !== null && (
<Typography className={classes.title} type="title" color="inherit" noWrap>
{title}
</Typography>}
</Typography>
)}
<div className={classes.grow} />
<AppSearch />
<IconButton
Expand Down
4 changes: 1 addition & 3 deletions docs/src/modules/components/AppWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ class AppWrapper extends React.Component<any, any> {
theme={this.styleContext.theme}
sheetsManager={this.styleContext.sheetsManager}
>
<AppFrame>
{children}
</AppFrame>
<AppFrame>{children}</AppFrame>
</MuiThemeProvider>
</JssProvider>
);
Expand Down
6 changes: 1 addition & 5 deletions docs/src/modules/components/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,7 @@ function Link(props, context) {
};
}

return (
<ComponentRoot {...rootProps}>
{children}
</ComponentRoot>
);
return <ComponentRoot {...rootProps}>{children}</ComponentRoot>;
}

Link.propTypes = {
Expand Down
18 changes: 8 additions & 10 deletions docs/src/modules/components/MarkdownDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ function MarkdownDocs(props, context) {
return (
<AppContent className={classes.root}>
<Head>
<title>
{`${getTitle(markdown)} - Material-UI`}
</title>
<title>{`${getTitle(markdown)} - Material-UI`}</title>
</Head>
<div className={classes.header}>
<Button component="a" href={`${SOURCE_CODE_ROOT_URL}${sourceLocation}`}>
Expand All @@ -68,17 +66,17 @@ function MarkdownDocs(props, context) {

return <MarkdownElement key={content} text={content} />;
})}
{components.length > 0
? <MarkdownElement
text={`
{components.length > 0 ? (
<MarkdownElement
text={`
## API
${components
.map(component => `- [&lt;${component} /&gt;](/api/${kebabCase(component)})`)
.join('\n')}
.map(component => `- [&lt;${component} /&gt;](/api/${kebabCase(component)})`)
.join('\n')}
`}
/>
: null}
/>
) : null}
</AppContent>
);
}
Expand Down
48 changes: 26 additions & 22 deletions docs/src/modules/utils/generateMarkdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,35 +164,39 @@ function generateProps(reactAPI) {
return text;
}

text = Object.keys(reactAPI.props).sort().reduce((textProps, propRaw) => {
const prop = getProp(reactAPI.props, propRaw);
const description = generatePropDescription(prop.description, prop.flowType || prop.type);

if (description === null) {
return textProps;
}
text = Object.keys(reactAPI.props)
.sort()
.reduce((textProps, propRaw) => {
const prop = getProp(reactAPI.props, propRaw);
const description = generatePropDescription(prop.description, prop.flowType || prop.type);

if (description === null) {
return textProps;
}

let defaultValue = '';
let defaultValue = '';

if (prop.defaultValue) {
defaultValue = prop.defaultValue.value.replace(/\n/g, '');
}
if (prop.defaultValue) {
defaultValue = prop.defaultValue.value.replace(/\n/g, '');
}

if (prop.required) {
propRaw = `<span style="color: #31a148">${propRaw}\u2009*</span>`;
}
if (prop.required) {
propRaw = `<span style="color: #31a148">${propRaw}\u2009*</span>`;
}

const type = prop.flowType || prop.type;
if (type && type.name === 'custom') {
if (getDeprecatedInfo(prop.type)) {
propRaw = `~~${propRaw}~~`;
const type = prop.flowType || prop.type;
if (type && type.name === 'custom') {
if (getDeprecatedInfo(prop.type)) {
propRaw = `~~${propRaw}~~`;
}
}
}

textProps += `| ${propRaw} | ${generatePropType(type)} | ${defaultValue} | ${description} |\n`;
textProps += `| ${propRaw} | ${generatePropType(
type,
)} | ${defaultValue} | ${description} |\n`;

return textProps;
}, text);
return textProps;
}, text);

return text;
}
Expand Down
5 changes: 3 additions & 2 deletions docs/src/pages/customization/BusinessVariables.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ const styles = theme => ({
},
});

let BusinessCheckbox = props =>
let BusinessCheckbox = props => (
<Checkbox defaultChecked className={props.classes.danger}>
{'Danger'}
</Checkbox>;
</Checkbox>
);

BusinessCheckbox.propTypes = {
classes: PropTypes.object.isRequired,
Expand Down
4 changes: 1 addition & 3 deletions docs/src/pages/customization/CssInJs.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ const MyLinkStyled = withStyles(styles)(MyLink);
export default function CssInJs() {
return (
<Typography type="subheading">
<MyLinkStyled href="#">
{'MyLink'}
</MyLinkStyled>
<MyLinkStyled href="#">{'MyLink'}</MyLinkStyled>
{' - '}
<MyLinkStyled href="#" variant="primary">
{'primary'}
Expand Down
5 changes: 3 additions & 2 deletions docs/src/pages/customization/Nested.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ const styles = theme => ({
},
});

let NestedCheckbox = props =>
let NestedCheckbox = props => (
<Checkbox defaultChecked className={props.classes.danger}>
{'Danger'}
</Checkbox>;
</Checkbox>
);

NestedCheckbox.propTypes = {
classes: PropTypes.object.isRequired,
Expand Down
6 changes: 1 addition & 5 deletions docs/src/pages/customization/OverridesComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import OverridesClassNames from 'docs/src/pages/customization/OverridesClassName

// We can use OverridesClassNames over and over.
function OverridesComponent() {
return (
<OverridesClassNames>
{'Component'}
</OverridesClassNames>
);
return <OverridesClassNames>{'Component'}</OverridesClassNames>;
}

export default OverridesComponent;
6 changes: 1 addition & 5 deletions docs/src/pages/customization/OverridesInlineStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ const style = {
};

function OverridesInlineStyle() {
return (
<Button style={style}>
{'inline-style'}
</Button>
);
return <Button style={style}>{'inline-style'}</Button>;
}

export default OverridesInlineStyle;
4 changes: 1 addition & 3 deletions docs/src/pages/customization/OverridesTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ const theme = createMuiTheme({
function OverridesTheme() {
return (
<MuiThemeProvider theme={theme}>
<Button>
{'Overrides'}
</Button>
<Button>{'Overrides'}</Button>
</MuiThemeProvider>
);
}
Expand Down
8 changes: 2 additions & 6 deletions docs/src/pages/customization/Palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ function Palette() {
return (
<MuiThemeProvider theme={theme}>
<div>
<Button color="primary">
{'Primary'}
</Button>
<Button color="accent">
{'Accent'}
</Button>
<Button color="primary">{'Primary'}</Button>
<Button color="accent">{'Accent'}</Button>
</div>
</MuiThemeProvider>
);
Expand Down
8 changes: 2 additions & 6 deletions docs/src/pages/customization/TypographyTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ function TypographyTheme() {
return (
<MuiThemeProvider theme={theme}>
<div>
<Typography type="body1">
{'body1'}
</Typography>
<Button>
{'Button'}
</Button>
<Typography type="body1">{'body1'}</Typography>
<Button>{'Button'}</Button>
</div>
</MuiThemeProvider>
);
Expand Down
8 changes: 2 additions & 6 deletions docs/src/pages/customization/WithTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ function WithTheme(props) {

return (
<div>
<Typography style={styles.primaryColor}>
{`Primary color ${primaryColor}`}
</Typography>
<Typography style={styles.primaryText}>
{`Primary text ${primaryText}`}
</Typography>
<Typography style={styles.primaryColor}>{`Primary color ${primaryColor}`}</Typography>
<Typography style={styles.primaryText}>{`Primary text ${primaryText}`}</Typography>
</div>
);
}
Expand Down
16 changes: 9 additions & 7 deletions docs/src/pages/demos/autocomplete/IntegrationAutosuggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ function renderSuggestion(suggestion, { query, isHighlighted }) {
<MenuItem selected={isHighlighted} component="div">
<div>
{parts.map((part, index) => {
return part.highlight
? <span key={index} style={{ fontWeight: 300 }}>
{part.text}
</span>
: <strong key={index} style={{ fontWeight: 500 }}>
{part.text}
</strong>;
return part.highlight ? (
<span key={index} style={{ fontWeight: 300 }}>
{part.text}
</span>
) : (
<strong key={index} style={{ fontWeight: 500 }}>
{part.text}
</strong>
);
})}
</div>
</MenuItem>
Expand Down
Loading

0 comments on commit ceb6637

Please sign in to comment.