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

nsqadmin: upgrade supported ECMAScript from ES5 to ES2020 in ESLint. #1470

Merged
merged 1 commit into from
Oct 30, 2023

Conversation

dudleycarr
Copy link
Contributor

@dudleycarr dudleycarr commented Oct 30, 2023

The nsqadmin ESLint configuration leaves the ECMAScript version unspecified which means it defaults to ES5. ES5 was a sensible default many years ago since nsqadmin doesn't transpile its JS nor are their polyfills for missing ECMAScript functionality.

That said, it's 2023 and modern browsers support vast majority of features from ES2020 and earlier for several years. ES2020 contains the many of the language features that you'd use on a daily basis in modern JS development.

Concrete numbers in terms of world wide adoption can be seen here:
https://caniuse.com/?search=es2020

In addition to adding es2020 to the environment list, the space-before-function-paren rule has been updated with the inclusion of async anonymous arrow functions.

Without the rule change:

const foo = async() => {
  return 1;
}

Generally, space is provided between the function modifier and the anonymous arrow function so that it does read as if async is the function name.

With the rule change:

const foo = async () => {
  return 1;
}

@mreiferson
Copy link
Member

All of this sounds reasonable to me, but you could probably tell me anything about the current state of javascript and I'd believe you.

@dudleycarr
Copy link
Contributor Author

😂 That's why I included the CanIUse link.

I think it's a conservative change. I presume that the majority of nsqadmin users have modern browsers. Exceptions exist in locked down IT departments. That said, an IT department running a 2 year old browser has some serious issues.

Of course, it doesn't change anything in the existing code base. However, new code and things that get refactored could make use of those changes.

@mreiferson mreiferson merged commit 1d183d9 into nsqio:master Oct 30, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants