diff --git a/package.json b/package.json index 4beaa5f8c..8fe60f979 100644 --- a/package.json +++ b/package.json @@ -18,12 +18,14 @@ "@types/node": "^7.0.21", "@types/react": "^15.6.1", "@types/react-dom": "^15.5.0", - "eslint": "^4.4.1", + "babel-core": "^6.24.1", + "eslint": "4.4.1", "husky": "^0.13.2", "lerna": "^2.0.0", "lerna-changelog": "^0.6.0", "lint-staged": "^3.3.1", - "prettier": "^1.5.2" + "prettier": "^1.5.2", + "typescript-babel-jest": "^1.0.4" }, "lint-staged": { "*.js": [ diff --git a/packages/create-react-app/createReactApp.js b/packages/create-react-app/createReactApp.js index 4a1b7901d..4cc6f5cba 100755 --- a/packages/create-react-app/createReactApp.js +++ b/packages/create-react-app/createReactApp.js @@ -75,14 +75,10 @@ const program = new commander.Command(packageJson.name) ); console.log(` - a specific npm version: ${chalk.green('0.8.2')}`); console.log( - ` - a custom fork published on npm: ${chalk.green( - 'my-react-scripts' - )}` + ` - a custom fork published on npm: ${chalk.green('my-react-scripts')}` ); console.log( - ` - a .tgz archive: ${chalk.green( - 'https://mysite.com/my-react-scripts-0.8.2.tgz' - )}` + ` - a .tgz archive: ${chalk.green('https://mysite.com/my-react-scripts-0.8.2.tgz')}` ); console.log( ` It is not needed unless you specifically want to use a fork.` @@ -92,9 +88,7 @@ const program = new commander.Command(packageJson.name) ` If you have any problems, do not hesitate to file an issue:` ); console.log( - ` ${chalk.cyan( - 'https://github.com/facebookincubator/create-react-app/issues/new' - )}` + ` ${chalk.cyan('https://github.com/facebookincubator/create-react-app/issues/new')}` ); console.log(); }) @@ -261,19 +255,15 @@ function run( console.log('Installing packages. This might take a couple of minutes.'); getPackageName(packageToInstall) - .then(packageName => - checkIfOnline(useYarn).then(isOnline => ({ - isOnline: isOnline, - packageName: packageName, - })) - ) + .then(packageName => checkIfOnline(useYarn).then(isOnline => ({ + isOnline: isOnline, + packageName: packageName, + }))) .then(info => { const isOnline = info.isOnline; const packageName = info.packageName; console.log( - `Installing ${chalk.cyan('react')}, ${chalk.cyan( - 'react-dom' - )}, and ${chalk.cyan(packageName)}...` + `Installing ${chalk.cyan('react')}, ${chalk.cyan('react-dom')}, and ${chalk.cyan(packageName)}...` ); console.log(); @@ -341,9 +331,7 @@ function run( if (!remainingFiles.length) { // Delete target folder if empty console.log( - `Deleting ${chalk.cyan(`${appName} /`)} from ${chalk.cyan( - path.resolve(root, '..') - )}` + `Deleting ${chalk.cyan(`${appName} /`)} from ${chalk.cyan(path.resolve(root, '..'))}` ); process.chdir(path.resolve(root, '..')); fs.removeSync(path.join(root)); @@ -431,9 +419,7 @@ function getPackageName(installPackage) { /^.+\/(.+?)(?:-\d+.+)?\.tgz$/ )[1]; console.log( - `Based on the filename, assuming it is "${chalk.cyan( - assumedProjectName - )}"` + `Based on the filename, assuming it is "${chalk.cyan(assumedProjectName)}"` ); return Promise.resolve(assumedProjectName); }); @@ -496,9 +482,7 @@ function checkAppName(appName) { const validationResult = validateProjectName(appName); if (!validationResult.validForNewPackages) { console.error( - `Could not create a project called ${chalk.red( - `"${appName}"` - )} because of npm naming restrictions:` + `Could not create a project called ${chalk.red(`"${appName}"`)} because of npm naming restrictions:` ); printValidationResults(validationResult.errors); printValidationResults(validationResult.warnings); @@ -510,9 +494,7 @@ function checkAppName(appName) { if (dependencies.indexOf(appName) >= 0) { console.error( chalk.red( - `We cannot create a project called ${chalk.green( - appName - )} because a dependency with the same name exists.\n` + + `We cannot create a project called ${chalk.green(appName)} because a dependency with the same name exists.\n` + `Due to the way npm works, the following names are not allowed:\n\n` ) + chalk.cyan(dependencies.map(depName => ` ${depName}`).join('\n')) + @@ -534,9 +516,7 @@ function makeCaretRange(dependencies, name) { if (!semver.validRange(patchedVersion)) { console.error( - `Unable to patch ${name} dependency version because version ${chalk.red( - version - )} will become invalid ${chalk.red(patchedVersion)}` + `Unable to patch ${name} dependency version because version ${chalk.red(version)} will become invalid ${chalk.red(patchedVersion)}` ); patchedVersion = version; } diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index 4e94e650c..6e6084596 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -237,8 +237,7 @@ module.exports = { { object: 'System', property: 'import', - message: - 'Please use import() instead. More info: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting', + message: 'Please use import() instead. More info: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting', }, ], diff --git a/packages/react-dev-utils/FileSizeReporter.js b/packages/react-dev-utils/FileSizeReporter.js index f25e47378..85fdb00cf 100644 --- a/packages/react-dev-utils/FileSizeReporter.js +++ b/packages/react-dev-utils/FileSizeReporter.js @@ -122,12 +122,15 @@ function measureFileSizesBeforeBuild(buildFolder) { if (!err && fileNames) { sizes = fileNames .filter(fileName => /\.(js|css)$/.test(fileName)) - .reduce((memo, fileName) => { - var contents = fs.readFileSync(fileName); - var key = removeFileNameHash(buildFolder, fileName); - memo[key] = gzipSize(contents); - return memo; - }, {}); + .reduce( + (memo, fileName) => { + var contents = fs.readFileSync(fileName); + var key = removeFileNameHash(buildFolder, fileName); + memo[key] = gzipSize(contents); + return memo; + }, + {} + ); } resolve({ root: buildFolder, diff --git a/packages/react-dev-utils/ModuleScopePlugin.js b/packages/react-dev-utils/ModuleScopePlugin.js index 3a10904d3..f8099cab2 100644 --- a/packages/react-dev-utils/ModuleScopePlugin.js +++ b/packages/react-dev-utils/ModuleScopePlugin.js @@ -52,24 +52,13 @@ class ModuleScopePlugin { // Error if in a parent directory of src/ const requestRelative = path.relative(appSrc, requestFullPath); if ( - requestRelative.startsWith('../') || - requestRelative.startsWith('..\\') + requestRelative.startsWith('../') || requestRelative.startsWith('..\\') ) { callback( new Error( - `You attempted to import ${chalk.cyan( - request.__innerRequest_request - )} which falls outside of the project ${chalk.cyan( - 'src/' - )} directory. ` + - `Relative imports outside of ${chalk.cyan( - 'src/' - )} are not supported. ` + - `You can either move it inside ${chalk.cyan( - 'src/' - )}, or add a symlink to it from project's ${chalk.cyan( - 'node_modules/' - )}.` + `You attempted to import ${chalk.cyan(request.__innerRequest_request)} which falls outside of the project ${chalk.cyan('src/')} directory. ` + + `Relative imports outside of ${chalk.cyan('src/')} are not supported. ` + + `You can either move it inside ${chalk.cyan('src/')}, or add a symlink to it from project's ${chalk.cyan('node_modules/')}.` ), request ); diff --git a/packages/react-dev-utils/WebpackDevServerUtils.js b/packages/react-dev-utils/WebpackDevServerUtils.js index bb4a8c790..d6c5acd21 100644 --- a/packages/react-dev-utils/WebpackDevServerUtils.js +++ b/packages/react-dev-utils/WebpackDevServerUtils.js @@ -37,20 +37,18 @@ if (isSmokeTest) { } function prepareUrls(protocol, host, port) { - const formatUrl = hostname => - url.format({ - protocol, - hostname, - port, - pathname: '/', - }); - const prettyPrintUrl = hostname => - url.format({ - protocol, - hostname, - port: chalk.bold(port), - pathname: '/', - }); + const formatUrl = hostname => url.format({ + protocol, + hostname, + port, + pathname: '/', + }); + const prettyPrintUrl = hostname => url.format({ + protocol, + hostname, + port: chalk.bold(port), + pathname: '/', + }); const isUnspecifiedHost = host === '0.0.0.0' || host === '::'; let prettyHost, lanUrlForConfig, lanUrlForTerminal; @@ -324,11 +322,9 @@ function prepareProxy(proxy, appPublicFolder) { // However API calls like `fetch()` won’t generally accept text/html. // If this heuristic doesn’t work well for you, use a custom `proxy` object. context: function(pathname, req) { - return ( - mayProxy(pathname) && + return mayProxy(pathname) && req.headers.accept && - req.headers.accept.indexOf('text/html') === -1 - ); + req.headers.accept.indexOf('text/html') === -1; }, onProxyReq: proxyReq => { // Browers may send Origin headers even with same-origin @@ -384,40 +380,39 @@ function prepareProxy(proxy, appPublicFolder) { function choosePort(host, defaultPort) { return detect(defaultPort, host).then( - port => - new Promise(resolve => { - if (port === defaultPort) { - return resolve(port); - } - const message = - process.platform !== 'win32' && defaultPort < 1024 && !isRoot() - ? `Admin permissions are required to run a server on a port below 1024.` - : `Something is already running on port ${defaultPort}.`; - if (isInteractive) { - clearConsole(); - const existingProcess = getProcessForPort(defaultPort); - const question = { - type: 'confirm', - name: 'shouldChangePort', - message: - chalk.yellow( - message + - `${existingProcess ? ` Probably:\n ${existingProcess}` : ''}` - ) + '\n\nWould you like to run the app on another port instead?', - default: true, - }; - inquirer.prompt(question).then(answer => { - if (answer.shouldChangePort) { - resolve(port); - } else { - resolve(null); - } - }); - } else { - console.log(chalk.red(message)); - resolve(null); - } - }), + port => new Promise(resolve => { + if (port === defaultPort) { + return resolve(port); + } + const message = process.platform !== 'win32' && + defaultPort < 1024 && + !isRoot() + ? `Admin permissions are required to run a server on a port below 1024.` + : `Something is already running on port ${defaultPort}.`; + if (isInteractive) { + clearConsole(); + const existingProcess = getProcessForPort(defaultPort); + const question = { + type: 'confirm', + name: 'shouldChangePort', + message: chalk.yellow( + message + + `${existingProcess ? ` Probably:\n ${existingProcess}` : ''}` + ) + '\n\nWould you like to run the app on another port instead?', + default: true, + }; + inquirer.prompt(question).then(answer => { + if (answer.shouldChangePort) { + resolve(port); + } else { + resolve(null); + } + }); + } else { + console.log(chalk.red(message)); + resolve(null); + } + }), err => { throw new Error( chalk.red(`Could not find an open port at ${chalk.bold(host)}.`) + diff --git a/packages/react-dev-utils/eslintFormatter.js b/packages/react-dev-utils/eslintFormatter.js index b7756b7a2..96b6ce14b 100644 --- a/packages/react-dev-utils/eslintFormatter.js +++ b/packages/react-dev-utils/eslintFormatter.js @@ -82,8 +82,7 @@ function formatter(results) { // it here because we always show at most one error, and // we can only be sure it's an ESLint error before exiting // this function. - output += - 'Search for the ' + + output += 'Search for the ' + chalk.underline(chalk.red('keywords')) + ' to learn more about each error.'; } diff --git a/packages/react-dev-utils/launchEditor.js b/packages/react-dev-utils/launchEditor.js index e1ea29c88..c644c2663 100644 --- a/packages/react-dev-utils/launchEditor.js +++ b/packages/react-dev-utils/launchEditor.js @@ -30,30 +30,19 @@ function isTerminalEditor(editor) { // of the app every time const COMMON_EDITORS_OSX = { '/Applications/Atom.app/Contents/MacOS/Atom': 'atom', - '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': - '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta', + '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': '/Applications/Atom Beta.app/Contents/MacOS/Atom Beta', '/Applications/Brackets.app/Contents/MacOS/Brackets': 'brackets', - '/Applications/Sublime Text.app/Contents/MacOS/Sublime Text': - '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl', - '/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2': - '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl', + '/Applications/Sublime Text.app/Contents/MacOS/Sublime Text': '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl', + '/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2': '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl', '/Applications/Visual Studio Code.app/Contents/MacOS/Electron': 'code', - '/Applications/AppCode.app/Contents/MacOS/appcode': - '/Applications/AppCode.app/Contents/MacOS/appcode', - '/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/PhpStorm.app/Contents/MacOS/phpstorm': - '/Applications/PhpStorm.app/Contents/MacOS/phpstorm', - '/Applications/PyCharm.app/Contents/MacOS/pycharm': - '/Applications/PyCharm.app/Contents/MacOS/pycharm', - '/Applications/PyCharm CE.app/Contents/MacOS/pycharm': - '/Applications/PyCharm CE.app/Contents/MacOS/pycharm', - '/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/AppCode.app/Contents/MacOS/appcode': '/Applications/AppCode.app/Contents/MacOS/appcode', + '/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/PhpStorm.app/Contents/MacOS/phpstorm': '/Applications/PhpStorm.app/Contents/MacOS/phpstorm', + '/Applications/PyCharm.app/Contents/MacOS/pycharm': '/Applications/PyCharm.app/Contents/MacOS/pycharm', + '/Applications/PyCharm CE.app/Contents/MacOS/pycharm': '/Applications/PyCharm CE.app/Contents/MacOS/pycharm', + '/Applications/RubyMine.app/Contents/MacOS/rubymine': '/Applications/RubyMine.app/Contents/MacOS/rubymine', + '/Applications/WebStorm.app/Contents/MacOS/webstorm': '/Applications/WebStorm.app/Contents/MacOS/webstorm', }; const COMMON_EDITORS_WIN = [ diff --git a/packages/react-dev-utils/openBrowser.js b/packages/react-dev-utils/openBrowser.js index 4f5700125..9ded70781 100644 --- a/packages/react-dev-utils/openBrowser.js +++ b/packages/react-dev-utils/openBrowser.js @@ -68,8 +68,7 @@ function startBrowserProcess(browser, url) { // requested a different browser, we can try opening // Chrome with AppleScript. This lets us reuse an // existing tab when possible instead of creating a new one. - const shouldTryOpenChromeWithAppleScript = - process.platform === 'darwin' && + const shouldTryOpenChromeWithAppleScript = process.platform === 'darwin' && (typeof browser !== 'string' || browser === OSX_CHROME); if (shouldTryOpenChromeWithAppleScript) { diff --git a/packages/react-dev-utils/printHostingInstructions.js b/packages/react-dev-utils/printHostingInstructions.js index 2ef25767a..07e3b0e7c 100644 --- a/packages/react-dev-utils/printHostingInstructions.js +++ b/packages/react-dev-utils/printHostingInstructions.js @@ -25,14 +25,10 @@ function printHostingInstructions( if (publicUrl && publicUrl.indexOf('.github.io/') !== -1) { // "homepage": "http://user.github.io/project" console.log( - `The project was built assuming it is hosted at ${chalk.green( - publicPathname - )}.` + `The project was built assuming it is hosted at ${chalk.green(publicPathname)}.` ); console.log( - `You can control this with the ${chalk.green( - 'homepage' - )} field in your ${chalk.cyan('package.json')}.` + `You can control this with the ${chalk.green('homepage')} field in your ${chalk.cyan('package.json')}.` ); console.log(); console.log(`The ${chalk.cyan('build')} folder is ready to be deployed.`); @@ -54,14 +50,10 @@ function printHostingInstructions( console.log(` ${chalk.yellow('"scripts"')}: {`); console.log(` ${chalk.dim('// ...')}`); console.log( - ` ${chalk.yellow('"predeploy"')}: ${chalk.yellow( - '"npm run build",' - )}` + ` ${chalk.yellow('"predeploy"')}: ${chalk.yellow('"npm run build",')}` ); console.log( - ` ${chalk.yellow('"deploy"')}: ${chalk.yellow( - '"gh-pages -d build"' - )}` + ` ${chalk.yellow('"deploy"')}: ${chalk.yellow('"gh-pages -d build"')}` ); console.log(' }'); console.log(); @@ -73,14 +65,10 @@ function printHostingInstructions( } else if (publicPath !== '/') { // "homepage": "http://mywebsite.com/project" console.log( - `The project was built assuming it is hosted at ${chalk.green( - publicPath - )}.` + `The project was built assuming it is hosted at ${chalk.green(publicPath)}.` ); console.log( - `You can control this with the ${chalk.green( - 'homepage' - )} field in your ${chalk.cyan('package.json')}.` + `You can control this with the ${chalk.green('homepage')} field in your ${chalk.cyan('package.json')}.` ); console.log(); console.log(`The ${chalk.cyan('build')} folder is ready to be deployed.`); @@ -89,14 +77,10 @@ function printHostingInstructions( if (publicUrl) { // "homepage": "http://mywebsite.com" console.log( - `The project was built assuming it is hosted at ${chalk.green( - publicUrl - )}.` + `The project was built assuming it is hosted at ${chalk.green(publicUrl)}.` ); console.log( - `You can control this with the ${chalk.green( - 'homepage' - )} field in your ${chalk.cyan('package.json')}.` + `You can control this with the ${chalk.green('homepage')} field in your ${chalk.cyan('package.json')}.` ); console.log(); } else { @@ -105,16 +89,12 @@ function printHostingInstructions( 'The project was built assuming it is hosted at the server root.' ); console.log( - `To override this, specify the ${chalk.green( - 'homepage' - )} in your ${chalk.cyan('package.json')}.` + `To override this, specify the ${chalk.green('homepage')} in your ${chalk.cyan('package.json')}.` ); console.log('For example, add this to build it for GitHub Pages:'); console.log(); console.log( - ` ${chalk.green('"homepage"')} ${chalk.cyan(':')} ${chalk.green( - '"http://myname.github.io/myapp"' - )}${chalk.cyan(',')}` + ` ${chalk.green('"homepage"')} ${chalk.cyan(':')} ${chalk.green('"http://myname.github.io/myapp"')}${chalk.cyan(',')}` ); console.log(); } diff --git a/packages/react-error-overlay/src/__tests__/mapper.js b/packages/react-error-overlay/src/__tests__/mapper.js index 169bf6c59..64c2cf730 100644 --- a/packages/react-error-overlay/src/__tests__/mapper.js +++ b/packages/react-error-overlay/src/__tests__/mapper.js @@ -14,8 +14,7 @@ import { resolve } from 'path'; test('basic error; 0 context', async () => { expect.assertions(1); - const error = - 'TypeError: document.body.missing is not a function\n at App.componentDidMount (http://localhost:3000/static/js/bundle.js:26122:21)\n at http://localhost:3000/static/js/bundle.js:30091:25\n at measureLifeCyclePerf (http://localhost:3000/static/js/bundle.js:29901:12)\n at http://localhost:3000/static/js/bundle.js:30090:11\n at CallbackQueue.notifyAll (http://localhost:3000/static/js/bundle.js:13256:22)\n at ReactReconcileTransaction.close (http://localhost:3000/static/js/bundle.js:35124:26)\n at ReactReconcileTransaction.closeAll (http://localhost:3000/static/js/bundle.js:7390:25)\n at ReactReconcileTransaction.perform (http://localhost:3000/static/js/bundle.js:7337:16)\n at batchedMountComponentIntoNode (http://localhost:3000/static/js/bundle.js:14204:15)\n at ReactDefaultBatchingStrategyTransaction.perform (http://localhost:3000/static/js/bundle.js:7324:20)\n at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:33900:26)\n at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:2181:27)\n at Object._renderNewRootComponent (http://localhost:3000/static/js/bundle.js:14398:18)\n at Object._renderSubtreeIntoContainer (http://localhost:3000/static/js/bundle.js:14479:32)\n at Object.render (http://localhost:3000/static/js/bundle.js:14500:23)\n at Object.friendlySyntaxErrorLabel (http://localhost:3000/static/js/bundle.js:17287:20)\n at __webpack_require__ (http://localhost:3000/static/js/bundle.js:660:30)\n at fn (http://localhost:3000/static/js/bundle.js:84:20)\n at Object. (http://localhost:3000/static/js/bundle.js:41219:18)\n at __webpack_require__ (http://localhost:3000/static/js/bundle.js:660:30)\n at validateFormat (http://localhost:3000/static/js/bundle.js:709:39)\n at http://localhost:3000/static/js/bundle.js:712:10'; + const error = 'TypeError: document.body.missing is not a function\n at App.componentDidMount (http://localhost:3000/static/js/bundle.js:26122:21)\n at http://localhost:3000/static/js/bundle.js:30091:25\n at measureLifeCyclePerf (http://localhost:3000/static/js/bundle.js:29901:12)\n at http://localhost:3000/static/js/bundle.js:30090:11\n at CallbackQueue.notifyAll (http://localhost:3000/static/js/bundle.js:13256:22)\n at ReactReconcileTransaction.close (http://localhost:3000/static/js/bundle.js:35124:26)\n at ReactReconcileTransaction.closeAll (http://localhost:3000/static/js/bundle.js:7390:25)\n at ReactReconcileTransaction.perform (http://localhost:3000/static/js/bundle.js:7337:16)\n at batchedMountComponentIntoNode (http://localhost:3000/static/js/bundle.js:14204:15)\n at ReactDefaultBatchingStrategyTransaction.perform (http://localhost:3000/static/js/bundle.js:7324:20)\n at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:33900:26)\n at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:2181:27)\n at Object._renderNewRootComponent (http://localhost:3000/static/js/bundle.js:14398:18)\n at Object._renderSubtreeIntoContainer (http://localhost:3000/static/js/bundle.js:14479:32)\n at Object.render (http://localhost:3000/static/js/bundle.js:14500:23)\n at Object.friendlySyntaxErrorLabel (http://localhost:3000/static/js/bundle.js:17287:20)\n at __webpack_require__ (http://localhost:3000/static/js/bundle.js:660:30)\n at fn (http://localhost:3000/static/js/bundle.js:84:20)\n at Object. (http://localhost:3000/static/js/bundle.js:41219:18)\n at __webpack_require__ (http://localhost:3000/static/js/bundle.js:660:30)\n at validateFormat (http://localhost:3000/static/js/bundle.js:709:39)\n at http://localhost:3000/static/js/bundle.js:712:10'; fetch.mockResponseOnce( fs @@ -39,8 +38,7 @@ test('basic error; 0 context', async () => { test('default context (3)', async () => { expect.assertions(1); - const error = - 'TypeError: document.body.missing is not a function\n at App.componentDidMount (http://localhost:3000/static/js/bundle.js:26122:21)'; + const error = 'TypeError: document.body.missing is not a function\n at App.componentDidMount (http://localhost:3000/static/js/bundle.js:26122:21)'; fetch.mockResponseOnce( fs @@ -64,8 +62,7 @@ test('default context (3)', async () => { test('bad comes back same', async () => { expect.assertions(2); - const error = - 'TypeError: document.body.missing is not a function\n at App.componentDidMount (A:1:2)'; + const error = 'TypeError: document.body.missing is not a function\n at App.componentDidMount (A:1:2)'; const orig = parse(error); expect(orig).toEqual([ { diff --git a/packages/react-error-overlay/src/components/Collapsible.js b/packages/react-error-overlay/src/components/Collapsible.js index 92f1de429..3d474d4e2 100644 --- a/packages/react-error-overlay/src/components/Collapsible.js +++ b/packages/react-error-overlay/src/components/Collapsible.js @@ -57,9 +57,11 @@ class Collapsible extends Component { collapsed ? collapsibleCollapsedStyle : collapsibleExpandedStyle } > - {(collapsed ? '▶' : '▼') + - ` ${count} stack frames were ` + - (collapsed ? 'collapsed.' : 'expanded.')} + { + (collapsed ? '▶' : '▼') + + ` ${count} stack frames were ` + + (collapsed ? 'collapsed.' : 'expanded.') + }
{this.props.children} diff --git a/packages/react-error-overlay/src/containers/CompileErrorContainer.js b/packages/react-error-overlay/src/containers/CompileErrorContainer.js index a3e89fe59..53e89101b 100644 --- a/packages/react-error-overlay/src/containers/CompileErrorContainer.js +++ b/packages/react-error-overlay/src/containers/CompileErrorContainer.js @@ -22,7 +22,9 @@ class CompileErrorContainer extends PureComponent {
-