Skip to content

Commit

Permalink
Fixes a silent crash when ejecting (#1810)
Browse files Browse the repository at this point in the history
* Fixes a silent crash when ejecting

* Delete unnecessary files

* Remove references to eslintrc in Webpack config

* Fix lint

* Correct ESLint CLI options
  • Loading branch information
gaearon authored and Timer committed Mar 14, 2017
1 parent b55a7d8 commit ccb5f84
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 28 deletions.
3 changes: 0 additions & 3 deletions packages/react-scripts/babelrc

This file was deleted.

9 changes: 3 additions & 6 deletions packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '/';
Expand Down Expand Up @@ -121,7 +116,9 @@ module.exports = {
// @remove-on-eject-begin
// Point ESLint to our predefined config.
options: {
configFile: path.join(__dirname, '../eslintrc'),
baseConfig: {
extends: ['react-app'],
},
useEslintrc: false,
},
// @remove-on-eject-end
Expand Down
9 changes: 3 additions & 6 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -122,7 +117,9 @@ 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'),
baseConfig: {
extends: ['react-app'],
},
useEslintrc: false,
},
// @remove-on-eject-end
Expand Down
3 changes: 0 additions & 3 deletions packages/react-scripts/eslintrc

This file was deleted.

2 changes: 0 additions & 2 deletions packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"url": "https://github.com/facebookincubator/create-react-app/issues"
},
"files": [
"babelrc",
"eslintrc",
"bin",
"config",
"scripts",
Expand Down
14 changes: 6 additions & 8 deletions packages/react-scripts/scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit ccb5f84

Please sign in to comment.