@@ -26,6 +26,7 @@ const WorkboxWebpackPlugin = require('workbox-webpack-plugin');
26
26
const WatchMissingNodeModulesPlugin = require ( 'react-dev-utils/WatchMissingNodeModulesPlugin' ) ;
27
27
const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' ) ;
28
28
const getCSSModuleLocalIdent = require ( 'react-dev-utils/getCSSModuleLocalIdent' ) ;
29
+ const ESLintPlugin = require ( 'eslint-webpack-plugin' ) ;
29
30
const paths = require ( './paths' ) ;
30
31
const modules = require ( './modules' ) ;
31
32
const getClientEnvironment = require ( './env' ) ;
@@ -349,29 +350,6 @@ module.exports = function (webpackEnv) {
349
350
rules : [
350
351
// Disable require.ensure as it's not a standard language feature.
351
352
{ 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
- } ,
375
353
{
376
354
// "oneOf" will traverse all following loaders until one will
377
355
// 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