File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
38
38
// @remove -on-eject-end
39
39
const postcssNormalize = require ( 'postcss-normalize' ) ;
40
40
41
+ // Get the app's `package.json`.
42
+ const appPackageJson = require ( paths . appPackageJson ) ;
43
+
41
44
// Source maps are resource heavy and can cause out of memory issue for large source files.
42
45
const shouldUseSourceMap = process . env . GENERATE_SOURCEMAP !== 'false' ;
43
46
// Some apps do not need the benefits of saving a web request, so not inlining the chunk
@@ -319,9 +322,13 @@ module.exports = function(webpackEnv) {
319
322
formatter : require . resolve ( 'react-dev-utils/eslintFormatter' ) ,
320
323
eslintPath : require . resolve ( 'eslint' ) ,
321
324
// @remove -on-eject-begin
322
- baseConfig : {
323
- extends : [ require . resolve ( 'eslint-config-react-app' ) ] ,
324
- } ,
325
+ baseConfig :
326
+ // We allow overriding the config, only if it extends our config
327
+ // (`extends` can be a string or array of strings).
328
+ appPackageJson . eslintConfig &&
329
+ appPackageJson . eslintConfig . extends . includes ( 'react-app' )
330
+ ? appPackageJson . eslintConfig
331
+ : { extends : [ require . resolve ( 'eslint-config-react-app' ) ] } ,
325
332
ignore : false ,
326
333
useEslintrc : false ,
327
334
// @remove -on-eject-end
Original file line number Diff line number Diff line change @@ -236,10 +236,12 @@ inquirer
236
236
} ;
237
237
238
238
// Add ESlint config
239
- console . log ( ` Adding ${ cyan ( 'ESLint' ) } configuration` ) ;
240
- appPackage . eslintConfig = {
241
- extends : 'react-app' ,
242
- } ;
239
+ if ( ! appPackage . eslintConfig ) {
240
+ console . log ( ` Adding ${ cyan ( 'ESLint' ) } configuration` ) ;
241
+ appPackage . eslintConfig = {
242
+ extends : 'react-app' ,
243
+ } ;
244
+ }
243
245
244
246
fs . writeFileSync (
245
247
path . join ( appPath , 'package.json' ) ,
You can’t perform that action at this time.
0 commit comments