From b4a8c0036c8430749230b29c763ef872e2ee0f79 Mon Sep 17 00:00:00 2001 From: Andrey Polischuk Date: Wed, 3 Apr 2024 02:00:17 +0300 Subject: [PATCH] fix(eslint): run eslint only in dev --- packages/eslint/index.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/eslint/index.js b/packages/eslint/index.js index 607c095..2889980 100644 --- a/packages/eslint/index.js +++ b/packages/eslint/index.js @@ -2,16 +2,18 @@ const ESLintPlugin = require('eslint-webpack-plugin') const formatter = require('react-dev-utils/eslintFormatter') module.exports = (options = {}) => ({ - modifyWebpackConfig({webpackConfig}) { - webpackConfig.plugins = [ - new ESLintPlugin({ - cache: false, - extensions: ['js', 'jsx', 'ts', 'tsx'], - ...options, - formatter - }), - ...webpackConfig.plugins - ] + modifyWebpackConfig({env: {dev: isDev}, webpackConfig}) { + if (isDev) { + webpackConfig.plugins = [ + new ESLintPlugin({ + cache: false, + extensions: ['js', 'jsx', 'ts', 'tsx'], + ...options, + formatter + }), + ...webpackConfig.plugins + ] + } return webpackConfig }