From d6e82c24d963f72acbc6f81deb795f0d686d8a3b Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 13 Mar 2017 17:51:20 +0000 Subject: [PATCH 1/5] Fixes a silent crash when ejecting --- packages/react-scripts/scripts/eject.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/react-scripts/scripts/eject.js b/packages/react-scripts/scripts/eject.js index 68c43d25068..8edc441002e 100644 --- a/packages/react-scripts/scripts/eject.js +++ b/packages/react-scripts/scripts/eject.js @@ -100,12 +100,6 @@ prompt( const ownPackage = require(path.join(ownPath, 'package.json')); const appPackage = require(path.join(appPath, 'package.json')); - const babelConfig = JSON.parse( - fs.readFileSync(path.join(ownPath, '.babelrc'), 'utf8') - ); - const eslintConfig = JSON.parse( - fs.readFileSync(path.join(ownPath, '.eslintrc'), 'utf8') - ); console.log(cyan('Updating the dependencies')); const ownPackageName = ownPackage.name; @@ -154,11 +148,15 @@ prompt( // Add Babel config console.log(` Adding ${cyan('Babel')} preset`); - appPackage.babel = babelConfig; + appPackage.babel = { + presets: ['react-app'], + }; // Add ESlint config console.log(` Adding ${cyan('ESLint')} configuration`); - appPackage.eslintConfig = eslintConfig; + appPackage.eslintConfig = { + extends: 'react-app', + }; fs.writeFileSync( path.join(appPath, 'package.json'), From 8ee7c4010d66ba3ed0cc194d9622530216d71d5d Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 13 Mar 2017 18:02:47 +0000 Subject: [PATCH 2/5] Delete unnecessary files --- packages/react-scripts/babelrc | 3 --- packages/react-scripts/eslintrc | 3 --- packages/react-scripts/package.json | 2 -- 3 files changed, 8 deletions(-) delete mode 100644 packages/react-scripts/babelrc delete mode 100644 packages/react-scripts/eslintrc diff --git a/packages/react-scripts/babelrc b/packages/react-scripts/babelrc deleted file mode 100644 index ad8e03a8248..00000000000 --- a/packages/react-scripts/babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["react-app"] -} \ No newline at end of file diff --git a/packages/react-scripts/eslintrc b/packages/react-scripts/eslintrc deleted file mode 100644 index 5e603ecd193..00000000000 --- a/packages/react-scripts/eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "react-app" -} diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 59542d4361d..b2cb03bb972 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -11,8 +11,6 @@ "url": "https://github.com/facebookincubator/create-react-app/issues" }, "files": [ - "babelrc", - "eslintrc", "bin", "config", "scripts", From 810112640c505f1c4f2bca66d84a09a7035f6ca3 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 13 Mar 2017 18:17:15 +0000 Subject: [PATCH 3/5] Remove references to eslintrc in Webpack config --- packages/react-scripts/config/webpack.config.dev.js | 2 +- packages/react-scripts/config/webpack.config.prod.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index c7948b66f6e..ec173f7a69e 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -121,7 +121,7 @@ module.exports = { // @remove-on-eject-begin // Point ESLint to our predefined config. options: { - configFile: path.join(__dirname, '../eslintrc'), + extends: ['react-app'], useEslintrc: false, }, // @remove-on-eject-end diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 979ed4e4d6d..92d697f0e6e 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -122,7 +122,7 @@ module.exports = { options: { // TODO: consider separate config for production, // e.g. to enable no-console and no-debugger only in production. - configFile: path.join(__dirname, '../eslintrc'), + extends: ['react-app'], useEslintrc: false, }, // @remove-on-eject-end From bb4918870bf8490bf6b5386f29ef8796b67d19ca Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 13 Mar 2017 19:14:28 +0000 Subject: [PATCH 4/5] Fix lint --- packages/react-scripts/config/webpack.config.dev.js | 5 ----- packages/react-scripts/config/webpack.config.prod.js | 5 ----- 2 files changed, 10 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index ec173f7a69e..1cf9a7e472e 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -19,11 +19,6 @@ const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeM const getClientEnvironment = require('./env'); const paths = require('./paths'); -// @remove-on-eject-begin -// `path` is not used after eject - see https://github.com/facebookincubator/create-react-app/issues/1174 -const path = require('path'); -// @remove-on-eject-end - // Webpack uses `publicPath` to determine where the app is being served from. // In development, we always serve from the root. This makes config easier. const publicPath = '/'; diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 92d697f0e6e..47842122f3e 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -19,11 +19,6 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const paths = require('./paths'); const getClientEnvironment = require('./env'); -// @remove-on-eject-begin -// `path` is not used after eject - see https://github.com/facebookincubator/create-react-app/issues/1174 -const path = require('path'); -// @remove-on-eject-end - // Webpack uses `publicPath` to determine where the app is being served from. // It requires a trailing slash, or the file assets will get an incorrect path. const publicPath = paths.servedPath; From 65c0b963dddc66dfeda3da4f3d09f00669e783f2 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Mon, 13 Mar 2017 16:56:09 -0400 Subject: [PATCH 5/5] Correct ESLint CLI options --- packages/react-scripts/config/webpack.config.dev.js | 4 +++- packages/react-scripts/config/webpack.config.prod.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 1cf9a7e472e..aea37eab6bc 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -116,7 +116,9 @@ module.exports = { // @remove-on-eject-begin // Point ESLint to our predefined config. options: { - extends: ['react-app'], + baseConfig: { + extends: ['react-app'], + }, useEslintrc: false, }, // @remove-on-eject-end diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 47842122f3e..218eb46bb0c 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -117,7 +117,9 @@ module.exports = { options: { // TODO: consider separate config for production, // e.g. to enable no-console and no-debugger only in production. - extends: ['react-app'], + baseConfig: { + extends: ['react-app'], + }, useEslintrc: false, }, // @remove-on-eject-end