You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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-beginignore: 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')
The text was updated successfully, but these errors were encountered:
Agreed! I'm also having this problem, and additionally would like to turn off caching because I'm using yarn 2 and don't want to have a node_modules directory automatically created just for the cache files.
I like the workaround described here: #9154 (comment) (to delete the eslint cache file). Perhaps this can be automated so that any time the eslint config is updated the cache is deleted. But what if the extended config is updated (eslint-config-react-app). Perhaps there is a proper solution.
Also, let me mention EXTEND_ESLINT so the issue search picks it (it doesnt pick it if it is only mentioned as process.env.EXTEND_ESLINT ).
Just wondering if this has been fixed in v4 or not? We're about to migrate to v4 because of various issues we encountered in v3 but not sure if this issue is also included?
Is your proposal related to a problem?
When I change my
.eslintrc.js
the changes are not reflected inreact-scripts start
. I found a workaround in #9007 described by @Josema to disable the cache innode_modules/react-scripts/config/webpack.config.js
:Describe the solution you'd like
Similar to what @Josema wrote (sadly this issue #9007 got closed)
Currently the webpack.config.js looks like that:
I suggest:
As it only needs to be disabled when isExtendingEslintConfig is true (
process.env.EXTEND_ESLINT === 'true'
)The text was updated successfully, but these errors were encountered: