-
Notifications
You must be signed in to change notification settings - Fork 13
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
Console logs mess up structured output from ESLint #76
Comments
What tool are you using that's parsing the text log from eslint? I wouldn't expect anything to be parsing this human readable output log; rather that tools would parse JSON output from ESLint. It could be done neatly and conventionally using https://www.npmjs.com/package/debug There is already a warn log for |
Oh yeah sorry it's these two:
We're using reviewdog, which is parsing eslint output (with |
Is it possible to detect the format flag? If so, that could be a good hint to skip this output. I find the output kind of nice — just an issue for our CI |
Does it use the It would seem fragile to assume that nothing except the machine readable format would appear on stdout. If this is the case, then any other lint plugin that uses console log/warn will need this log silencing fix. I think the flag could be detected yes, via context parameter in the rule. |
It doesn't use output-file. It reads it from stdout. It would seem fragile, but at least based on the plugins we have installed so far, it seems uncommon for eslint plugins to emit informational output. |
Agreed. Given ESLint supports JSON to stdout, it appears to encourage this use case of parsing structured output from stdout. So we shouldn't get in the way of that. I think it should only log if using one of the formatters listed as human-readable from here https://eslint.org/docs/latest/use/formatters - so compact and stylish. According to the page, the only way of specifying formatters is via CLI option, and there can only be one formatter. I can't immediately see how we can access that from the rule - https://eslint.org/docs/latest/extend/custom-rules#the-context-object . It feels like something rules shouldn't know about, so this isn't surprising. I'm quite busy for the short term but if you want to start a conversation over on ESLint's repo on how we should log / how we can get what the current formatter is, then we might be able to agree a draft solution sooner for either one of us to implement. |
What if we hide these messaged behind |
I think "checking compatibility for targets" can go behind a debug flag, using https://www.npmjs.com/package/debug The warning "No compatibility data for target family" is something the user should be aware of, otherwise they probably have false confidence that es-compat is checking things that it isn't. The simple solution for this would be to refer to https://github.com/mdn/browser-compat-data/tree/main/browsers from documentation. |
How do you make the "No compatibility data…" warning go away? If that could be included in the message, that would be helpful |
It's because there are browsers on your browserslist for which MDN compatibility database doesn't have data. There's no current way other than removing from your browserslist. |
Here's what the config looked like:
So it seems like |
The only other thing I can think of would be to use https://github.com/fyrd/caniuse data instead, though that is a much bigger ask. |
Resolved by #83 |
Hi there! Really enjoying this library so far, but unfortunately the console log that says which targets are being checked makes it difficult for CI tools to parse the output from eslint. Would it be possible to put these logs behind a DEBUG= env var or something? Thanks!
The text was updated successfully, but these errors were encountered: