Add Prettier Formatting (#258)

* Add Prettier formatting to source files and example files, and check that Prettier formatting is maintained on PRs

* Remove trailing-comma as we are using Node 6 on Circle

* Use latest Node 6 LTS version in Circle

* Remove unused test
This commit is contained in:
Héctor Ramos 2017-12-04 19:21:02 -08:00 committed by Joel Marcey
parent 0cead4b6f9
commit 65421db62e
50 changed files with 1376 additions and 1350 deletions

View file

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
const React = require("react");
const React = require('react');
// html head for each page
class Head extends React.Component {
@ -17,8 +17,10 @@ class Head extends React.Component {
});
const highlightDefaultVersion = '9.12.0';
const highlightConfig = this.props.config.highlight
|| { version: highlightDefaultVersion, theme: 'default' };
const highlightConfig = this.props.config.highlight || {
version: highlightDefaultVersion,
theme: 'default',
};
const highlightVersion = highlightConfig.version || highlightDefaultVersion;
const highlightTheme = highlightConfig.theme || 'default';
@ -43,7 +45,7 @@ class Head extends React.Component {
{this.props.redirect && (
<meta
http-equiv="refresh"
content={"0; URL=" + this.props.redirect}
content={'0; URL=' + this.props.redirect}
/>
)}
<link
@ -58,45 +60,47 @@ class Head extends React.Component {
)}
<link
rel="stylesheet"
href={`//cdnjs.cloudflare.com/ajax/libs/highlight.js/${highlightVersion}/styles/${highlightTheme}.min.css`}
href={`//cdnjs.cloudflare.com/ajax/libs/highlight.js/${
highlightVersion
}/styles/${highlightTheme}.min.css`}
/>
{hasBlog && (
<link
rel="alternate"
type="application/atom+xml"
href={this.props.config.url + "/blog/atom.xml"}
title={this.props.config.title + " Blog ATOM Feed"}
href={this.props.config.url + '/blog/atom.xml'}
title={this.props.config.title + ' Blog ATOM Feed'}
/>
)}
{hasBlog && (
<link
rel="alternate"
type="application/rss+xml"
href={this.props.config.url + "/blog/feed.xml"}
title={this.props.config.title + " Blog RSS Feed"}
href={this.props.config.url + '/blog/feed.xml'}
title={this.props.config.title + ' Blog RSS Feed'}
/>
)}
{/* External resources */}
{this.props.config.stylesheets && this.props.config.stylesheets.map(function(source) {
return (
<link rel="stylesheet" href={source} />
);
})}
{this.props.config.scripts && this.props.config.scripts.map(function(source, idx) {
return (
<script
type="text/javascript"
key={"script" + idx}
src={source}
/>
);
})}
{this.props.config.stylesheets &&
this.props.config.stylesheets.map(function(source) {
return <link rel="stylesheet" href={source} />;
})}
{this.props.config.scripts &&
this.props.config.scripts.map(function(source, idx) {
return (
<script
type="text/javascript"
key={'script' + idx}
src={source}
/>
);
})}
{/* Site defined code. Keep these at the end to avoid overriding. */}
<link
rel="stylesheet"
href={this.props.config.baseUrl + "css/main.css"}
href={this.props.config.baseUrl + 'css/main.css'}
/>
</head>
);