Problem/Motivation
As mentioned in the parent issue #3238306: [META] Where possible, refactor existing jQuery uses to vanillaJS to reduce jQuery footprint, we are working towards reducing our jQuery footprint. One of the ways to accomplish this is to reduce the number of jQuery features used in Drupal core. We have added eslint rules that identify specific features and fail tests when those features are in use.
There are (or will be) individual issues for each jQuery-use eslint rule. This one is specific to jquery/no-map, which targets the jQuery.map function and map function
Steps to reproduce
Proposed resolution
Remaining tasks
- In
core/.eslintrc.jquery.jsonChange"jquery/no-map": 0,to"jquery/no-map": 2,to enable eslint checks for uses of jQuerymap(). With this change, you'll be able to see uses of the undesirable jQuery feature by runningyarn lint:core-js-passingfrom thecoredirectory - If it's determined to be feasible, refactor those uses of jQuery
map()to use Vanilla (native) JavaScript instead.
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3238860
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3238860-refactor-if-feasible
changes, plain diff MR !1231
Comments
Comment #2
hooroomooComment #3
hooroomooComment #7
mstrelan commentedComment #8
larowlanleft a review
Comment #10
bnjmnmA single JS change that was vetted by a JS maintainer seems like a pretty safe RTBC.
Comment #12
lauriiiCommitted 926b484 and pushed to 9.4.x. Thanks!
Not backporting this to 9.3.x. since based on https://www.drupal.org/about/core/policies/core-change-policies/allowed-... this isn't eligible for backport.