WIP '@typescript-eslint/no-unnecessary-condition' by mstange · Pull Request #5620 · firefox-devtools/profiler · GitHub
Skip to content

WIP '@typescript-eslint/no-unnecessary-condition'#5620

Draft
mstange wants to merge 5 commits into
firefox-devtools:mainfrom
mstange:push-lnuxlrtpomym
Draft

WIP '@typescript-eslint/no-unnecessary-condition'#5620
mstange wants to merge 5 commits into
firefox-devtools:mainfrom
mstange:push-lnuxlrtpomym

Conversation

@mstange

@mstange mstange commented Sep 19, 2025

Copy link
Copy Markdown
Contributor

There are type-aware lints we can enable to catch more typescript things. no-unnecessary-condition would catch unnecessary null checks but it's a fair amount of work to get passing. This is some WIP towards that.

I filed microsoft/TypeScript#62468 for the newSelectedThreadIndexes.size false positive.

I'm not really sure why, but without this, TypeScript thinks that the state
can only have the values that it sees in the initialization value. It also
doesn't complain if setState is called with values that don't match the type
it inferred for the state member.

It needs to know that this.state can have other values than the initial value
if we want to avoid false positives from '@typescript-eslint/no-unnecessary-condition'.
Without these, it thinks that all of the possible keys are present.

Fixing this is needed if we want to avoid '@typescript-eslint/no-unnecessary-condition'
complaining about our 'prop in obj' tests.
@mstange mstange force-pushed the push-lnuxlrtpomym branch from e1439da to 1545249 Compare January 6, 2026 12:18
@codecov

codecov Bot commented Jan 6, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant