Skip to content
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

Only show lint warnings from most recently edited file in browser console #2378

Open
gaearon opened this issue May 26, 2017 · 13 comments
Open

Comments

@gaearon
Copy link
Contributor

gaearon commented May 26, 2017

This came up in discussion in #2070 (comment).
Seems like a sensible thing to do, although I'm not sure how hard it would be.

Tagging as good first bug but I don't have any ideas on how to do it.

@siggirh
Copy link

siggirh commented May 29, 2017

I'm wondering if this helps with the complaint from tnrich in that linked thread. If the developer is commenting out stuff or w/e, saving and looking back to the browser - the changes (and thus, the output that annoys him) is going to come from that last edited file. Aren't those errors the ones he doesn't want to see in the console?

@gaearon
Copy link
Contributor Author

gaearon commented May 29, 2017

We can cap it to maximum 5 warnings per file, for example. They would still be there but they would be more relevant, and limited.

@siggirh
Copy link

siggirh commented May 29, 2017

Wouldn't that be confusing if you have more than five and are only displaying five of them? As in, wouldn't capping the number defeat the purpose of having them there in the first place? I guess my pondering is whether displaying the linting errors in the console is to let the user know that he HAS errors or that he has these EXACT errors. I'm wondering if we should leave this alone and let it stay as is :)

@gaearon
Copy link
Contributor Author

gaearon commented May 29, 2017

We can debate whether to cap them or not, but I think displaying them just for most recently edited file is a good start by itself.

@svicalifornia
Copy link

@gaearon @kombucha Has the commit referenced above been merged into the official CRA trunk?

@kombucha
Copy link

kombucha commented Aug 16, 2017

@svicalifornia Nope, see #2409

@gaearon
Copy link
Contributor Author

gaearon commented Aug 17, 2017

Not yet. We'll do a cleanup pass some time after releasing React 16. For now most of my effort is focused on React.

@stale
Copy link

stale bot commented Nov 2, 2018

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.

@stale stale bot added the stale label Nov 2, 2018
@Timer Timer removed the stale label Nov 2, 2018
@Timer Timer added this to the 2.x milestone Nov 2, 2018
@svicalifornia
Copy link

@gaearon Now that React 16 and CRA 2 are out, can we revisit this issue?

@iansu iansu modified the milestones: 2.x, 3.x Mar 10, 2019
@roramigator
Copy link

Is this being worked on?

@ghost
Copy link

ghost commented Dec 18, 2020

Hello, now we have an infinite recursion in react-dev-utils. It is using console to warn about usage of console. So it should complain about it's own console usage also (using console) and then complain about it's own console usage also (using console)... :)

Screenshot 2020-12-18 at 11 02 45

Currently I have all linter messages in the terminal in the output of "yarn start" and am happy with them there. The output from webpackHotDevClient.js is only making my debugging and experimenting harder.

Would it be possible to respect the 'no-console' best practice and stop writing there completely? https://eslint.org/docs/rules/no-console

@liesislukas
Copy link

liesislukas commented Aug 27, 2021

can we just have an option to disable eslint console logs and that's it? I use eslint in IDE setup, it's logging stuff on terminal, errors are shown full screen, during build it logs errors on build machine and stops the production build if there are issues but polluting console with all those warnings is just a mess in my case. I need those warnings in IDE to highlight potential issues, but mostly i don't care about that warning. I use eslint to warn about sketchy code and throw errors about code which is potentially broken or may be broken in some case.

Could be an option to enable eslint
logs in console - all | warning | error | none
in cli - all | warning | error | none

and default is whatever is now, but there would be a way to disable.

and whatever extras like "recent file only" "limit to 5 warnings per file" and so on are just extension on main options - to log or not to log those warning at all

@mrkev
Copy link

mrkev commented Sep 3, 2021

Huge +1 to @liesislukas. I tried to configure my webpack config through react-app-rewired to disable warnings on hot reload without much success. I wonder if this is because react-dev-utils uses its own webpackHotDevClient.

From what I've seen, people in my team interact with lints in the editor first, the "Problems" tab on VSCode second and the terminal third— not the browser. I don't doubt this might be useful for some people, but for us it in fact detrimental, since we do a lot of our debugging via console logging.

Rather than blocking a solution on the harder problem of filtering by recently-edited files, some immediate impact for many teams like mine would be an environment flag or some other mechanism to disable warnings in the browser outright.

I'm so slowed down by this I'd be happy to add a flag for disabling the relay of warnings. Where can I learn about the HMR system and how to disable warnings @gaearon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants