Skip to content

Commit

Permalink
Chore: PRETTIER ALL THE THINGS!!! 🦆🦆🦆
Browse files Browse the repository at this point in the history
  • Loading branch information
sapegin committed May 11, 2017
1 parent 16c5443 commit fc6a3ba
Show file tree
Hide file tree
Showing 132 changed files with 1,285 additions and 1,345 deletions.
71 changes: 36 additions & 35 deletions bin/styleguidist.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@ function printAllWarnings(warnings, originalWarnings) {
}

function printStyleguidistError(errors) {
const styleguidistError = errors.find(message => message.includes('Module build failed: Error: Styleguidist:'));
const styleguidistError = errors.find(message =>
message.includes('Module build failed: Error: Styleguidist:')
);
if (!styleguidistError) {
return;
}

const m = styleguidistError.match(/Styleguidist: (.*?)\n/);
printErrorWithLink(
m[1],
'Learn how to configure your style guide:',
consts.DOCS_CONFIG
);
printErrorWithLink(m[1], 'Learn how to configure your style guide:', consts.DOCS_CONFIG);
process.exit(1);
}

Expand All @@ -75,7 +73,9 @@ function printNoLoaderError(errors) {
return;
}

const noLoaderError = errors.find(message => message.includes('You may need an appropriate loader'));
const noLoaderError = errors.find(message =>
message.includes('You may need an appropriate loader')
);
if (!noLoaderError) {
return;
}
Expand Down Expand Up @@ -104,18 +104,15 @@ const argv = minimist(process.argv.slice(2));
let config;
try {
config = getConfig(argv.config);
}
catch (err) {
} catch (err) {
if (err instanceof StyleguidistError) {
printErrorWithLink(
err.message,
err.extra + '\n\n' +
'Learn how to configure your style guide:',
err.extra + '\n\n' + 'Learn how to configure your style guide:',
consts.DOCS_CONFIG
);
process.exit(1);
}
else {
} else {
throw err;
}
}
Expand All @@ -142,8 +139,7 @@ function commandBuild() {
if (err) {
console.log(err);
process.exit(1);
}
else {
} else {
console.log('Style guide published to:');
console.log(chalk.underline(config.styleguideDir));
}
Expand All @@ -169,8 +165,7 @@ function commandServer() {
'You can change the port using the `serverPort` option in your style guide config:',
consts.DOCS_CONFIG
);
}
else {
} else {
console.error(chalk.bold.red(err.message));
/* istanbul ignore if */
if (argv.verbose) {
Expand All @@ -185,8 +180,7 @@ function commandServer() {
const compiler = server(config, err => {
if (err) {
console.log(err);
}
else {
} else {
console.log('Style guide server started at:');
console.log(chalk.underline('http://' + config.serverHost + ':' + config.serverPort));
console.log();
Expand Down Expand Up @@ -214,20 +208,27 @@ function commandServer() {
}

function commandHelp() {
console.log([
chalk.underline('Usage'),
'',
' ' + chalk.bold('styleguidist') + ' ' + chalk.cyan('<command>') + ' ' + chalk.yellow('[<options>]'),
'',
chalk.underline('Commands'),
'',
' ' + chalk.cyan('build') + ' Build style guide',
' ' + chalk.cyan('server') + ' Run development server',
' ' + chalk.cyan('help') + ' Display React Styleguidist help',
'',
chalk.underline('Options'),
'',
' ' + chalk.yellow('--config') + ' Config file path',
' ' + chalk.yellow('--verbose') + ' Print debug information',
].join('\n'));
console.log(
[
chalk.underline('Usage'),
'',
' ' +
chalk.bold('styleguidist') +
' ' +
chalk.cyan('<command>') +
' ' +
chalk.yellow('[<options>]'),
'',
chalk.underline('Commands'),
'',
' ' + chalk.cyan('build') + ' Build style guide',
' ' + chalk.cyan('server') + ' Run development server',
' ' + chalk.cyan('help') + ' Display React Styleguidist help',
'',
chalk.underline('Options'),
'',
' ' + chalk.yellow('--config') + ' Config file path',
' ' + chalk.yellow('--verbose') + ' Print debug information',
].join('\n')
);
}
13 changes: 3 additions & 10 deletions examples/basic/src/components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,13 @@ import './Button.css';
/**
* The only true button.
*/
export default function Button({
color,
size,
onClick,
children,
}) {
export default function Button({ color, size, onClick, children }) {
const styles = {
color,
fontSize: Button.sizes[size],
};

return (
<button className="button" style={styles} onClick={onClick}>{children}</button>
);
return <button className="button" style={styles} onClick={onClick}>{children}</button>;
}
Button.propTypes = {
/** Button label */
Expand All @@ -35,7 +28,7 @@ Button.defaultProps = {
color: '#333',
size: 'normal',
/* eslint-disable no-console */
onClick: (event) => {
onClick: event => {
console.log('You have clicked me!', event.target);
},
/* eslint-enable no-console */
Expand Down
4 changes: 1 addition & 3 deletions examples/basic/src/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export default class Modal extends Component {
zIndex: 999,
},
};
return (
<ReactModal contentLabel="Modal" isOpen={isOpen} style={style}>{children}</ReactModal>
);
return <ReactModal contentLabel="Modal" isOpen={isOpen} style={style}>{children}</ReactModal>;
}
}
16 changes: 12 additions & 4 deletions examples/basic/src/components/Placeholder/Placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ import './Placeholder.css';
*/
export default class Placeholder extends Component {
static propTypes = {
type: PropTypes.oneOf(['animal', 'bacon', 'beard', 'bear', 'cat', 'food', 'city', 'nature', 'people']),
type: PropTypes.oneOf([
'animal',
'bacon',
'beard',
'bear',
'cat',
'food',
'city',
'nature',
'people',
]),
width: PropTypes.number,
height: PropTypes.number,
};
Expand Down Expand Up @@ -37,8 +47,6 @@ export default class Placeholder extends Component {

render() {
const { width, height } = this.props;
return (
<img className="placeholder" src={this.getImageUrl()} width={width} height={height} />
);
return <img className="placeholder" src={this.getImageUrl()} width={width} height={height} />;
}
}
10 changes: 2 additions & 8 deletions examples/basic/src/components/PushButton/PushButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@ import './PushButton.css';
/**
* An example-less button.
*/
export default function PushButton({
color,
size,
children,
}) {
export default function PushButton({ color, size, children }) {
const styles = {
color,
fontSize: PushButton.sizes[size],
};

return (
<button className="push-button" style={styles}>{children}</button>
);
return <button className="push-button" style={styles}>{children}</button>;
}
PushButton.propTypes = {
/**
Expand Down
4 changes: 3 additions & 1 deletion examples/basic/src/components/RandomButton/RandomButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export default class RandomButton extends Component {

render() {
return (
<button className="random-button" onClick={this.handleClick.bind(this)}>{this.state.label}</button>
<button className="random-button" onClick={this.handleClick.bind(this)}>
{this.state.label}
</button>
);
}
}
22 changes: 8 additions & 14 deletions examples/basic/src/components/WrappedButton/WrappedButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,13 @@ import PropTypes from 'prop-types';
* @author [Jeremy Gayed](https://github.com/tizmagik)
* @deprecated Use the [only true button](#button) instead
*/
const WrappedButton = ({
color,
size,
children,
}) => {
const WrappedButton = ({ color, size, children }) => {
const styles = {
color,
fontSize: WrappedButton.sizes[size],
};

return (
<button className="wrapped-button" style={styles}>{children}</button>
);
return <button className="wrapped-button" style={styles}>{children}</button>;
};
WrappedButton.propTypes = {
/**
Expand Down Expand Up @@ -67,11 +61,11 @@ WrappedButton.sizes = {
large: '18px',
};


const Decorator = Composed => class MyHOC extends Component {
render() {
return <Composed {...this.props} />;
}
};
const Decorator = Composed =>
class MyHOC extends Component {
render() {
return <Composed {...this.props} />;
}
};

export default Decorator(WrappedButton);
10 changes: 2 additions & 8 deletions examples/cra/src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@ import './Button.css';
/**
* The only true button.
*/
export default function Button({
color,
size,
children,
}) {
export default function Button({ color, size, children }) {
const styles = {
color,
fontSize: Button.sizes[size],
};

return (
<button className="button" style={styles}>{children}</button>
);
return <button className="button" style={styles}>{children}</button>;
}
Button.propTypes = {
/**
Expand Down
20 changes: 18 additions & 2 deletions examples/cra/src/components/Placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ import './Placeholder.css';
*/
export default class Placeholder extends Component {
static propTypes = {
type: PropTypes.oneOf(['animal', 'bacon', 'beard', 'bear', 'cat', 'food', 'city', 'nature', 'people']),
type: PropTypes.oneOf([
'animal',
'bacon',
'beard',
'bear',
'cat',
'food',
'city',
'nature',
'people',
]),
width: PropTypes.number,
height: PropTypes.number,
};
Expand Down Expand Up @@ -38,7 +48,13 @@ export default class Placeholder extends Component {
render() {
const { type, width, height } = this.props;
return (
<img className="placeholder" src={this.getImageUrl()} alt={type} width={width} height={height} />
<img
className="placeholder"
src={this.getImageUrl()}
alt={type}
width={width}
height={height}
/>
);
}
}
4 changes: 3 additions & 1 deletion examples/cra/src/components/RandomButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export default class RandomButton extends Component {

render() {
return (
<button className="random-button" onClick={this.handleClick.bind(this)}>{this.state.label}</button>
<button className="random-button" onClick={this.handleClick.bind(this)}>
{this.state.label}
</button>
);
}
}
5 changes: 1 addition & 4 deletions examples/cra/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ import ReactDOM from 'react-dom';
import App from './App';
import './index.css';

ReactDOM.render(
<App />,
document.getElementById('root')
);
ReactDOM.render(<App />, document.getElementById('root'));
10 changes: 2 additions & 8 deletions examples/customised/src/components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@ import s from './Button.css';
/**
* The only true button.
*/
export default function Button({
color,
size,
children,
}) {
export default function Button({ color, size, children }) {
const styles = {
color,
fontSize: Button.sizes[size],
};

return (
<button className={s.root} style={styles}>{children}</button>
);
return <button className={s.root} style={styles}>{children}</button>;
}
Button.propTypes = {
/**
Expand Down
4 changes: 1 addition & 3 deletions examples/customised/src/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export default class Modal extends Component {
zIndex: 999,
},
};
return (
<ReactModal contentLabel="Modal" isOpen={isOpen} style={style}>{children}</ReactModal>
);
return <ReactModal contentLabel="Modal" isOpen={isOpen} style={style}>{children}</ReactModal>;
}
}
Loading

0 comments on commit fc6a3ba

Please sign in to comment.