After update to 4.0 lint errors are blocking the rendering #9887
Comments
|
I always get these compile fails on eslint errors also in CRA 3.x (which is fine). |
|
It depends. For example a simple |
|
This also breaks on prop warnings, which is very intrusive during development. It would be nice if this could be fixed... |
|
Updated: Add
In
|
|
|
|
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. |
|
Try with caching, again add in ESLintPlugin options. |
|
Caching fixed in this PR: #9911 |
|
There is a temporary workaround, but it works for me for now. I renamed |
|
It feels like |
|
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? |
joebochill
mentioned this issue
|
I encountered this issue yesterday |
|
Just want to post some extra context for anyone reading: Originally CRA used its own config for linting files during build and did not consult main project Then in CRA v4.0 that was consolidated (see #9587) - now EXTEND_ESLINT is the default. That removed a lot of ambiguity but now stylistic rule errors block dev build, which is what this thread is all about. This is actually not such a big issue for initial CRA lint setup (since most rules in Hopefully the above provides some background information for why this came up at this point in time. |
unframework
mentioned this issue
|
I'd like to be able to disable CRA running of eslint completely. I already have a git precommit hook that runs run eslint & prettier fixing for code layout then will block commit if further rules are failing. I also have linting running on CI as a merge-blocking step (in case anyone disables the precommit hook). I feel like CRA is dictating and restricting workflow with this change & that is unhelpful and beyond its scope. I also don't see why it is enabled when SKIP_PREFLIGHT_CHECK is true. I'm also confused about that flag's purpose as in the code it looks like it disables another, separate path to eslint & I don't understand why there are two. |
rswerve
mentioned this issue
|
Do we have a confirmation that this only happens for people with custom configs? |
If I get rid of .eslintrc.js, I see the "old" behavior of compiling with warnings. If I keep .eslintrc.js, any rules not set to "warn" in that file will result in "Failed to compile" with a listing of broken rules (the two rules I tested were |
I confirm for me too. In my case it come from my air-bnb extended eslint |
|
Same for me as above. I commented out the air-bnb in the |
|
+1 here on confirming the relationship to existing rules. I have always had With CRA 4, it causes dev build to fail on unused variables. Removing |
This was referenced
|
I also get no-console complier error, I fixed it by remove the old eslintrc.js and overrides rules in package.json:
|
|
I'm also seeing this issue - unfortunately none of the suggested solutions work. I had briefly thought that @LuoTuxiu's suggestion worked, but that's because I forgot to include the offending file |
kelvinfan001
mentioned this issue
To accommodate the eslint 7.x, react-scripts have also been updated to 4.x. However, 4.x introduced some breaking changes, most notably facebook/create-react-app#9887, which is preventing react from compiling due to linting errors in our own eslintrc.js (particularly airbnb). Disable airbnb for now so we can at least compile. In @avatarneil's soon-to-come mega PR that fixes all linting issues, we can add airbnb back.
|
Since the issue fix is scheduled for 4.0.2 I used patch-package to create a temporary workaround. You can do the following to fix the issue:
|
Thank you very much @fernandaad, this helped a lot! |
|
Hi all, we've created a discussion around this - as we do plan to make changes soon. Please let us know what you'd like to prioritise, or if we've missed something. See #10344 |
aleksi-kangas
mentioned this issue
robertwt7
mentioned this issue
Workaround is to downgrade react-scripts from 4.0.0. to 3.x.x and to remove devDepenencies for eslint. After this commit is pulled from git, it requires removing node_modules dir and npm install.
- node-sass -> sass - craco 6.0.0 - react 17.0.1 - react-scripts 4.0.1 (remove eslint-config-airbnb see facebook/create-react-app#9887 (comment) reintegrate later ?)
deepcoderai
mentioned this issue
|
In our setup it looks like our |
✅ fix tests🔨 use craco for react-scripts workaround: facebook/create-react-app#9887
Thanks, but I fixed it after adding something to the
|
|
Hi everyone, you can now change this behaviour as of the latest Please see the PR #10170 or docs for more info! |
|
Forgive me if this sounds naiive, I'm a little new to |
Nevermind, I figured out it goes in |
DimaDK02
mentioned this issue
|
@KyleRAnderson it can go in the root too if you prefer, as a valid ESLint config file. Just keep in mind that the behaviour as of v4.0 is that your ESLint config is used within the Webpack ESLint Plugin, which means that errors will show in the error overlay (which is what this issue, and solution are about). |
|
Awesome Work
Truly Awesome Work |
Thank-you for clarifying, that makes a lot of sense, and thank-you for resolving this issue. It was something I was facing as well |
|
I'm also a bit new to CRA so I'm having troubles with this, I'm adding the new rule to my .env as says on the docs but when I try to run the dev server I keep geetting the errors that prevent the build. This is only happening with |
|
@CarlosHdez -- I'm seeing the exact same behavior. I have two files, .env
.env.production
Unfortunately the |
|
Thanks for reporting this @cjones26 and @CarlosHdez. Are either of you able to provide a reproduction of this? Using In this example, I have one error, one warning. With this flag, both are now warnings |
|
@mrmckeb for some reason, I can see that all errors became warnings with the new flag in the terminal, but it still throws the error on the app error overlay. That's the point of this issue. |
|
@rus-yurchenko, this was supposed to fix that, I'm sorry if you aren't seeing it fixed. Can you please share a screenshot, or some more details? A reproduction would be ideal :) |
|
@mrmckeb I left a comment with a Codesandbox Container example where the problem metioned by @rus-yurchenko can be reproduced. You can see it here |
|
Thanks @miguelCT. Interestingly I can reproduce with only some errors, not all (maybe only TypeScript-related errors). I'll keep investigating. I see they also made changes to the way this works in the plugin itself, which I also need to dig into: |
Would it still be helpful if we provided an example, or is the example provided by @miguelCT sufficient? |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.


Describe the bug
With CRA 3.x lint errors where reported as warning in the console. Now it is blocking the rendering :

Expected behaviour
I would like to have by default the old behaviour (warning in console), or at least a way to switch back to this old behaviour
Edit:
@unframework give bellow a nice analysis about this issue: #9887 (comment)_
Solutions & workarounds
The text was updated successfully, but these errors were encountered: