Problem/Motivation
Underscore.js was added to core as a dependency of Backbone.js. Outside of Backbone related code, our usage has been very light. It could take a while to remove all Backbone related code from core on #3145958: [META] Re-evaluate use of Backbone.js in core, so in the mean while we could remove our dependency on Underscore.js.
Proposed resolution
- #3270395: Remove use of underscore from editor.admin.js and filter.filter_html.admin.js
- Ensure QuickEdit is moving Image integration library there, instead of having it in Image, in #3265140: Move QuickEditImageController from image to quickedit.
- Have a child issue to deprecate the library, which will be postponed on #3228986: [Meta] Tasks to deprecate Quick Edit.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Comments
Comment #3
xjmRetitling for clarity.
Comment #4
xjmComment #5
murilohp commentedI can help you with this one!
Comment #6
murilohp commentedSo sorry about my delay here, this is my first time deprecating a JS lib, I made this new patch for D9.4, deprecating it from the core.libraries, do we need deprecation tests here?
Regarding the proposed solution:
Deprecate Underscore.js library, The patch adds a new deprecation message for this.Load Underscore.js directly on libraries that currently depend on it, I don't think I got this right, the patch adds a new underscore lib on each module that depends on it and points to the file directly on core, I didn't know if it was supposed to be this way.Since we still need to open the follow-ups issues and review the patch. I'll leave this as NW.
Comment #7
mradcliffeJust a note that quickedit is going to be removed in 10.0.0 in #3227033: Remove Quick Edit from core. The follow-up for that should be posted in the contrib module, I think.
Can we even pass tests if core itself is using a deprecated asset library? If not, we'd need to do the removal in one issue or block the deprecation on the child issues?
Comment #8
xjmUsually we have to do the issues to remove the usage first, and then do the final issue to remove the deprecation. We could convert this issue to a meta issue to do that?
QuickEdit will remain in Drupal 9 core until 2024, so many issues would need to be fixed in both core and contrib QuickEdit until then. In the case of this, though, we could maybe skip/silence the deprecation within QuickEdit since it's essentially end-of-life. Worth exploring, anyway.
Comment #9
murilohp commentedSure! IMHO it's the best idea here, then we could open the follow up issues for the modules: editor, filter, image and quickedit
Comment #10
xjmI thought about this more.
QuickEdit will need to retain its dependency on underscore regardless, because it depends on Backbone. So that's not worth doing; we can just silence the deprecation within QuickEdit. I wonder if it's possible to ignore the deprecation messages only within QuickEdit...
Comment #11
xjmRegarding #10, QuickEdit's tests will all be marked legacy when the module is formally deprecated, so yes! That will solve that; just means QE deprecation needs to be complete first.
Comment #12
xjmScoping by module isn't always the best choice, but after taking a quick look at the library definitions, we have the following JS code affected
So Image is only dependent on editor in its QuickEdit integration, which is code that should have been moved to QuickEdit already. 🤔 We should figure out why that hasn't happened yet from the QuickEdit deprecation meta.
Since it's really only two JS files,
core/modules/editor/js/editor.admin.jsandcore/modules/filter/filter.filter_html.admin.js, we should be able to handle the removals in a single issue. That issue can go in anytime. Then, we commit the actual deprecation once QuickEdit is deprecated.Comment #13
xjmUpdated the IS with a new proposed resolution. We need two child issues filed.
Comment #14
xjmFiled the first child issue for the removal from non-deprecatable code.
Comment #15
xjmComment #16
xjmComment #17
xjmComment #18
nod_Added #3272872: deprecate underscore and mark it internal to handle the backbone dependency on underscore.
Comment #20
xjmComment #22
xjmIs there anything left in scope here for D11?
Comment #24
catchThis is done, we have #3203920: Replace Contextual Links BackboneJS usage with VanillaJS equivalent one remaining child issue (apart from deprecating toolbar when navigation is stable) to remove backbone too.
Comment #26
quietone commented