From 97039e8ce81614539ace50a978566062c9474ac7 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 7 Jan 2025 08:58:03 +0000 Subject: [PATCH 01/12] ci: remove `devversion` from unavailable pullapprove list (#59391) Removing myself as I'm available for reviews. PR Close #59391 --- .pullapprove.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pullapprove.yml b/.pullapprove.yml index 22217c82f955e8..8357b0095e38d9 100644 --- a/.pullapprove.yml +++ b/.pullapprove.yml @@ -57,7 +57,7 @@ version: 3 availability: - users_unavailable: ['atscott', 'devversion'] + users_unavailable: ['atscott'] # Meta field that goes unused by PullApprove to allow for defining aliases to be # used throughout the config. From adc56b72c52c2984209be5e9a3c6a30bddda86d1 Mon Sep 17 00:00:00 2001 From: Angular Robot Date: Tue, 7 Jan 2025 15:05:15 +0000 Subject: [PATCH 02/12] build: update dependency @types/diff to v7 (#59403) See associated pull request for more information. PR Close #59403 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index fed24267ab7552..05c34ed7bbcb68 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "@types/bluebird": "^3.5.27", "@types/chrome": "^0.0.290", "@types/convert-source-map": "^2.0.0", - "@types/diff": "^6.0.0", + "@types/diff": "^7.0.0", "@types/dom-view-transitions": "^1.0.1", "@types/hammerjs": "2.0.46", "@types/jasmine": "^5.0.0", diff --git a/yarn.lock b/yarn.lock index 0e4539305184be..ac7241d5de42ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4172,10 +4172,10 @@ "@types/d3-transition" "*" "@types/d3-zoom" "*" -"@types/diff@^6.0.0": - version "6.0.0" - resolved "https://registry.yarnpkg.com/@types/diff/-/diff-6.0.0.tgz#031f27cf57564f3cce825f38fb19fdd4349ad07a" - integrity sha512-dhVCYGv3ZSbzmQaBSagrv1WJ6rXCdkyTcDyoNu1MD8JohI7pR7k8wdZEm+mvdxRKXyHVwckFzWU1vJc+Z29MlA== +"@types/diff@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@types/diff/-/diff-7.0.0.tgz#e9f6a33a72164b3a80b983114a1cef9a6f0c2165" + integrity sha512-sVpkpbnTJL9CYoDf4U+tHaQLe5HiTaHWY7m9FuYA7oMCHwC9ie0Vh9eIGapyzYrU3+pILlSY2fAc4elfw5m4dg== "@types/dom-view-transitions@^1.0.1": version "1.0.5" From dc07a43b86fcd295ae5721b34c0ab171e6f530c5 Mon Sep 17 00:00:00 2001 From: arturovt Date: Wed, 13 Nov 2024 20:27:50 +0200 Subject: [PATCH 03/12] refactor(docs-infra): cleanup after render sequence in `ReferenceScrollHandler` (#58640) In this commit, we're replacing the provided injector in `afterNextRender` with a node injector because it was previously mistakenly passing an `EnvironmentInjector` in the `ReferenceScrollHandler`. PR Close #58640 --- adev/src/app/app-scroller.ts | 7 +++++-- .../services/reference-scroll-handler.service.ts | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/adev/src/app/app-scroller.ts b/adev/src/app/app-scroller.ts index aabb2c52d1fc87..69a9df0bf3c1e8 100644 --- a/adev/src/app/app-scroller.ts +++ b/adev/src/app/app-scroller.ts @@ -12,6 +12,7 @@ import { ApplicationRef, afterNextRender, EnvironmentInjector, + Injector, } from '@angular/core'; import {Scroll, Router} from '@angular/router'; import {filter, firstValueFrom, map, switchMap, tap} from 'rxjs'; @@ -62,7 +63,7 @@ export class AppScroller { }); } - scroll() { + scroll(injector?: Injector) { if (!this._lastScrollEvent || !this.canScroll) { return; } @@ -83,7 +84,9 @@ export class AppScroller { } }, }, - {injector: this.injector}, + // Use the component injector when provided so that the manager can + // deregister the sequence once the component is destroyed. + {injector: injector ?? this.injector}, ); this.cancelScroll = () => { ref.destroy(); diff --git a/adev/src/app/features/references/services/reference-scroll-handler.service.ts b/adev/src/app/features/references/services/reference-scroll-handler.service.ts index afd894e9cafc1b..7dc77823fb87c8 100644 --- a/adev/src/app/features/references/services/reference-scroll-handler.service.ts +++ b/adev/src/app/features/references/services/reference-scroll-handler.service.ts @@ -7,7 +7,7 @@ */ import {DOCUMENT, isPlatformBrowser} from '@angular/common'; -import {DestroyRef, Injectable, PLATFORM_ID, inject} from '@angular/core'; +import {DestroyRef, Injectable, Injector, PLATFORM_ID, inject} from '@angular/core'; import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; import {fromEvent} from 'rxjs'; import {MEMBER_ID_ATTRIBUTE} from '../constants/api-reference-prerender.constants'; @@ -22,6 +22,7 @@ const SCROLL_MARGIN_TOP = 100; export class ReferenceScrollHandler { private readonly destroyRef = inject(DestroyRef); private readonly document = inject(DOCUMENT); + private readonly injector = inject(Injector); private readonly window = inject(WINDOW); private readonly router = inject(Router); private readonly appScroller = inject(AppScroller); @@ -43,7 +44,7 @@ export class ReferenceScrollHandler { // If there is no fragment or the scroll event has a position (traversing through history), // allow the scroller to handler scrolling instead of going to the fragment if (!fragment || this.appScroller.lastScrollEvent?.position) { - this.appScroller.scroll(); + this.appScroller.scroll(this.injector); return; } From e1ab001e540faf4ee3932df5e416907a04e3b21b Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Tue, 7 Jan 2025 11:43:18 +0100 Subject: [PATCH 04/12] refactor(docs-infra): code cleanups (#59395) A handfull of different code cleanups in adev components. PR Close #59395 --- .../algolia-icon/algolia-icon.component.ts | 1 - .../breadcrumb/breadcrumb.component.html | 2 +- .../breadcrumb/breadcrumb.component.ts | 35 ++++++------------- adev/shared-docs/components/icon/BUILD.bazel | 3 +- .../components/icon/icon.component.html | 1 - .../components/icon/icon.component.ts | 15 ++++---- .../api-item-label.component.ts | 5 ++- .../api-reference-manager.service.ts | 1 - 8 files changed, 21 insertions(+), 42 deletions(-) delete mode 100644 adev/shared-docs/components/icon/icon.component.html diff --git a/adev/shared-docs/components/algolia-icon/algolia-icon.component.ts b/adev/shared-docs/components/algolia-icon/algolia-icon.component.ts index ff8baec99c85cb..270612ada95582 100644 --- a/adev/shared-docs/components/algolia-icon/algolia-icon.component.ts +++ b/adev/shared-docs/components/algolia-icon/algolia-icon.component.ts @@ -11,7 +11,6 @@ import {ChangeDetectionStrategy, Component} from '@angular/core'; @Component({ selector: 'docs-algolia-icon', changeDetection: ChangeDetectionStrategy.OnPush, - imports: [], templateUrl: './algolia-icon.component.html', }) export class AlgoliaIcon {} diff --git a/adev/shared-docs/components/breadcrumb/breadcrumb.component.html b/adev/shared-docs/components/breadcrumb/breadcrumb.component.html index 5cf1378ed22827..95095f4a225caf 100644 --- a/adev/shared-docs/components/breadcrumb/breadcrumb.component.html +++ b/adev/shared-docs/components/breadcrumb/breadcrumb.component.html @@ -1,4 +1,4 @@ -@for (breadcrumb of breadcrumbItems(); track breadcrumb) { +@for (breadcrumb of breadcrumbItems(); track $index) {
@if (breadcrumb.path) { @if (breadcrumb.isExternal) { diff --git a/adev/shared-docs/components/breadcrumb/breadcrumb.component.ts b/adev/shared-docs/components/breadcrumb/breadcrumb.component.ts index df1cbabbe27e16..f76dd1e0366455 100644 --- a/adev/shared-docs/components/breadcrumb/breadcrumb.component.ts +++ b/adev/shared-docs/components/breadcrumb/breadcrumb.component.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.dev/license */ -import {ChangeDetectionStrategy, Component, OnInit, inject, signal} from '@angular/core'; +import {ChangeDetectionStrategy, Component, inject, computed} from '@angular/core'; import {NavigationState} from '../../services/index'; import {NavigationItem} from '../../interfaces/index'; import {RouterLink} from '@angular/router'; @@ -18,31 +18,18 @@ import {RouterLink} from '@angular/router'; styleUrls: ['./breadcrumb.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class Breadcrumb implements OnInit { +export class Breadcrumb { private readonly navigationState = inject(NavigationState); - breadcrumbItems = signal([]); + breadcrumbItems = computed(() => { + const breadcrumbs: NavigationItem[] = []; + let activeItem = this.navigationState.activeNavigationItem()?.parent; - ngOnInit(): void { - this.setBreadcrumbItemsBasedOnNavigationStructure(); - } + while (activeItem != null) { + breadcrumbs.push(activeItem); + activeItem = activeItem.parent; + } - private setBreadcrumbItemsBasedOnNavigationStructure(): void { - let breadcrumbs: NavigationItem[] = []; - - const traverse = (node: NavigationItem | null) => { - if (!node) { - return; - } - - if (node.parent) { - breadcrumbs = [node.parent, ...breadcrumbs]; - traverse(node.parent); - } - }; - - traverse(this.navigationState.activeNavigationItem()); - - this.breadcrumbItems.set(breadcrumbs); - } + return breadcrumbs.reverse(); + }); } diff --git a/adev/shared-docs/components/icon/BUILD.bazel b/adev/shared-docs/components/icon/BUILD.bazel index c96cc8d6b13744..027993987bd731 100644 --- a/adev/shared-docs/components/icon/BUILD.bazel +++ b/adev/shared-docs/components/icon/BUILD.bazel @@ -1,5 +1,5 @@ -load("//tools:defaults.bzl", "ng_module") load("@io_bazel_rules_sass//:defs.bzl", "sass_binary") +load("//tools:defaults.bzl", "ng_module") package(default_visibility = ["//visibility:private"]) @@ -10,7 +10,6 @@ ng_module( ], assets = [ ":icon.component.css", - "icon.component.html", ], visibility = [ "//adev/shared-docs/components:__pkg__", diff --git a/adev/shared-docs/components/icon/icon.component.html b/adev/shared-docs/components/icon/icon.component.html deleted file mode 100644 index 40b37264033950..00000000000000 --- a/adev/shared-docs/components/icon/icon.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/adev/shared-docs/components/icon/icon.component.ts b/adev/shared-docs/components/icon/icon.component.ts index 9f40be92768166..187529a6712201 100644 --- a/adev/shared-docs/components/icon/icon.component.ts +++ b/adev/shared-docs/components/icon/icon.component.ts @@ -18,24 +18,21 @@ import { @Component({ selector: 'docs-icon', - templateUrl: './icon.component.html', - styleUrl: './icon.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, host: { - '[class]': 'MATERIAL_SYMBOLS_OUTLINED', + 'class': 'material-symbols-outlined', '[style.font-size.px]': 'fontSize()', 'aria-hidden': 'true', 'translate': 'no', }, - changeDetection: ChangeDetectionStrategy.OnPush, + template: '', + styleUrl: './icon.component.scss', }) export class IconComponent { - fontSize = computed(() => { - return IconComponent.isFontLoaded() ? null : 0; - }); + private static isFontLoaded = signal(false); - protected readonly MATERIAL_SYMBOLS_OUTLINED = 'material-symbols-outlined'; + protected readonly fontSize = computed(() => (IconComponent.isFontLoaded() ? null : 0)); - private static isFontLoaded = signal(false); /** Share the same promise across different instances of the component */ private static whenFontLoad?: Promise | undefined; diff --git a/adev/src/app/features/references/api-item-label/api-item-label.component.ts b/adev/src/app/features/references/api-item-label/api-item-label.component.ts index 1ed5e7cfe97b58..340a8d454285a7 100644 --- a/adev/src/app/features/references/api-item-label/api-item-label.component.ts +++ b/adev/src/app/features/references/api-item-label/api-item-label.component.ts @@ -8,16 +8,15 @@ import {ChangeDetectionStrategy, Component, computed, input} from '@angular/core'; import {ApiItemType} from '../interfaces/api-item-type'; -import {ApiLabel, shortLabelsMap} from '../pipes/api-label.pipe'; +import {shortLabelsMap} from '../pipes/api-label.pipe'; @Component({ selector: 'docs-api-item-label', - template: `{{ label() }}`, changeDetection: ChangeDetectionStrategy.OnPush, host: { '[class]': `clazz()`, }, - imports: [ApiLabel], + template: `{{ label() }}`, }) export default class ApiItemLabel { readonly type = input.required(); diff --git a/adev/src/app/features/references/api-reference-list/api-reference-manager.service.ts b/adev/src/app/features/references/api-reference-list/api-reference-manager.service.ts index fda0260015d38f..ba1f9dd2b70538 100644 --- a/adev/src/app/features/references/api-reference-list/api-reference-manager.service.ts +++ b/adev/src/app/features/references/api-reference-list/api-reference-manager.service.ts @@ -10,7 +10,6 @@ import {Injectable, signal} from '@angular/core'; // This file is generated at build-time, error is expected here. import API_MANIFEST_JSON from '../../../../../src/assets/api/manifest.json'; import {getApiUrl} from '../helpers/manifest.helper'; -import {ApiItem} from '../interfaces/api-item'; import {ApiItemsGroup} from '../interfaces/api-items-group'; import {ApiManifest} from '../interfaces/api-manifest'; From d1f8834884538596cd73eab0ad17f5438aac2024 Mon Sep 17 00:00:00 2001 From: Angular Robot Date: Tue, 7 Jan 2025 06:12:52 +0000 Subject: [PATCH 05/12] build: update dependency @types/selenium-webdriver4 to v4.1.28 (#59389) See associated pull request for more information. PR Close #59389 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 05c34ed7bbcb68..9cfcc9ba78994e 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "@types/jasminewd2": "^2.0.8", "@types/node": "^18.11.18", "@types/selenium-webdriver": "3.0.7", - "@types/selenium-webdriver4": "npm:@types/selenium-webdriver@4.1.27", + "@types/selenium-webdriver4": "npm:@types/selenium-webdriver@4.1.28", "@types/semver": "^7.3.4", "@types/shelljs": "^0.8.6", "@types/systemjs": "6.15.1", diff --git a/yarn.lock b/yarn.lock index ac7241d5de42ca..62250d95cf61e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4510,10 +4510,10 @@ resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.2.tgz#ed279a64fa438bb69f2480eda44937912bb7480a" integrity sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow== -"@types/selenium-webdriver4@npm:@types/selenium-webdriver@4.1.27": - version "4.1.27" - resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-4.1.27.tgz#e08000d649df6f099b4099432bd2fece9f50ea7b" - integrity sha512-ALqsj8D7Swb6MnBQuAQ58J3KC3yh6fLGtAmpBmnZX8j+0kmP7NaLt56CuzBw2W2bXPrvHFTgn8iekOQFUKXEQA== +"@types/selenium-webdriver4@npm:@types/selenium-webdriver@4.1.28": + version "4.1.28" + resolved "https://registry.yarnpkg.com/@types/selenium-webdriver/-/selenium-webdriver-4.1.28.tgz#7b4f3c50a67494f8fd6d396a2eaab7d9df1f9f34" + integrity sha512-Au7CXegiS7oapbB16zxPToY4Cjzi9UQQMf3W2ZZM8PigMLTGR3iUAHjPUTddyE5g1SBjT/qpmvlsAQLBfNAdKg== dependencies: "@types/node" "*" "@types/ws" "*" From 0e23f20c4117ffd5c871549a8012b8e22b03b5f4 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Tue, 7 Jan 2025 16:13:00 +0100 Subject: [PATCH 06/12] fix(platform-browser): styles not replaced during HMR when using animations renderer (#59393) When we replace a component during HMR, we clear it from the cache of the renderer factory, however when using animations, there's an animation-specific renderer factory that wraps the base DOM one and was preventing the cache from being cleared. These changes rework the logic that clear the cache to go through a method so we can forward the call to the delegated factory. PR Close #59393 --- goldens/size-tracking/integration-payloads.json | 2 +- .../animations/browser/src/render/animation_renderer.ts | 8 ++++++++ packages/core/src/render3/hmr.ts | 5 +++-- packages/platform-browser/src/dom/dom_renderer.ts | 8 ++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/goldens/size-tracking/integration-payloads.json b/goldens/size-tracking/integration-payloads.json index 1398be73519a93..fe8a61ccb84ed1 100644 --- a/goldens/size-tracking/integration-payloads.json +++ b/goldens/size-tracking/integration-payloads.json @@ -47,7 +47,7 @@ }, "defer": { "uncompressed": { - "main": 12094, + "main": 12709, "polyfills": 33807, "defer.component": 345 } diff --git a/packages/animations/browser/src/render/animation_renderer.ts b/packages/animations/browser/src/render/animation_renderer.ts index d2cb627a8365bd..6c13d9d51f6007 100644 --- a/packages/animations/browser/src/render/animation_renderer.ts +++ b/packages/animations/browser/src/render/animation_renderer.ts @@ -132,4 +132,12 @@ export class AnimationRendererFactory implements RendererFactory2 { whenRenderingDone(): Promise { return this.engine.whenRenderingDone(); } + + /** + * Used during HMR to clear any cached data about a component. + * @param componentId ID of the component that is being replaced. + */ + protected componentReplaced(componentId: string) { + (this.delegate as {componentReplaced?: (id: string) => void}).componentReplaced?.(componentId); + } } diff --git a/packages/core/src/render3/hmr.ts b/packages/core/src/render3/hmr.ts index 9fc1903475c523..274933a6b37c96 100644 --- a/packages/core/src/render3/hmr.ts +++ b/packages/core/src/render3/hmr.ts @@ -124,8 +124,9 @@ function recreateMatchingLViews(def: ComponentDef, rootLView: LView): v */ function clearRendererCache(factory: RendererFactory, def: ComponentDef) { // Cast to read a private field. - // NOTE: This must be kept synchronized with the renderer factory implementation in platform-browser. - (factory as {rendererByCompId?: Map}).rendererByCompId?.delete(def.id); + // NOTE: This must be kept synchronized with the renderer factory implementation in + // platform-browser and platform-browser/animations. + (factory as {componentReplaced?: (id: string) => void}).componentReplaced?.(def.id); } /** diff --git a/packages/platform-browser/src/dom/dom_renderer.ts b/packages/platform-browser/src/dom/dom_renderer.ts index f1ebc21ddc1e7c..ef32a78f744239 100644 --- a/packages/platform-browser/src/dom/dom_renderer.ts +++ b/packages/platform-browser/src/dom/dom_renderer.ts @@ -195,6 +195,14 @@ export class DomRendererFactory2 implements RendererFactory2, OnDestroy { ngOnDestroy() { this.rendererByCompId.clear(); } + + /** + * Used during HMR to clear any cached data about a component. + * @param componentId ID of the component that is being replaced. + */ + protected componentReplaced(componentId: string) { + this.rendererByCompId.delete(componentId); + } } class DefaultDomRenderer2 implements Renderer2 { From a6cdbec09f33bd88388231e41d9d152e264994c1 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Mon, 6 Jan 2025 15:37:07 +0800 Subject: [PATCH 07/12] refactor: remove unnecessary TSLint rule flags (#59365) There are many TSLint rule flags in the source code that have no effect, and they can be safely removed to keep the code clean. PR Close #59365 --- .../docs-viewer/docs-viewer.component.ts | 1 - .../code-editor/code-mirror-editor.service.ts | 1 - .../home/services/home-animation.service.ts | 3 +-- .../devtools-app/devtools-app.component.ts | 1 - .../src/lib/component-tree.ts | 1 - .../src/lib/devtools-tabs/diffing/index.ts | 3 --- .../element-property-resolver.spec.ts | 2 -- .../src/lib/priority-aware-message-bus.ts | 1 - .../app/devtools-app/devtools-app.routes.ts | 1 - modules/benchmarks/src/util.ts | 1 - packages/common/http/test/fetch_spec.ts | 1 - packages/common/src/dom_adapter.ts | 1 - .../testing/src/navigation/fake_navigation.ts | 1 - .../primitives/event-dispatch/src/event.ts | 23 ------------------- .../event-dispatch/test/dispatcher_test.ts | 2 -- .../event-dispatch/test/event_test.ts | 12 ---------- .../event-dispatch/test/eventcontract_test.ts | 2 -- packages/core/src/console.ts | 1 - packages/core/src/event_emitter.ts | 3 ++- packages/core/src/hydration/api.ts | 1 - .../core/src/render3/list_reconciliation.ts | 1 - packages/core/src/render3/ng_module_ref.ts | 1 - .../core/src/util/ng_i18n_closure_mode.ts | 2 -- .../animation/animation_integration_spec.ts | 2 -- .../e2e/fill-mode/fill-mode.e2e-spec.ts | 1 - .../image-distortion.e2e-spec.ts | 1 - .../image-perf-warnings-lazy.e2e-spec.ts | 1 - .../image-perf-warnings-oversized.e2e-spec.ts | 1 - .../e2e/lcp-check/lcp-check.e2e-spec.ts | 1 - .../oversized-image.e2e-spec.ts | 1 - .../preconnect-check.e2e-spec.ts | 1 - .../core/ts/change_detect/change-detection.ts | 1 - .../examples/upgrade/static/ts/lite/module.ts | 1 - .../src/interfaces.ts | 1 - packages/platform-browser/src/hydration.ts | 1 - packages/zone.js/lib/zone-impl.ts | 7 ------ .../two_symbols_per_var.js | 1 - 37 files changed, 3 insertions(+), 84 deletions(-) diff --git a/adev/shared-docs/components/viewers/docs-viewer/docs-viewer.component.ts b/adev/shared-docs/components/viewers/docs-viewer/docs-viewer.component.ts index 30334d6563ca8b..3a33715c2a2345 100644 --- a/adev/shared-docs/components/viewers/docs-viewer/docs-viewer.component.ts +++ b/adev/shared-docs/components/viewers/docs-viewer/docs-viewer.component.ts @@ -79,7 +79,6 @@ export class DocViewer implements OnChanges { private readonly injector = inject(Injector); private readonly appRef = inject(ApplicationRef); - // tslint:disable-next-line:no-unused-variable private animateContent = false; private readonly pendingTasks = inject(PendingTasks); diff --git a/adev/src/app/editor/code-editor/code-mirror-editor.service.ts b/adev/src/app/editor/code-editor/code-mirror-editor.service.ts index 5c654a2f0656e1..bb476e9f625772 100644 --- a/adev/src/app/editor/code-editor/code-mirror-editor.service.ts +++ b/adev/src/app/editor/code-editor/code-mirror-editor.service.ts @@ -220,7 +220,6 @@ export class CodeMirrorEditor { if (!this.currentFile().filename.endsWith('.ts')) return; this.tsVfsWorker.postMessage(request); - // tslint:disable-next-line:semicolon }; private getVfsEnvFileSystemMap(): Map { diff --git a/adev/src/app/features/home/services/home-animation.service.ts b/adev/src/app/features/home/services/home-animation.service.ts index 9600f18181523d..bef70be9233f0c 100644 --- a/adev/src/app/features/home/services/home-animation.service.ts +++ b/adev/src/app/features/home/services/home-animation.service.ts @@ -491,8 +491,7 @@ export class HomeAnimation { this.canvas.update(time, deltaTime, frame, this.progress); // TODO: add support for class fields arrow function - // Using disable-next-line to avoid tslint errors - An arrow function is required for binding to the listener - // tslint:disable-next-line:semicolon + // An arrow function is required for binding to the listener }; /** diff --git a/devtools/projects/demo-standalone/src/app/devtools-app/devtools-app.component.ts b/devtools/projects/demo-standalone/src/app/devtools-app/devtools-app.component.ts index da6da0d886049c..adc938a4d23087 100644 --- a/devtools/projects/demo-standalone/src/app/devtools-app/devtools-app.component.ts +++ b/devtools/projects/demo-standalone/src/app/devtools-app/devtools-app.component.ts @@ -24,7 +24,6 @@ import {FrameManager} from '../../../../../projects/ng-devtools/src/lib/frame_ma new IFrameMessageBus( 'angular-devtools', 'angular-devtools-backend', - // tslint:disable-next-line: no-non-null-assertion () => (document.querySelector('#sample-app') as HTMLIFrameElement).contentWindow!, ), ); diff --git a/devtools/projects/ng-devtools-backend/src/lib/component-tree.ts b/devtools/projects/ng-devtools-backend/src/lib/component-tree.ts index 2f73e7e5fc7cd4..e18f007409e60f 100644 --- a/devtools/projects/ng-devtools-backend/src/lib/component-tree.ts +++ b/devtools/projects/ng-devtools-backend/src/lib/component-tree.ts @@ -490,7 +490,6 @@ const getRootLViewsHelper = (element: Element, rootLViews = new Set()): Set rootLViews.add(lView); return rootLViews; } - // tslint:disable-next-line: prefer-for-of for (let i = 0; i < element.children.length; i++) { getRootLViewsHelper(element.children[i], rootLViews); } diff --git a/devtools/projects/ng-devtools/src/lib/devtools-tabs/diffing/index.ts b/devtools/projects/ng-devtools/src/lib/devtools-tabs/diffing/index.ts index f0066c62470621..8d20e288f9864e 100644 --- a/devtools/projects/ng-devtools/src/lib/devtools-tabs/diffing/index.ts +++ b/devtools/projects/ng-devtools/src/lib/devtools-tabs/diffing/index.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.dev/license */ -// tslint:disable-next-line:deprecation import {DefaultIterableDiffer} from '@angular/core'; export interface MovedRecord { @@ -56,7 +55,6 @@ export const diff = ( (a[record.currentIndex] as any)[prop] = (b[record.currentIndex] as any)[prop]; }); if (!alreadySet[record.previousIndex]) { - // tslint:disable-next-line: no-non-null-assertion a[record.previousIndex] = null!; } alreadySet[record.currentIndex] = true; @@ -79,7 +77,6 @@ export const diff = ( return; } if (record.currentIndex === null && !alreadySet[record.previousIndex]) { - // tslint:disable-next-line: no-non-null-assertion a[record.previousIndex] = null!; } removedItems.push(record.item); diff --git a/devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/property-resolver/element-property-resolver.spec.ts b/devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/property-resolver/element-property-resolver.spec.ts index f5a341f36a1632..2862ed7e747531 100644 --- a/devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/property-resolver/element-property-resolver.spec.ts +++ b/devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/property-resolver/element-property-resolver.spec.ts @@ -110,7 +110,6 @@ describe('ElementPropertyResolver', () => { }); const fooController = resolver.getDirectiveController('FooCmp'); expect(fooController).toBeTruthy(); - // tslint:disable-next-line: no-non-null-assertion const fooProps = fooController!.getExpandedProperties(); expect(fooProps).toEqual([ { @@ -130,7 +129,6 @@ describe('ElementPropertyResolver', () => { const barController = resolver.getDirectiveController('BarDir'); expect(barController).toBeTruthy(); - // tslint:disable-next-line: no-non-null-assertion const barProps = barController!.getExpandedProperties(); expect(barProps).toEqual([ { diff --git a/devtools/projects/protocol/src/lib/priority-aware-message-bus.ts b/devtools/projects/protocol/src/lib/priority-aware-message-bus.ts index cf1b603220fd82..fd2e83c94c4a52 100644 --- a/devtools/projects/protocol/src/lib/priority-aware-message-bus.ts +++ b/devtools/projects/protocol/src/lib/priority-aware-message-bus.ts @@ -83,7 +83,6 @@ export class PriorityAwareMessageBus extends MessageBus { if (blockedBy) { // The source code here is safe. // TypeScript type inference ignores the null check here. - // tslint:disable-next-line: no-non-null-assertion for (const blocker of blockedBy!) { if (this._inProgress[blocker]) { return false; diff --git a/devtools/src/app/devtools-app/devtools-app.routes.ts b/devtools/src/app/devtools-app/devtools-app.routes.ts index f1b1a18e104d17..9f4e03d7887cf8 100644 --- a/devtools/src/app/devtools-app/devtools-app.routes.ts +++ b/devtools/src/app/devtools-app/devtools-app.routes.ts @@ -26,7 +26,6 @@ export const DEVTOOL_ROUTES: Routes = [ new IFrameMessageBus( 'angular-devtools', 'angular-devtools-backend', - // tslint:disable-next-line: no-non-null-assertion () => (document.querySelector('#sample-app') as HTMLIFrameElement).contentWindow!, ), ); diff --git a/modules/benchmarks/src/util.ts b/modules/benchmarks/src/util.ts index 7d90447aef67d8..ba2c8122ca8279 100644 --- a/modules/benchmarks/src/util.ts +++ b/modules/benchmarks/src/util.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.dev/license */ -/* tslint:disable:no-console */ urlParamsToForm(); export function getIntParameter(name: string) { diff --git a/packages/common/http/test/fetch_spec.ts b/packages/common/http/test/fetch_spec.ts index f1fa8e79968c08..81dbd56cf949e2 100644 --- a/packages/common/http/test/fetch_spec.ts +++ b/packages/common/http/test/fetch_spec.ts @@ -495,7 +495,6 @@ export class MockFetchFactory extends FetchFactory { this.clearWarningTimeout = () => clearTimeout(timeoutId); return this.promise; - // tslint:disable:semicolon }; mockFlush( diff --git a/packages/common/src/dom_adapter.ts b/packages/common/src/dom_adapter.ts index 8df0c109afa31e..0025a92832f559 100644 --- a/packages/common/src/dom_adapter.ts +++ b/packages/common/src/dom_adapter.ts @@ -16,7 +16,6 @@ export function setRootDomAdapter(adapter: DomAdapter) { _DOM ??= adapter; } -/* tslint:disable:requireParameterType */ /** * Provides DOM operations in an environment-agnostic way. * diff --git a/packages/common/testing/src/navigation/fake_navigation.ts b/packages/common/testing/src/navigation/fake_navigation.ts index b3d02f0d3c407d..b84b85b96b85f8 100644 --- a/packages/common/testing/src/navigation/fake_navigation.ts +++ b/packages/common/testing/src/navigation/fake_navigation.ts @@ -603,7 +603,6 @@ export class FakeNavigationHistoryEntry implements NavigationHistoryEntry { private readonly state: unknown; private readonly historyState: unknown; - // tslint:disable-next-line:no-any ondispose: ((this: NavigationHistoryEntry, ev: Event) => any) | null = null; constructor( diff --git a/packages/core/primitives/event-dispatch/src/event.ts b/packages/core/primitives/event-dispatch/src/event.ts index 2173f7a8fbfa9d..1f11f260372eeb 100644 --- a/packages/core/primitives/event-dispatch/src/event.ts +++ b/packages/core/primitives/event-dispatch/src/event.ts @@ -90,10 +90,8 @@ export function removeEventListener(element: Element, info: EventHandlerInfo) { const options = typeof info.passive === 'boolean' ? {capture: info.capture} : info.capture; element.removeEventListener(info.eventType, info.handler as EventListener, options); // `detachEvent` is an old DOM API. - // tslint:disable-next-line:no-any } else if ((element as any).detachEvent) { // `detachEvent` is an old DOM API. - // tslint:disable-next-line:no-any (element as any).detachEvent(`on${info.eventType}`, info.handler); } } @@ -147,13 +145,10 @@ let isMac: boolean = typeof navigator !== 'undefined' && /Macintosh/.test(naviga function isMiddleClick(e: Event): boolean { return ( // `which` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).which === 2 || // `which` is an old DOM API. - // tslint:disable-next-line:no-any ((e as any).which == null && // `button` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).button === 4) // middle click for IE ); } @@ -168,14 +163,11 @@ function isMiddleClick(e: Event): boolean { export function isModifiedClickEvent(e: Event): boolean { return ( // `metaKey` is an old DOM API. - // tslint:disable-next-line:no-any (isMac && (e as any).metaKey) || // `ctrlKey` is an old DOM API. - // tslint:disable-next-line:no-any (!isMac && (e as any).ctrlKey) || isMiddleClick(e) || // `shiftKey` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).shiftKey ); } @@ -214,7 +206,6 @@ export function isValidActionKeyTarget(el: Element): boolean { return false; } // `isContentEditable` is an old DOM API. - // tslint:disable-next-line:no-any if ((el as any).isContentEditable) { return false; } @@ -230,16 +221,12 @@ export function isValidActionKeyTarget(el: Element): boolean { function hasModifierKey(e: Event): boolean { return ( // `ctrlKey` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).ctrlKey || // `shiftKey` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).shiftKey || // `altKey` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).altKey || // `metaKey` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).metaKey ); } @@ -294,10 +281,8 @@ export function shouldCallPreventDefaultOnNativeHtmlControl(e: Event): boolean { export function isActionKeyEvent(e: Event): boolean { let key = // `which` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).which || // `keyCode` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).keyCode; if (!key && (e as KeyboardEvent).key) { key = ACTION_KEY_TO_KEYCODE[(e as KeyboardEvent).key]; @@ -374,10 +359,8 @@ const NATIVELY_FOCUSABLE_ELEMENTS: {[key: string]: number} = { export function isSpaceKeyEvent(e: Event): boolean { const key = // `which` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).which || // `keyCode` is an old DOM API. - // tslint:disable-next-line:no-any (e as any).keyCode; const el = getTarget(e); const elementName = ((el as HTMLInputElement).type || el.tagName).toUpperCase(); @@ -404,7 +387,6 @@ export function isSpaceKeyEvent(e: Event): boolean { */ export function isMouseSpecialEvent(e: Event, type: string, element: Element): boolean { // `relatedTarget` is an old DOM API. - // tslint:disable-next-line:no-any const related = (e as any).relatedTarget as Node; return ( @@ -436,7 +418,6 @@ export function createMouseSpecialEvent(e: Event, target: Element): Event { // this event into a pseudo-real mouseenter/mouseleave event by adjusting // its type. // - // tslint:disable-next-line:no-any const copy: {-readonly [P in keyof Event]?: Event[P]} = {}; for (const property in e) { if (property === 'srcElement' || property === 'target') { @@ -444,14 +425,12 @@ export function createMouseSpecialEvent(e: Event, target: Element): Event { } const key = property as keyof Event; // Making a copy requires iterating through all properties of `Event`. - // tslint:disable-next-line:no-dict-access-on-struct-type const value = e[key]; if (typeof value === 'function') { continue; } // Value should be the expected type, but the value of `key` is not known // statically. - // tslint:disable-next-line:no-any copy[key] = value as any; } if (e.type === EventType.MOUSEOVER) { @@ -523,14 +502,12 @@ export function recreateTouchEventAsClick(event: TouchEvent): MouseEvent { } const key = property as keyof TouchEvent; // Making a copy requires iterating through all properties of `TouchEvent`. - // tslint:disable-next-line:no-dict-access-on-struct-type const value = event[key]; if (typeof value === 'function') { continue; } // Value should be the expected type, but the value of `key` is not known // statically. - // tslint:disable-next-line:no-any click[key as keyof MouseEvent] = value as any; } diff --git a/packages/core/primitives/event-dispatch/test/dispatcher_test.ts b/packages/core/primitives/event-dispatch/test/dispatcher_test.ts index 9040a62447f9f7..119c2eb8f31682 100644 --- a/packages/core/primitives/event-dispatch/test/dispatcher_test.ts +++ b/packages/core/primitives/event-dispatch/test/dispatcher_test.ts @@ -193,7 +193,6 @@ function dispatchMouseEvent( } = {}, ) { // createEvent/initMouseEvent is used to support IE11 - // tslint:disable:deprecation const event = document.createEvent('MouseEvent'); event.initMouseEvent( type, @@ -239,7 +238,6 @@ function dispatchKeyboardEvent( } = {}, ) { // createEvent/initKeyboardEvent is used to support IE11 - // tslint:disable:deprecation const event = document.createEvent('KeyboardEvent'); event.initKeyboardEvent( type, diff --git a/packages/core/primitives/event-dispatch/test/event_test.ts b/packages/core/primitives/event-dispatch/test/event_test.ts index 9d6691150f1ce9..49ed1b467abea6 100644 --- a/packages/core/primitives/event-dispatch/test/event_test.ts +++ b/packages/core/primitives/event-dispatch/test/event_test.ts @@ -621,7 +621,6 @@ describe('event test.ts', () => { const originalEvent = document.createEvent('UIEvent') as TouchEvent; originalEvent.initEvent('touchend', false, false); // touches is readonly. - // tslint:disable-next-line:no-any (originalEvent as any).touches = [ {clientX: 1, clientY: 2, screenX: 3, screenY: 4, pageX: 5, pageY: 6}, {}, @@ -640,7 +639,6 @@ describe('event test.ts', () => { const originalEvent = document.createEvent('UIEvent') as TouchEvent; originalEvent.initEvent('touchend', false, false); // changedTouches is readonly. - // tslint:disable-next-line:no-any (originalEvent as any).changedTouches = [ { clientX: 'other', @@ -660,7 +658,6 @@ describe('event test.ts', () => { expect(event.screenX).toBe(3); expect(event.screenY).toBe(4); // originalEventType is a non-standard added property. - // tslint:disable-next-line:no-any expect((event as any).originalEventType).toBe('touchend'); }); @@ -668,10 +665,8 @@ describe('event test.ts', () => { const originalEvent = document.createEvent('UIEvent') as TouchEvent; originalEvent.initEvent('touchend', false, false); // changedTouches is readonly. - // tslint:disable-next-line:no-any (originalEvent as any).changedTouches = []; // touches is readonly. - // tslint:disable-next-line:no-any (originalEvent as any).touches = [{clientX: 1}, {}]; const event = jsactionEvent.recreateTouchEventAsClick(originalEvent); @@ -685,7 +680,6 @@ describe('event test.ts', () => { const originalEvent = document.createEvent('UIEvent') as TouchEvent; originalEvent.initEvent('touchend', false, false); // touches is readonly. - // tslint:disable-next-line:no-any (originalEvent as any).touches = [ {'clientX': 101, 'clientY': 102, 'screenX': 201, 'screenY': 202}, ]; @@ -698,7 +692,6 @@ describe('event test.ts', () => { expect(event.type).toBe(EventType.CLICK); // originalEventType is a non-standard added property. - // tslint:disable-next-line:no-any expect((event as any).originalEventType).toBe(EventType.TOUCHEND); expect(event.target).toBe(div); expect(event.clientX).toBe(101); @@ -720,7 +713,6 @@ describe('event test.ts', () => { expect(event.type).toBe(EventType.CLICK); // originalEventType is a non-standard added property. - // tslint:disable-next-line:no-any expect((event as any).originalEventType).toBe(EventType.TOUCHEND); expect(event.target).toBe(div); expect(event.clientX).toBeUndefined(); @@ -733,7 +725,6 @@ describe('event test.ts', () => { const originalEvent = document.createEvent('UIEvent') as TouchEvent; originalEvent.initEvent('touchend', false, false); // touches is readonly. - // tslint:disable-next-line:no-any (originalEvent as any).touches = [ {clientX: 1, clientY: 2, screenX: 3, screenY: 4, pageX: 5, pageY: 6}, {}, @@ -747,11 +738,9 @@ describe('event test.ts', () => { expect(event.defaultPrevented).toBe(true); // _propagationStopped is a non-standard added property. - // tslint:disable-next-line:no-any expect((event as any)['_propagationStopped']).toBe(false); event.stopPropagation(); // _propagationStopped is a non-standard added property. - // tslint:disable-next-line:no-any expect((event as any)['_propagationStopped']).toBe(true); }); @@ -759,7 +748,6 @@ describe('event test.ts', () => { const originalEvent = document.createEvent('UIEvent') as TouchEvent; originalEvent.initEvent('touchend', false, false); // touches is readonly. - // tslint:disable-next-line:no-any (originalEvent as any).touches = [ {clientX: 1, clientY: 2, screenX: 3, screenY: 4, pageX: 5, pageY: 6}, {}, diff --git a/packages/core/primitives/event-dispatch/test/eventcontract_test.ts b/packages/core/primitives/event-dispatch/test/eventcontract_test.ts index 68a2eacf09f7eb..c83a9cd09f2e69 100644 --- a/packages/core/primitives/event-dispatch/test/eventcontract_test.ts +++ b/packages/core/primitives/event-dispatch/test/eventcontract_test.ts @@ -129,7 +129,6 @@ function dispatchMouseEvent( } = {}, ) { // createEvent/initMouseEvent is used to support IE11 - // tslint:disable:deprecation const event = document.createEvent('MouseEvent'); event.initMouseEvent( type, @@ -301,7 +300,6 @@ describe('EventContract', () => { }); // createEvent/initEvent is used to support IE11 - // tslint:disable:deprecation const animationEndEvent = document.createEvent('AnimationEvent'); animationEndEvent.initEvent('webkitanimationend', true, true); // tslint:enable:deprecation diff --git a/packages/core/src/console.ts b/packages/core/src/console.ts index d15c30155d9c2d..d4939d52dce87a 100644 --- a/packages/core/src/console.ts +++ b/packages/core/src/console.ts @@ -16,7 +16,6 @@ export class Console { } // Note: for reporting errors use `DOM.logError()` as it is platform specific warn(message: string): void { - // tslint:disable-next-line:no-console console.warn(message); } } diff --git a/packages/core/src/event_emitter.ts b/packages/core/src/event_emitter.ts index e6f47cc722a64f..e46696bba3e2c4 100644 --- a/packages/core/src/event_emitter.ts +++ b/packages/core/src/event_emitter.ts @@ -110,7 +110,8 @@ export interface EventEmitter extends Subject, OutputRef { } class EventEmitter_ extends Subject implements OutputRef { - __isAsync: boolean; // tslint:disable-line + // tslint:disable-next-line:require-internal-with-underscore + __isAsync: boolean; destroyRef: DestroyRef | undefined = undefined; private readonly pendingTasks: PendingTasksInternal | undefined = undefined; diff --git a/packages/core/src/hydration/api.ts b/packages/core/src/hydration/api.ts index 6f31c176abd63a..afd7531c08c679 100644 --- a/packages/core/src/hydration/api.ts +++ b/packages/core/src/hydration/api.ts @@ -250,7 +250,6 @@ export function withDomHydration(): EnvironmentProviders { 'Make sure the `provideClientHydration()` is included into the list ' + 'of providers in the server part of the application configuration.', ); - // tslint:disable-next-line:no-console console.warn(message); } }, diff --git a/packages/core/src/render3/list_reconciliation.ts b/packages/core/src/render3/list_reconciliation.ts index 2ac43c432981b1..bfc4bb64de33f6 100644 --- a/packages/core/src/render3/list_reconciliation.ts +++ b/packages/core/src/render3/list_reconciliation.ts @@ -334,7 +334,6 @@ export function reconcile( '.', ); - // tslint:disable-next-line:no-console console.warn(message); } } diff --git a/packages/core/src/render3/ng_module_ref.ts b/packages/core/src/render3/ng_module_ref.ts index 11bde2cf7aff4d..7bb44fa00864f6 100644 --- a/packages/core/src/render3/ng_module_ref.ts +++ b/packages/core/src/render3/ng_module_ref.ts @@ -51,7 +51,6 @@ export const createNgModuleRef = createNgModule; export class NgModuleRef extends viewEngine_NgModuleRef implements InternalNgModuleRef { // tslint:disable-next-line:require-internal-with-underscore _bootstrapComponents: Type[] = []; - // tslint:disable-next-line:require-internal-with-underscore private readonly _r3Injector: R3Injector; override instance!: T; destroyCbs: (() => void)[] | null = []; diff --git a/packages/core/src/util/ng_i18n_closure_mode.ts b/packages/core/src/util/ng_i18n_closure_mode.ts index 829a58b68a343d..ed9ad457898a10 100644 --- a/packages/core/src/util/ng_i18n_closure_mode.ts +++ b/packages/core/src/util/ng_i18n_closure_mode.ts @@ -21,10 +21,8 @@ if (typeof ngI18nClosureMode === 'undefined') { // Make sure to refer to ngI18nClosureMode as ['ngI18nClosureMode'] for closure. // NOTE: we need to have it in IIFE so that the tree-shaker is happy. (function () { - // tslint:disable-next-line:no-toplevel-property-access global['ngI18nClosureMode'] = // TODO(FW-1250): validate that this actually, you know, works. - // tslint:disable-next-line:no-toplevel-property-access typeof goog !== 'undefined' && typeof goog.getMsg === 'function'; })(); } diff --git a/packages/core/test/animation/animation_integration_spec.ts b/packages/core/test/animation/animation_integration_spec.ts index d2a223a4f36cd1..cb4954f56f40cd 100644 --- a/packages/core/test/animation/animation_integration_spec.ts +++ b/packages/core/test/animation/animation_integration_spec.ts @@ -3078,11 +3078,9 @@ const DEFAULT_COMPONENT_ID = '1'; exp2: any = false; event1: AnimationEvent | undefined; event2: AnimationEvent | undefined; - // tslint:disable:semicolon callback1 = (event: any) => { this.event1 = event; }; - // tslint:disable:semicolon callback2 = (event: any) => { this.event2 = event; }; diff --git a/packages/core/test/bundling/image-directive/e2e/fill-mode/fill-mode.e2e-spec.ts b/packages/core/test/bundling/image-directive/e2e/fill-mode/fill-mode.e2e-spec.ts index 757de5c151b172..f2cc9b01a5050b 100644 --- a/packages/core/test/bundling/image-directive/e2e/fill-mode/fill-mode.e2e-spec.ts +++ b/packages/core/test/bundling/image-directive/e2e/fill-mode/fill-mode.e2e-spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.dev/license */ -/* tslint:disable:no-console */ import {browser} from 'protractor'; import {logging} from 'selenium-webdriver'; diff --git a/packages/core/test/bundling/image-directive/e2e/image-distortion/image-distortion.e2e-spec.ts b/packages/core/test/bundling/image-directive/e2e/image-distortion/image-distortion.e2e-spec.ts index 31e736e05a533b..84e57f8efc3118 100644 --- a/packages/core/test/bundling/image-directive/e2e/image-distortion/image-distortion.e2e-spec.ts +++ b/packages/core/test/bundling/image-directive/e2e/image-distortion/image-distortion.e2e-spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.dev/license */ -/* tslint:disable:no-console */ import {browser} from 'protractor'; import {logging} from 'selenium-webdriver'; diff --git a/packages/core/test/bundling/image-directive/e2e/image-perf-warnings-lazy/image-perf-warnings-lazy.e2e-spec.ts b/packages/core/test/bundling/image-directive/e2e/image-perf-warnings-lazy/image-perf-warnings-lazy.e2e-spec.ts index f760cdf37f64b3..1883240f0da9a0 100644 --- a/packages/core/test/bundling/image-directive/e2e/image-perf-warnings-lazy/image-perf-warnings-lazy.e2e-spec.ts +++ b/packages/core/test/bundling/image-directive/e2e/image-perf-warnings-lazy/image-perf-warnings-lazy.e2e-spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.dev/license */ -/* tslint:disable:no-console */ import {browser, by, element} from 'protractor'; import {logging} from 'selenium-webdriver'; diff --git a/packages/core/test/bundling/image-directive/e2e/image-perf-warnings-oversized/image-perf-warnings-oversized.e2e-spec.ts b/packages/core/test/bundling/image-directive/e2e/image-perf-warnings-oversized/image-perf-warnings-oversized.e2e-spec.ts index a837bc4dc55a78..81ca16ffc75999 100644 --- a/packages/core/test/bundling/image-directive/e2e/image-perf-warnings-oversized/image-perf-warnings-oversized.e2e-spec.ts +++ b/packages/core/test/bundling/image-directive/e2e/image-perf-warnings-oversized/image-perf-warnings-oversized.e2e-spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.dev/license */ -/* tslint:disable:no-console */ import {browser} from 'protractor'; import {logging} from 'selenium-webdriver'; diff --git a/packages/core/test/bundling/image-directive/e2e/lcp-check/lcp-check.e2e-spec.ts b/packages/core/test/bundling/image-directive/e2e/lcp-check/lcp-check.e2e-spec.ts index a89f13adadebf6..c6b7b1c0b3d08f 100644 --- a/packages/core/test/bundling/image-directive/e2e/lcp-check/lcp-check.e2e-spec.ts +++ b/packages/core/test/bundling/image-directive/e2e/lcp-check/lcp-check.e2e-spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.dev/license */ -/* tslint:disable:no-console */ import {browser, by, element} from 'protractor'; import {logging} from 'selenium-webdriver'; diff --git a/packages/core/test/bundling/image-directive/e2e/oversized-image/oversized-image.e2e-spec.ts b/packages/core/test/bundling/image-directive/e2e/oversized-image/oversized-image.e2e-spec.ts index 313bec0c99d69e..4f396b04aeba8f 100644 --- a/packages/core/test/bundling/image-directive/e2e/oversized-image/oversized-image.e2e-spec.ts +++ b/packages/core/test/bundling/image-directive/e2e/oversized-image/oversized-image.e2e-spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.dev/license */ -/* tslint:disable:no-console */ import {browser, by, element, ExpectedConditions} from 'protractor'; import {logging} from 'selenium-webdriver'; diff --git a/packages/core/test/bundling/image-directive/e2e/preconnect-check/preconnect-check.e2e-spec.ts b/packages/core/test/bundling/image-directive/e2e/preconnect-check/preconnect-check.e2e-spec.ts index c020c33dba678a..02b3ccd9747298 100644 --- a/packages/core/test/bundling/image-directive/e2e/preconnect-check/preconnect-check.e2e-spec.ts +++ b/packages/core/test/bundling/image-directive/e2e/preconnect-check/preconnect-check.e2e-spec.ts @@ -6,7 +6,6 @@ * found in the LICENSE file at https://angular.dev/license */ -/* tslint:disable:no-console */ import {browser, by, element, ElementHelper} from 'protractor'; import {logging} from 'selenium-webdriver'; diff --git a/packages/examples/core/ts/change_detect/change-detection.ts b/packages/examples/core/ts/change_detect/change-detection.ts index a8b4e8776ed189..278a4a781b8f59 100644 --- a/packages/examples/core/ts/change_detect/change-detection.ts +++ b/packages/examples/core/ts/change_detect/change-detection.ts @@ -5,7 +5,6 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ -/* tslint:disable:no-console */ import { ChangeDetectionStrategy, ChangeDetectorRef, diff --git a/packages/examples/upgrade/static/ts/lite/module.ts b/packages/examples/upgrade/static/ts/lite/module.ts index 401ea8528939a9..4477b84512908d 100644 --- a/packages/examples/upgrade/static/ts/lite/module.ts +++ b/packages/examples/upgrade/static/ts/lite/module.ts @@ -24,7 +24,6 @@ import {BrowserModule} from '@angular/platform-browser'; // #docregion basic-how-to import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; // #enddocregion -/* tslint:disable: no-duplicate-imports */ // #docregion basic-how-to import {downgradeComponent, downgradeModule, UpgradeComponent} from '@angular/upgrade/static'; diff --git a/packages/misc/angular-in-memory-web-api/src/interfaces.ts b/packages/misc/angular-in-memory-web-api/src/interfaces.ts index f17356de843788..18980f837e93da 100644 --- a/packages/misc/angular-in-memory-web-api/src/interfaces.ts +++ b/packages/misc/angular-in-memory-web-api/src/interfaces.ts @@ -132,7 +132,6 @@ export class InMemoryBackendConfig implements InMemoryBackendConfigArgs { /** Return information (UriInfo) about a URI */ export function parseUri(str: string): UriInfo { // Adapted from parseuri package - http://blog.stevenlevithan.com/archives/parseuri - // tslint:disable-next-line:max-line-length const URL_REGEX = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/; const m = URL_REGEX.exec(str); diff --git a/packages/platform-browser/src/hydration.ts b/packages/platform-browser/src/hydration.ts index fe8a2e510c1ce0..4e716d0ac47fea 100644 --- a/packages/platform-browser/src/hydration.ts +++ b/packages/platform-browser/src/hydration.ts @@ -163,7 +163,6 @@ function provideZoneJsCompatibilityDetector(): Provider[] { 'that uses a custom or a noop Zone.js implementation. ' + 'This is not yet a fully supported configuration.', ); - // tslint:disable-next-line:no-console console.warn(message); } }, diff --git a/packages/zone.js/lib/zone-impl.ts b/packages/zone.js/lib/zone-impl.ts index 9b47fa2b2e7eca..5d7c2af6e5d7d6 100644 --- a/packages/zone.js/lib/zone-impl.ts +++ b/packages/zone.js/lib/zone-impl.ts @@ -782,7 +782,6 @@ export function initZone(): ZoneType { mark('Zone'); class ZoneImpl implements AmbientZone { - // tslint:disable-next-line:require-internal-with-underscore static __symbol__: (name: string) => string = __symbol__; static assertZonePatched() { @@ -813,7 +812,6 @@ export function initZone(): ZoneType { return _currentTask; } - // tslint:disable-next-line:require-internal-with-underscore static __load_patch(name: string, fn: PatchFn, ignoreDuplicate = false): void { if (patches.hasOwnProperty(name)) { // `checkDuplicate` option is defined from global variable @@ -1372,7 +1370,6 @@ export function initZone(): ZoneType { } } - // tslint:disable-next-line:require-internal-with-underscore _updateTaskCount(type: TaskType, count: number) { const counts = this._taskCounts; const prev = counts[type]; @@ -1400,12 +1397,9 @@ export function initZone(): ZoneType { public data: TaskData | undefined; public scheduleFn: ((task: Task) => void) | undefined; public cancelFn: ((task: Task) => void) | undefined; - // tslint:disable-next-line:require-internal-with-underscore _zone: ZoneImpl | null = null; public runCount: number = 0; - // tslint:disable-next-line:require-internal-with-underscore _zoneDelegates: _ZoneDelegate[] | null = null; - // tslint:disable-next-line:require-internal-with-underscore _state: TaskState = 'notScheduled'; constructor( @@ -1464,7 +1458,6 @@ export function initZone(): ZoneType { this._transitionTo(notScheduled, scheduling); } - // tslint:disable-next-line:require-internal-with-underscore _transitionTo(toState: TaskState, fromState1: TaskState, fromState2?: TaskState) { if (this._state === fromState1 || this._state === fromState2) { this._state = toState; diff --git a/tools/symbol-extractor/symbol_extractor_spec/two_symbols_per_var.js b/tools/symbol-extractor/symbol_extractor_spec/two_symbols_per_var.js index 38a7db13521264..10c689a9468fbd 100644 --- a/tools/symbol-extractor/symbol_extractor_spec/two_symbols_per_var.js +++ b/tools/symbol-extractor/symbol_extractor_spec/two_symbols_per_var.js @@ -29,6 +29,5 @@ ); })(); var no_initializer; - // tslint:disable-next-line:no-console console.error(new A().a(), new B().b()); })(); From 9b8f699032dbcc584126215afd25c8e710ef7035 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Mon, 6 Jan 2025 16:08:31 +0800 Subject: [PATCH 08/12] refactor: remove unnecessary `// tslint:disable` rule flags in devtools (#59365) Files in the vendor directory have been excluded in tslint.json. PR Close #59365 --- .../src/lib/vendor/angular-split/lib/component/interface.ts | 2 -- .../lib/vendor/angular-split/lib/component/split.component.ts | 1 - .../vendor/angular-split/lib/component/splitArea.directive.ts | 2 -- .../src/lib/vendor/angular-split/lib/component/utils.ts | 1 - .../ng-devtools/src/lib/vendor/angular-split/public_api.ts | 1 - 5 files changed, 7 deletions(-) diff --git a/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/interface.ts b/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/interface.ts index 4f6942cfb7028e..d20e173c5bdeb6 100644 --- a/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/interface.ts +++ b/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/interface.ts @@ -1,5 +1,3 @@ -// tslint:disable - import {SplitAreaDirective} from './splitArea.directive'; export interface IPoint { diff --git a/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/split.component.ts b/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/split.component.ts index 0fda04568c451c..5dbc66d55cc503 100644 --- a/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/split.component.ts +++ b/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/split.component.ts @@ -1,4 +1,3 @@ -// tslint:disable import { AfterViewInit, ChangeDetectionStrategy, diff --git a/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/splitArea.directive.ts b/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/splitArea.directive.ts index 25d24766114654..1118f059755940 100644 --- a/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/splitArea.directive.ts +++ b/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/splitArea.directive.ts @@ -1,5 +1,3 @@ -// tslint:disable - import {Directive, ElementRef, Input, NgZone, OnDestroy, OnInit, Renderer2} from '@angular/core'; import {SplitComponent} from '../component/split.component'; diff --git a/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/utils.ts b/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/utils.ts index 3abd266ce684b5..54e675a5b4fb4a 100644 --- a/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/utils.ts +++ b/devtools/projects/ng-devtools/src/lib/vendor/angular-split/lib/component/utils.ts @@ -1,4 +1,3 @@ -// tslint:disable import {ElementRef} from '@angular/core'; import { diff --git a/devtools/projects/ng-devtools/src/lib/vendor/angular-split/public_api.ts b/devtools/projects/ng-devtools/src/lib/vendor/angular-split/public_api.ts index ff9042c22bb81a..8d5f94a0facd4a 100644 --- a/devtools/projects/ng-devtools/src/lib/vendor/angular-split/public_api.ts +++ b/devtools/projects/ng-devtools/src/lib/vendor/angular-split/public_api.ts @@ -1,4 +1,3 @@ -// tslint:disable /* * Public API Surface of angular-split */ From aaf1fbb1527a75811bf88fa08c4dde8478fd071a Mon Sep 17 00:00:00 2001 From: Matthieu Riegler Date: Tue, 7 Jan 2025 15:22:23 +0100 Subject: [PATCH 09/12] refactor(core): remove outdated comment. (#59401) Should have been done by #58238, but was probably missed in a rebase. fixes #59397 PR Close #59401 --- packages/core/src/render3/def_getters.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/src/render3/def_getters.ts b/packages/core/src/render3/def_getters.ts index 21e539226febfc..29095d6d384f41 100644 --- a/packages/core/src/render3/def_getters.ts +++ b/packages/core/src/render3/def_getters.ts @@ -50,6 +50,5 @@ export function getPipeDef(type: any): PipeDef | null { */ export function isStandalone(type: Type): boolean { const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef(type); - // TODO: standalone as default value (invert the condition) - return def !== null ? def.standalone : false; + return def !== null && def.standalone; } From 5685b4c6aa56cbf4315034a2ef6e987eff5ad8d1 Mon Sep 17 00:00:00 2001 From: arturovt Date: Tue, 7 Jan 2025 00:14:47 +0200 Subject: [PATCH 10/12] refactor(core): prevent duplicating LView destroyed checks (#59387) The `type_checks` module already exposes a utility function that checks whether `LView` is marked as destroyed. There is no need to check flags in other places, as we can reuse the helper function. PR Close #59387 --- .../render3/instructions/change_detection.ts | 5 +++- .../src/render3/interfaces/type_checks.ts | 1 + .../core/src/render3/node_manipulation.ts | 26 +++++++++---------- packages/core/src/render3/util/view_utils.ts | 4 +-- packages/core/src/render3/view_ref.ts | 4 +-- .../bundle.golden_symbols.json | 1 + .../animations/bundle.golden_symbols.json | 1 + .../cyclic_import/bundle.golden_symbols.json | 1 + .../bundling/defer/bundle.golden_symbols.json | 1 + .../forms_reactive/bundle.golden_symbols.json | 1 + .../bundle.golden_symbols.json | 1 + .../hello_world/bundle.golden_symbols.json | 1 + .../hydration/bundle.golden_symbols.json | 1 + .../router/bundle.golden_symbols.json | 1 + .../bundle.golden_symbols.json | 1 + .../bundling/todo/bundle.golden_symbols.json | 1 + 16 files changed, 32 insertions(+), 19 deletions(-) diff --git a/packages/core/src/render3/instructions/change_detection.ts b/packages/core/src/render3/instructions/change_detection.ts index 2a7040fdac05b4..06fe193302daae 100644 --- a/packages/core/src/render3/instructions/change_detection.ts +++ b/packages/core/src/render3/instructions/change_detection.ts @@ -69,6 +69,7 @@ import { refreshContentQueries, } from './shared'; import {runEffectsInView} from '../reactivity/view_effect_runner'; +import {isDestroyed} from '../interfaces/type_checks'; /** * The maximum number of times the change detection traversal will rerun before throwing an error. @@ -193,8 +194,10 @@ export function refreshView( context: T, ) { ngDevMode && assertEqual(isCreationMode(lView), false, 'Should be run in update mode'); + + if (isDestroyed(lView)) return; + const flags = lView[FLAGS]; - if ((flags & LViewFlags.Destroyed) === LViewFlags.Destroyed) return; // Check no changes mode is a dev only mode used to verify that bindings have not changed // since they were assigned. We do not want to execute lifecycle hooks in that mode. diff --git a/packages/core/src/render3/interfaces/type_checks.ts b/packages/core/src/render3/interfaces/type_checks.ts index 8b81a4db9bc72e..48f3f8d8ab4768 100644 --- a/packages/core/src/render3/interfaces/type_checks.ts +++ b/packages/core/src/render3/interfaces/type_checks.ts @@ -57,5 +57,6 @@ export function hasI18n(lView: LView): boolean { } export function isDestroyed(lView: LView): boolean { + // Determines whether a given LView is marked as destroyed. return (lView[FLAGS] & LViewFlags.Destroyed) === LViewFlags.Destroyed; } diff --git a/packages/core/src/render3/node_manipulation.ts b/packages/core/src/render3/node_manipulation.ts index e01aff850b6b51..d4e1c4a9cce0d5 100644 --- a/packages/core/src/render3/node_manipulation.ts +++ b/packages/core/src/render3/node_manipulation.ts @@ -6,11 +6,7 @@ * found in the LICENSE file at https://angular.dev/license */ -import { - consumerDestroy, - getActiveConsumer, - setActiveConsumer, -} from '@angular/core/primitives/signals'; +import {consumerDestroy, setActiveConsumer} from '@angular/core/primitives/signals'; import {NotificationSource} from '../change_detection/scheduling/zoneless_scheduling'; import {hasInSkipHydrationBlockFlag} from '../hydration/skip_hydration'; @@ -55,8 +51,8 @@ import { TProjectionNode, } from './interfaces/node'; import {Renderer} from './interfaces/renderer'; -import {RComment, RElement, RNode, RTemplate, RText} from './interfaces/renderer_dom'; -import {isLContainer, isLView} from './interfaces/type_checks'; +import {RComment, RElement, RNode, RText} from './interfaces/renderer_dom'; +import {isDestroyed, isLContainer, isLView} from './interfaces/type_checks'; import { CHILD_HEAD, CLEANUP, @@ -445,15 +441,17 @@ export function detachView(lContainer: LContainer, removeIndex: number): LView | * @param lView The view to be destroyed. */ export function destroyLView(tView: TView, lView: LView) { - if (!(lView[FLAGS] & LViewFlags.Destroyed)) { - const renderer = lView[RENDERER]; + if (isDestroyed(lView)) { + return; + } - if (renderer.destroyNode) { - applyView(tView, lView, renderer, WalkTNodeTreeAction.Destroy, null, null); - } + const renderer = lView[RENDERER]; - destroyViewTree(lView); + if (renderer.destroyNode) { + applyView(tView, lView, renderer, WalkTNodeTreeAction.Destroy, null, null); } + + destroyViewTree(lView); } /** @@ -465,7 +463,7 @@ export function destroyLView(tView: TView, lView: LView) { * @param lView The LView to clean up */ function cleanUpView(tView: TView, lView: LView): void { - if (lView[FLAGS] & LViewFlags.Destroyed) { + if (isDestroyed(lView)) { return; } diff --git a/packages/core/src/render3/util/view_utils.ts b/packages/core/src/render3/util/view_utils.ts index 3beb392622441b..1af2076b3ce994 100644 --- a/packages/core/src/render3/util/view_utils.ts +++ b/packages/core/src/render3/util/view_utils.ts @@ -19,7 +19,7 @@ import {assertLView, assertTNode, assertTNodeForLView} from '../assert'; import {LContainer, TYPE} from '../interfaces/container'; import {TConstants, TNode} from '../interfaces/node'; import {RNode} from '../interfaces/renderer_dom'; -import {isLContainer, isLView} from '../interfaces/type_checks'; +import {isDestroyed, isLContainer, isLView} from '../interfaces/type_checks'; import { DECLARATION_VIEW, ENVIRONMENT, @@ -271,7 +271,7 @@ export function markAncestorsForTraversal(lView: LView) { * Stores a LView-specific destroy callback. */ export function storeLViewOnDestroy(lView: LView, onDestroyCallback: () => void) { - if ((lView[FLAGS] & LViewFlags.Destroyed) === LViewFlags.Destroyed) { + if (isDestroyed(lView)) { throw new RuntimeError( RuntimeErrorCode.VIEW_ALREADY_DESTROYED, ngDevMode && 'View has already been destroyed.', diff --git a/packages/core/src/render3/view_ref.ts b/packages/core/src/render3/view_ref.ts index e871ac5fd07843..dafeffafb7fcce 100644 --- a/packages/core/src/render3/view_ref.ts +++ b/packages/core/src/render3/view_ref.ts @@ -18,7 +18,7 @@ import {collectNativeNodes} from './collect_native_nodes'; import {checkNoChangesInternal, detectChangesInternal} from './instructions/change_detection'; import {markViewDirty} from './instructions/mark_view_dirty'; import {CONTAINER_HEADER_OFFSET, VIEW_REFS} from './interfaces/container'; -import {isLContainer, isRootView} from './interfaces/type_checks'; +import {isDestroyed, isLContainer, isRootView} from './interfaces/type_checks'; import { CONTEXT, DECLARATION_LCONTAINER, @@ -116,7 +116,7 @@ export class ViewRef implements EmbeddedViewRef, ChangeDetectorRefInterfac } get destroyed(): boolean { - return (this._lView[FLAGS] & LViewFlags.Destroyed) === LViewFlags.Destroyed; + return isDestroyed(this._lView); } destroy(): void { diff --git a/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json b/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json index ec5b8ba161e707..2e2e27117ed7cf 100644 --- a/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json +++ b/packages/core/test/bundling/animations-standalone/bundle.golden_symbols.json @@ -370,6 +370,7 @@ "isContentQueryHost", "isCssClassMatching", "isCurrentTNodeParent", + "isDestroyed", "isElementNode", "isEnvironmentProviders", "isFunction", diff --git a/packages/core/test/bundling/animations/bundle.golden_symbols.json b/packages/core/test/bundling/animations/bundle.golden_symbols.json index b8638397cd9ce9..ebbc60f3e3cff4 100644 --- a/packages/core/test/bundling/animations/bundle.golden_symbols.json +++ b/packages/core/test/bundling/animations/bundle.golden_symbols.json @@ -394,6 +394,7 @@ "isContentQueryHost", "isCssClassMatching", "isCurrentTNodeParent", + "isDestroyed", "isElementNode", "isEnvironmentProviders", "isFunction", diff --git a/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json b/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json index 5dfbd87d9e44d6..eed65d143f05b1 100644 --- a/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json +++ b/packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json @@ -316,6 +316,7 @@ "isContentQueryHost", "isCssClassMatching", "isCurrentTNodeParent", + "isDestroyed", "isEnvironmentProviders", "isFunction", "isInlineTemplate", diff --git a/packages/core/test/bundling/defer/bundle.golden_symbols.json b/packages/core/test/bundling/defer/bundle.golden_symbols.json index e95cd9617b92c4..fa5f219a85443f 100644 --- a/packages/core/test/bundling/defer/bundle.golden_symbols.json +++ b/packages/core/test/bundling/defer/bundle.golden_symbols.json @@ -763,6 +763,7 @@ "isContentQueryHost", "isCssClassMatching", "isCurrentTNodeParent", + "isDestroyed", "isDirectiveHost", "isEnvironmentProviders", "isFunction", diff --git a/packages/core/test/bundling/forms_reactive/bundle.golden_symbols.json b/packages/core/test/bundling/forms_reactive/bundle.golden_symbols.json index 9d80f77a06b913..40c1c7fb2389ac 100644 --- a/packages/core/test/bundling/forms_reactive/bundle.golden_symbols.json +++ b/packages/core/test/bundling/forms_reactive/bundle.golden_symbols.json @@ -459,6 +459,7 @@ "isContentQueryHost", "isCssClassMatching", "isCurrentTNodeParent", + "isDestroyed", "isDirectiveHost", "isEmptyInputValue", "isEnvironmentProviders", diff --git a/packages/core/test/bundling/forms_template_driven/bundle.golden_symbols.json b/packages/core/test/bundling/forms_template_driven/bundle.golden_symbols.json index 0092c84e119580..029463abf3ee33 100644 --- a/packages/core/test/bundling/forms_template_driven/bundle.golden_symbols.json +++ b/packages/core/test/bundling/forms_template_driven/bundle.golden_symbols.json @@ -445,6 +445,7 @@ "isContentQueryHost", "isCssClassMatching", "isCurrentTNodeParent", + "isDestroyed", "isDirectiveHost", "isEnvironmentProviders", "isFormControlState", diff --git a/packages/core/test/bundling/hello_world/bundle.golden_symbols.json b/packages/core/test/bundling/hello_world/bundle.golden_symbols.json index 4383288608c974..a76215fb1d1fc3 100644 --- a/packages/core/test/bundling/hello_world/bundle.golden_symbols.json +++ b/packages/core/test/bundling/hello_world/bundle.golden_symbols.json @@ -247,6 +247,7 @@ "isAngularZoneProperty", "isApplicationBootstrapConfig", "isComponentDef", + "isDestroyed", "isEnvironmentProviders", "isFunction", "isInlineTemplate", diff --git a/packages/core/test/bundling/hydration/bundle.golden_symbols.json b/packages/core/test/bundling/hydration/bundle.golden_symbols.json index b129e888bbb247..284d6eb507aedb 100644 --- a/packages/core/test/bundling/hydration/bundle.golden_symbols.json +++ b/packages/core/test/bundling/hydration/bundle.golden_symbols.json @@ -325,6 +325,7 @@ "isAsyncIterable", "isComponentDef", "isComponentHost", + "isDestroyed", "isDetachedByI18n", "isDisconnectedNode", "isEnvironmentProviders", diff --git a/packages/core/test/bundling/router/bundle.golden_symbols.json b/packages/core/test/bundling/router/bundle.golden_symbols.json index d4ca307d0cb01e..71364e6cefca8b 100644 --- a/packages/core/test/bundling/router/bundle.golden_symbols.json +++ b/packages/core/test/bundling/router/bundle.golden_symbols.json @@ -535,6 +535,7 @@ "isContentQueryHost", "isCssClassMatching", "isCurrentTNodeParent", + "isDestroyed", "isDirectiveHost", "isEmptyError", "isEnvironmentProviders", diff --git a/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json b/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json index 105c76a3e7b96a..0d41e6808cc0fb 100644 --- a/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json +++ b/packages/core/test/bundling/standalone_bootstrap/bundle.golden_symbols.json @@ -276,6 +276,7 @@ "isAngularZoneProperty", "isApplicationBootstrapConfig", "isComponentDef", + "isDestroyed", "isEnvironmentProviders", "isFunction", "isInlineTemplate", diff --git a/packages/core/test/bundling/todo/bundle.golden_symbols.json b/packages/core/test/bundling/todo/bundle.golden_symbols.json index 966fd5d40d3577..1524cf7a2ba734 100644 --- a/packages/core/test/bundling/todo/bundle.golden_symbols.json +++ b/packages/core/test/bundling/todo/bundle.golden_symbols.json @@ -376,6 +376,7 @@ "isContentQueryHost", "isCssClassMatching", "isCurrentTNodeParent", + "isDestroyed", "isDirectiveHost", "isEnvironmentProviders", "isFunction", From 52a6710f54bcec81f4cde23a78b9f78d038156c5 Mon Sep 17 00:00:00 2001 From: arturovt Date: Sat, 28 Dec 2024 20:03:03 +0200 Subject: [PATCH 11/12] fix(router): complete router `events` on dispose (#59327) In this commit, we manually complete the `events` subject to remove all active observers and enable granular garbage collection, as users may forget to unsubscribe manually when subscribing to `router.events`. PR Close #59327 --- packages/router/src/router.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index 669c43e939d063..ca305559117ab2 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -377,6 +377,12 @@ export class Router { /** Disposes of the router. */ dispose(): void { + // We call `unsubscribe()` to release observers, as users may forget to + // unsubscribe manually when subscribing to `router.events`. We do not call + // `complete()` because it is unsafe; if someone subscribes using the `first` + // operator and the observable completes before emitting a value, + // RxJS will throw an error. + this._events.unsubscribe(); this.navigationTransitions.complete(); if (this.nonRouterCurrentEntryChangeSubscription) { this.nonRouterCurrentEntryChangeSubscription.unsubscribe(); From d9707e1127f5b48ce593906c7b448ed9fef5d0cc Mon Sep 17 00:00:00 2001 From: arturovt Date: Mon, 6 Jan 2025 19:52:09 +0200 Subject: [PATCH 12/12] refactor(core): drop `DEFER_BLOCK_DEPENDENCY_INTERCEPTOR` in production (#59381) `new` expressions are not dropped by default because they are considered side-effectful, even if they are not referenced anywhere in production mode. PR Close #59381 --- packages/core/src/defer/rendering.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/defer/rendering.ts b/packages/core/src/defer/rendering.ts index ccc1c185b755bf..4a3e6cc0a60ab2 100644 --- a/packages/core/src/defer/rendering.ts +++ b/packages/core/src/defer/rendering.ts @@ -66,7 +66,9 @@ import { * This token is only injected in devMode */ export const DEFER_BLOCK_DEPENDENCY_INTERCEPTOR = - new InjectionToken('DEFER_BLOCK_DEPENDENCY_INTERCEPTOR'); + /* @__PURE__ */ new InjectionToken( + 'DEFER_BLOCK_DEPENDENCY_INTERCEPTOR', + ); /** * **INTERNAL**, token used for configuring defer block behavior.