diff --git a/packages/craco/src/lib/features/webpack/eslint.ts b/packages/craco/src/lib/features/webpack/eslint.ts index ac7915c..c6c25d7 100644 --- a/packages/craco/src/lib/features/webpack/eslint.ts +++ b/packages/craco/src/lib/features/webpack/eslint.ts @@ -120,23 +120,24 @@ export function overrideEsLint( context: BaseContext ) { if (cracoConfig.eslint) { + const { enable, mode, pluginOptions } = cracoConfig.eslint; + + if (enable === false) { + disableEslint(webpackConfig); + + return webpackConfig; + } + const { isFound, match } = getPlugin( webpackConfig, pluginByName('ESLintWebpackPlugin') ); + if (!isFound) { logError('Cannot find ESLint plugin (ESLintWebpackPlugin).'); return webpackConfig; } - const { enable, mode, pluginOptions } = cracoConfig.eslint; - - if (enable === false) { - disableEslint(webpackConfig); - - return webpackConfig; - } - enableEslintIgnoreFile(match); if (mode === 'file') {