[OP-19547] Remove lodash global and dependency

Removes the global `_` (window assignment in init-vendors and the spec
setup), its ambient type declarations, and the `lodash` / `@types/lodash`
dependencies. `lodash-es` remains for the helpers with no native
equivalent.

Must merge last: depends on every other bucket having removed its `_.`
usage from both frontend/src and the module frontends.

https://community.openproject.org/wp/OP-19547
This commit is contained in:
Alexander Brandon Coles
2026-06-13 19:05:58 +01:00
parent 8d1cbe8000
commit 213b8df11f
5 changed files with 0 additions and 29 deletions
-9
View File
@@ -95,7 +95,6 @@
"jquery-migrate": "^4.0.2",
"json5": "^2.2.2",
"lit-html": "^3.3.3",
"lodash": "^4.18.1",
"luxon": "^3.7.2",
"mdx-embed": "^1.1.2",
"mime": "^4.1.0",
@@ -144,7 +143,6 @@
"@types/hotwired__turbo": "^8.0.10",
"@types/jquery": "^4.0.1",
"@types/jquery-migrate": "^3.3.3",
"@types/lodash": "^4.17.24",
"@types/mousetrap": "^1.6.3",
"@types/node": "^25.9.1",
"@types/pako": "^2.0.4",
@@ -7024,13 +7022,6 @@
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true
},
"node_modules/@types/lodash": {
"version": "4.17.24",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.24.tgz",
"integrity": "sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/mousetrap": {
"version": "1.6.15",
"resolved": "https://registry.npmjs.org/@types/mousetrap/-/mousetrap-1.6.15.tgz",
-2
View File
@@ -22,7 +22,6 @@
"@types/hotwired__turbo": "^8.0.10",
"@types/jquery": "^4.0.1",
"@types/jquery-migrate": "^3.3.3",
"@types/lodash": "^4.17.24",
"@types/mousetrap": "^1.6.3",
"@types/node": "^25.9.1",
"@types/pako": "^2.0.4",
@@ -141,7 +140,6 @@
"jquery-migrate": "^4.0.2",
"json5": "^2.2.2",
"lit-html": "^3.3.3",
"lodash": "^4.18.1",
"luxon": "^3.7.2",
"mdx-embed": "^1.1.2",
"mime": "^4.1.0",
@@ -30,9 +30,6 @@
//
// dependencies required by classic (Rails) and Angular application.
// Lodash
import lodash from 'lodash';
import moment from 'moment';
import './init-moment-locales';
@@ -42,12 +39,5 @@ import '@openproject/primer-view-components/app/assets/javascripts/primer_view_c
import URI from 'urijs';
import 'urijs/src/URITemplate';
declare global {
interface Window {
_:typeof lodash;
}
}
window._ = lodash;
window.moment = moment;
window.URI = URI;
-6
View File
@@ -1,5 +1,4 @@
import { I18n } from 'i18n-js';
import lodash from 'lodash';
import '@testing-library/jest-dom/vitest';
import { afterEach, vi } from 'vitest';
import { registerDialogStreamAction } from 'core-turbo/dialog-stream-action';
@@ -15,11 +14,6 @@ afterEach(() => {
window.I18n = new I18n();
// Production code expects `_` to be available globally (set in init-vendors.ts).
// Mirror that here so production modules pulled in by spec compilation can run.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any)._ = lodash;
// jsdom does not implement CSS.escape; production helpers (e.g. getMetaElement)
// call it unconditionally.
if (typeof CSS === 'undefined' || typeof CSS.escape !== 'function') {
-2
View File
@@ -14,7 +14,6 @@
import { Injector } from '@angular/core';
import { OpenProject } from 'core-app/core/setup/globals/openproject';
import * as TLodash from 'lodash';
import { Screenfull } from 'screenfull';
import { ErrorReporterBase } from 'core-app/core/errors/error-reporter-base';
import { I18n } from 'i18n-js';
@@ -24,7 +23,6 @@ declare module 'dom-autoscroller';
declare module 'core-vendor/enjoyhint';
declare global {
const _:typeof TLodash;
const I18n:I18n;
}