Skip to content

Commit

Permalink
Rerun prettier and pin version (facebook#3058)
Browse files Browse the repository at this point in the history
* rerun prettier for all files

* pin prettier to 1.6.1
  • Loading branch information
viankakrisna authored and kasperpeulen committed Sep 24, 2017
1 parent 5786537 commit a8ef240
Show file tree
Hide file tree
Showing 34 changed files with 79 additions and 133 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"lerna": "^2.0.0",
"lerna-changelog": "^0.6.0",
"lint-staged": "^3.3.1",
"prettier": "^1.5.2"
"prettier": "1.6.1"
},
"lint-staged": {
"*.js": [
Expand Down
4 changes: 3 additions & 1 deletion packages/create-react-app/createReactApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,9 @@ function checkNpmVersion() {
let hasMinNpm = false;
let npmVersion = null;
try {
npmVersion = execSync('npm --version').toString().trim();
npmVersion = execSync('npm --version')
.toString()
.trim();
hasMinNpm = semver.gte(npmVersion, '3.0.0');
} catch (err) {
// ignore
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dev-utils/launchEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const COMMON_EDITORS_OSX = {
'/Applications/CLion.app/Contents/MacOS/clion':
'/Applications/CLion.app/Contents/MacOS/clion',
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea':
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea',
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea',
'/Applications/PhpStorm.app/Contents/MacOS/phpstorm':
'/Applications/PhpStorm.app/Contents/MacOS/phpstorm',
'/Applications/PyCharm.app/Contents/MacOS/pycharm':
Expand All @@ -53,7 +53,7 @@ const COMMON_EDITORS_OSX = {
'/Applications/RubyMine.app/Contents/MacOS/rubymine':
'/Applications/RubyMine.app/Contents/MacOS/rubymine',
'/Applications/WebStorm.app/Contents/MacOS/webstorm':
'/Applications/WebStorm.app/Contents/MacOS/webstorm',
'/Applications/WebStorm.app/Contents/MacOS/webstorm',
};

const COMMON_EDITORS_WIN = [
Expand Down
6 changes: 1 addition & 5 deletions packages/react-error-overlay/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ type HeaderPropType = {|
|};

function Header(props: HeaderPropType) {
return (
<div style={headerStyle}>
{props.headerText}
</div>
);
return <div style={headerStyle}>{props.headerText}</div>;
}

export default Header;
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ class RuntimeErrorContainer extends PureComponent {
return (
<ErrorOverlay shortcutHandler={this.shortcutHandler}>
<CloseButton close={close} />
{totalErrors > 1 &&
{totalErrors > 1 && (
<NavigationBar
currentError={this.state.currentIndex + 1}
totalErrors={totalErrors}
previous={this.previous}
next={this.next}
/>}
/>
)}
<RuntimeError
errorRecord={errorRecords[this.state.currentIndex]}
launchEditorEndpoint={this.props.launchEditorEndpoint}
Expand Down
9 changes: 4 additions & 5 deletions packages/react-error-overlay/src/containers/StackFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ class StackFrame extends Component {
const canOpenInEditor = this.canOpenInEditor();
return (
<div>
<div>
{functionName}
</div>
<div>{functionName}</div>
<div style={linkStyle}>
<a
style={canOpenInEditor ? anchorStyle : null}
Expand All @@ -168,7 +166,7 @@ class StackFrame extends Component {
{url}
</a>
</div>
{codeBlockProps &&
{codeBlockProps && (
<span>
<a
onClick={canOpenInEditor ? this.openInEditor : null}
Expand All @@ -179,7 +177,8 @@ class StackFrame extends Component {
<button style={toggleStyle} onClick={this.toggleCompiled}>
{'View ' + (compiled ? 'source' : 'compiled')}
</button>
</span>}
</span>
)}
</div>
);
}
Expand Down
6 changes: 1 addition & 5 deletions packages/react-error-overlay/src/containers/StackTrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ class StackTrace extends Component {
}

render() {
return (
<div style={traceStyle}>
{this.renderFrames()}
</div>
);
return <div style={traceStyle}>{this.renderFrames()}</div>;
}
}

Expand Down
22 changes: 14 additions & 8 deletions packages/react-error-overlay/src/utils/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ import StackFrame from './stack-frame';
const regexExtractLocation = /\(?(.+?)(?::(\d+))?(?::(\d+))?\)?$/;

function extractLocation(token: string): [string, number, number] {
return regexExtractLocation.exec(token).slice(1).map(v => {
const p = Number(v);
if (!isNaN(p)) {
return p;
}
return v;
});
return regexExtractLocation
.exec(token)
.slice(1)
.map(v => {
const p = Number(v);
if (!isNaN(p)) {
return p;
}
return v;
});
}

const regexValidFrame_Chrome = /^\s*(at|in)\s.+(:\d+)/;
Expand Down Expand Up @@ -55,7 +58,10 @@ function parseStack(stack: string[]): StackFrame[] {
if (e.indexOf('(at ') !== -1) {
e = e.replace(/\(at /, '(');
}
const data = e.trim().split(/\s+/g).slice(1);
const data = e
.trim()
.split(/\s+/g)
.slice(1);
const last = data.pop();
return new StackFrame(data.join(' ') || null, ...extractLocation(last));
}
Expand Down
5 changes: 4 additions & 1 deletion packages/react-error-overlay/src/utils/warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import type { ReactFrame } from '../effects/proxyConsole';

function stripInlineStacktrace(message: string): string {
return message.split('\n').filter(line => !line.match(/^\s*in/)).join('\n'); // " in Foo"
return message
.split('\n')
.filter(line => !line.match(/^\s*in/))
.join('\n'); // " in Foo"
}

function massage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import React from 'react';

export default () =>
export default () => (
<span>
<span id="feature-file-env-original-1">
{process.env.REACT_APP_ORIGINAL_1}
Expand All @@ -21,7 +21,6 @@ export default () =>
{process.env.REACT_APP_DEVELOPMENT}
{process.env.REACT_APP_PRODUCTION}
</span>
<span id="feature-file-env-x">
{process.env.REACT_APP_X}
</span>
</span>;
<span id="feature-file-env-x">{process.env.REACT_APP_X}</span>
</span>
);
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ export default class extends Component {
render() {
return (
<div id="feature-node-path">
{this.state.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import React from 'react';

export default () =>
<span id="feature-public-url">
{process.env.PUBLIC_URL}.
</span>;
export default () => (
<span id="feature-public-url">{process.env.PUBLIC_URL}.</span>
);
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

import React from 'react';

export default () =>
export default () => (
<span id="feature-shell-env-variables">
{process.env.REACT_APP_SHELL_ENV_MESSAGE}.
</span>;
</span>
);
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ export default class extends Component {
<div id="feature-array-destructuring">
{this.state.users.map(user => {
const [id, name] = user;
return (
<div key={id}>
{name}
</div>
);
return <div key={id}>{name}</div>;
})}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ export default class extends Component {
render() {
return (
<div id="feature-array-spread">
{this.state.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ export default class extends Component {
render() {
return (
<div id="feature-async-await">
{this.state.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ export default class extends Component {
render() {
return (
<div id="feature-class-properties">
{this.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
{this.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ export default class extends Component {
render() {
return (
<div id="feature-computed-properties">
{this.state.users.map(user =>
<div key={user.id}>
{user.user_name}
</div>
)}
{this.state.users.map(user => (
<div key={user.id}>{user.user_name}</div>
))}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ export default class extends Component {

return (
<div id="feature-custom-interpolation">
{this.state.users.map(user =>
{this.state.users.map(user => (
<div key={user.id} style={veryInlineStyle}>
{user.name}
</div>
)}
))}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ export default class extends Component {
render() {
return (
<div id="feature-default-parameters">
{this.state.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ export default class extends Component {
render() {
return (
<div id="feature-destructuring-and-await">
{this.state.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ export default class extends Component {
render() {
return (
<div id="feature-generators">
{this.state.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ export default class extends Component {
<div id="feature-object-destructuring">
{this.state.users.map(user => {
const { id, name } = user;
return (
<div key={id}>
{name}
</div>
);
return <div key={id}>{name}</div>;
})}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ export default class extends Component {
render() {
return (
<div id="feature-object-spread">
{this.state.users.map(user =>
{this.state.users.map(user => (
<div key={user.id}>
{user.name}: {user.age}
</div>
)}
))}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ export default class extends Component {
render() {
return (
<div id="feature-promises">
{this.state.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ export default class extends Component {
render() {
return (
<div id="feature-rest-and-default">
{this.state.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ export default class extends Component {
render() {
return (
<div id="feature-rest-parameters">
{this.state.users.map(user =>
<div key={user.id}>
{user.name}
</div>
)}
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
Expand Down
Loading

0 comments on commit a8ef240

Please sign in to comment.