@@ -27,6 +27,7 @@ const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
27
27
const WatchMissingNodeModulesPlugin = require ( 'react-dev-utils/WatchMissingNodeModulesPlugin' ) ;
28
28
const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' ) ;
29
29
const getCSSModuleLocalIdent = require ( 'react-dev-utils/getCSSModuleLocalIdent' ) ;
30
+ const ESLintPlugin = require ( 'eslint-webpack-plugin' ) ;
30
31
const paths = require ( './paths' ) ;
31
32
const modules = require ( './modules' ) ;
32
33
const getClientEnvironment = require ( './env' ) ;
@@ -351,29 +352,6 @@ module.exports = function (webpackEnv) {
351
352
rules : [
352
353
// Disable require.ensure as it's not a standard language feature.
353
354
{ parser : { requireEnsure : false } } ,
354
-
355
- // First, run the linter.
356
- // It's important to do this before Babel processes the JS.
357
- {
358
- test : / \. ( j s | m j s | j s x | t s | t s x ) $ / ,
359
- enforce : 'pre' ,
360
- use : [
361
- {
362
- options : {
363
- cache : true ,
364
- cwd : paths . appPath ,
365
- formatter : require . resolve ( 'react-dev-utils/eslintFormatter' ) ,
366
- eslintPath : require . resolve ( 'eslint' ) ,
367
- resolvePluginsRelativeTo : __dirname ,
368
- baseConfig : {
369
- extends : [ require . resolve ( 'eslint-config-react-app/base' ) ] ,
370
- } ,
371
- } ,
372
- loader : require . resolve ( 'eslint-loader' ) ,
373
- } ,
374
- ] ,
375
- include : paths . appSrc ,
376
- } ,
377
355
{
378
356
// "oneOf" will traverse all following loaders until one will
379
357
// match the requirements. When no loader matches it will fall
@@ -742,6 +720,19 @@ module.exports = function (webpackEnv) {
742
720
// The formatter is invoked directly in WebpackDevServerUtils during development
743
721
formatter : isEnvProduction ? typescriptFormatter : undefined ,
744
722
} ) ,
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
+ } ) ,
745
736
] . filter ( Boolean ) ,
746
737
// Some libraries import Node modules but don't use them in the browser.
747
738
// Tell webpack to provide empty mocks for them so importing them works.
0 commit comments