From 481e184aef7f3b55349637e766b670221cfdee52 Mon Sep 17 00:00:00 2001 From: ehsan <ehsankhfr@gmail.com> Date: Sun, 1 Nov 2020 11:10:23 +0000 Subject: [PATCH 1/4] eslint cache desctination folder change --- packages/react-scripts/config/paths.js | 3 +++ packages/react-scripts/config/webpack.config.js | 1 + 2 files changed, 4 insertions(+) diff --git a/packages/react-scripts/config/paths.js b/packages/react-scripts/config/paths.js index 516513081b2..0fcec410ef3 100644 --- a/packages/react-scripts/config/paths.js +++ b/packages/react-scripts/config/paths.js @@ -73,6 +73,7 @@ module.exports = { proxySetup: resolveApp('src/setupProxy.js'), appNodeModules: resolveApp('node_modules'), swSrc: resolveModule(resolveApp, 'src/service-worker'), + cachePath: resolveApp('node_modules/.cache'), publicUrlOrPath, }; @@ -96,6 +97,7 @@ module.exports = { proxySetup: resolveApp('src/setupProxy.js'), appNodeModules: resolveApp('node_modules'), swSrc: resolveModule(resolveApp, 'src/service-worker'), + cachePath: resolveApp('node_modules/.cache'), publicUrlOrPath, // These properties only exist before ejecting: ownPath: resolveOwn('.'), @@ -132,6 +134,7 @@ if ( proxySetup: resolveOwn(`${templatePath}/src/setupProxy.js`), appNodeModules: resolveOwn('node_modules'), swSrc: resolveModule(resolveOwn, `${templatePath}/src/service-worker`), + cachePath: resolveApp('node_modules/.cache'), publicUrlOrPath, // These properties only exist before ejecting: ownPath: resolveOwn('.'), diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 8efff0b96c7..38c282c1efc 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -753,6 +753,7 @@ module.exports = function (webpackEnv) { eslintPath: require.resolve('eslint'), context: paths.appSrc, cache: true, + cacheLocation: paths.cachePath, // ESLint class options cwd: paths.appPath, resolvePluginsRelativeTo: __dirname, From 8ff62f5598ea7e09029f7cf44044bc36fec09eff Mon Sep 17 00:00:00 2001 From: ehsan <ehsankhfr@gmail.com> Date: Sun, 1 Nov 2020 18:13:49 +0000 Subject: [PATCH 2/4] eslint temp folder access check --- packages/react-scripts/config/paths.js | 14 +++++++++++--- packages/react-scripts/config/webpack.config.js | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/react-scripts/config/paths.js b/packages/react-scripts/config/paths.js index 0fcec410ef3..207fff12711 100644 --- a/packages/react-scripts/config/paths.js +++ b/packages/react-scripts/config/paths.js @@ -10,6 +10,7 @@ const path = require('path'); const fs = require('fs'); +const os = require('os'); const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath'); // Make sure any symlinks in the project folder are resolved: @@ -56,6 +57,13 @@ const resolveModule = (resolveFn, filePath) => { return resolveFn(`${filePath}.js`); }; +let cachePath = resolveApp('node_modules/.cache'); +try { + fs.accessSync(cachePath, fs.constants.W_OK | fs.constants.R_OK); +} catch (_) { + cachePath = os.tmpdir(); +} + // config after eject: we're in ./config/ module.exports = { dotenv: resolveApp('.env'), @@ -73,7 +81,7 @@ module.exports = { proxySetup: resolveApp('src/setupProxy.js'), appNodeModules: resolveApp('node_modules'), swSrc: resolveModule(resolveApp, 'src/service-worker'), - cachePath: resolveApp('node_modules/.cache'), + cachePath, publicUrlOrPath, }; @@ -97,7 +105,7 @@ module.exports = { proxySetup: resolveApp('src/setupProxy.js'), appNodeModules: resolveApp('node_modules'), swSrc: resolveModule(resolveApp, 'src/service-worker'), - cachePath: resolveApp('node_modules/.cache'), + cachePath, publicUrlOrPath, // These properties only exist before ejecting: ownPath: resolveOwn('.'), @@ -134,7 +142,7 @@ if ( proxySetup: resolveOwn(`${templatePath}/src/setupProxy.js`), appNodeModules: resolveOwn('node_modules'), swSrc: resolveModule(resolveOwn, `${templatePath}/src/service-worker`), - cachePath: resolveApp('node_modules/.cache'), + cachePath, publicUrlOrPath, // These properties only exist before ejecting: ownPath: resolveOwn('.'), diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 38c282c1efc..1e007c5fa1c 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -753,7 +753,7 @@ module.exports = function (webpackEnv) { eslintPath: require.resolve('eslint'), context: paths.appSrc, cache: true, - cacheLocation: paths.cachePath, + cacheLocation: path.resolve(paths.cachePath, '.eslintcache'), // ESLint class options cwd: paths.appPath, resolvePluginsRelativeTo: __dirname, From 67a7b3ccf3197b774194c081d9a385e68dbb6cd1 Mon Sep 17 00:00:00 2001 From: Ian Schmitz <ianschmitz@gmail.com> Date: Mon, 7 Dec 2020 21:05:45 -0800 Subject: [PATCH 3/4] Restore paths.js --- packages/react-scripts/config/paths.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/react-scripts/config/paths.js b/packages/react-scripts/config/paths.js index 207fff12711..516513081b2 100644 --- a/packages/react-scripts/config/paths.js +++ b/packages/react-scripts/config/paths.js @@ -10,7 +10,6 @@ const path = require('path'); const fs = require('fs'); -const os = require('os'); const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath'); // Make sure any symlinks in the project folder are resolved: @@ -57,13 +56,6 @@ const resolveModule = (resolveFn, filePath) => { return resolveFn(`${filePath}.js`); }; -let cachePath = resolveApp('node_modules/.cache'); -try { - fs.accessSync(cachePath, fs.constants.W_OK | fs.constants.R_OK); -} catch (_) { - cachePath = os.tmpdir(); -} - // config after eject: we're in ./config/ module.exports = { dotenv: resolveApp('.env'), @@ -81,7 +73,6 @@ module.exports = { proxySetup: resolveApp('src/setupProxy.js'), appNodeModules: resolveApp('node_modules'), swSrc: resolveModule(resolveApp, 'src/service-worker'), - cachePath, publicUrlOrPath, }; @@ -105,7 +96,6 @@ module.exports = { proxySetup: resolveApp('src/setupProxy.js'), appNodeModules: resolveApp('node_modules'), swSrc: resolveModule(resolveApp, 'src/service-worker'), - cachePath, publicUrlOrPath, // These properties only exist before ejecting: ownPath: resolveOwn('.'), @@ -142,7 +132,6 @@ if ( proxySetup: resolveOwn(`${templatePath}/src/setupProxy.js`), appNodeModules: resolveOwn('node_modules'), swSrc: resolveModule(resolveOwn, `${templatePath}/src/service-worker`), - cachePath, publicUrlOrPath, // These properties only exist before ejecting: ownPath: resolveOwn('.'), From 03598daa07dc44ca91cc8467710fa3fce9bc37c0 Mon Sep 17 00:00:00 2001 From: Ian Schmitz <ianschmitz@gmail.com> Date: Mon, 7 Dec 2020 21:06:34 -0800 Subject: [PATCH 4/4] Update webpack.config.js --- packages/react-scripts/config/webpack.config.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 1e007c5fa1c..3f1e4a8f169 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -753,7 +753,10 @@ module.exports = function (webpackEnv) { eslintPath: require.resolve('eslint'), context: paths.appSrc, cache: true, - cacheLocation: path.resolve(paths.cachePath, '.eslintcache'), + cacheLocation: path.resolve( + paths.appNodeModules, + '.cache/.eslintcache' + ), // ESLint class options cwd: paths.appPath, resolvePluginsRelativeTo: __dirname,