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
{{ message }}
Repository navigation
After update to 4.0 lint errors are blocking the rendering #9887
It depends. For example a simple console.log now also prevents compiling. This was not the case with 3.4.x. There is always the flag TSC_COMPILE_ON_ERROR=true you can set in your .env to compile anyways.
Reacted by dev-bjoern, Poyoman/Johan, Zal Machado, David Rice, Olivier Kamers, Jonas de Farias Peretiatko, Accelerise, Robert Tirta, Reza Sam Khaniani, Yevheniia and 11 more
Reacted by Jonas de Farias Peretiatko, Hugo V., Reza Sam Khaniani, 流浪大法师, lloydbanks and ivansanchezperez
This also breaks on prop warnings, which is very intrusive during development. It would be nice if this could be fixed...
Reacted by Markus, Poyoman/Johan, Paulo Pacitti, bastienduran, Alicedema, fitzsimonsdevin, Mateus Freira dos Santos, Reza Sam Khaniani, Ruslan Plastun, 流浪大法师 and 4 more
Even more, the compilation time became much longer because it now extends the ESlint config and runs lint on every change, which eliminates the speed of fast refresh. I used ESlint only as a part of lint-staged before and want to continue to use it as an optional thing that won't slow down compilation time.
Reacted by Anna Aneychik, Kirpich634, Nicky Jay, Lulololu, bastienduran, Radu-Sebastian Amarie, wezea, Andrew Ooi, Matthieu Larcher, fitzsimonsdevin and 12 more
There is a temporary workaround, but it works for me for now. I renamed .eslintrc to something else which is not findable by cra, like config.eslint.js. Then I changed all eslint scripts in package.json to eslint -c config.eslint.js ...rest of params. The only problem I have now is that my configuration is not working in my editor too, I mean fix eslint errors on save is not working and I should change the configuration file for my editor too. It may not worth it to change all of these also.
In my case I am using coc-eslint and coc-nvim which can be configured to use the new config file as explained here: url.
In my case, the errors I got after upgrading were in files that are not included in the build - and thus weren't linted in v3.4.0 but somehow are in v4.0.0. Maybe this is what you're seeing too?
I'm not sure if the problem is related but upgrading to React 4.0.3 from 3.x gave us new errors blocking the build, same as the author of this thread.
While I'm not against blocking the build I don't understand why I cannot modify those errors in our eslintrc.json file.
It looks like upgrading to 4.X now ignore our local configuration. For exemple, adding "@typescript-eslint/ban-ts-ignore": "off", successfully removes the error from VScode but the build is still failing the same way.
Hi @vincentdesmares, that sounds like a setup issue - as it definitely shouldn't behave that way - but it may be a bug of course! Can you share a reproduction? I can investigate further :)
I will try to reproduce the issue in a standalone repository.
I'm very tempted to just trash my previous config and start clean but right now if I want to configure my app, the only reference that I found is https://create-react-app.dev/docs/setting-up-your-editor and the emplacement of the configuration is not explicitly specified.
This still seems like an issue when building. ESLINT_NO_DEV_ERRORS=true fixes when simply running for development, but when building the build still fails on lint errors
This still seems like an issue when building. ESLINT_NO_DEV_ERRORS=true fixes when simply running for development, but when building the build still fails on lint errors
That’s the expected behavior. It’s the DEV in NO_DEV_ERRORS. If you don’t want a particular error to break your build, you can turn off the specific linting rule in your eslint config.
This still seems like an issue when building. ESLINT_NO_DEV_ERRORS=true fixes when simply running for development, but when building the build still fails on lint errors
That’s the expected behavior. It’s the DEV in NO_DEV_ERRORS. If you don’t want a particular error to break your build, you can turn off the specific linting rule in your eslint config.
Is there no build equivalent of ESLINT_NO_DEV_ERRORS? I don't want ANY lint errors to break my build, it's a style check, bad style should not be a reason for my deployment to suddenly be not building. I shouldn't have to go through and change all my lint rules to warning instead of errors, especially because then our CI workflow won't notify us of the lint "failure"
Reacted by John Athanasiou, Trung Dang, Adnan Bacic, Sharafudheen KK, Tomasz Zlamaniec and Sullivan S.
This still seems like an issue when building. ESLINT_NO_DEV_ERRORS=true fixes when simply running for development, but when building the build still fails on lint errors
That’s the expected behavior. It’s the DEV in NO_DEV_ERRORS. If you don’t want a particular error to break your build, you can turn off the specific linting rule in your eslint config.
Is there no build equivalent of ESLINT_NO_DEV_ERRORS? I don't want ANY lint errors to break my build, it's a style check, bad style should not be a reason for my deployment to suddenly be not building. I shouldn't have to go through and change all my lint rules to warning instead of errors, especially because then our CI workflow won't notify us of the lint "failure"
@Nerdsie There is. Check out this PR. The environment variable DISABLE_ESLINT_PLUGIN set to true will do what you want.
@rswerve Thanks, just what I need. It still feels weird to me to have to disable (both in prod and dev, via seperate options) build breaking on lint errors. Are people using eslint in such a way that lint errors catch more than just deviation from preferred styling?
@rswerve Thanks, just what I need. It still feels weird to me to have to disable (both in prod and dev, via seperate options) build breaking on lint errors. Are people using eslint in such a way that lint errors catch more than just deviation from preferred styling?
@Nerdsie Yes. For example, to enforce the Rules of Hooks. If someone wants to break one of those rules, we want them to be aware they're doing it and disable it deliberately, so we can see it in code review. And even with styling, on a team you're either enforcing consistent styles or you're not; we find it's less to think about if we are, so we break the build (this almost never happens, because everyone runs Prettier locally).
Activity
dev-bjoern commentedon Oct 24, 2020
I always get these compile fails on eslint errors also in CRA 3.x (which is fine).
mstykow commentedon Oct 24, 2020
It depends. For example a simple
console.lognow also prevents compiling. This was not the case with 3.4.x. There is always the flagTSC_COMPILE_ON_ERROR=trueyou can set in your .env to compile anyways.fred172 commentedon Oct 26, 2020
This also breaks on prop warnings, which is very intrusive during development. It would be nice if this could be fixed...
RosenTomov commentedon Oct 26, 2020
Updated:
Add
In
config/webpack.config.js-> ESLintPluginSaibamen commentedon Oct 26, 2020
failOnError: false,Don't do that... Skip warnings onlyrus-yurchenko commentedon Oct 26, 2020
Even more, the compilation time became much longer because it now extends the ESlint config and runs lint on every change, which eliminates the speed of fast refresh. I used ESlint only as a part of lint-staged before and want to continue to use it as an optional thing that won't slow down compilation time.
RosenTomov commentedon Oct 26, 2020
Try with caching, again add
cache: true,in ESLintPlugin options.
Saibamen commentedon Oct 26, 2020
Caching fixed in this PR: #9911
asdfasdfasdfasdfff commentedon Oct 27, 2020
There is a temporary workaround, but it works for me for now. I renamed
.eslintrcto something else which is not findable by cra, likeconfig.eslint.js. Then I changed all eslint scripts in package.json toeslint -c config.eslint.js ...rest of params. The only problem I have now is that my configuration is not working in my editor too, I mean fix eslint errors on save is not working and I should change the configuration file for my editor too. It may not worth it to change all of these also.In my case I am using
coc-eslintandcoc-nvimwhich can be configured to use the new config file as explained here: url.fix: webpack ESLintPlugin honours SKIP_PREFLIGHT_CHECK (react#9887)
abraidwood commentedon Oct 27, 2020
It feels like
webpack.config.jsshould honour theSKIP_PREFLIGHT_CHECKenvironment variable something like this abraidwood@39452dffix: webpack ESLintPlugin honours SKIP_PREFLIGHT_CHECK (react#9887)
fredefl commentedon Oct 27, 2020
In my case, the errors I got after upgrading were in files that are not included in the build - and thus weren't linted in v3.4.0 but somehow are in v4.0.0. Maybe this is what you're seeing too?
76 remaining items
vincentdesmares commentedon Feb 25, 2021
Hi @mrmckeb,
I'm not sure if the problem is related but upgrading to React 4.0.3 from 3.x gave us new errors blocking the build, same as the author of this thread.
While I'm not against blocking the build I don't understand why I cannot modify those errors in our eslintrc.json file.
It looks like upgrading to 4.X now ignore our local configuration. For exemple, adding
"@typescript-eslint/ban-ts-ignore": "off", successfully removes the error from VScode but the build is still failing the same way.mrmckeb commentedon Feb 26, 2021
Hi @vincentdesmares, that sounds like a setup issue - as it definitely shouldn't behave that way - but it may be a bug of course! Can you share a reproduction? I can investigate further :)
vincentdesmares commentedon Feb 26, 2021
I will try to reproduce the issue in a standalone repository.
I'm very tempted to just trash my previous config and start clean but right now if I want to configure my app, the only reference that I found is https://create-react-app.dev/docs/setting-up-your-editor and the emplacement of the configuration is not explicitly specified.
What's the available configurations?
mrmckeb commentedon Feb 26, 2021
It should be anything that ESLint supports: https://eslint.org/docs/2.0.0/user-guide/configuring#configuration-file-formats
Just make sure it's not defined in your
package.jsontoo - as that's where we place it by default.Bump react-scripts to v4.0.3
Bump react-scripts to v4.0.3
stclairdaniel commentedon May 12, 2021
I'm still getting this issue in 4.0.3 -
anushbmx commentedon May 13, 2021
@stclairdaniel add
ESLINT_NO_DEV_ERRORS=truein your .env, it will skip these errors in developmentNerdsie commentedon Jun 4, 2021
This still seems like an issue when building.
ESLINT_NO_DEV_ERRORS=truefixes when simply running for development, but when building the build still fails on lint errorsrswerve commentedon Jun 4, 2021
That’s the expected behavior. It’s the DEV in NO_DEV_ERRORS. If you don’t want a particular error to break your build, you can turn off the specific linting rule in your eslint config.
Nerdsie commentedon Jun 4, 2021
Is there no build equivalent of
ESLINT_NO_DEV_ERRORS? I don't want ANY lint errors to break my build, it's a style check, bad style should not be a reason for my deployment to suddenly be not building. I shouldn't have to go through and change all my lint rules to warning instead of errors, especially because then our CI workflow won't notify us of the lint "failure"rswerve commentedon Jun 4, 2021
@Nerdsie There is. Check out this PR. The environment variable DISABLE_ESLINT_PLUGIN set to
truewill do what you want.Nerdsie commentedon Jun 4, 2021
@rswerve Thanks, just what I need. It still feels weird to me to have to disable (both in prod and dev, via seperate options) build breaking on lint errors. Are people using eslint in such a way that lint errors catch more than just deviation from preferred styling?
rswerve commentedon Jun 4, 2021
@Nerdsie Yes. For example, to enforce the Rules of Hooks. If someone wants to break one of those rules, we want them to be aware they're doing it and disable it deliberately, so we can see it in code review. And even with styling, on a team you're either enforcing consistent styles or you're not; we find it's less to think about if we are, so we break the build (this almost never happens, because everyone runs Prettier locally).
soullivaneuh commentedon Jun 30, 2022
Confirming @rswerve solution, here is my
buildnpm script: