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

Chore: Replace the inquirer dependency with enquirer #13254

Merged
merged 9 commits into from Jun 9, 2020
Merged

Chore: Replace the inquirer dependency with enquirer #13254

merged 9 commits into from Jun 9, 2020

Conversation

Siilwyn
Copy link
Contributor

@Siilwyn Siilwyn commented May 3, 2020

Closes #13208

Prerequisites checklist

  • I have read the contributing guidelines.
  • The team has reached consensus on the changes proposed in this pull request. If not, I understand that the evaluation process will begin with this pull request and won't be merged until the team has reached consensus.

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)

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label May 3, 2020
Comment on lines 440 to 441
result(input) {
return this.skip ? null : input;
Copy link
Contributor Author

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,
Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

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.)

Comment on lines +517 to +519
skip() {
return this.state.answers.purpose !== "style";
},
Copy link
Contributor Author

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.

@yeonjuan yeonjuan added accepted There is consensus among the team that this change meets the criteria for inclusion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint and removed triage An ESLint team member will look at this issue soon labels May 4, 2020
Copy link
Member

@yeonjuan yeonjuan left a 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)
스크린샷 2020-05-05 오전 2 32 41

  1. 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)"?)
  2. Does your project use TypeScript? (Y/n) - this question shows us the default value as Y but the default value of the answer is false

    • both should be semantic "No"

@Siilwyn
Copy link
Contributor Author

Siilwyn commented May 4, 2020

@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?)

@yeonjuan
Copy link
Member

yeonjuan commented May 5, 2020

@Siilwyn Thanks for the change :)

(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?)

Yes but, the PR message should follow the guideline.
Because we use the PR title as a commit message when it squashed(If there are multiple commits)

So, Would you mind change the PR title?

return this.state.answers.purpose !== "style";
},
result(input) {
return this.skip ? null : input;
Copy link
Member

@yeonjuan yeonjuan May 5, 2020

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

스크린샷 2020-05-05 오후 10 19 31

Copy link
Contributor Author

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.

@aladdin-add aladdin-add changed the title Replace the inquirer dependency with enquirer Chore: Replace the inquirer dependency with enquirer May 5, 2020
Co-authored-by: YeonJuan <yeonjuan93@naver.com>
Copy link
Member

@yeonjuan yeonjuan left a 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!

@Siilwyn
Copy link
Contributor Author

Siilwyn commented May 12, 2020

What happens now?

@nzakas
Copy link
Member

nzakas commented May 12, 2020

@Siilwyn we still need some other reviews before this can be merged. Stay tuned.

Copy link
Member

@nzakas nzakas left a 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,
Copy link
Member

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?

@nzakas
Copy link
Member

nzakas commented Jun 9, 2020

Oops, looks like that last commit introduced a conflict. Can you take a look?

@Siilwyn
Copy link
Contributor Author

Siilwyn commented Jun 9, 2020

@nzakas should be fixed now!

@kaicataldo
Copy link
Member

Thanks for contributing!

@kaicataldo kaicataldo merged commit 7ce7988 into eslint:master Jun 9, 2020
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 7, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package size seems big
4 participants