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

avoid logical nullish assignment to allow node < v15 support #120

Closed
wants to merge 1 commit into from

Conversation

doronpr
Copy link

@doronpr doronpr commented Sep 21, 2023

fixes this error:

[04:42:31.066] Oops! Something went wrong! :(
[04:42:31.066] 
[04:42:31.066] ESLint: 8.33.0
[04:42:31.066] 
[04:42:31.066] /home/builduser/work/a5af963239e640d2/packages/package/node_modules/eslint-plugin-n/lib/util/get-typescript-extension-map.js:43
[04:42:31.066]         backward[javascript] ??= []
[04:42:31.066]                              ^^^
[04:42:31.066] 
[04:42:31.066] SyntaxError: Unexpected token '??='

avoid logical nullish assignment to allow node < v15 support
@aladdin-add
Copy link

node.js < v16 has been dropped, so we won't accept this change. you can:

  1. upgrade to node >=16. (has been EOL per https://github.com/nodejs/release#end-of-life-releases)
  2. stay using eslint-pluign-n v15 if you are not able to upgrade as of now.

Comment on lines +43 to +45
if (backward['javascript'] === null || backward['javascript'] === undefined) {
backward['javascript'] = [];
}
Copy link

Choose a reason for hiding this comment

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

This would also break the mapping, it should be backward[javascript], like this:

Suggested change
if (backward['javascript'] === null || backward['javascript'] === undefined) {
backward['javascript'] = [];
}
if (backward[javascript] === null || backward[javascript] === undefined) {
backward[javascript] = [];
}

Also, I don't remember if we support == null, but this would work too

Suggested change
if (backward['javascript'] === null || backward['javascript'] === undefined) {
backward['javascript'] = [];
}
if (backward[javascript] == null) {
backward[javascript] = [];
}

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.

None yet

3 participants