@@ -26,6 +26,7 @@ const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
2626const WatchMissingNodeModulesPlugin = require ( 'react-dev-utils/WatchMissingNodeModulesPlugin' ) ;
2727const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' ) ;
2828const getCSSModuleLocalIdent = require ( 'react-dev-utils/getCSSModuleLocalIdent' ) ;
29+ const ESLintPlugin = require ( 'eslint-webpack-plugin' ) ;
2930const paths = require ( './paths' ) ;
3031const modules = require ( './modules' ) ;
3132const getClientEnvironment = require ( './env' ) ;
@@ -349,29 +350,6 @@ module.exports = function (webpackEnv) {
349350 rules : [
350351 // Disable require.ensure as it's not a standard language feature.
351352 { parser : { requireEnsure : false } } ,
352-
353- // First, run the linter.
354- // It's important to do this before Babel processes the JS.
355- {
356- test : / \. ( j s | m j s | j s x | t s | t s x ) $ / ,
357- enforce : 'pre' ,
358- use : [
359- {
360- options : {
361- cache : true ,
362- cwd : paths . appPath ,
363- formatter : require . resolve ( 'react-dev-utils/eslintFormatter' ) ,
364- eslintPath : require . resolve ( 'eslint' ) ,
365- resolvePluginsRelativeTo : __dirname ,
366- baseConfig : {
367- extends : [ require . resolve ( 'eslint-config-react-app/base' ) ] ,
368- } ,
369- } ,
370- loader : require . resolve ( 'eslint-loader' ) ,
371- } ,
372- ] ,
373- include : paths . appSrc ,
374- } ,
375353 {
376354 // "oneOf" will traverse all following loaders until one will
377355 // match the requirements. When no loader matches it will fall
@@ -742,6 +720,19 @@ module.exports = function (webpackEnv) {
742720 // The formatter is invoked directly in WebpackDevServerUtils during development
743721 formatter : isEnvProduction ? typescriptFormatter : undefined ,
744722 } ) ,
723+ new ESLintPlugin ( {
724+ // Plugin options
725+ extensions : [ 'js' , 'mjs' , 'jsx' , 'ts' , 'tsx' ] ,
726+ formatter : require . resolve ( 'react-dev-utils/eslintFormatter' ) ,
727+ eslintPath : require . resolve ( 'eslint' ) ,
728+ context : paths . appSrc ,
729+ // ESLint class options
730+ cwd : paths . appPath ,
731+ resolvePluginsRelativeTo : __dirname ,
732+ baseConfig : {
733+ extends : [ require . resolve ( 'eslint-config-react-app/base' ) ] ,
734+ } ,
735+ } ) ,
745736 ] . filter ( Boolean ) ,
746737 // Some libraries import Node modules but don't use them in the browser.
747738 // Tell webpack to provide empty mocks for them so importing them works.
0 commit comments