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-ready
, which targets the jQuery ready function.
Steps to reproduce
Proposed resolution
Remaining tasks
- In
core/.eslintrc.jquery.json
Change"jquery/no-ready": 0,
to"jquery/no-ready": 2,
to enable eslint checks for uses of jQuery.ready()
. With this change, you'll be able to see uses of the undesirable jQuery feature by runningyarn lint:core-js-passing
from thecore
directory - If it's determined to be feasible, refactor those uses of jQuery
.ready()
to use Vanilla (native) JavaScript instead.
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3238915
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:
Comments
Comment #4
nod_Comment #5
nod_Need to change the target to the 9.4.x branch
Comment #6
nod_Comment #8
nod_Comment #11
nod_Comment #13
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commentedRemoved Color Module and Quick Edit Module Tests that were present in earlier commit. Also remove .es6.js files.
Need to update Target Branch to 10.1.x for MR inorder to check merge status. Anyone with edit access pls update target branch in MR. Thanks.
Comment #15
nod_updated your MR. You had the generated file from 9.x branch replace the source file from 10.x branch. that's why a new patch is easier when going from 9.x to 10.x for JS patches :)
Comment #17
nod_The gitlab comments are absolute mayhem for a 1 line change 😂
Comment #18
smustgrave CreditAttribution: smustgrave at Mobomo commentedCould this get a test? To show that the error is being caught correctly?
Comment #19
mstrelan CreditAttribution: mstrelan at PreviousNext commented@smustgrave do you mean we should be testing that eslint is working? I'm not sure that's necessary. Do we do the same for phpstan?
Otherwise the actual code change here is just a refactor, it should already have coverage.
Comment #20
smustgrave CreditAttribution: smustgrave at Mobomo commentedDo we have any coverage for code-commit-check.sh ? If not or it's something we can test for I'll mark RTBC.
Comment #21
nod_Need to revert the changes to commit checks file. It's made just to force a run through all files. It's not necessary anymore
Comment #22
smustgrave CreditAttribution: smustgrave at Mobomo commentedOh in that case this can be moved to RTBC once that's done.
Comment #24
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commentedSetting to Need review as the review comments on MR are resolved.
Comment #25
nod_All good now, thanks!
Comment #28
bnjmnmLooks good! Committed to 10.1.x and cherry-picked to 10.0.x.