Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ESLint cache file into node_modules #9977

Merged
merged 4 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/react-scripts/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -56,6 +57,13 @@ const resolveModule = (resolveFn, filePath) => {
return resolveFn(`${filePath}.js`);
};

let cachePath = resolveApp('node_modules/.cache');
ianschmitz marked this conversation as resolved.
Show resolved Hide resolved
try {
fs.accessSync(cachePath, fs.constants.W_OK | fs.constants.R_OK);
ianschmitz marked this conversation as resolved.
Show resolved Hide resolved
} catch (_) {
cachePath = os.tmpdir();
}

// config after eject: we're in ./config/
module.exports = {
dotenv: resolveApp('.env'),
Expand All @@ -73,6 +81,7 @@ module.exports = {
proxySetup: resolveApp('src/setupProxy.js'),
appNodeModules: resolveApp('node_modules'),
swSrc: resolveModule(resolveApp, 'src/service-worker'),
cachePath,
publicUrlOrPath,
};

Expand All @@ -96,6 +105,7 @@ 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('.'),
Expand Down Expand Up @@ -132,6 +142,7 @@ 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('.'),
Expand Down
1 change: 1 addition & 0 deletions packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ module.exports = function (webpackEnv) {
eslintPath: require.resolve('eslint'),
context: paths.appSrc,
cache: true,
cacheLocation: path.resolve(paths.cachePath, '.eslintcache'),
// ESLint class options
cwd: paths.appPath,
resolvePluginsRelativeTo: __dirname,
Expand Down