From d4eb263180366adfb5c491efa4ba50892dd7ba93 Mon Sep 17 00:00:00 2001 From: Mikhail Bodrov Date: Fri, 15 Sep 2023 14:37:07 +0300 Subject: [PATCH 1/2] fix: optimize reduce addCypressToWebpackEslintRulesInPlace --- npm/webpack-dev-server/src/helpers/createReactAppHandler.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/npm/webpack-dev-server/src/helpers/createReactAppHandler.ts b/npm/webpack-dev-server/src/helpers/createReactAppHandler.ts index a99c756645c4..df109486540a 100644 --- a/npm/webpack-dev-server/src/helpers/createReactAppHandler.ts +++ b/npm/webpack-dev-server/src/helpers/createReactAppHandler.ts @@ -90,7 +90,11 @@ function addCypressToWebpackEslintRulesInPlace (webpackConfig: Configuration) { if (eslintPlugin) { const cypressGlobalsRules = cypressGlobals - .reduce((acc, global) => ({ ...acc, [global]: 'writable' }), {}) + .reduce((acc, global) => { + acc[global] = 'writable'; + + return acc; + }, {}) eslintPlugin.options.baseConfig = { ...eslintPlugin.options.baseConfig, From 8379abc0d37a021a45eb6393d024fd1ce9dc664e Mon Sep 17 00:00:00 2001 From: Mikhail Bodrov Date: Fri, 15 Sep 2023 16:36:57 +0300 Subject: [PATCH 2/2] Fix lint and types --- npm/webpack-dev-server/src/helpers/createReactAppHandler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/npm/webpack-dev-server/src/helpers/createReactAppHandler.ts b/npm/webpack-dev-server/src/helpers/createReactAppHandler.ts index df109486540a..d0915b76265a 100644 --- a/npm/webpack-dev-server/src/helpers/createReactAppHandler.ts +++ b/npm/webpack-dev-server/src/helpers/createReactAppHandler.ts @@ -90,10 +90,10 @@ function addCypressToWebpackEslintRulesInPlace (webpackConfig: Configuration) { if (eslintPlugin) { const cypressGlobalsRules = cypressGlobals - .reduce((acc, global) => { - acc[global] = 'writable'; + .reduce>((acc, global) => { + acc[global] = 'writable' - return acc; + return acc }, {}) eslintPlugin.options.baseConfig = {