Skip to content

Generated Code + Semicolons #18

@DrewML

Description

@DrewML

Expected Behaviour

Hey! We're starting to work on some integrations with I/O functions on the Magento side of things, and I spun up a new functions-only app with aio app:init.

I noticed that the example functions pulled in by the Yeoman generator are currently going semi-less. I definitely am not looking to start a debate of which style is better.

However, Magento has a lot of folks that don't consider JS their primary language (employees and system integrators), and this can cause some surprises when folks are first attempting to onboard to I/O.

As an example, I helped a co-worker debug their function for about ~30 minutes the other day - I totally missed the missing semi they had after an IIFE, which ended up creating some surprising results.

I would love to see us improve in one of the following 2 ways:

  • Terminate statements with semicolons
    OR
  • Include ESLint with a default configuration that'll catch common ASI footguns

My own preference would be to add semis to the examples. I think a decent number of folks starting that don't have a JS background won't know what ESLint is, and likely won't have the editor plugin installed when they start up. Eliminating a foot gun for those folks could make the onboarding experience more seamless.

Actual Behaviour

No semis, no tooling to catch mistakes

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions