Skip to content

Commit

Permalink
Fixes a silent crash when ejecting (facebook#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 c40d031 commit a34d48a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 28 deletions.
3 changes: 0 additions & 3 deletions babelrc

This file was deleted.

9 changes: 3 additions & 6 deletions 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 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 eslintrc

This file was deleted.

2 changes: 0 additions & 2 deletions 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 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 a34d48a

Please sign in to comment.