From 9e7f1f65ede330dcd9b0badb99b966e5813a1c83 Mon Sep 17 00:00:00 2001 From: Daniel Maricic Date: Mon, 11 Sep 2023 11:44:18 +0200 Subject: [PATCH] run check to disable eslint before checking the webpack-eslint-plugin. --- .../craco/src/lib/features/webpack/eslint.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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') {