-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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? |
I encountered this issue yesterday 😕 Spend hours trying to understand what was going on. I had to downgrade to |
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. |
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. |
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 |
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 🤦♂️ |
If you fix your |
Unsubscribe
在 2021-02-24 04:02:16,"Ashfaq Nisar" <[email protected]> 写道:
@channyeintun can you provide a reproduction of the issue ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@channyeintun It looks like you're only seeing the output in the console, so you're not seeing dev errors. Is it showing the overlay? |
@mrmckeb @ehaynes99 |
eject + emitError=false works for me |
Now no error exists. It's fixed. No need to configure anything. Just execute create-react-app project-name. |
@maksim-chekrishov We don't recommend ejecting, as you'll no longer receive updates from us - including security updates. Try to eject only if you really need to modify the scripts/configs yourself and want to manage the configs/upgrades for yourself. |
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 |
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. What's the available configurations? |
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 |
Due to a change in create-react-app in v4.0, eslint errors block React apps from building. See facebook/create-react-app#9887. To fix this, v4.0.3 of react-scripts introduces a new flag that disables eslint. See facebook/create-react-app#10170. This update allows the app to be built in spite of eslint errors.
Due to a change in create-react-app in v4.0, eslint errors block React apps from building. See facebook/create-react-app#9887. To fix this, v4.0.3 of react-scripts introduces a new flag that disables eslint. See facebook/create-react-app#10170. This update allows the app to be built in spite of eslint errors.
I'm still getting this issue in 4.0.3 -
|
@stclairdaniel add |
This still seems like an issue when building. |
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 |
@Nerdsie There is. Check out this PR. The environment variable DISABLE_ESLINT_PLUGIN set to |
@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). |
Currently, when we attempt to start our react app, create-react-app fails to compile when there are any eslint or prettier errors. The reason for this is documented in this github issue: facebook/create-react-app#9887 (comment) This issue is fixed with react-scripts v4.0.2 with the use of an ESLINT_NO_DEV_ERRORS env var (this is documented under advanced configuration here: https://create-react-app.dev/docs/advanced-configuration/) This commit adds the ESLINT_NO_DEV_ERRORS env var to our env-example file. We will need to separately add it to our production and staging environments too.
Currently, when we attempt to start our react app, create-react-app fails to compile when there are any eslint or prettier errors. The reason for this is documented in this github issue: facebook/create-react-app#9887 (comment) This issue is fixed with react-scripts v4.0.2 with the use of an ESLINT_NO_DEV_ERRORS env var (this is documented under advanced configuration here: https://create-react-app.dev/docs/advanced-configuration/) This commit adds the ESLINT_NO_DEV_ERRORS env var to our env-example file. We will need to separately add it to our production and staging environments too.
Confirming @rswerve solution, here is my "build": "npx tsc --noEmit && DISABLE_ESLINT_PLUGIN=true CI=false react-scripts build", |
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: