Description
Is your proposal related to a problem?
When I change my .eslintrc.js
the changes are not reflected in react-scripts start
. I found a workaround in #9007 described by @Josema to disable the cache in node_modules/react-scripts/config/webpack.config.js
:
this is caused by how react-scripts handles ESLint cache. By default, cache is set to true. If you set it to false, any change to eslint rules will be honoured every time. The setting is in node_modules/react-scripts/config/webpack.config.js
Describe the solution you'd like
Similar to what @Josema wrote (sadly this issue #9007 got closed)
So my suggestion is to make this cache option configurable, and by default set it to false, to avoid confusion.
Currently the webpack.config.js looks like that:
// First, run the linter.
// It's important to do this before Babel processes the JS.
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
enforce: 'pre',
use: [
{
options: {
cache: false,
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),
resolvePluginsRelativeTo: __dirname,
// @remove-on-eject-begin
ignore: isExtendingEslintConfig,
baseConfig: isExtendingEslintConfig
? undefined
: {
extends: [require.resolve('eslint-config-react-app')],
},
useEslintrc: isExtendingEslintConfig,
// @remove-on-eject-end
},
loader: require.resolve('eslint-loader'),
},
],
I suggest:
cache: !isExtendingEslintConfig,
As it only needs to be disabled when isExtendingEslintConfig is true (process.env.EXTEND_ESLINT === 'true'
)