I've recently created a project with create-react-project
.
The problem is that, while I'm developing, every time there's a problem with ESLint, the build breaks and doesn't compile the code.
Can I keep the build running while still having ESLint running and reporting errors that I will fix later?
If you want to force ESLint to always emit warnings (that will not stop you build) instead of errors, you need to set emitWarning: true
in webpack.config.js
:
{
enforce: 'pre',
include: paths.appSrc,
test: /\.(js|jsx|mjs)$/,
use: [{
loader: require.resolve('eslint-loader'),
options: {
formatter: eslintFormatter,
eslintPath: require.resolve('eslint'),
emitWarning: true, 👈 HERE
},
}],
},
Errors and Warning
By default the loader will auto adjust error reporting depending on eslint errors/warnings counts. You can still force this behavior by using
emitError
oremitWarning
options:
emitError
(default:false
)Loader will always return errors if this option is set to true.
emitWarning
(default:false
)Loader will always return warnings if option is set to
true
. If you're using hot module replacement, you may wish to enable this in development, or else updates will be skipped when there's an eslint error.
- ...