-
Notifications
You must be signed in to change notification settings - Fork 352
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
refactor: enable and fix class-methods-use-this #2827
Conversation
5ef7d96
to
e16635f
Compare
58bbbe1
to
5c98328
Compare
5c98328
to
b467e68
Compare
b467e68
to
accd95c
Compare
Snapshots for
|
Hi @tinfoil-knight, let me try and reproduce this locally. Those tests are passing in our CI on Node.j 16 and 10 though |
There was a merge conflict in |
7d782bf
to
d2ec3ab
Compare
I've removed un-necessary multiple merge commits from |
@erezrokah Please merge |
@erezrokah Please review and merge if everything looks fine. |
Hi @tinfoil-knight, thanks for opening the PR. This is on my todo list for today 👍 |
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 doing this @tinfoil-knight!
This will help keeping the CLI code nice a tidy 🧹
What do you think of extracting the instance methods that didn't use this
to plain functions?
For example in the Command
class file, see pollForToken
Then we could export them under utils
from the command.js
file to be exported in the following manner:
const { utils: { log, logJson, ... } } = require('../utils/command')
That will allow us to follow up in another PR and move non related Command
functions to separate files.
@erezrokah I wanted to extract those utilities out too. Will do it. How about I put them in a |
👍 That makes sense |
@erezrokah In many places there's code like below where functions (like
For more context, see init.js. |
@erezrokah Could you please review the question above once when time allows so I can progress forward on the issue? |
Good point, could we |
Yep. That's what I was thinking. Just taking the functions out and making it a top-level require/import in the file instead of passing as args. |
This seems unrelated to your change. Those tests are flaky and we're actively trying to stabilize them |
Alright then. The PR is ready for a review in that case. |
I've fixed all the merge conflicts. |
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.
@tinfoil-knight thanks again for another very important PR.
I'm going to test this manually a bit to make sure various code paths didn't break with all the utilities extractions
This PR should also fix #2728. |
- Summary
See #1891
Enables the class-methods-use-this for ESLint and fixes instances where
this
wasn't used by turning them to static methods.- Test plan
npm run format:check:lint
runs without error.npm test
passed for all tests.