Commit a171d930 authored by Dan Abramov's avatar Dan Abramov
Browse files

Reformat source code with Prettier 1.5.2

parent 29c8733e
Showing with 58 additions and 46 deletions
+58 -46
...@@ -41,7 +41,11 @@ export default class extends Component { ...@@ -41,7 +41,11 @@ export default class extends Component {
render() { render() {
return ( return (
<div id="feature-template-interpolation"> <div id="feature-template-interpolation">
{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> </div>
); );
} }
......
...@@ -10,6 +10,5 @@ ...@@ -10,6 +10,5 @@
import React from 'react'; import React from 'react';
import tiniestCat from './assets/tiniest-cat.jpg'; import tiniestCat from './assets/tiniest-cat.jpg';
export default () => ( export default () =>
<img id="feature-image-inclusion" src={tiniestCat} alt="tiniest cat" /> <img id="feature-image-inclusion" src={tiniestCat} alt="tiniest cat" />;
);
...@@ -10,4 +10,7 @@ ...@@ -10,4 +10,7 @@
import React from 'react'; import React from 'react';
import { abstract } from './assets/abstract.json'; import { abstract } from './assets/abstract.json';
export default () => <summary id="feature-json-inclusion">{abstract}</summary>; export default () =>
<summary id="feature-json-inclusion">
{abstract}
</summary>;
...@@ -16,5 +16,9 @@ export default () => { ...@@ -16,5 +16,9 @@ export default () => {
if (!test() || v !== '2.0.0') { if (!test() || v !== '2.0.0') {
throw new Error('Functionality test did not pass.'); throw new Error('Functionality test did not pass.');
} }
return <p id="feature-linked-modules">{v}</p>; return (
<p id="feature-linked-modules">
{v}
</p>
);
}; };
...@@ -14,6 +14,7 @@ const text = aFileWithoutExt.includes('base64') ...@@ -14,6 +14,7 @@ const text = aFileWithoutExt.includes('base64')
? atob(aFileWithoutExt.split('base64,')[1]).trim() ? atob(aFileWithoutExt.split('base64,')[1]).trim()
: aFileWithoutExt; : aFileWithoutExt;
export default () => ( export default () =>
<a id="feature-no-ext-inclusion" href={text}>aFileWithoutExt</a> <a id="feature-no-ext-inclusion" href={text}>
); aFileWithoutExt
</a>;
...@@ -14,6 +14,7 @@ const text = aFileWithExtUnknown.includes('base64') ...@@ -14,6 +14,7 @@ const text = aFileWithExtUnknown.includes('base64')
? atob(aFileWithExtUnknown.split('base64,')[1]).trim() ? atob(aFileWithExtUnknown.split('base64,')[1]).trim()
: aFileWithExtUnknown; : aFileWithExtUnknown;
export default () => ( export default () =>
<a id="feature-unknown-ext-inclusion" href={text}>aFileWithExtUnknown</a> <a id="feature-unknown-ext-inclusion" href={text}>
); aFileWithExtUnknown
</a>;
...@@ -35,7 +35,8 @@ const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); ...@@ -35,7 +35,8 @@ const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
const FileSizeReporter = require('react-dev-utils/FileSizeReporter'); const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
const measureFileSizesBeforeBuild = FileSizeReporter.measureFileSizesBeforeBuild; const measureFileSizesBeforeBuild =
FileSizeReporter.measureFileSizesBeforeBuild;
const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild; const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
const useYarn = fs.existsSync(paths.yarnLockFile); const useYarn = fs.existsSync(paths.yarnLockFile);
......
...@@ -85,19 +85,16 @@ inquirer ...@@ -85,19 +85,16 @@ inquirer
const folders = ['config', 'config/jest', 'scripts']; const folders = ['config', 'config/jest', 'scripts'];
// Make shallow array of files paths // Make shallow array of files paths
const files = folders.reduce( const files = folders.reduce((files, folder) => {
(files, folder) => { return files.concat(
return files.concat( fs
fs .readdirSync(path.join(ownPath, folder))
.readdirSync(path.join(ownPath, folder)) // set full path
// set full path .map(file => path.join(ownPath, folder, file))
.map(file => path.join(ownPath, folder, file)) // omit dirs from file list
// omit dirs from file list .filter(file => fs.lstatSync(file).isFile())
.filter(file => fs.lstatSync(file).isFile()) );
); }, []);
},
[]
);
// Ensure that the app folder is clean and we won't override any files // Ensure that the app folder is clean and we won't override any files
folders.forEach(verifyAbsent); folders.forEach(verifyAbsent);
...@@ -124,18 +121,19 @@ inquirer ...@@ -124,18 +121,19 @@ inquirer
if (content.match(/\/\/ @remove-file-on-eject/)) { if (content.match(/\/\/ @remove-file-on-eject/)) {
return; return;
} }
content = content content =
// Remove dead code from .js files on eject content
.replace( // Remove dead code from .js files on eject
/\/\/ @remove-on-eject-begin([\s\S]*?)\/\/ @remove-on-eject-end/mg, .replace(
'' /\/\/ @remove-on-eject-begin([\s\S]*?)\/\/ @remove-on-eject-end/gm,
) ''
// Remove dead code from .applescript files on eject )
.replace( // Remove dead code from .applescript files on eject
/-- @remove-on-eject-begin([\s\S]*?)-- @remove-on-eject-end/mg, .replace(
'' /-- @remove-on-eject-begin([\s\S]*?)-- @remove-on-eject-end/gm,
) ''
.trim() + '\n'; )
.trim() + '\n';
console.log(` Adding ${cyan(file.replace(ownPath, ''))} to the project`); console.log(` Adding ${cyan(file.replace(ownPath, ''))} to the project`);
fs.writeFileSync(file.replace(ownPath, appPath), content); fs.writeFileSync(file.replace(ownPath, appPath), content);
}); });
...@@ -187,7 +185,9 @@ inquirer ...@@ -187,7 +185,9 @@ inquirer
'node scripts/$1.js' 'node scripts/$1.js'
); );
console.log( console.log(
` Replacing ${cyan(`"${binKey} ${key}"`)} with ${cyan(`"node scripts/${key}.js"`)}` ` Replacing ${cyan(`"${binKey} ${key}"`)} with ${cyan(
`"node scripts/${key}.js"`
)}`
); );
}); });
}); });
......
...@@ -28,11 +28,8 @@ module.exports = function( ...@@ -28,11 +28,8 @@ module.exports = function(
originalDirectory, originalDirectory,
template template
) { ) {
const ownPackageName = require(path.join( const ownPackageName = require(path.join(__dirname, '..', 'package.json'))
__dirname, .name;
'..',
'package.json'
)).name;
const ownPath = path.join(appPath, 'node_modules', ownPackageName); const ownPath = path.join(appPath, 'node_modules', ownPackageName);
const appPackage = require(path.join(appPath, 'package.json')); const appPackage = require(path.join(appPath, 'package.json'));
const useYarn = fs.existsSync(path.join(appPath, 'yarn.lock')); const useYarn = fs.existsSync(path.join(appPath, 'yarn.lock'));
...@@ -192,6 +189,8 @@ module.exports = function( ...@@ -192,6 +189,8 @@ module.exports = function(
function isReactInstalled(appPackage) { function isReactInstalled(appPackage) {
const dependencies = appPackage.dependencies || {}; const dependencies = appPackage.dependencies || {};
return typeof dependencies.react !== 'undefined' && return (
typeof dependencies['react-dom'] !== 'undefined'; typeof dependencies.react !== 'undefined' &&
typeof dependencies['react-dom'] !== 'undefined'
);
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment