commit-code-check.sh doesn't allow optional chaining in JavaScript

Created on 23 January 2023, almost 2 years ago
Updated 12 September 2023, about 1 year ago

Problem/Motivation

As discovered in #3305706-23: Uncaught TypeError: this.$pluginSelect.find(...)[0] is undefined β†’ our scripts/dev/commit-code-check.sh doesn't allow optional chaining in JavaScript.

So for example, this this.$pluginSelect.find('option')[0]?.value; is being rejected by the script with the following output:

----------------------------------------------------------------------------------------------------
Checking core/modules/field_ui/field_ui.js


/var/www/html/core/modules/field_ui/field_ui.js
  371:52  error  Parsing error: Unexpected token .

βœ– 1 problem (1 error, 0 warnings)


----------------------------------------------------------------------------------------------------

( https://www.drupal.org/pift-ci-job/2561443 β†’ )

Since we dropped support for IE10 in Drupal 10.x, we should allow for ? to come before a . from 10.0.x-dev upwards

Steps to reproduce

Allow for ? to come before a . from 10.0.x-dev upwards

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

ESLint now allows ES11/ECMAScript 2020 syntax to be used in JavaScript as it is supported by all modern browsers.

πŸ“Œ Task
Status

Fixed

Version

10.1 ✨

Component
JavascriptΒ  β†’

Last updated 3 days ago

Created by

πŸ‡³πŸ‡±Netherlands spokje

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024