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
Chore: Replace the inquirer dependency with enquirer #13254
Conversation
lib/init/config-initializer.js
Outdated
result(input) { | ||
return this.skip ? null : input; |
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.
This result method is needed since enquirer will even return the initial value when the question is skipped, unlike inquirer.
name: "purpose", | ||
message: "How would you like to use ESLint?", | ||
default: "problems", | ||
initial: 1, |
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.
The returned number matches the name
value of nth in the choices
array.
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.
Can you add that as a comment?
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.
@Siilwyn can you add this as a comment in the file?
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.
Yes 👍
(Didn't get a notification for your first comment.)
skip() { | ||
return this.state.answers.purpose !== "style"; | ||
}, |
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.
The skip
method is the reverse of when
so the conditional statement is reversed.
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.
Hi. @Siilwyn Thanks for working this. 😀
I tried it and found two issues. (I don't know about "enquirer" well)
-
default value representation: question use character -
(y/n)
/ answer use boolean -(true/false)
- I think we should use the same representation for the default value ( maybe "(y/n)"?)
-
Does your project use TypeScript? (Y/n) - this question shows us the default value as
Y
but the default value of the answer isfalse
- both should be semantic "No"
@yeonjuan alright, I've replaced all confirm prompts to have more humane answers. (I see the commit-message CI fail, but I think this is alright since when this PR is ready to merge it can be squashed to use my first commit which is compliant right?) |
@Siilwyn Thanks for the change :)
Yes but, the PR message should follow the guideline. So, Would you mind change the PR title? |
lib/init/config-initializer.js
Outdated
return this.state.answers.purpose !== "style"; | ||
}, | ||
result(input) { | ||
return this.skip ? null : input; |
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.
@Siilwyn
It seems not working as we expected.
When I answered with the "guide," in this step. but the selecting styleguide step was skipped.
✔ How would you like to use ESLint? · style
✔ What type of modules does your project use? · none
✔ Which framework does your project use? · none
✔ Does your project use TypeScript? · No / Yes
✔ Where does your code run? · browser
✔ How would you like to define a style for your project? · guide
✔ What format do you want your config file to be in? · JavaScript
✔ What style of indentation do you use? · tab
✔ What quotes do you use for strings? · double
✔ What line endings do you use? · unix
✔ Do you require semicolons? · No / Yes
Successfully created .eslintrc.js file in
It seems the this.skip
is a function (truthy
value), so the result always be a null
Maybe we should change all the logic which uses this.skip
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.
Good catch! That was a typo sorry about that. I was testing it on one question with skipped
got it working but then messed up the copy paste on all somehow.
Co-authored-by: YeonJuan <yeonjuan93@naver.com>
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.
@Siilwyn Thanks for contributing! LGTM!
What happens now? |
@Siilwyn we still need some other reviews before this can be merged. Stay tuned. |
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.
Sorry we lost track of this! There’s just one unresolved request but it’s for adding a comment so I won’t hold this up if you can’t get to it.
@kaicataldo can you take a look? I’d like another set of eyes.
name: "purpose", | ||
message: "How would you like to use ESLint?", | ||
default: "problems", | ||
initial: 1, |
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.
@Siilwyn can you add this as a comment in the file?
Oops, looks like that last commit introduced a conflict. Can you take a look? |
@nzakas should be fixed now! |
Thanks for contributing! |
Closes #13208
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:
See #13208: replace dependency to decrease package size.
What changes did you make? (Give an overview)
Replace the dependency and changed the equivalent methods to work.
Is there anything you'd like reviewers to focus on?
Mostly if edge cases work, I've tested some paths but not certain if everything went over like how it was supposed to work in the first place. (never used eslint --init myself before)