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

Updates babel and caniuse-lite #12044

Merged

Conversation

bjarnef
Copy link
Contributor

@bjarnef bjarnef commented Feb 23, 2022

Prerequisites

  • I have added steps to test this contribution in the description below

Description

Previously part of this closed PR for v8: #11482

Test notes

Ensure we can write syntax like the following without compile errors.

const adventurer = {
    name: 'Alice',
    cat: {
        name: 'Dinah'
    }
};

const dogName = adventurer.dog?.name;
console.log(dogName ?? "Buddy"); 

@bjarnef bjarnef changed the title V9/feature/babel adjustments Babel adjustments Feb 23, 2022
@umbrabot
Copy link

Hi there @bjarnef, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@nul800sebastiaan
Copy link
Member

This update seems fine @bjarnef - any reason it's still in Draft?

@bjarnef
Copy link
Contributor Author

bjarnef commented Feb 27, 2022

@nul800sebastiaan yes, the Gulp task throwed an error at this line const dogName = adventurer.dog?.name;

image

It didn't like ?. syntax.. I need to check it again :)

@bjarnef bjarnef marked this pull request as ready for review February 27, 2022 09:31
@bjarnef
Copy link
Contributor Author

bjarnef commented Feb 27, 2022

@nul800sebastiaan okay it was due ESLint not configured to allow a newer EMCA version: https://stackoverflow.com/a/63239666/1693918

const adventurer = {
    name: 'Alice',
    cat: {
        name: 'Dinah'
    }
};

const dogName = adventurer.dog?.name || "Buddy";
const birdName = adventurer.bird ?? "Pip"
        
console.log("Test optional-chaining: " + dogName);
console.log("Test nullish-coalescing-operator: " + birdName);

image

It allow us to use a modern JS syntax, while still compile for browsers based on https://github.com/umbraco/Umbraco-CMS/blob/v9/contrib/src/Umbraco.Web.UI.Client/.babelrc#L6

It also seems there a newer version of caniuse-lite which is recommended to update continuously:
https://github.com/umbraco/Umbraco-CMS/blob/v9/contrib/src/Umbraco.Web.UI.Client/package.json#L61

@nul800sebastiaan nul800sebastiaan merged commit 6d52a2f into umbraco:v9/contrib Feb 27, 2022
@nul800sebastiaan
Copy link
Member

Sweet! The sample indeed works great and I've also updated caniuse-lite in here. Thanks very much! 👍

@nul800sebastiaan nul800sebastiaan changed the title Babel adjustments Updates babel and caniuse-lite Feb 27, 2022
@nul800sebastiaan nul800sebastiaan added category/dx Developer experience community/pr dependencies Pull requests that update a dependency file release/9.4.0 labels Feb 27, 2022
@bjarnef bjarnef deleted the v9/feature/babel-adjustments branch February 27, 2022 13:48
@nul800sebastiaan nul800sebastiaan added status/dependency-update This change requires a dependency to be updated (Deploy, Forms, Courier) and removed category/dx Developer experience labels Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community/pr dependencies Pull requests that update a dependency file release/9.4.0 status/dependency-update This change requires a dependency to be updated (Deploy, Forms, Courier)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants