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

Refactor utils modules before migrating to TS. #3870

Merged
merged 8 commits into from
Aug 30, 2023

Conversation

garg3133
Copy link
Member

@garg3133 garg3133 commented Aug 8, 2023

No description provided.

@github-actions
Copy link

github-actions bot commented Aug 8, 2023

Status

  • ❌ No modified files found in the types directory.
    Please make sure to include types for any changes you have made. Thank you!.

lib/utils/logger/log_settings.js Outdated Show resolved Hide resolved
}
class LogSettings {
constructor() {
this.__outputEnabled = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of __outputEnabled, we should use #outputEnabled.
Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no problem with either notations, it's just that __ notation is what we're using everywhere in the Nightwatch project, and because we are anyway going to convert this file to TS just after this PR is merged where we'll use the private keyword, using/not using # doesn't really matter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Needed to update eslint to work with # as well. But not sure if # is supported in Node.js 16, let's see.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, it seems that they are available since Node.js 12, but I wonder why it was only implemented in ECMAScript 2022?

lib/utils/logger/log_settings.js Outdated Show resolved Hide resolved
@@ -3,7 +3,7 @@
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": 2020,
"ecmaVersion": 13,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find 13 in the documentation. We can use latest to use the latest environment parser in ESLint.
Ref: https://eslint.org/docs/latest/use/configure/language-options#specifying-environments

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

13 is present in inline documentation, which is same as setting it to 2022.

image

I didn't specify latest because earlier also 2020 version was mentioned instead of latest and I'm not sure of the reason for that, but I suppose it's so that any changes in ESLint do not affect us, as long as we don't explicitly decide to move to a new version ourselves.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@beatfactor Can you please look into this once, if it is fine to use latest or should we just keep to a specific version?

Also, please review and merge this PR afterwards, as it is a blocker for migrating the utils/logger module.

@beatfactor beatfactor merged commit 0822095 into nightwatchjs:main Aug 30, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants