@@ -33,7 +33,6 @@ const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
3333const ForkTsCheckerWebpackPlugin = require ( 'react-dev-utils/ForkTsCheckerWebpackPlugin' ) ;
3434const typescriptFormatter = require ( 'react-dev-utils/typescriptFormatter' ) ;
3535// @remove -on-eject-begin
36- const eslint = require ( 'eslint' ) ;
3736const getCacheIdentifier = require ( 'react-dev-utils/getCacheIdentifier' ) ;
3837// @remove -on-eject-end
3938const postcssNormalize = require ( 'postcss-normalize' ) ;
@@ -46,6 +45,8 @@ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
4645// makes for a smoother build process.
4746const shouldInlineRuntimeChunk = process . env . INLINE_RUNTIME_CHUNK !== 'false' ;
4847
48+ const isExtendingEslintConfig = process . env . EXTEND_ESLINT === 'true' ;
49+
4950const imageInlineSizeLimit = parseInt (
5051 process . env . IMAGE_INLINE_SIZE_LIMIT || '10000'
5152) ;
@@ -61,7 +62,7 @@ const sassModuleRegex = /\.module\.(scss|sass)$/;
6162
6263// This is the production and development configuration.
6364// It is focused on developer experience, fast rebuilds, and a minimal bundle.
64- module . exports = function ( webpackEnv ) {
65+ module . exports = function ( webpackEnv ) {
6566 const isEnvDevelopment = webpackEnv === 'development' ;
6667 const isEnvProduction = webpackEnv === 'production' ;
6768
@@ -189,12 +190,13 @@ module.exports = function(webpackEnv) {
189190 publicPath : paths . publicUrlOrPath ,
190191 // Point sourcemap entries to original disk location (format as URL on Windows)
191192 devtoolModuleFilenameTemplate : isEnvProduction
192- ? info =>
193+ ? ( info ) =>
193194 path
194195 . relative ( paths . appSrc , info . absoluteResourcePath )
195196 . replace ( / \\ / g, '/' )
196197 : isEnvDevelopment &&
197- ( info => path . resolve ( info . absoluteResourcePath ) . replace ( / \\ / g, '/' ) ) ,
198+ ( ( info ) =>
199+ path . resolve ( info . absoluteResourcePath ) . replace ( / \\ / g, '/' ) ) ,
198200 // Prevents conflicts when multiple webpack runtimes (from different apps)
199201 // are used on the same page.
200202 jsonpFunction : `webpackJsonp${ appPackageJson . name } ` ,
@@ -277,7 +279,7 @@ module.exports = function(webpackEnv) {
277279 // https://twitter.com/wSokra/status/969679223278505985
278280 // https://github.com/facebook/create-react-app/issues/5358
279281 runtimeChunk : {
280- name : entrypoint => `runtime-${ entrypoint . name } ` ,
282+ name : ( entrypoint ) => `runtime-${ entrypoint . name } ` ,
281283 } ,
282284 } ,
283285 resolve : {
@@ -295,8 +297,8 @@ module.exports = function(webpackEnv) {
295297 // `web` extension prefixes have been added for better support
296298 // for React Native Web.
297299 extensions : paths . moduleFileExtensions
298- . map ( ext => `.${ ext } ` )
299- . filter ( ext => useTypeScript || ! ext . includes ( 'ts' ) ) ,
300+ . map ( ( ext ) => `.${ ext } ` )
301+ . filter ( ( ext ) => useTypeScript || ! ext . includes ( 'ts' ) ) ,
300302 alias : {
301303 // Support React Native Web
302304 // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -346,28 +348,13 @@ module.exports = function(webpackEnv) {
346348 eslintPath : require . resolve ( 'eslint' ) ,
347349 resolvePluginsRelativeTo : __dirname ,
348350 // @remove -on-eject-begin
349- ignore : process . env . EXTEND_ESLINT === 'true' ,
350- baseConfig : ( ( ) => {
351- // We allow overriding the config only if the env variable is set
352- if ( process . env . EXTEND_ESLINT === 'true' ) {
353- const eslintCli = new eslint . CLIEngine ( ) ;
354- let eslintConfig ;
355- try {
356- eslintConfig = eslintCli . getConfigForFile (
357- paths . appIndexJs
358- ) ;
359- } catch ( e ) {
360- console . error ( e ) ;
361- process . exit ( 1 ) ;
362- }
363- return eslintConfig ;
364- } else {
365- return {
351+ ignore : isExtendingEslintConfig ,
352+ baseConfig : isExtendingEslintConfig
353+ ? undefined
354+ : {
366355 extends : [ require . resolve ( 'eslint-config-react-app' ) ] ,
367- } ;
368- }
369- } ) ( ) ,
370- useEslintrc : false ,
356+ } ,
357+ useEslintrc : isExtendingEslintConfig ,
371358 // @remove -on-eject-end
372359 } ,
373360 loader : require . resolve ( 'eslint-loader' ) ,
@@ -653,7 +640,7 @@ module.exports = function(webpackEnv) {
653640 return manifest ;
654641 } , seed ) ;
655642 const entrypointFiles = entrypoints . main . filter (
656- fileName => ! fileName . endsWith ( '.map' )
643+ ( fileName ) => ! fileName . endsWith ( '.map' )
657644 ) ;
658645
659646 return {
0 commit comments