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
New: Adds new info flag #12060
New: Adds new info flag #12060
Conversation
9550d02
to
8a7428d
Compare
Thanks for contributing! Can you add tests for your changes? Also, I think there's no need to print browsers information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Can we see if we can somehow figure out which version of ESLint is being executed? Global or local? Also would be awesome if we could pull and print eslint plugins installed as well, not sure it's possible though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, it seems like we have a few options:
- Make
cli.execute()
consistently return a promise (which will force consumers to update to handle the asynchronous method correctly) - Figure out a way to do this synchronously
- Decide we're okay with
cli.execute()
having side effects with a dangling promise
Thoughts from the rest of the team?
The closest I've come to that is printing the ESLint execution location in some of our friendly message templates, which can at least help us recognize a global ESLint.
I think we should try for synchronous first, but if that's not possible, I think it would be okay to convert to async. I think this is only in cli.js, not CLIEngine, right? If so, I don't think that's part of the public API. |
Agreed! |
@jamesgeorge007 The current test is failing because |
@jamesgeorge007 It's difficult for us to know what was going on without seeing the actual code. Given the fact that it does so much and that it only has an async API, I'm wondering if using I also think we should really nail down exactly what information we're showing here for the ease of the PR author. We originally discussed including the information required for a bug report, which would include:
Additionally, we could potentially add both a check for local and global installations and report them both:
Would it make sense to just start there? We can always add more information (the operating system, etc.) at a later date if we feel like it would be useful. |
some of the local-installed packages were used by eslint internally. e.g. * eslint-release: ^1.2.0 => 1.2.0
* eslint-scope: ^5.0.0 => 5.0.0
* eslint-utils: ^1.3.1 => 1.4.0
* eslint-visitor-keys: ^1.0.0 => 1.0.0 is it possible to only show |
Updated info:- Environment Information:-
System:
OS: Linux 4.18 Ubuntu 18.10 (Cosmic Cuttlefish)
CPU: (2) x64 Intel(R) Pentium(R) CPU G2020 @ 2.90GHz
Binaries:
Node: 12.8.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.10.3 - /usr/local/bin/npm
npmPackages:
eslint-config-eslint: file:packages/eslint-config-eslint => 5.0.1
eslint-plugin-eslint-plugin: ^2.0.1 => 2.1.0
eslint-plugin-internal-rules: file:tools/internal-rules => 0.0.0
eslint-plugin-node: ^9.0.0 => 9.1.0
npmGlobalPackages:
eslint: 6.1.0 |
thanks for the update, seems local-installed eslint is missing? 😄 |
Hi.
|
@jamesgeorge007 Can you tell us what part you're having trouble with and what you've tried? |
It just says ,we need to update it in case of the promisified approach. Also, address the |
See the links I mentioned.
|
The respective test case seem to fail 🤔 Line 170 in bfdb0c9
@platinumazure @mysticatea thoughts 🤔 |
Before we go too far down this path, I want to ask again: Did we identify a compelling reason for writing async code here, as well as using the I'm a little worried about the scope of this change and how difficult testing might become here, and I really think we should see if we can avoid the extra complexity here if at all possible. |
@platinumazure It's just that we wanna execute platform specific shell commands to fetch those information and why reinventing the wheel when everything is already cooked up 🤔 |
I’m a bit concerned that the team’s concerns aren’t being heard here. There are multiple comments above expressing concern about making the CLI code asynchronous and it seems to have been mostly ignored.
From above:
Please let us know if you’d like us to clarify anything. As far as the implementation goes, this would have to be explored by whoever wants to implement this, but please see this comment that outlines my take on how this might be implemented. |
@kaicataldo @platinumazure b6fb32 manages to take away the all confusion and hops over to the intended synchronous implementation. With that we've Environment Information:-
node: v12.8.0
npm: 6.10.3
eslint: v6.1.0 |
The above mentioned information is as per the current |
42abb52
to
a20969e
Compare
I quickly spiked a synchronous alternative to the asynchronous version found in this PR to better illustrate what I had in mind my comments. I know there's been a lot of back and forth on here, and I'd love to see if we can come to a consensus and land this feature! You can find the code here: kaicataldo@ef0fe91 This would print out the following log: Environment Info:
Node version: 12.8.0
npm version: 6.10.3
Local ESLint version: 6.1.0 (Currently used)
Global ESLint version: 5.16.0 One key difference (and one I'd like to advocate for regardless of the implementation), is that when the Note that I've only run this in macOS and so can't guarantee it'll work across other platforms in its current iteration. |
@kaicataldo LGTM 👍 |
Also, how're we gonna proceed with this just to ensure my work here so far is not in vain 😅 |
@jamesgeorge007 I used As far as how we want to proceed - we should all decide! My intention was not to take over the issue. I just wanted to better illustrate what I had in mind, and you're welcome to continue working on this PR if you would like. That being said, I'm happy to clean up my branch, add tests, and make it a real PR, if that's deemed the appropriate path forward. Regardless, I don't think your work has been in vain - you proposed this idea and made a PR that started a lot of discussion, and that's really valuable. 👍 |
@jamesgeorge007 We always appreciate contributions from the community, and prefer them to contributions from core team members. So if you are willing to incorporate @kaicataldo ideas into your PR, we would gladly merge that in. |
ae7588e
to
9806ebc
Compare
New: add test case fix: remove showing up browser information fix: show up local version of eslint fix: test fix: update local package info glob fix: explicitly return a promise fix: update local package glob tweaks fix: fixup async behavior fix: update test case fix: handle promise rejection fix: revert switch over to synchronous version WIP: spike info flag implementation
9806ebc
to
780dad7
Compare
have -i as an alias to --info flag
closing in favor of #12270 |
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[x] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
eslint --info
/eslint -i
Is there anything you'd like reviewers to focus on?
Fixes #11958