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

[FEATURE] Support ES2021 language features #692

Merged
merged 1 commit into from
Jan 25, 2022
Merged

[FEATURE] Support ES2021 language features #692

merged 1 commit into from
Jan 25, 2022

Conversation

matz3
Copy link
Member

@matz3 matz3 commented Jan 24, 2022

By upgrading espree to the latest version, ES2021 language features
are now supported.

JIRA: CPOUI5FOUNDATION-363

By upgrading espree to the latest version, ES2021 language features
are now supported.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.79% when pulling c1ca28d on upgrade-espree into 50e2c7c on next.

Copy link
Member

@RandomByte RandomByte left a comment

Choose a reason for hiding this comment

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

LGTM, @codeworrior to approve

@codeworrior
Copy link
Member

I have to make up my mind how to properly handle chained expressions. Our check for conditional expressions wants to detect whether a certain code is always executed (eager) or not (conditional).

The following top level code

someName.memberA[(function() { sap.ui.require(["a/b/c"]); return "someProperty";}())] 

would eagerly depend on a/b/c.

But

someName.memberA?.[(function() { sap.ui.require(["a/b/c"]); return "someProperty";}())] 

would not.

This no longer can be declared statically. Within a ChainExpression.expression, the optional flag of the contained MemberExpressions has to be taken into account. If it is true, then the property part becomes conditional.

Well, but to enable the new syntax elements, the change is both required and helpful.

@matz3
Copy link
Member Author

matz3 commented Jan 25, 2022

Thanks for the insights.

I also thought about handling for the ChainExpression.
But as e.g. someName.memberA && sap.ui.require(["a/b/c"]); will not result into a conditional dependency, I thought that we anyways have some cases where we could improve, so I didn't have a deeper look into all this.

What I forgot to mention:
ChainExpression is not part of the Syntax, so I first could run a build without any issues until I used a ChainExpression in the code, which resulted into an error in the JSModuleAnalyzer visit function ("Unhandled AST node type"). So maybe we need another check in the opposite direction, at least within a unit test, to ensure that we will add new node types to our code.

@matz3 matz3 merged commit e749b6a into next Jan 25, 2022
@matz3 matz3 deleted the upgrade-espree branch January 25, 2022 08:31
@codeworrior
Copy link
Member

Reg. the gaps in espree.Syntax see eslint/js#532 (fixes eslint/js#531)

I'm waiting for OSPO to approve the (C)CLA.

@pubmikeb
Copy link

pubmikeb commented Feb 19, 2022

@codeworrior, thanks for contributing to the ESLint project.

Does this merge mean that UI5 Tooling 2.14.5 now supports the ES2021 language features?
If not, it would be amazing to get such support to be able using the modern JS features in UI5 apps.

@matz3
Copy link
Member Author

matz3 commented Feb 21, 2022

@pubmikeb this PR got merged into the next branch which will result into the v3.0.0 release. There are prereleases available, as described in SAP/ui5-tooling#506

As the espree update requires a higher node version, we are not able to port this into the v2.x codeline.

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.

5 participants