Repository navigation
style: use the optional chains typescript-eslint 8.71 asks for - #3797
Draft
armando-navarro wants to merge 1 commit into
Draft
armando-navarro wants to merge 1 commit into
armando-navarro wants to merge 1 commit into
Conversation
The Angular 22 upgrade needs @typescript-eslint 8.71 for TypeScript 6, and that release reports prefer-optional-chain on these two checks, so lint fails once it lands. Both rewrites keep behavior. An undefined provided list still falls through to getApp(). config.name is always a non-empty string, so a missing app still never matches it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caution
Do not merge until the
21.0.xbranch is cutThis is part of the Angular 22 upgrade and ships in 22.0.0-rc.0. Merge it after
21.0.xis cut frommain.Refs #3696
This rewrites two checks as optional chains, so lint keeps passing once the Angular 22 upgrade brings in a newer
@typescript-eslint.Changes
src/app/app.module.ts:provided && provided.length === 1becomesprovided?.length === 1.src/compat/firebase.app.module.ts:app && app.name === config.namebecomesapp?.name === config.name.Both rewrites keep behavior. An undefined
providedstill falls through togetApp(), and sinceconfig.nameis set to a non-empty string two lines above the check, a missingappstill never matches it.Why
@typescript-eslint8.46, the version in today's lockfile, accepts only TypeScript below 6.0, so the Angular 22 upgrade moves it to 8.71.@typescript-eslint/prefer-optional-chainon these two lines, sonpm run lintfails.Verification
With
@typescript-eslint8.71.1 on the Angular 22 upgrade, eslint reports exactly these two errors on the old lines and none on the new ones.There are no new tests, since the existing specs already run both lines through
provideFirebaseAppandAngularFireModule.initializeApp.