Skip to content

chore: allow for-of loops

Tomas Vik requested to merge tv/2023-11/allow-for-of into main

Description

This MR removes the eslint restricted syntax rule that prevented us from using for of loops.

      {
        selector: 'ForOfStatement',
        message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
      },

https://github.com/airbnb/javascript/blob/11ab37144b7f846f04f64a29b5beb6e00d74e84b/packages/eslint-config-airbnb-base/rules/style.js#L348

We target node 18 and whatever electron (chromium) that VS Code uses. The (asynchronous) for-of are natively supported for many years now and since we don't have to support legacy browsers, we don't have to worry about babel (which we don't use) having to include regenerator-runtime.

Support

Related Issues

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap

Merge request reports